Author: hiren
Date: Fri Aug 26 19:23:17 2016
New Revision: 304857
URL: https://svnweb.freebsd.org/changeset/base/304857

Log:
  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

Modified:
  head/sys/netinet/tcp_stacks/fastpath.c

Modified: head/sys/netinet/tcp_stacks/fastpath.c
==============================================================================
--- head/sys/netinet/tcp_stacks/fastpath.c      Fri Aug 26 19:08:58 2016        
(r304856)
+++ head/sys/netinet/tcp_stacks/fastpath.c      Fri Aug 26 19:23:17 2016        
(r304857)
@@ -172,7 +172,10 @@ tcp_do_fastack(struct mbuf *m, struct tc
               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 tc
                 * 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 t
 {
        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 t
                                        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 t
                                        }
                                        /* 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 t
                                         * 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, 
        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, 
        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 tcphd
               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 tcphd
                 * 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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to