Lines Matching defs:th
269 hhook_run_tcp_est_in(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to)
275 hhook_data.th = th;
288 cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs,
298 tp->t_ccv.bytes_this_ack = BYTES_THIS_ACK(tp, th);
314 SEQ_GEQ(th->th_ack, tp->gput_ack)) {
318 gput = (((int64_t)SEQ_SUB(th->th_ack, tp->gput_seq)) << 3) /
350 tp->t_ccv.curack = th->th_ack;
414 cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
436 SEQ_GEQ(th->th_ack, tp->snd_recover)) {
472 if (th != NULL)
473 tp->t_ccv.curack = th->th_ack;
479 cc_post_recovery(struct tcpcb *tp, struct tcphdr *th)
484 if (SEQ_LT(tp->snd_fack, th->th_ack) ||
486 tp->snd_fack = th->th_ack;
488 tp->t_ccv.curack = th->th_ack;
548 cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos)
550 cc_ecnpkt_handler_flags(tp, tcp_get_flags(th), iptos);
609 struct tcphdr *th = NULL;
653 th = (struct tcphdr *)((caddr_t)ip6 + off0);
659 th->th_sum = m->m_pkthdr.csum_data;
661 th->th_sum = in6_cksum_pseudo(ip6, tlen,
663 th->th_sum ^= 0xffff;
665 th->th_sum = in6_cksum(m, IPPROTO_TCP, off0, tlen);
666 if (th->th_sum) {
709 th = (struct tcphdr *)((caddr_t)ip + off0);
717 th->th_sum = m->m_pkthdr.csum_data;
719 th->th_sum = in_pseudo(ip->ip_src.s_addr,
723 th->th_sum ^= 0xffff;
734 th->th_sum = in_cksum(m, len);
745 if (th->th_sum && (port == 0)) {
762 off = th->th_off << 2;
779 th = (struct tcphdr *)((caddr_t)ip6 + off0);
794 th = (struct tcphdr *)((caddr_t)ip + off0);
799 optp = (u_char *)(th + 1);
801 thflags = tcp_get_flags(th);
806 tcp_fields_to_host(th);
849 &ip6->ip6_src, th->th_sport, &ip6->ip6_dst, th->th_dport,
858 th->th_sport, &next_hop6->sin6_addr,
860 th->th_dport, lookupflag, m->m_pkthdr.rcvif);
864 th->th_sport, &ip6->ip6_dst, th->th_dport, lookupflag,
880 inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src, th->th_sport,
881 ip->ip_dst, th->th_dport, lookupflag & ~INPLOOKUP_WILDCARD,
890 th->th_sport, next_hop->sin_addr,
892 th->th_dport, lookupflag, m->m_pkthdr.rcvif);
896 th->th_sport, ip->ip_dst, th->th_dport, lookupflag,
917 if ((s = tcp_log_vain(NULL, th, (void *)ip, ip6)))
1003 if (tcp_twcheck(inp, &to, th, m, tlen))
1059 inc.inc_fport = th->th_sport;
1060 inc.inc_lport = th->th_dport;
1078 rstreason = syncache_expand(&inc, &to, th, &so, m, port);
1122 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1157 TCP_PROBE5(receive, NULL, tp, m, tp, th);
1158 tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen,
1173 syncache_chkrst(&inc, th, m, port);
1180 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1191 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1212 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1268 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1290 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1298 if (th->th_dport == th->th_sport &&
1300 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1308 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1321 if (th->th_dport == th->th_sport &&
1323 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1333 if ((s = tcp_log_addrs(&inc, th, NULL, NULL)))
1346 TCP_PROBE3(debug__input, tp, th, m);
1348 if ((so = syncache_add(&inc, &to, th, inp, so, m, NULL, NULL,
1375 TCPMD5_INPUT(m, th, to.to_signature) != 0)
1379 TCP_PROBE5(receive, NULL, tp, m, tp, th);
1395 tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen, tlen, iptos);
1417 TCP_PROBE5(receive, NULL, tp, m, tp, th);
1418 tcp_dropwithreset(m, th, tp, tlen, rstreason);
1423 TCP_PROBE5(receive, NULL, tp, m, tp, th);
1475 tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, struct socket *so,
1488 TCP_PROBE6(receive__autoresize, NULL, tp, m, tp, th, newsize);
1521 tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th,
1539 thflags = tcp_get_flags(th);
1553 tcp_pcap_add(th, m, &(tp->t_inpkts));
1555 TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0,
1559 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
1573 (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) {
1597 tiwin = th->th_win << tp->snd_scale;
1606 tcp_packets_this_ack(tp, th->th_ack),
1608 cc_cong_signal(tp, th, CC_ECN);
1613 tcp_dooptions(&to, (u_char *)(th + 1),
1614 (th->th_off << 2) - sizeof(struct tcphdr),
1645 cc_cong_signal(tp, th, CC_RTO_ERR);
1670 tp->snd_wnd = th->th_win;
1719 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
1726 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
1741 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
1766 th->th_seq == tp->rcv_nxt &&
1781 SEQ_LEQ(th->th_seq, tp->last_ack_sent)) {
1787 if (SEQ_GT(th->th_ack, tp->snd_una) &&
1788 SEQ_LEQ(th->th_ack, tp->snd_max) &&
1805 cc_cong_signal(tp, th, CC_RTO_ERR);
1826 SEQ_GT(th->th_ack, tp->t_rtseq)) {
1833 acked = BYTES_THIS_ACK(tp, th);
1837 hhook_run_tcp_est_in(tp, th, &to);
1844 SEQ_LEQ(th->th_ack, tp->snd_recover))
1845 tp->snd_recover = th->th_ack - 1;
1853 cc_ack_received(tp, th, nsegs, CC_ACK);
1855 tp->snd_una = th->th_ack;
1860 tp->snd_wl2 = th->th_ack;
1873 TCP_PROBE3(debug__input, tp, th, m);
1902 } else if (th->th_ack == tp->snd_una &&
1929 tp->snd_wl1 = th->th_seq;
1937 TCP_PROBE3(debug__input, tp, th, m);
1939 newsize = tcp_autorcvbuf(m, th, so, tp, tlen);
1991 (SEQ_LEQ(th->th_ack, tp->snd_una) ||
1992 SEQ_GT(th->th_ack, tp->snd_max))) {
2038 m, tp, th);
2047 tp->irs = th->th_seq;
2073 tp->snd_nxt = th->th_ack;
2103 m, tp, th);
2123 * Advance th->th_seq to correspond to first data byte.
2127 th->th_seq++;
2136 tp->snd_wl1 = th->th_seq - 1;
2137 tp->rcv_up = th->th_seq;
2178 if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
2179 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) ||
2180 (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) {
2182 ("%s: TH_RST for TCPS_SYN_SENT th %p tp %p",
2183 __func__, th, tp));
2186 tp->last_ack_sent == th->th_seq) {
2208 tcp_send_challenge_ack(tp, th, m);
2223 SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
2224 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) {
2230 tcp_send_challenge_ack(tp, th, m);
2273 if (tp->t_state == TCPS_SYN_RECEIVED && SEQ_LT(th->th_seq, tp->irs)) {
2279 todrop = tp->rcv_nxt - th->th_seq;
2283 th->th_seq++;
2284 if (th->th_urp > 1)
2285 th->th_urp--;
2318 tcp_update_sack_list(tp, th->th_seq,
2319 th->th_seq + todrop);
2327 th->th_seq += todrop;
2329 if (th->th_urp > todrop)
2330 th->th_urp -= todrop;
2333 th->th_urp = 0;
2344 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
2364 todrop = (th->th_seq + tlen) - (tp->rcv_nxt + tp->rcv_wnd);
2376 if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) {
2407 SEQ_LEQ(th->th_seq, tp->last_ack_sent) &&
2408 SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen +
2463 if (SEQ_LT(th->th_ack, seq_min)) {
2468 tcp_send_challenge_ack(tp, th, m);
2518 m, tp, th);
2535 if (SEQ_GT(th->th_ack, tp->snd_una) && !(tp->t_flags & TF_NEEDSYN))
2546 tp->snd_wl1 = th->th_seq - 1;
2552 * tp->snd_una < th->th_ack <= tp->snd_max
2553 * then advance tp->snd_una to th->th_ack and drop
2563 if (SEQ_GT(th->th_ack, tp->snd_max)) {
2568 sack_changed = tcp_sack_doack(tp, &to, th->th_ack);
2571 tcp_sack_lost_retransmission(tp, th);
2582 hhook_run_tcp_est_in(tp, th, &to);
2585 if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
2640 if (th->th_ack != tp->snd_una ||
2648 cc_ack_received(tp, th, nsegs,
2653 tcp_do_prr_ack(tp, th, &to,
2720 if (SEQ_LEQ(th->th_ack,
2727 cc_cong_signal(tp, th, CC_NDUPACK);
2728 cc_ack_received(tp, th, nsegs,
2743 imin(tp->snd_max - th->th_ack,
2768 if (SEQ_GT(th->th_ack, tp->snd_una)) {
2773 tp->snd_nxt = th->th_ack;
2796 cc_ack_received(tp, th, nsegs, CC_DUPACK);
2878 KASSERT(SEQ_GT(th->th_ack, tp->snd_una),
2885 if (SEQ_LT(th->th_ack, tp->snd_recover)) {
2893 tcp_do_prr_ack(tp, th, &to,
2898 tcp_sack_partialack(tp, th,
2902 tcp_newreno_partial_ack(tp, th);
2907 BYTES_THIS_ACK(tp, th);
2908 tp->snd_fack = th->th_ack;
2913 tcp_do_prr_ack(tp, th, &to, SACK_CHANGE,
2952 acked = BYTES_THIS_ACK(tp, th);
2954 "(tp->snd_una=%u, th->th_ack=%u, tp=%p, m=%p)", __func__,
2955 tp->snd_una, th->th_ack, tp, m));
2972 cc_cong_signal(tp, th, CC_RTO_ERR);
2995 } else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) {
3021 if (th->th_ack == tp->snd_max) {
3041 cc_ack_received(tp, th, nsegs, CC_ACK);
3065 SEQ_LEQ(th->th_ack, tp->snd_recover))
3066 tp->snd_recover = th->th_ack - 1;
3067 tp->snd_una = th->th_ack;
3069 SEQ_GEQ(th->th_ack, tp->snd_recover)) {
3070 cc_post_recovery(tp, th);
3142 (SEQ_LT(tp->snd_wl1, th->th_seq) ||
3143 (tp->snd_wl1 == th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) ||
3144 (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))))) {
3147 tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd)
3150 tp->snd_wl1 = th->th_seq;
3151 tp->snd_wl2 = th->th_ack;
3160 if ((thflags & TH_URG) && th->th_urp &&
3169 if (th->th_urp + sbavail(&so->so_rcv) > sb_max) {
3170 th->th_urp = 0; /* XXX */
3189 if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
3190 tp->rcv_up = th->th_seq + th->th_urp;
3205 if (th->th_urp <= (uint32_t)tlen &&
3208 tcp_pulloutofband(so, th, m, drop_hdrlen);
3234 tcp_seq save_start = th->th_seq;
3239 * Insert segment which includes th into TCP reassembly queue
3250 if (th->th_seq == tp->rcv_nxt &&
3268 thflags = tcp_get_flags(th) & TH_FIN;
3279 * XXX: Due to the header drop above "th" is
3286 thflags = tcp_reass(tp, th, &temp, &tlen, m);
3336 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
3420 TCP_PROBE3(debug__input, tp, th, m);
3455 (SEQ_GT(tp->snd_una, th->th_ack) ||
3456 SEQ_GT(th->th_ack, tp->snd_max)) ) {
3461 TCP_PROBE3(debug__input, tp, th, m);
3470 tcp_dropwithreset(m, th, tp, tlen, rstreason);
3473 tcp_dropwithreset(m, th, NULL, tlen, rstreason);
3480 TCP_PROBE3(debug__input, tp, th, m);
3493 tcp_dropwithreset(struct mbuf *m, struct tcphdr *th, struct tcpcb *tp,
3508 if ((tcp_get_flags(th) & TH_RST) || m->m_flags & (M_BCAST|M_MCAST))
3538 if (tcp_get_flags(th) & TH_ACK) {
3539 tcp_respond(tp, mtod(m, void *), th, m, (tcp_seq)0,
3540 th->th_ack, TH_RST);
3542 if (tcp_get_flags(th) & TH_SYN)
3544 if (tcp_get_flags(th) & TH_FIN)
3546 tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen,
3666 tcp_pulloutofband(struct socket *so, struct tcphdr *th, struct mbuf *m,
3669 int cnt = off + th->th_urp - 1;
4083 tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to,
4175 tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th)
4186 tp->snd_nxt = th->th_ack;
4191 tp->snd_cwnd = maxseg + BYTES_THIS_ACK(tp, th);
4202 if (tp->snd_cwnd > BYTES_THIS_ACK(tp, th))
4203 tp->snd_cwnd -= BYTES_THIS_ACK(tp, th);