Author: rscheff
Date: Thu May 14 09:55:41 2020
New Revision: 361029
URL: https://svnweb.freebsd.org/changeset/base/361029

Log:
  MFC r360491:   Introduce a lower bound of 2 MSS to TCP Cubic.
  
  Running TCP Cubic together with ECN could end up reducing cwnd down to 1 
byte, if the
  receiver continously sets the ECE flag, resulting in very poor transmission 
speeds.
  
  In line with RFC6582 App. B, a lower bound of 2 MSS is introduced, as well as 
a typecast
  to prevent any potential integer overflows during intermediate calculation 
steps of the
  adjusted cwnd.
  
  Reported by:  Cheng Cui
  Reviewed by:  tuexen (mentor)
  Approved by:  tuexen (mentor)
  Sponsored by: NetApp, Inc.
  Differential Revision:        https://reviews.freebsd.org/D23353

Modified:
  stable/12/sys/netinet/cc/cc_cubic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==============================================================================
--- stable/12/sys/netinet/cc/cc_cubic.c Thu May 14 09:18:50 2020        
(r361028)
+++ stable/12/sys/netinet/cc/cc_cubic.c Thu May 14 09:55:41 2020        
(r361029)
@@ -332,8 +332,9 @@ cubic_post_recovery(struct cc_var *ccv)
                            CCV(ccv, t_maxseg);
                else
                        /* Update cwnd based on beta and adjusted max_cwnd. */
-                       CCV(ccv, snd_cwnd) = max(1, ((CUBIC_BETA *
-                           cubic_data->max_cwnd) >> CUBIC_SHIFT));
+                       CCV(ccv, snd_cwnd) = 
max(((uint64_t)cubic_data->max_cwnd *
+                           CUBIC_BETA) >> CUBIC_SHIFT,
+                           2 * CCV(ccv, t_maxseg));
        }
        cubic_data->t_last_cong = ticks;
 
@@ -399,6 +400,7 @@ static void
 cubic_ssthresh_update(struct cc_var *ccv)
 {
        struct cubic *cubic_data;
+       uint32_t ssthresh;
 
        cubic_data = ccv->cc_data;
 
@@ -407,10 +409,11 @@ cubic_ssthresh_update(struct cc_var *ccv)
         * subsequent congestion events, set it to cwnd * beta.
         */
        if (cubic_data->num_cong_events == 0)
-               CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd) >> 1;
+               ssthresh = CCV(ccv, snd_cwnd) >> 1;
        else
-               CCV(ccv, snd_ssthresh) = ((u_long)CCV(ccv, snd_cwnd) *
+               ssthresh = ((uint64_t)CCV(ccv, snd_cwnd) *
                    CUBIC_BETA) >> CUBIC_SHIFT;
+       CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * CCV(ccv, t_maxseg));
 }
 
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to