Author: rscheff
Date: Tue Nov 17 08:03:49 2020
New Revision: 367752
URL: https://svnweb.freebsd.org/changeset/base/367752

Log:
  MFC r367007: tcp: move cwnd and ssthresh updates into cc modules
  
  This will pave the way of setting ssthresh differently in TCP CUBIC, according
  to RFC8312 section 4.7.
  
  Use dynamic tcp_maxseg() adjusting for tcp options instead of static t_maxseg.
  
  Submitted by: chengc_netapp.com
  Reviewed by:  rrs, tuexen, rscheff
  Sponsored by: NetApp, Inc.
  Differential Revision:        https://reviews.freebsd.org/D26807

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

Modified: stable/12/sys/netinet/cc/cc_cubic.c
==============================================================================
--- stable/12/sys/netinet/cc/cc_cubic.c Tue Nov 17 06:04:16 2020        
(r367751)
+++ stable/12/sys/netinet/cc/cc_cubic.c Tue Nov 17 08:03:49 2020        
(r367752)
@@ -265,8 +265,10 @@ static void
 cubic_cong_signal(struct cc_var *ccv, uint32_t type)
 {
        struct cubic *cubic_data;
+       u_int mss;
 
        cubic_data = ccv->cc_data;
+       mss = tcp_maxseg(ccv->ccvc.tcp);
 
        switch (type) {
        case CC_NDUPACK:
@@ -293,6 +295,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type)
                break;
 
        case CC_RTO:
+               CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
+                                                CCV(ccv, snd_cwnd)) / 2 / mss,
+                                            2) * mss;
+               CCV(ccv, snd_cwnd) = mss;
                /*
                 * Grab the current time and record it so we know when the
                 * most recent congestion event was. Only record it when the

Modified: stable/12/sys/netinet/cc/cc_dctcp.c
==============================================================================
--- stable/12/sys/netinet/cc/cc_dctcp.c Tue Nov 17 06:04:16 2020        
(r367751)
+++ stable/12/sys/netinet/cc/cc_dctcp.c Tue Nov 17 08:03:49 2020        
(r367752)
@@ -235,7 +235,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
        if (CCV(ccv, t_flags) & TF_ECN_PERMIT) {
                dctcp_data = ccv->cc_data;
                cwin = CCV(ccv, snd_cwnd);
-               mss = CCV(ccv, t_maxseg);
+               mss = tcp_maxseg(ccv->ccvc.tcp);
 
                switch (type) {
                case CC_NDUPACK:
@@ -282,6 +282,10 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
                        dctcp_data->ece_curr = 1;
                        break;
                case CC_RTO:
+                       CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
+                                                        CCV(ccv, snd_cwnd)) / 
2 / mss,
+                                                    2) * mss;
+                       CCV(ccv, snd_cwnd) = mss;
                        dctcp_update_alpha(ccv);
                        dctcp_data->save_sndnxt += CCV(ccv, t_maxseg);
                        dctcp_data->num_cong_events++;

Modified: stable/12/sys/netinet/cc/cc_htcp.c
==============================================================================
--- stable/12/sys/netinet/cc/cc_htcp.c  Tue Nov 17 06:04:16 2020        
(r367751)
+++ stable/12/sys/netinet/cc/cc_htcp.c  Tue Nov 17 08:03:49 2020        
(r367752)
@@ -271,8 +271,10 @@ static void
 htcp_cong_signal(struct cc_var *ccv, uint32_t type)
 {
        struct htcp *htcp_data;
+       u_int mss;
 
        htcp_data = ccv->cc_data;
+       mss = tcp_maxseg(ccv->ccvc.tcp);
 
        switch (type) {
        case CC_NDUPACK:
@@ -311,6 +313,10 @@ htcp_cong_signal(struct cc_var *ccv, uint32_t type)
                break;
 
        case CC_RTO:
+               CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
+                                                CCV(ccv, snd_cwnd)) / 2 / mss,
+                                            2) * mss;
+               CCV(ccv, snd_cwnd) = mss;
                /*
                 * Grab the current time and record it so we know when the
                 * most recent congestion event was. Only record it when the

Modified: stable/12/sys/netinet/cc/cc_newreno.c
==============================================================================
--- stable/12/sys/netinet/cc/cc_newreno.c       Tue Nov 17 06:04:16 2020        
(r367751)
+++ stable/12/sys/netinet/cc/cc_newreno.c       Tue Nov 17 08:03:49 2020        
(r367752)
@@ -241,7 +241,7 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type)
        u_int mss;
 
        cwin = CCV(ccv, snd_cwnd);
-       mss = CCV(ccv, t_maxseg);
+       mss = tcp_maxseg(ccv->ccvc.tcp);
        nreno = ccv->cc_data;
        beta = (nreno == NULL) ? V_newreno_beta : nreno->beta;
        beta_ecn = (nreno == NULL) ? V_newreno_beta_ecn : nreno->beta_ecn;
@@ -278,6 +278,12 @@ newreno_cong_signal(struct cc_var *ccv, uint32_t type)
                        CCV(ccv, snd_cwnd) = cwin;
                        ENTER_CONGRECOVERY(CCV(ccv, t_flags));
                }
+               break;
+       case CC_RTO:
+               CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
+                                                CCV(ccv, snd_cwnd)) / 2 / mss,
+                                            2) * mss;
+               CCV(ccv, snd_cwnd) = mss;
                break;
        }
 }

Modified: stable/12/sys/netinet/tcp_input.c
==============================================================================
--- stable/12/sys/netinet/tcp_input.c   Tue Nov 17 06:04:16 2020        
(r367751)
+++ stable/12/sys/netinet/tcp_input.c   Tue Nov 17 08:03:49 2020        
(r367752)
@@ -403,8 +403,6 @@ cc_conn_init(struct tcpcb *tp)
 void inline
 cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
 {
-       u_int maxseg;
-
        INP_WLOCK_ASSERT(tp->t_inpcb);
 
        switch(type) {
@@ -430,13 +428,9 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui
                }
                break;
        case CC_RTO:
-               maxseg = tcp_maxseg(tp);
                tp->t_dupacks = 0;
                tp->t_bytes_acked = 0;
                EXIT_RECOVERY(tp->t_flags);
-               tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 /
-                   maxseg) * maxseg;
-               tp->snd_cwnd = maxseg;
                if (tp->t_flags & TF_ECN_PERMIT)
                        tp->t_flags |= TF_ECN_SND_CWR;
                break;
_______________________________________________
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