Lines Matching refs:th

276 hhook_run_tcp_est_in(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to)  in hhook_run_tcp_est_in()  argument
282 hhook_data.th = th; in hhook_run_tcp_est_in()
295 cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs, in cc_ack_received() argument
305 tp->t_ccv.bytes_this_ack = BYTES_THIS_ACK(tp, th); in cc_ack_received()
321 SEQ_GEQ(th->th_ack, tp->gput_ack)) { in cc_ack_received()
325 gput = (((int64_t)SEQ_SUB(th->th_ack, tp->gput_seq)) << 3) / in cc_ack_received()
357 tp->t_ccv.curack = th->th_ack; in cc_ack_received()
421 cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) in cc_cong_signal() argument
443 SEQ_GEQ(th->th_ack, tp->snd_recover)) { in cc_cong_signal()
475 if (th != NULL) in cc_cong_signal()
476 tp->t_ccv.curack = th->th_ack; in cc_cong_signal()
482 cc_post_recovery(struct tcpcb *tp, struct tcphdr *th) in cc_post_recovery() argument
487 tp->t_ccv.curack = th->th_ack; in cc_post_recovery()
547 cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th, uint8_t iptos) in cc_ecnpkt_handler() argument
549 cc_ecnpkt_handler_flags(tp, tcp_get_flags(th), iptos); in cc_ecnpkt_handler()
608 struct tcphdr *th = NULL; in tcp_input_with_port() local
652 th = (struct tcphdr *)((caddr_t)ip6 + off0); in tcp_input_with_port()
658 th->th_sum = m->m_pkthdr.csum_data; in tcp_input_with_port()
660 th->th_sum = in6_cksum_pseudo(ip6, tlen, in tcp_input_with_port()
662 th->th_sum ^= 0xffff; in tcp_input_with_port()
664 th->th_sum = in6_cksum(m, IPPROTO_TCP, off0, tlen); in tcp_input_with_port()
665 if (th->th_sum) { in tcp_input_with_port()
708 th = (struct tcphdr *)((caddr_t)ip + off0); in tcp_input_with_port()
716 th->th_sum = m->m_pkthdr.csum_data; in tcp_input_with_port()
718 th->th_sum = in_pseudo(ip->ip_src.s_addr, in tcp_input_with_port()
722 th->th_sum ^= 0xffff; in tcp_input_with_port()
733 th->th_sum = in_cksum(m, len); in tcp_input_with_port()
744 if (th->th_sum && (port == 0)) { in tcp_input_with_port()
761 off = th->th_off << 2; in tcp_input_with_port()
778 th = (struct tcphdr *)((caddr_t)ip6 + off0); in tcp_input_with_port()
793 th = (struct tcphdr *)((caddr_t)ip + off0); in tcp_input_with_port()
798 optp = (u_char *)(th + 1); in tcp_input_with_port()
800 thflags = tcp_get_flags(th); in tcp_input_with_port()
805 tcp_fields_to_host(th); in tcp_input_with_port()
848 &ip6->ip6_src, th->th_sport, &ip6->ip6_dst, th->th_dport, in tcp_input_with_port()
857 th->th_sport, &next_hop6->sin6_addr, in tcp_input_with_port()
859 th->th_dport, lookupflag, m->m_pkthdr.rcvif); in tcp_input_with_port()
863 th->th_sport, &ip6->ip6_dst, th->th_dport, lookupflag, in tcp_input_with_port()
879 inp = in_pcblookup_mbuf(&V_tcbinfo, ip->ip_src, th->th_sport, in tcp_input_with_port()
880 ip->ip_dst, th->th_dport, lookupflag & ~INPLOOKUP_WILDCARD, in tcp_input_with_port()
889 th->th_sport, next_hop->sin_addr, in tcp_input_with_port()
891 th->th_dport, lookupflag, m->m_pkthdr.rcvif); in tcp_input_with_port()
895 th->th_sport, ip->ip_dst, th->th_dport, lookupflag, in tcp_input_with_port()
916 if ((s = tcp_log_vain(NULL, th, (void *)ip, ip6))) in tcp_input_with_port()
1002 if (tcp_twcheck(inp, &to, th, m, tlen)) in tcp_input_with_port()
1058 inc.inc_fport = th->th_sport; in tcp_input_with_port()
1059 inc.inc_lport = th->th_dport; in tcp_input_with_port()
1077 rstreason = syncache_expand(&inc, &to, th, &so, m, port); in tcp_input_with_port()
1121 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1156 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1157 tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen, in tcp_input_with_port()
1172 syncache_chkrst(&inc, th, m, port); in tcp_input_with_port()
1179 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1190 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1211 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1267 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1289 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1297 if (th->th_dport == th->th_sport && in tcp_input_with_port()
1299 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1307 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1320 if (th->th_dport == th->th_sport && in tcp_input_with_port()
1322 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1332 if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) in tcp_input_with_port()
1345 TCP_PROBE3(debug__input, tp, th, m); in tcp_input_with_port()
1347 if ((so = syncache_add(&inc, &to, th, inp, so, m, NULL, NULL, in tcp_input_with_port()
1374 TCPMD5_INPUT(m, th, to.to_signature) != 0) in tcp_input_with_port()
1378 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1394 tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen, tlen, iptos); in tcp_input_with_port()
1416 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1417 tcp_dropwithreset(m, th, tp, tlen, rstreason); in tcp_input_with_port()
1422 TCP_PROBE5(receive, NULL, tp, m, tp, th); in tcp_input_with_port()
1474 tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, struct socket *so, in tcp_autorcvbuf() argument
1487 TCP_PROBE6(receive__autoresize, NULL, tp, m, tp, th, newsize); in tcp_autorcvbuf()
1520 tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, in tcp_do_segment() argument
1538 thflags = tcp_get_flags(th); in tcp_do_segment()
1552 tcp_pcap_add(th, m, &(tp->t_inpkts)); in tcp_do_segment()
1554 TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_IN, 0, in tcp_do_segment()
1558 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1572 (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) { in tcp_do_segment()
1596 tiwin = th->th_win << tp->snd_scale; in tcp_do_segment()
1605 tcp_packets_this_ack(tp, th->th_ack), in tcp_do_segment()
1607 cc_cong_signal(tp, th, CC_ECN); in tcp_do_segment()
1612 tcp_dooptions(&to, (u_char *)(th + 1), in tcp_do_segment()
1613 (th->th_off << 2) - sizeof(struct tcphdr), in tcp_do_segment()
1637 cc_cong_signal(tp, th, CC_RTO_ERR); in tcp_do_segment()
1660 tp->snd_wnd = th->th_win; in tcp_do_segment()
1703 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1710 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1725 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
1750 th->th_seq == tp->rcv_nxt && in tcp_do_segment()
1765 SEQ_LEQ(th->th_seq, tp->last_ack_sent)) { in tcp_do_segment()
1771 if (SEQ_GT(th->th_ack, tp->snd_una) && in tcp_do_segment()
1772 SEQ_LEQ(th->th_ack, tp->snd_max) && in tcp_do_segment()
1789 cc_cong_signal(tp, th, CC_RTO_ERR); in tcp_do_segment()
1810 SEQ_GT(th->th_ack, tp->t_rtseq)) { in tcp_do_segment()
1817 acked = BYTES_THIS_ACK(tp, th); in tcp_do_segment()
1821 hhook_run_tcp_est_in(tp, th, &to); in tcp_do_segment()
1828 SEQ_LEQ(th->th_ack, tp->snd_recover)) in tcp_do_segment()
1829 tp->snd_recover = th->th_ack - 1; in tcp_do_segment()
1837 cc_ack_received(tp, th, nsegs, CC_ACK); in tcp_do_segment()
1839 tp->snd_una = th->th_ack; in tcp_do_segment()
1844 tp->snd_wl2 = th->th_ack; in tcp_do_segment()
1857 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
1884 } else if (th->th_ack == tp->snd_una && in tcp_do_segment()
1911 tp->snd_wl1 = th->th_seq; in tcp_do_segment()
1919 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
1921 newsize = tcp_autorcvbuf(m, th, so, tp, tlen); in tcp_do_segment()
1973 (SEQ_LEQ(th->th_ack, tp->snd_una) || in tcp_do_segment()
1974 SEQ_GT(th->th_ack, tp->snd_max))) { in tcp_do_segment()
2020 m, tp, th); in tcp_do_segment()
2029 tp->irs = th->th_seq; in tcp_do_segment()
2055 tp->snd_nxt = th->th_ack; in tcp_do_segment()
2085 m, tp, th); in tcp_do_segment()
2109 th->th_seq++; in tcp_do_segment()
2118 tp->snd_wl1 = th->th_seq - 1; in tcp_do_segment()
2119 tp->rcv_up = th->th_seq; in tcp_do_segment()
2160 if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) && in tcp_do_segment()
2161 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) || in tcp_do_segment()
2162 (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) { in tcp_do_segment()
2165 __func__, th, tp)); in tcp_do_segment()
2168 tp->last_ack_sent == th->th_seq) { in tcp_do_segment()
2190 tcp_send_challenge_ack(tp, th, m); in tcp_do_segment()
2205 SEQ_GEQ(th->th_seq, tp->last_ack_sent) && in tcp_do_segment()
2206 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) { in tcp_do_segment()
2212 tcp_send_challenge_ack(tp, th, m); in tcp_do_segment()
2255 if (tp->t_state == TCPS_SYN_RECEIVED && SEQ_LT(th->th_seq, tp->irs)) { in tcp_do_segment()
2261 todrop = tp->rcv_nxt - th->th_seq; in tcp_do_segment()
2265 th->th_seq++; in tcp_do_segment()
2266 if (th->th_urp > 1) in tcp_do_segment()
2267 th->th_urp--; in tcp_do_segment()
2300 tcp_update_sack_list(tp, th->th_seq, in tcp_do_segment()
2301 th->th_seq + todrop); in tcp_do_segment()
2309 th->th_seq += todrop; in tcp_do_segment()
2311 if (th->th_urp > todrop) in tcp_do_segment()
2312 th->th_urp -= todrop; in tcp_do_segment()
2315 th->th_urp = 0; in tcp_do_segment()
2326 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
2346 todrop = (th->th_seq + tlen) - (tp->rcv_nxt + tp->rcv_wnd); in tcp_do_segment()
2358 if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) { in tcp_do_segment()
2389 SEQ_LEQ(th->th_seq, tp->last_ack_sent) && in tcp_do_segment()
2390 SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen + in tcp_do_segment()
2445 if (SEQ_LT(th->th_ack, seq_min)) { in tcp_do_segment()
2450 tcp_send_challenge_ack(tp, th, m); in tcp_do_segment()
2500 m, tp, th); in tcp_do_segment()
2517 if (SEQ_GT(th->th_ack, tp->snd_una) && !(tp->t_flags & TF_NEEDSYN)) in tcp_do_segment()
2528 tp->snd_wl1 = th->th_seq - 1; in tcp_do_segment()
2545 if (SEQ_GT(th->th_ack, tp->snd_max)) { in tcp_do_segment()
2550 sack_changed = tcp_sack_doack(tp, &to, th->th_ack); in tcp_do_segment()
2553 tcp_sack_lost_retransmission(tp, th); in tcp_do_segment()
2564 hhook_run_tcp_est_in(tp, th, &to); in tcp_do_segment()
2567 if (SEQ_LEQ(th->th_ack, tp->snd_una)) { in tcp_do_segment()
2622 if (th->th_ack != tp->snd_una || in tcp_do_segment()
2630 cc_ack_received(tp, th, nsegs, in tcp_do_segment()
2635 tcp_do_prr_ack(tp, th, &to, sack_changed); in tcp_do_segment()
2692 if (SEQ_LEQ(th->th_ack, in tcp_do_segment()
2699 cc_cong_signal(tp, th, CC_NDUPACK); in tcp_do_segment()
2700 cc_ack_received(tp, th, nsegs, in tcp_do_segment()
2729 if (SEQ_GT(th->th_ack, tp->snd_una)) in tcp_do_segment()
2733 tp->snd_nxt = th->th_ack; in tcp_do_segment()
2756 cc_ack_received(tp, th, nsegs, in tcp_do_segment()
2835 KASSERT(SEQ_GT(th->th_ack, tp->snd_una), in tcp_do_segment()
2842 if (SEQ_LT(th->th_ack, tp->snd_recover)) { in tcp_do_segment()
2850 tcp_do_prr_ack(tp, th, &to, in tcp_do_segment()
2855 tcp_sack_partialack(tp, th); in tcp_do_segment()
2858 tcp_newreno_partial_ack(tp, th); in tcp_do_segment()
2863 BYTES_THIS_ACK(tp, th); in tcp_do_segment()
2864 tp->snd_fack = th->th_ack; in tcp_do_segment()
2869 tcp_do_prr_ack(tp, th, &to, SACK_CHANGE); in tcp_do_segment()
2907 acked = BYTES_THIS_ACK(tp, th); in tcp_do_segment()
2910 tp->snd_una, th->th_ack, tp, m)); in tcp_do_segment()
2927 cc_cong_signal(tp, th, CC_RTO_ERR); in tcp_do_segment()
2950 } else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) { in tcp_do_segment()
2976 if (th->th_ack == tp->snd_max) { in tcp_do_segment()
2996 cc_ack_received(tp, th, nsegs, CC_ACK); in tcp_do_segment()
3020 SEQ_LEQ(th->th_ack, tp->snd_recover)) in tcp_do_segment()
3021 tp->snd_recover = th->th_ack - 1; in tcp_do_segment()
3022 tp->snd_una = th->th_ack; in tcp_do_segment()
3024 SEQ_GEQ(th->th_ack, tp->snd_recover)) { in tcp_do_segment()
3025 cc_post_recovery(tp, th); in tcp_do_segment()
3097 (SEQ_LT(tp->snd_wl1, th->th_seq) || in tcp_do_segment()
3098 (tp->snd_wl1 == th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) || in tcp_do_segment()
3099 (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))))) { in tcp_do_segment()
3102 tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd) in tcp_do_segment()
3105 tp->snd_wl1 = th->th_seq; in tcp_do_segment()
3106 tp->snd_wl2 = th->th_ack; in tcp_do_segment()
3115 if ((thflags & TH_URG) && th->th_urp && in tcp_do_segment()
3124 if (th->th_urp + sbavail(&so->so_rcv) > sb_max) { in tcp_do_segment()
3125 th->th_urp = 0; /* XXX */ in tcp_do_segment()
3144 if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) { in tcp_do_segment()
3145 tp->rcv_up = th->th_seq + th->th_urp; in tcp_do_segment()
3160 if (th->th_urp <= (uint32_t)tlen && in tcp_do_segment()
3163 tcp_pulloutofband(so, th, m, drop_hdrlen); in tcp_do_segment()
3189 tcp_seq save_start = th->th_seq; in tcp_do_segment()
3205 if (th->th_seq == tp->rcv_nxt && in tcp_do_segment()
3223 thflags = tcp_get_flags(th) & TH_FIN; in tcp_do_segment()
3241 thflags = tcp_reass(tp, th, &temp, &tlen, m); in tcp_do_segment()
3291 if ((s = tcp_log_addrs(inc, th, NULL, NULL))) { in tcp_do_segment()
3375 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
3410 (SEQ_GT(tp->snd_una, th->th_ack) || in tcp_do_segment()
3411 SEQ_GT(th->th_ack, tp->snd_max)) ) { in tcp_do_segment()
3416 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
3425 tcp_dropwithreset(m, th, tp, tlen, rstreason); in tcp_do_segment()
3428 tcp_dropwithreset(m, th, NULL, tlen, rstreason); in tcp_do_segment()
3435 TCP_PROBE3(debug__input, tp, th, m); in tcp_do_segment()
3448 tcp_dropwithreset(struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, in tcp_dropwithreset() argument
3463 if ((tcp_get_flags(th) & TH_RST) || m->m_flags & (M_BCAST|M_MCAST)) in tcp_dropwithreset()
3493 if (tcp_get_flags(th) & TH_ACK) { in tcp_dropwithreset()
3494 tcp_respond(tp, mtod(m, void *), th, m, (tcp_seq)0, in tcp_dropwithreset()
3495 th->th_ack, TH_RST); in tcp_dropwithreset()
3497 if (tcp_get_flags(th) & TH_SYN) in tcp_dropwithreset()
3499 if (tcp_get_flags(th) & TH_FIN) in tcp_dropwithreset()
3501 tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen, in tcp_dropwithreset()
3621 tcp_pulloutofband(struct socket *so, struct tcphdr *th, struct mbuf *m, in tcp_pulloutofband() argument
3624 int cnt = off + th->th_urp - 1; in tcp_pulloutofband()
4018 tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to, sackstatus_t sack_changed) in tcp_do_prr_ack() argument
4104 tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) in tcp_newreno_partial_ack() argument
4114 tp->snd_nxt = th->th_ack; in tcp_newreno_partial_ack()
4119 tp->snd_cwnd = maxseg + BYTES_THIS_ACK(tp, th); in tcp_newreno_partial_ack()
4129 if (tp->snd_cwnd > BYTES_THIS_ACK(tp, th)) in tcp_newreno_partial_ack()
4130 tp->snd_cwnd -= BYTES_THIS_ACK(tp, th); in tcp_newreno_partial_ack()