Lines Matching refs:tp
203 tcp_log_reassm(struct tcpcb *tp, struct tseg_qent *q, struct tseg_qent *p,
209 if (tp->t_logstate != TCP_LOG_STATE_OFF) {
229 log.u_bbr.flex6 = tp->t_segqmbuflen;
233 TCP_LOG_EVENTP(tp, NULL,
234 &tp->t_inpcb->inp_socket->so_rcv,
235 &tp->t_inpcb->inp_socket->so_snd,
242 tcp_reass_log_dump(struct tcpcb *tp)
246 if (tp->t_logstate != TCP_LOG_STATE_OFF) {
247 TAILQ_FOREACH(q, &tp->t_segq, tqe_q) {
248 tcp_log_reassm(tp, q, NULL, q->tqe_start, q->tqe_len, TCP_R_LOG_DUMP, 0);
254 tcp_reass_log_new_in(struct tcpcb *tp, tcp_seq seq, int len, struct mbuf *m,
266 tcp_log_reassm(tp, q, NULL, seq, len, logval, cnt);
304 tcp_reass_flush(struct tcpcb *tp)
308 INP_WLOCK_ASSERT(tp->t_inpcb);
310 while ((qe = TAILQ_FIRST(&tp->t_segq)) != NULL) {
311 TAILQ_REMOVE(&tp->t_segq, qe, tqe_q);
314 tp->t_segqlen--;
316 tp->t_segqmbuflen = 0;
317 KASSERT((tp->t_segqlen == 0),
319 tp, tp->t_segqlen));
323 tcp_reass_append(struct tcpcb *tp, struct tseg_qent *last,
329 tcp_log_reassm(tp, last, NULL, th->th_seq, tlen, TCP_R_LOG_APPEND, 0);
338 tp->t_rcvoopack++;
342 tcp_reass_log_new_in(tp, last->tqe_start, lenofoh, last->tqe_m,
349 tcp_reass_prepend(struct tcpcb *tp, struct tseg_qent *first, struct mbuf *m, struct tcphdr *th,
355 tcp_log_reassm(tp, first, NULL, th->th_seq, tlen, TCP_R_LOG_PREPEND, 0);
361 tcp_log_reassm(tp, first, NULL, 0, i, TCP_R_LOG_TRIM, 1);
374 tp->t_rcvoopack++;
378 tcp_reass_log_new_in(tp, first->tqe_start, lenofoh, first->tqe_m,
385 tcp_reass_replace(struct tcpcb *tp, struct tseg_qent *q, struct mbuf *m,
395 tcp_log_reassm(tp, q, NULL, seq, len, TCP_R_LOG_REPLACE, 0);
398 KASSERT(tp->t_segqmbuflen >= q->tqe_mbuf_cnt,
399 ("Tp:%p seg queue goes negative", tp));
400 tp->t_segqmbuflen -= q->tqe_mbuf_cnt;
409 tp->t_rcvoopack++;
415 tp->t_segqmbuflen += mbufoh;
420 tcp_reass_merge_into(struct tcpcb *tp, struct tseg_qent *ent,
427 tcp_log_reassm(tp, q, ent, 0, 0, TCP_R_LOG_MERGE_INTO, 0);
438 TAILQ_REMOVE(&tp->t_segq, q, tqe_q);
440 tp->t_segqlen--;
445 tcp_reass_merge_forward(struct tcpcb *tp, struct tseg_qent *ent)
461 TAILQ_FOREACH_FROM_SAFE(q, &tp->t_segq, tqe_q, qtmp) {
469 tp->t_segqmbuflen -= q->tqe_mbuf_cnt;
471 TAILQ_REMOVE(&tp->t_segq, q, tqe_q);
473 tp->t_segqlen--;
483 tcp_log_reassm(tp, q, NULL, 0, i, TCP_R_LOG_TRIM, 2);
488 tcp_reass_merge_into(tp, ent, q);
526 tcp_reass(struct tcpcb *tp, struct tcphdr *th, tcp_seq *seq_start,
535 struct socket *so = tp->t_inpcb->inp_socket;
539 INP_WLOCK_ASSERT(tp->t_inpcb);
547 "(tp=%p, th=%p, seq_start=%p, tlenp=%p, m=%p)",
548 tp, th, seq_start, tlenp, m));
555 KASSERT(SEQ_GEQ(th->th_seq, tp->rcv_nxt),
556 ("Attempt to add old entry to reassembly queue (th=%p, tp=%p)",
557 th, tp));
559 tcp_reass_log_new_in(tp, th->th_seq, *tlenp, m, TCP_R_LOG_ADD, NULL);
579 tcp_reass_log_dump(tp);
587 sb = &tp->t_inpcb->inp_socket->so_rcv;
588 if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) &&
589 (sb->sb_mbcnt + tp->t_segqmbuflen + lenofoh) > sb->sb_mbmax) {
596 tcp_log_reassm(tp, NULL, NULL, th->th_seq, lenofoh, TCP_R_LOG_LIMIT_REACHED, 0);
598 if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) {
606 tcp_reass_log_dump(tp);
615 last = TAILQ_LAST_FAST(&tp->t_segq, tseg_qent, tqe_q);
643 tcp_log_reassm(tp, last, NULL, 0, i, TCP_R_LOG_TRIM, 3);
666 tcp_reass_append(tp, last, m, th, *tlenp, mlast, lenofoh);
667 tp->t_segqmbuflen += lenofoh;
701 first = TAILQ_FIRST(&tp->t_segq);
728 if (SEQ_LT(th->th_seq, tp->rcv_nxt)) {
736 panic("th->th_seq:%u rcv_nxt:%u tp:%p not pre-trimmed",
737 th->th_seq, tp->rcv_nxt, tp);
739 i = tp->rcv_nxt - th->th_seq;
741 tcp_log_reassm(tp, first, NULL, 0, i, TCP_R_LOG_TRIM, 4);
751 tcp_reass_prepend(tp, first, m, th, *tlenp, mlast, lenofoh);
754 panic("First stayed same m:%p foobar:%p first->tqe_m:%p tp:%p first:%p",
755 m, firstmbuf, first->tqe_m, tp, first);
757 panic("First did not change to m:%p foobar:%p first->tqe_m:%p tp:%p first:%p",
758 m, firstmbuf, first->tqe_m, tp, first);
761 tp->t_segqmbuflen += lenofoh;
782 TAILQ_FOREACH(q, &tp->t_segq, tqe_q) {
851 tcp_log_reassm(tp, p, NULL, 0, i, TCP_R_LOG_TRIM, 5);
870 tcp_reass_append(tp, p, m, th, *tlenp, mlast, lenofoh);
871 tp->t_segqmbuflen += lenofoh;
874 panic("Impossible cut th_seq:%u p->seq:%u(%d) p:%p tp:%p",
876 p, tp);
904 tcp_reass_replace(tp, q, m, th->th_seq, *tlenp, mlast, lenofoh, th->th_flags);
917 tcp_reass_prepend(tp, q, m, th, *tlenp, mlast, lenofoh);
918 tp->t_segqmbuflen += lenofoh;
922 tcp_reass_merge_forward(tp, q);
951 if (th->th_seq == tp->rcv_nxt && TCPS_HAVEESTABLISHED(tp->t_state)) {
952 tp->rcv_nxt += *tlenp;
966 if ((tp->t_segqlen > tcp_reass_queue_guard) &&
977 if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) {
984 tcp_reass_log_dump(tp);
989 if (tp->t_segqlen >= min((so->so_rcv.sb_hiwat / tp->t_maxseg) + 1,
993 if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) {
1000 tcp_reass_log_dump(tp);
1014 if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL,
1022 tp->t_segqlen++;
1023 tp->t_rcvoopack++;
1033 tp->t_segqmbuflen += te->tqe_mbuf_cnt;
1035 TAILQ_INSERT_HEAD(&tp->t_segq, te, tqe_q);
1037 TAILQ_INSERT_AFTER(&tp->t_segq, p, te, tqe_q);
1040 tcp_reass_log_new_in(tp, th->th_seq, *tlenp, m, TCP_R_LOG_NEW_ENTRY, te);
1047 if (!TCPS_HAVEESTABLISHED(tp->t_state))
1049 q = TAILQ_FIRST(&tp->t_segq);
1050 KASSERT(q == NULL || SEQ_GEQ(q->tqe_start, tp->rcv_nxt),
1051 ("Reassembly queue for %p has stale entry at head", tp));
1052 if (!q || q->tqe_start != tp->rcv_nxt) {
1054 tcp_reass_log_dump(tp);
1060 tp->rcv_nxt += q->tqe_len;
1063 TAILQ_REMOVE(&tp->t_segq, q, tqe_q);
1068 tcp_reass_log_new_in(tp, q->tqe_start, q->tqe_len, q->tqe_m, TCP_R_LOG_READ, q);
1070 tcp_log_reassm(tp, q, NULL, th->th_seq, *tlenp, TCP_R_LOG_READ, 1);
1072 tcp_log_reassm(tp, q, NULL, 0, 0, TCP_R_LOG_READ, 1);
1079 tcp_log_reassm(tp, q, NULL, th->th_seq, *tlenp, TCP_R_LOG_READ, 2);
1081 tcp_log_reassm(tp, q, NULL, 0, 0, TCP_R_LOG_READ, 2);
1084 KASSERT(tp->t_segqmbuflen >= q->tqe_mbuf_cnt,
1085 ("tp:%p seg queue goes negative", tp));
1086 tp->t_segqmbuflen -= q->tqe_mbuf_cnt;
1088 tp->t_segqlen--;
1090 } while (q && q->tqe_start == tp->rcv_nxt);
1091 if (TAILQ_EMPTY(&tp->t_segq) &&
1092 (tp->t_segqmbuflen != 0)) {
1094 panic("tp:%p segq:%p len:%d queue empty",
1095 tp, &tp->t_segq, tp->t_segqmbuflen);
1099 tcp_log_reassm(tp, NULL, NULL, th->th_seq, *tlenp, TCP_R_LOG_ZERO, 0);
1101 tcp_log_reassm(tp, NULL, NULL, 0, 0, TCP_R_LOG_ZERO, 0);
1104 tp->t_segqmbuflen = 0;
1108 tcp_reass_log_dump(tp);