Lines Matching defs:th

357 #define DELAY_ACK(tp, th) (CC_ALGO(tp)->delay_ack != NULL && CC_ALGO(tp)->delay_ack(tp, th))
360 static void tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th);
512 tcp_reass(tp, th, tlenp, m)
514 register struct tcphdr *th;
527 * Call with th==0 after become established to
530 if (th == NULL)
561 if (th->th_seq != tp->rcv_nxt &&
583 if (SEQ_GT(q->tqe_th->th_seq, th->th_seq))
596 i = p->tqe_th->th_seq + p->tqe_len - th->th_seq;
620 th->th_seq += i;
637 register int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq;
657 te->tqe_th = th;
679 th->th_dport, th->th_sport);
698 tp->t_inpcb->inp_faddr, th->th_dport, th->th_sport);
1085 register struct tcphdr *th;
1163 th = (struct tcphdr *)(void *)((caddr_t)ip6 + off0);
1167 th->th_sum = m->m_pkthdr.csum_data;
1177 th->th_sum = 0;
1179 th->th_sum = 0xffff;
1183 th->th_sum ^= 0xffff;
1184 if (th->th_sum) {
1204 KERNEL_DEBUG(DBG_LAYER_BEG, ((th->th_dport << 16) | th->th_sport),
1206 th->th_seq, th->th_ack, th->th_win);
1225 struct tcphdr *, th);
1254 th = (struct tcphdr *)(void *)((caddr_t)ip + off0);
1274 th->th_sum = in_addword(pseudo, (m->m_pkthdr.csum_data & 0xFFFF));
1277 th->th_sum = m->m_pkthdr.csum_data;
1279 th->th_sum = in_pseudo(ip->ip_src.s_addr,
1283 th->th_sum ^= 0xffff;
1296 th->th_sum = in_cksum(m, len);
1301 if (th->th_sum) {
1317 struct ip *, ip, struct tcpcb *, NULL, struct tcphdr *, th);
1319 KERNEL_DEBUG(DBG_LAYER_BEG, ((th->th_dport << 16) | th->th_sport),
1321 th->th_seq, th->th_ack, th->th_win);
1329 off = th->th_off << 2;
1344 th = (struct tcphdr *)(void *)((caddr_t)ip6 + off0);
1355 th = (struct tcphdr *)(void *)((caddr_t)ip + off0);
1359 optp = (u_char *)(th + 1);
1371 (th->th_flags & TH_SYN) == 0) {
1378 thflags = th->th_flags;
1429 NTOHL(th->th_seq);
1430 NTOHL(th->th_ack);
1431 NTOHS(th->th_win);
1432 NTOHS(th->th_urp);
1453 inp = in_pcblookup_hash(&tcbinfo, ip->ip_src, th->th_sport,
1454 ip->ip_dst, th->th_dport, 0, m->m_pkthdr.rcvif);
1461 th->th_sport, next_hop->sin_addr,
1462 th->th_dport, 1, m->m_pkthdr.rcvif);
1465 ip->ip_src, th->th_sport,
1476 inp = in6_pcblookup_hash(&tcbinfo, &ip6->ip6_src, th->th_sport,
1477 &ip6->ip6_dst, th->th_dport, 1,
1481 inp = in_pcblookup_hash(&tcbinfo, ip->ip_src, th->th_sport,
1482 ip->ip_dst, th->th_dport, 1, m->m_pkthdr.rcvif);
1559 dbuf, ntohs(th->th_dport),
1561 ntohs(th->th_sport));
1566 dbuf, ntohs(th->th_dport), sbuf,
1567 ntohs(th->th_sport), thflags);
1581 dbuf, ntohs(th->th_dport),
1583 ntohs(th->th_sport)));
1645 tiwin = th->th_win << tp->snd_scale;
1647 tiwin = th->th_win;
1669 tcp_savetcp = *th;
1717 if (th->th_dport == th->th_sport) {
1812 sin6->sin6_port = th->th_sport;
1824 sin->sin_port = th->th_sport;
1900 inp->inp_lport = th->th_dport;
2079 SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
2080 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) {
2125 tcp_dooptions(tp, optp, optlen, th, &to, ifscope);
2131 tp->snd_wnd = th->th_win << tp->snd_scale;
2164 th->th_seq == tp->rcv_nxt &&
2233 th->th_seq == tp->rcv_nxt &&
2244 SEQ_LEQ(th->th_seq, tp->last_ack_sent)) {
2255 if (SEQ_GT(th->th_ack, tp->snd_una) &&
2256 SEQ_LEQ(th->th_ack, tp->snd_max) &&
2284 struct tcpcb *, tp, struct tcphdr *, th,
2300 SEQ_GT(th->th_ack, tp->t_rtseq)) {
2303 acked = th->th_ack - tp->snd_una;
2312 CC_ALGO(tp)->inseq_ack_rcvd(tp, th);
2315 struct tcpcb *, tp, struct tcphdr *, th,
2322 SEQ_LEQ(th->th_ack, tp->snd_recover))
2323 tp->snd_recover = th->th_ack - 1;
2324 tp->snd_una = th->th_ack;
2330 tp->snd_wl2 = th->th_ack;
2362 } else if (th->th_ack == tp->snd_una &&
2386 ((th->th_seq - tp->irs) >
2388 ((tp->t_idleat == 0) || ((th->th_seq -
2391 tcp_start_coalescing(ip, th, tlen);
2404 tp->snd_wl1 = th->th_seq;
2434 KERNEL_DEBUG(DBG_LAYER_END, ((th->th_dport << 16) | th->th_sport),
2436 th->th_seq, th->th_ack, th->th_win);
2441 KERNEL_DEBUG(DBG_LAYER_END, ((th->th_dport << 16) | th->th_sport),
2443 th->th_seq, th->th_ack, th->th_win);
2446 if (DELAY_ACK(tp, th)) {
2511 sin6->sin6_port = th->th_sport;
2533 sin->sin_port = th->th_sport;
2546 tcp_dooptions(tp, optp, optlen, th, &to, ifscope);
2560 tp->irs = th->th_seq;
2606 (SEQ_LEQ(th->th_ack, tp->snd_una) ||
2607 SEQ_GT(th->th_ack, tp->snd_max))) {
2631 (SEQ_LEQ(th->th_ack, tp->iss) ||
2632 SEQ_GT(th->th_ack, tp->snd_max))) {
2652 tp->snd_wnd = th->th_win; /* initial send window */
2654 tp->irs = th->th_seq;
2686 if (DELAY_ACK(tp, th) && tlen != 0 ) {
2737 * Advance th->th_seq to correspond to first data byte.
2741 th->th_seq++;
2750 tp->snd_wl1 = th->th_seq - 1;
2751 tp->rcv_up = th->th_seq;
2853 if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
2854 SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) ||
2856 ((tp->last_ack_sent == th->th_seq) || ((tp->last_ack_sent -1) == th->th_seq)))) {
2866 if (tp->last_ack_sent != th->th_seq) {
2947 if (tp->t_state == TCPS_SYN_RECEIVED && SEQ_LT(th->th_seq, tp->irs)) {
2956 todrop = tp->rcv_nxt - th->th_seq;
2960 th->th_seq++;
2961 if (th->th_urp > 1)
2962 th->th_urp--;
3003 th->th_seq += todrop;
3005 if (th->th_urp > todrop)
3006 th->th_urp -= todrop;
3009 th->th_urp = 0;
3033 todrop = (th->th_seq+tlen) - (tp->rcv_nxt+tp->rcv_wnd);
3046 SEQ_GT(th->th_seq, tp->rcv_nxt)) {
3059 if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) {
3090 SEQ_LEQ(th->th_seq, tp->last_ack_sent) &&
3091 SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen +
3146 tp->snd_wnd = th->th_win << tp->snd_scale;
3176 tp->snd_wl1 = th->th_seq - 1;
3185 * tp->snd_una < th->th_ack <= tp->snd_max
3186 * then advance tp->snd_una to th->th_ack and drop
3197 if (SEQ_GT(th->th_ack, tp->snd_max)) {
3203 tcp_sack_doack(tp, &to, th->th_ack);
3204 if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
3232 th->th_ack != tp->snd_una)
3256 struct tcpcb *, tp, struct tcphdr *, th,
3277 if (SEQ_LEQ(th->th_ack,
3304 struct tcpcb *, tp, struct tcphdr *, th,
3310 tp->snd_nxt = th->th_ack;
3318 struct tcpcb *, tp, struct tcphdr *, th,
3331 if (SEQ_LT(th->th_ack, tp->snd_recover)) {
3333 tcp_sack_partialack(tp, th);
3335 tcp_newreno_partial_ack(tp, th);
3338 struct tcpcb *, tp, struct tcphdr *, th,
3343 CC_ALGO(tp)->post_fr(tp, th);
3347 struct tcpcb *, tp, struct tcphdr *, th,
3382 acked = th->th_ack - tp->snd_una;
3408 struct tcpcb *, tp, struct tcphdr *, th,
3430 } else if (tp->t_rtttime && SEQ_GT(th->th_ack, tp->t_rtseq)) {
3440 if (th->th_ack == tp->snd_max) {
3459 SEQ_GEQ(th->th_ack, tp->snd_recover)) {
3462 struct tcpcb *, tp, struct tcphdr *, th,
3477 CC_ALGO(tp)->ack_rcvd(tp, th);
3480 struct tcpcb *, tp, struct tcphdr *, th,
3496 SEQ_LEQ(th->th_ack, tp->snd_recover))
3497 tp->snd_recover = th->th_ack - 1;
3500 SEQ_GEQ(th->th_ack, tp->snd_recover))
3503 tp->snd_una = th->th_ack;
3603 (SEQ_LT(tp->snd_wl1, th->th_seq) ||
3604 (tp->snd_wl1 == th->th_seq && (SEQ_LT(tp->snd_wl2, th->th_ack) ||
3605 (tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd))))) {
3608 tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd)
3611 tp->snd_wl1 = th->th_seq;
3612 tp->snd_wl2 = th->th_ack;
3621 if ((thflags & TH_URG) && th->th_urp &&
3629 if (th->th_urp + so->so_rcv.sb_cc > sb_max) {
3630 th->th_urp = 0; /* XXX */
3648 if (SEQ_GT(th->th_seq+th->th_urp, tp->rcv_up)) {
3649 tp->rcv_up = th->th_seq + th->th_urp;
3665 if (th->th_urp <= (u_int32_t)tlen
3670 tcp_pulloutofband(so, th, m,
3711 tcp_seq save_start = th->th_seq;
3712 tcp_seq save_end = th->th_seq + tlen;
3715 * Insert segment which includes th into TCP reassembly queue
3726 if (th->th_seq == tp->rcv_nxt &&
3730 if (DELAY_ACK(tp, th) &&
3741 thflags = th->th_flags & TH_FIN;
3759 thflags = tcp_reass(tp, th, &tlen, m);
3770 KERNEL_DEBUG(DBG_LAYER_END, ((th->th_dport << 16) | th->th_sport),
3772 th->th_seq, th->th_ack, th->th_win);
3777 KERNEL_DEBUG(DBG_LAYER_END, ((th->th_dport << 16) | th->th_sport),
3779 th->th_seq, th->th_ack, th->th_win);
3804 if (DELAY_ACK(tp, th) && (tp->t_flags & TF_NEEDSYN)) {
3907 (SEQ_GT(tp->snd_una, th->th_ack) ||
3908 SEQ_GT(th->th_ack, tp->snd_max)) ) {
3968 tcp_respond(tp, mtod(m, void *), th, m, (tcp_seq)0, th->th_ack,
3974 tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen,
4012 tcp_dooptions(tp, cp, cnt, th, to, input_ifscope)
4019 struct tcphdr *th;
4047 if (!(th->th_flags & TH_SYN))
4060 if (!(th->th_flags & TH_SYN))
4088 if (th->th_flags & TH_SYN) {
4098 if (th->th_flags & TH_SYN)
4111 if (th->th_flags & TH_SYN)
4122 tcp_pulloutofband(so, th, m, off)
4124 struct tcphdr *th;
4128 int cnt = off + th->th_urp - 1;
4630 tcp_newreno_partial_ack(tp, th)
4632 struct tcphdr *th;
4638 tp->snd_nxt = th->th_ack;
4644 tp->snd_cwnd = tp->t_maxseg + (th->th_ack - tp->snd_una);
4654 if (tp->snd_cwnd > th->th_ack - tp->snd_una)
4655 tp->snd_cwnd -= th->th_ack - tp->snd_una;