From 06b99bd826e97c3c41ff323539df4189e6844ae9 Mon Sep 17 00:00:00 2001 From: Hiren Panchasara Date: Fri, 26 Aug 2016 19:23:17 +0000 Subject: [PATCH] Adjust TCP module fastpath after r304803's cc_ack_received() changes. Reported by: hiren, bz, np Reviewed by: rrs Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D7664 --- sys/netinet/tcp_stacks/fastpath.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/sys/netinet/tcp_stacks/fastpath.c b/sys/netinet/tcp_stacks/fastpath.c index 7be9f9681ef..6ce62586ca0 100644 --- a/sys/netinet/tcp_stacks/fastpath.c +++ b/sys/netinet/tcp_stacks/fastpath.c @@ -172,7 +172,10 @@ tcp_do_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, int ti_locked, u_long tiwin) { int acked; + uint16_t nsegs; int winup_only=0; + + nsegs = max(1, m->m_pkthdr.lro_nsegs); #ifdef TCPDEBUG /* * The size of tcp_saveipgen must be the size of the max ip header, @@ -278,7 +281,7 @@ tcp_do_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, * typically means increasing the congestion * window. */ - cc_ack_received(tp, th, CC_ACK); + cc_ack_received(tp, th, nsegs, CC_ACK); tp->snd_una = th->th_ack; /* @@ -502,9 +505,12 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so, { int acked, ourfinisacked, needoutput = 0; int rstreason, todrop, win; + uint16_t nsegs; char *s; struct in_conninfo *inc; struct mbuf *mfree = NULL; + + nsegs = max(1, m->m_pkthdr.lro_nsegs); #ifdef TCPDEBUG /* * The size of tcp_saveipgen must be the size of the max ip header, @@ -1085,7 +1091,8 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->t_dupacks = 0; else if (++tp->t_dupacks > tcprexmtthresh || IN_FASTRECOVERY(tp->t_flags)) { - cc_ack_received(tp, th, CC_DUPACK); + cc_ack_received(tp, th, nsegs, + CC_DUPACK); if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags)) { int awnd; @@ -1135,7 +1142,8 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so, } /* Congestion signal before ack. */ cc_cong_signal(tp, th, CC_NDUPACK); - cc_ack_received(tp, th, CC_DUPACK); + cc_ack_received(tp, th, nsegs, + CC_DUPACK); tcp_timer_activate(tp, TT_REXMT, 0); tp->t_rtttime = 0; if (tp->t_flags & TF_SACK_PERMIT) { @@ -1169,7 +1177,8 @@ tcp_do_slowpath(struct mbuf *m, struct tcphdr *th, struct socket *so, * segment. Restore the original * snd_cwnd after packet transmission. */ - cc_ack_received(tp, th, CC_DUPACK); + cc_ack_received(tp, th, nsegs, + CC_DUPACK); u_long oldcwnd = tp->snd_cwnd; tcp_seq oldsndmax = tp->snd_max; u_int sent; @@ -1323,7 +1332,7 @@ process_ACK: * control related information. This typically means increasing * the congestion window. */ - cc_ack_received(tp, th, CC_ACK); + cc_ack_received(tp, th, nsegs, CC_ACK); SOCKBUF_LOCK(&so->so_snd); if (acked > sbavail(&so->so_snd)) { @@ -1758,6 +1767,7 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr *th, struct socket *so, int thflags; u_long tiwin; char *s; + uint16_t nsegs; int can_enter; struct in_conninfo *inc; struct tcpopt to; @@ -1765,6 +1775,7 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr *th, struct socket *so, thflags = th->th_flags; tp->sackhint.last_sack_ack = 0; inc = &tp->t_inpcb->inp_inc; + nsegs = max(1, m->m_pkthdr.lro_nsegs); /* * If this is either a state-changing packet or current state isn't * established, we require a write lock on tcbinfo. Otherwise, we @@ -1983,7 +1994,10 @@ tcp_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, int ti_locked, u_long tiwin) { int acked; + uint16_t nsegs; int winup_only=0; + + nsegs = max(1, m->m_pkthdr.lro_nsegs); #ifdef TCPDEBUG /* * The size of tcp_saveipgen must be the size of the max ip header, @@ -2128,7 +2142,7 @@ tcp_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, * typically means increasing the congestion * window. */ - cc_ack_received(tp, th, CC_ACK); + cc_ack_received(tp, th, nsegs, CC_ACK); tp->snd_una = th->th_ack; tp->t_dupacks = 0;