Lines Matching refs:th

274 hhook_run_tcp_est_in(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to)  in hhook_run_tcp_est_in()  argument
280 hhook_data.th = th; in hhook_run_tcp_est_in()
293 cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs, in cc_ack_received() argument
303 tp->t_ccv.bytes_this_ack = BYTES_THIS_ACK(tp, th); in cc_ack_received()
319 SEQ_GEQ(th->th_ack, tp->gput_ack)) { in cc_ack_received()
323 gput = (((int64_t)SEQ_SUB(th->th_ack, tp->gput_seq)) << 3) / in cc_ack_received()
355 tp->t_ccv.curack = th->th_ack; in cc_ack_received()
419 cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) in cc_cong_signal() argument
441 SEQ_GEQ(th->th_ack, tp->snd_recover)) { in cc_cong_signal()
477 if (th != NULL) in cc_cong_signal()
478 tp->t_ccv.curack = th->th_ack; in cc_cong_signal()
484 cc_post_recovery(struct tcpcb *tp, struct tcphdr *th) in cc_post_recovery() argument
489 if (SEQ_LT(tp->snd_fack, th->th_ack) || in cc_post_recovery()
491 tp->snd_fack = th->th_ack; in cc_post_recovery()
493 tp->t_ccv.curack = th->th_ack; in cc_post_recovery()
553 cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos) in cc_ecnpkt_handler() argument
555 cc_ecnpkt_handler_flags(tp, tcp_get_flags(th), iptos); in cc_ecnpkt_handler()
614 struct tcphdr *th = NULL; in tcp_input_with_port() local
658 th = (struct tcphdr *)((caddr_t)ip6 + off0); in tcp_input_with_port()
664 th->th_sum = m->m_pkthdr.csum_data; in tcp_input_with_port()
666 th->th_sum = in6_cksum_pseudo(ip6, tlen, in tcp_input_with_port()
668 th->th_sum ^= 0xffff; in tcp_input_with_port()
670 th->th_sum = in6_cksum(m, IPPROTO_TCP, off0, tlen); in tcp_input_with_port()
671 if (th->th_sum) { in tcp_input_with_port()
714 th = (struct tcphdr *)((caddr_t)ip + off0); in tcp_input_with_port()
722 th->th_sum = m->m_pkthdr.csum_data; in tcp_input_with_port()
724 th->th_sum = in_pseudo(ip->ip_src.s_addr, in tcp_input_with_port()
728 th->th_sum ^= 0xffff; in tcp_input_with_port()
739 th->th_sum = in_cksum(m, len); in tcp_input_with_port()
750 if (th->th_sum && (port == 0)) { in tcp_input_with_port()
767 off = th->th_off << 2; in tcp_input_with_port()
784 th = (struct tcphdr *)((caddr_t)ip6 + off0); in tcp_input_with_port()
799 th = (struct tcphdr *)((caddr_t)ip + off0); in tcp_input_with_port()
804 optp = (u_char *)(th + 1); in tcp_input_with_port()
806 thflags = tcp_get_flags(th); in tcp_input_with_port()
811 tcp_fields_to_host(th); in tcp_input_with_port()
855 &ip6->ip6_src, th->th_sport, &ip6->ip6_dst, th->th_dport, in tcp_input_with_port()
864 th->th_sport, &next_hop6->sin6_addr, in tcp_input_with_port()
866 th->th_dport, lookupflag, m->m_pkthdr.rcvif); in tcp_input_with_port()
870 th->th_sport, &ip6->ip6_dst, th->th_dport, lookupflag, in tcp_input_with_port()
886 inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src, th->th_sport, in tcp_input_with_port()
887 ip->ip_dst, th->th_dport, lookupflag & ~INPLOOKUP_WILDCARD, in tcp_input_with_port()
896 th->th_sport, next_hop->sin_addr, in tcp_input_with_port()
898 th->th_dport, lookupflag, m->m_pkthdr.rcvif); in tcp_input_with_port()
902 th->th_sport, ip->ip_dst, th->th_dport, lookupflag, in tcp_input_with_port()
923 if ((s = tcp_log_vain(NULL, th, (void *)ip, ip6))) in tcp_input_with_port()
1009 if (tcp_twcheck(inp, &to, th, m, tlen)) in tcp_input_with_port()
1065 inc.inc_fport = th->th_sport; in tcp_input_with_port()
1066 inc.inc_lport = th->th_dport; in tcp_input_with_port()
1084 rstreason = syncache_expand(&inc, &to, th, &so, m, port); in tcp_input_with_port()
1128 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1163 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1164 tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen, in tcp_input_with_port()
1179 syncache_chkrst(&inc, th, m, port); in tcp_input_with_port()
1186 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1197 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1218 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1274 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1296 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1304 if (th->th_dport == th->th_sport && in tcp_input_with_port()
1306 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1314 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1327 if (th->th_dport == th->th_sport && in tcp_input_with_port()
1329 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1339 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1352 TCP_PROBE3(debug__input, tp, th, m); in tcp_input_with_port()
1354 if ((so = syncache_add(&inc, &to, th, inp, so, m, NULL, NULL, in tcp_input_with_port()
1372 TCPMD5_INPUT(m, th, to.to_signature) != 0) in tcp_input_with_port()
1376 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1392 tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen, tlen, iptos); in tcp_input_with_port()
1414 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1415 tcp_dropwithreset(m, th, tp, tlen, rstreason); in tcp_input_with_port()
1420 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1472 tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, struct socket *so, in tcp_autorcvbuf() argument
1485 TCP_PROBE6(receive__autoresize, NULL, tp, m, tp, th, newsize); in tcp_autorcvbuf()
1518 tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, in tcp_do_segment() argument
1536 thflags = tcp_get_flags(th); in tcp_do_segment()
1550 tcp_pcap_add(th, m, &(tp->t_inpkts)); in tcp_do_segment()
1552 TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, in tcp_do_segment()
1556 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1570 (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) { in tcp_do_segment()
1594 tiwin = th->th_win << tp->snd_scale; in tcp_do_segment()
1603 tcp_packets_this_ack(tp, th->th_ack), in tcp_do_segment()
1605 cc_cong_signal(tp, th, CC_ECN); in tcp_do_segment()
1610 tcp_dooptions(&to, (u_char *)(th + 1), in tcp_do_segment()
1611 (th->th_off << 2) - sizeof(struct tcphdr), in tcp_do_segment()
1642 cc_cong_signal(tp, th, CC_RTO_ERR); in tcp_do_segment()
1667 tp->snd_wnd = th->th_win; in tcp_do_segment()
1716 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1723 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1738 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1763 th->th_seq == tp->rcv_nxt && in tcp_do_segment()
1778 SEQ_LEQ(th->th_seq, tp->last_ack_sent)) { in tcp_do_segment()
1784 if (SEQ_GT(th->th_ack, tp->snd_una) && in tcp_do_segment()
1785 SEQ_LEQ(th->th_ack, tp->snd_max) && in tcp_do_segment()
1802 cc_cong_signal(tp, th, CC_RTO_ERR); in tcp_do_segment()
1823 SEQ_GT(th->th_ack, tp->t_rtseq)) { in tcp_do_segment()
1830 acked = BYTES_THIS_ACK(tp, th); in tcp_do_segment()
1834 hhook_run_tcp_est_in(tp, th, &to); in tcp_do_segment()
1841 SEQ_LEQ(th->th_ack, tp->snd_recover)) in tcp_do_segment()
1842 tp->snd_recover = th->th_ack - 1; in tcp_do_segment()
1850 cc_ack_received(tp, th, nsegs, CC_ACK); in tcp_do_segment()
1852 tp->snd_una = th->th_ack; in tcp_do_segment()
1857 tp->snd_wl2 = th->th_ack; in tcp_do_segment()
1870 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
1899 } else if (th->th_ack == tp->snd_una && in tcp_do_segment()
1926 tp->snd_wl1 = th->th_seq; in tcp_do_segment()
1934 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
1936 newsize = tcp_autorcvbuf(m, th, so, tp, tlen); in tcp_do_segment()
1988 (SEQ_LEQ(th->th_ack, tp->snd_una) || in tcp_do_segment()
1989 SEQ_GT(th->th_ack, tp->snd_max))) { in tcp_do_segment()
2035 m, tp, th); in tcp_do_segment()
2044 tp->irs = th->th_seq; in tcp_do_segment()
2070 tp->snd_nxt = th->th_ack; in tcp_do_segment()
2100 m, tp, th); in tcp_do_segment()
2124 th->th_seq++; in tcp_do_segment()
2133 tp->snd_wl1 = th->th_seq - 1; in tcp_do_segment()
2134 tp->rcv_up = th->th_seq; in tcp_do_segment()
2175 if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) && in tcp_do_segment()
2176 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) || in tcp_do_segment()
2177 (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) { in tcp_do_segment()
2180 __func__, th, tp)); in tcp_do_segment()
2183 tp->last_ack_sent == th->th_seq) { in tcp_do_segment()
2205 tcp_send_challenge_ack(tp, th, m); in tcp_do_segment()
2220 SEQ_GEQ(th->th_seq, tp->last_ack_sent) && in tcp_do_segment()
2221 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) { in tcp_do_segment()
2227 tcp_send_challenge_ack(tp, th, m); in tcp_do_segment()
2270 if (tp->t_state == TCPS_SYN_RECEIVED && SEQ_LT(th->th_seq, tp->irs)) { in tcp_do_segment()
2276 todrop = tp->rcv_nxt - th->th_seq; in tcp_do_segment()
2280 th->th_seq++; in tcp_do_segment()
2281 if (th->th_urp > 1) in tcp_do_segment()
2282 th->th_urp--; in tcp_do_segment()
2315 tcp_update_sack_list(tp, th->th_seq, in tcp_do_segment()
2316 th->th_seq + todrop); in tcp_do_segment()
2324 th->th_seq += todrop; in tcp_do_segment()
2326 if (th->th_urp > todrop) in tcp_do_segment()
2327 th->th_urp -= todrop; in tcp_do_segment()
2330 th->th_urp = 0; in tcp_do_segment()
2341 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
2361 todrop = (th->th_seq + tlen) - (tp->rcv_nxt + tp->rcv_wnd); in tcp_do_segment()
2373 if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) { in tcp_do_segment()
2404 SEQ_LEQ(th->th_seq, tp->last_ack_sent) && in tcp_do_segment()
2405 SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen + in tcp_do_segment()
2460 if (SEQ_LT(th->th_ack, seq_min)) { in tcp_do_segment()
2465 tcp_send_challenge_ack(tp, th, m); in tcp_do_segment()
2515 m, tp, th); in tcp_do_segment()
2532 if (SEQ_GT(th->th_ack, tp->snd_una) && !(tp->t_flags & TF_NEEDSYN)) in tcp_do_segment()
2543 tp->snd_wl1 = th->th_seq - 1; in tcp_do_segment()
2560 if (SEQ_GT(th->th_ack, tp->snd_max)) { in tcp_do_segment()
2565 sack_changed = tcp_sack_doack(tp, &to, th->th_ack); in tcp_do_segment()
2568 tcp_sack_lost_retransmission(tp, th); in tcp_do_segment()
2579 hhook_run_tcp_est_in(tp, th, &to); in tcp_do_segment()
2582 if (SEQ_LEQ(th->th_ack, tp->snd_una)) { in tcp_do_segment()
2637 if (th->th_ack != tp->snd_una || in tcp_do_segment()
2645 cc_ack_received(tp, th, nsegs, in tcp_do_segment()
2650 tcp_do_prr_ack(tp, th, &to, in tcp_do_segment()
2717 if (SEQ_LEQ(th->th_ack, in tcp_do_segment()
2724 cc_cong_signal(tp, th, CC_NDUPACK); in tcp_do_segment()
2725 cc_ack_received(tp, th, nsegs, in tcp_do_segment()
2740 imin(tp->snd_max - th->th_ack, in tcp_do_segment()
2765 if (SEQ_GT(th->th_ack, tp->snd_una)) { in tcp_do_segment()
2770 tp->snd_nxt = th->th_ack; in tcp_do_segment()
2793 cc_ack_received(tp, th, nsegs, CC_DUPACK); in tcp_do_segment()
2875 KASSERT(SEQ_GT(th->th_ack, tp->snd_una), in tcp_do_segment()
2882 if (SEQ_LT(th->th_ack, tp->snd_recover)) { in tcp_do_segment()
2890 tcp_do_prr_ack(tp, th, &to, in tcp_do_segment()
2895 tcp_sack_partialack(tp, th, in tcp_do_segment()
2899 tcp_newreno_partial_ack(tp, th); in tcp_do_segment()
2904 BYTES_THIS_ACK(tp, th); in tcp_do_segment()
2905 tp->snd_fack = th->th_ack; in tcp_do_segment()
2910 tcp_do_prr_ack(tp, th, &to, SACK_CHANGE, in tcp_do_segment()
2949 acked = BYTES_THIS_ACK(tp, th); in tcp_do_segment()
2952 tp->snd_una, th->th_ack, tp, m)); in tcp_do_segment()
2969 cc_cong_signal(tp, th, CC_RTO_ERR); in tcp_do_segment()
2992 } else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) { in tcp_do_segment()
3018 if (th->th_ack == tp->snd_max) { in tcp_do_segment()
3038 cc_ack_received(tp, th, nsegs, CC_ACK); in tcp_do_segment()
3062 SEQ_LEQ(th->th_ack, tp->snd_recover)) in tcp_do_segment()
3063 tp->snd_recover = th->th_ack - 1; in tcp_do_segment()
3064 tp->snd_una = th->th_ack; in tcp_do_segment()
3066 SEQ_GEQ(th->th_ack, tp->snd_recover)) { in tcp_do_segment()
3067 cc_post_recovery(tp, th); in tcp_do_segment()
3139 (SEQ_LT(tp->snd_wl1, th->th_seq) || in tcp_do_segment()
3140 (tp->snd_wl1 == th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) || in tcp_do_segment()
3141 (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))))) { in tcp_do_segment()
3144 tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd) in tcp_do_segment()
3147 tp->snd_wl1 = th->th_seq; in tcp_do_segment()
3148 tp->snd_wl2 = th->th_ack; in tcp_do_segment()
3157 if ((thflags & TH_URG) && th->th_urp && in tcp_do_segment()
3166 if (th->th_urp + sbavail(&so->so_rcv) > sb_max) { in tcp_do_segment()
3167 th->th_urp = 0; /* XXX */ in tcp_do_segment()
3186 if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) { in tcp_do_segment()
3187 tp->rcv_up = th->th_seq + th->th_urp; in tcp_do_segment()
3202 if (th->th_urp <= (uint32_t)tlen && in tcp_do_segment()
3205 tcp_pulloutofband(so, th, m, drop_hdrlen); in tcp_do_segment()
3231 tcp_seq save_start = th->th_seq; in tcp_do_segment()
3247 if (th->th_seq == tp->rcv_nxt && in tcp_do_segment()
3265 thflags = tcp_get_flags(th) & TH_FIN; in tcp_do_segment()
3283 thflags = tcp_reass(tp, th, &temp, &tlen, m); in tcp_do_segment()
3333 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
3417 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
3452 (SEQ_GT(tp->snd_una, th->th_ack) || in tcp_do_segment()
3453 SEQ_GT(th->th_ack, tp->snd_max)) ) { in tcp_do_segment()
3458 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
3467 tcp_dropwithreset(m, th, tp, tlen, rstreason); in tcp_do_segment()
3470 tcp_dropwithreset(m, th, NULL, tlen, rstreason); in tcp_do_segment()
3477 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
3490 tcp_dropwithreset(struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, in tcp_dropwithreset() argument
3505 if ((tcp_get_flags(th) & TH_RST) || m->m_flags & (M_BCAST|M_MCAST)) in tcp_dropwithreset()
3535 if (tcp_get_flags(th) & TH_ACK) { in tcp_dropwithreset()
3536 tcp_respond(tp, mtod(m, void *), th, m, (tcp_seq)0, in tcp_dropwithreset()
3537 th->th_ack, TH_RST); in tcp_dropwithreset()
3539 if (tcp_get_flags(th) & TH_SYN) in tcp_dropwithreset()
3541 if (tcp_get_flags(th) & TH_FIN) in tcp_dropwithreset()
3543 tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen, in tcp_dropwithreset()
3663 tcp_pulloutofband(struct socket *so, struct tcphdr *th, struct mbuf *m, in tcp_pulloutofband() argument
3666 int cnt = off + th->th_urp - 1; in tcp_pulloutofband()
4080 tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to, in tcp_do_prr_ack() argument
4172 tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) in tcp_newreno_partial_ack() argument
4183 tp->snd_nxt = th->th_ack; in tcp_newreno_partial_ack()
4188 tp->snd_cwnd = maxseg + BYTES_THIS_ACK(tp, th); in tcp_newreno_partial_ack()
4199 if (tp->snd_cwnd > BYTES_THIS_ACK(tp, th)) in tcp_newreno_partial_ack()
4200 tp->snd_cwnd -= BYTES_THIS_ACK(tp, th); in tcp_newreno_partial_ack()