Page MenuHomeFreeBSD

D59669.diff
No OneTemporary

D59669.diff

diff --git a/sys/netinet/cc/cc.h b/sys/netinet/cc/cc.h
--- a/sys/netinet/cc/cc.h
+++ b/sys/netinet/cc/cc.h
@@ -173,7 +173,10 @@
/* Called on detection of a congestion signal. */
void (*cong_signal)(struct cc_var *ccv, ccsignal_t type);
- /* Called after exiting congestion recovery. */
+ /* Called before exiting congestion recovery. */
+ void (*pre_post_recovery)(struct cc_var *ccv);
+
+ /* Called at exiting congestion recovery. */
void (*post_recovery)(struct cc_var *ccv);
/* Called when data transfer resumes after an idle period. */
@@ -227,6 +230,7 @@
* module that wishes to use NewReno type behaviour (along
* with anything else they may add on, pre or post call).
*/
+void newreno_cc_pre_post_recovery(struct cc_var *ccv);
void newreno_cc_post_recovery(struct cc_var *);
void newreno_cc_after_idle(struct cc_var *);
void newreno_cc_cong_signal(struct cc_var *, ccsignal_t);
diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c
--- a/sys/netinet/cc/cc.c
+++ b/sys/netinet/cc/cc.c
@@ -389,29 +389,19 @@
* Perform any necessary tasks before we exit congestion recovery.
*/
void
-newreno_cc_post_recovery(struct cc_var *ccv)
+newreno_cc_pre_post_recovery(struct cc_var *ccv)
{
- int pipe;
- uint32_t mss = tcp_fixed_maxseg(ccv->tp);
+ /* According to RFC 9937, cwnd is updated to ssthresh post recovery. */
+}
- if (IN_FASTRECOVERY(CCV(ccv, t_flags))) {
- /*
- * Fast recovery will conclude after returning from this
- * function. Window inflation should have left us with
- * approximately snd_ssthresh outstanding data. But in case we
- * would be inclined to send a burst, better to do it via the
- * slow start mechanism.
- */
- pipe = tcp_compute_pipe(ccv->tp);
- if (pipe < CCV(ccv, snd_ssthresh))
- /*
- * Ensure that cwnd does not collapse to 1 MSS under
- * adverse conditions. Implements RFC6582
- */
- CCV(ccv, snd_cwnd) = max(pipe, mss) + mss;
- else
- CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
- }
+/*
+ * start exiting congestion recovery.
+ */
+void
+newreno_cc_post_recovery(struct cc_var *ccv)
+{
+ EXIT_RECOVERY(CCV(ccv, t_flags));
+ CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
}
void
diff --git a/sys/netinet/cc/cc_cdg.c b/sys/netinet/cc/cc_cdg.c
--- a/sys/netinet/cc/cc_cdg.c
+++ b/sys/netinet/cc/cc_cdg.c
@@ -236,6 +236,7 @@
.cong_signal = cdg_cong_signal,
.mod_destroy = cdg_mod_destroy,
.cc_data_sz = cdg_data_sz,
+ .pre_post_recovery = newreno_cc_pre_post_recovery,
.post_recovery = newreno_cc_post_recovery,
.after_idle = newreno_cc_after_idle,
};
diff --git a/sys/netinet/cc/cc_chd.c b/sys/netinet/cc/cc_chd.c
--- a/sys/netinet/cc/cc_chd.c
+++ b/sys/netinet/cc/cc_chd.c
@@ -140,6 +140,7 @@
.mod_init = chd_mod_init,
.cc_data_sz = chd_data_sz,
.after_idle = newreno_cc_after_idle,
+ .pre_post_recovery = newreno_cc_pre_post_recovery,
.post_recovery = newreno_cc_post_recovery,
};
diff --git a/sys/netinet/cc/cc_cubic.c b/sys/netinet/cc/cc_cubic.c
--- a/sys/netinet/cc/cc_cubic.c
+++ b/sys/netinet/cc/cc_cubic.c
@@ -79,7 +79,7 @@
static void cubic_cong_signal(struct cc_var *ccv, ccsignal_t type);
static void cubic_conn_init(struct cc_var *ccv);
static int cubic_mod_init(void);
-static void cubic_post_recovery(struct cc_var *ccv);
+static void cubic_pre_post_recovery(struct cc_var *ccv);
static void cubic_record_rtt(struct cc_var *ccv);
static uint32_t cubic_get_ssthresh(struct cc_var *ccv, uint32_t maxseg);
static void cubic_after_idle(struct cc_var *ccv);
@@ -96,7 +96,8 @@
.cong_signal = cubic_cong_signal,
.conn_init = cubic_conn_init,
.mod_init = cubic_mod_init,
- .post_recovery = cubic_post_recovery,
+ .pre_post_recovery = cubic_pre_post_recovery,
+ .post_recovery = newreno_cc_post_recovery,
.after_idle = cubic_after_idle,
.cc_data_sz = cubic_data_sz,
.rttsample = cubic_rttsample,
@@ -528,34 +529,9 @@
* Perform any necessary tasks before we exit congestion recovery.
*/
static void
-cubic_post_recovery(struct cc_var *ccv)
+cubic_pre_post_recovery(struct cc_var *ccv)
{
- struct cubic *cubic_data;
- int pipe;
- uint32_t mss = tcp_fixed_maxseg(ccv->tp);
-
- cubic_data = ccv->cc_data;
- pipe = 0;
-
- if (IN_FASTRECOVERY(CCV(ccv, t_flags))) {
- /*
- * If inflight data is less than ssthresh, set cwnd
- * conservatively to avoid a burst of data, as suggested in
- * the NewReno RFC. Otherwise, use the CUBIC method.
- */
- pipe = tcp_compute_pipe(ccv->tp);
- if (pipe < CCV(ccv, snd_ssthresh))
- /*
- * Ensure that cwnd does not collapse to 1 MSS under
- * adverse conditions. Implements RFC6582
- */
- CCV(ccv, snd_cwnd) = max(pipe, mss) + mss;
- else
- /* Update cwnd based on beta and adjusted W_max. */
- CCV(ccv, snd_cwnd) = max(((uint64_t)cubic_data->W_max *
- CUBIC_BETA) >> CUBIC_SHIFT,
- 2 * mss);
- }
+ struct cubic *cubic_data = ccv->cc_data;
/* Calculate the average RTT between congestion epochs. */
if (cubic_data->epoch_ack_count > 0 &&
@@ -600,7 +576,7 @@
* If the connection is within its first congestion
* epoch, ensure we prime mean_rtt_usecs with a
* reasonable value until the epoch average RTT is
- * calculated in cubic_post_recovery().
+ * calculated in cubic_pre_post_recovery().
*/
if (cubic_data->min_rtt_usecs >
cubic_data->mean_rtt_usecs)
diff --git a/sys/netinet/cc/cc_dctcp.c b/sys/netinet/cc/cc_dctcp.c
--- a/sys/netinet/cc/cc_dctcp.c
+++ b/sys/netinet/cc/cc_dctcp.c
@@ -85,7 +85,7 @@
static int dctcp_cb_init(struct cc_var *ccv, void *ptr);
static void dctcp_cong_signal(struct cc_var *ccv, ccsignal_t type);
static void dctcp_conn_init(struct cc_var *ccv);
-static void dctcp_post_recovery(struct cc_var *ccv);
+static void dctcp_pre_post_recovery(struct cc_var *ccv);
static void dctcp_ecnpkt_handler(struct cc_var *ccv);
static void dctcp_update_alpha(struct cc_var *ccv);
static size_t dctcp_data_sz(void);
@@ -97,7 +97,8 @@
.cb_init = dctcp_cb_init,
.cong_signal = dctcp_cong_signal,
.conn_init = dctcp_conn_init,
- .post_recovery = dctcp_post_recovery,
+ .pre_post_recovery = dctcp_pre_post_recovery,
+ .post_recovery = newreno_cc_post_recovery,
.ecnpkt_handler = dctcp_ecnpkt_handler,
.after_idle = dctcp_after_idle,
.cc_data_sz = dctcp_data_sz,
@@ -328,9 +329,9 @@
* Perform any necessary tasks before we exit congestion recovery.
*/
static void
-dctcp_post_recovery(struct cc_var *ccv)
+dctcp_pre_post_recovery(struct cc_var *ccv)
{
- newreno_cc_post_recovery(ccv);
+ newreno_cc_pre_post_recovery(ccv);
if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT)
dctcp_update_alpha(ccv);
diff --git a/sys/netinet/cc/cc_hd.c b/sys/netinet/cc/cc_hd.c
--- a/sys/netinet/cc/cc_hd.c
+++ b/sys/netinet/cc/cc_hd.c
@@ -101,6 +101,7 @@
.cc_data_sz = hd_data_sz,
.after_idle = newreno_cc_after_idle,
.cong_signal = newreno_cc_cong_signal,
+ .pre_post_recovery = newreno_cc_pre_post_recovery,
.post_recovery = newreno_cc_post_recovery,
};
diff --git a/sys/netinet/cc/cc_htcp.c b/sys/netinet/cc/cc_htcp.c
--- a/sys/netinet/cc/cc_htcp.c
+++ b/sys/netinet/cc/cc_htcp.c
@@ -141,7 +141,6 @@
static int htcp_cb_init(struct cc_var *ccv, void *ptr);
static void htcp_cong_signal(struct cc_var *ccv, ccsignal_t type);
static int htcp_mod_init(void);
-static void htcp_post_recovery(struct cc_var *ccv);
static void htcp_recalc_alpha(struct cc_var *ccv);
static void htcp_recalc_beta(struct cc_var *ccv);
static void htcp_record_rtt(struct cc_var *ccv);
@@ -184,7 +183,8 @@
.cb_init = htcp_cb_init,
.cong_signal = htcp_cong_signal,
.mod_init = htcp_mod_init,
- .post_recovery = htcp_post_recovery,
+ .pre_post_recovery = newreno_cc_pre_post_recovery,
+ .post_recovery = newreno_cc_post_recovery,
.cc_data_sz = htcp_data_sz,
.after_idle = newreno_cc_after_idle,
};
@@ -357,39 +357,6 @@
return (0);
}
-/*
- * Perform any necessary tasks before we exit congestion recovery.
- */
-static void
-htcp_post_recovery(struct cc_var *ccv)
-{
- int pipe;
- struct htcp *htcp_data;
- uint32_t mss = tcp_fixed_maxseg(ccv->tp);
-
- pipe = 0;
- htcp_data = ccv->cc_data;
-
- if (IN_FASTRECOVERY(CCV(ccv, t_flags))) {
- /*
- * If inflight data is less than ssthresh, set cwnd
- * conservatively to avoid a burst of data, as suggested in the
- * NewReno RFC. Otherwise, use the HTCP method.
- */
- pipe = tcp_compute_pipe(ccv->tp);
- if (pipe < CCV(ccv, snd_ssthresh))
- /*
- * Ensure that cwnd down not collape to 1 MSS under
- * adverse conditions. Implements RFC6582
- */
- CCV(ccv, snd_cwnd) = max(pipe, mss) + mss;
- else
- CCV(ccv, snd_cwnd) = max(1, ((htcp_data->beta *
- htcp_data->prev_cwnd / mss)
- >> HTCP_SHIFT)) * mss;
- }
-}
-
static void
htcp_recalc_alpha(struct cc_var *ccv)
{
diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c
--- a/sys/netinet/cc/cc_newreno.c
+++ b/sys/netinet/cc/cc_newreno.c
@@ -105,6 +105,7 @@
.ack_received = newreno_ack_received,
.after_idle = newreno_after_idle,
.cong_signal = newreno_cong_signal,
+ .pre_post_recovery = newreno_cc_pre_post_recovery,
.post_recovery = newreno_cc_post_recovery,
.ctl_output = newreno_ctl_output,
.newround = newreno_newround,
diff --git a/sys/netinet/cc/cc_vegas.c b/sys/netinet/cc/cc_vegas.c
--- a/sys/netinet/cc/cc_vegas.c
+++ b/sys/netinet/cc/cc_vegas.c
@@ -115,6 +115,7 @@
.mod_init = vegas_mod_init,
.cc_data_sz = vegas_data_sz,
.after_idle = newreno_cc_after_idle,
+ .pre_post_recovery = newreno_cc_pre_post_recovery,
.post_recovery = newreno_cc_post_recovery,
};
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -482,21 +482,23 @@
{
INP_WLOCK_ASSERT(tptoinpcb(tp));
- if (CC_ALGO(tp)->post_recovery != NULL) {
+ if (CC_ALGO(tp)->pre_post_recovery != NULL) {
if (SEQ_LT(tp->snd_fack, th->th_ack) ||
SEQ_GT(tp->snd_fack, tp->snd_max)) {
tp->snd_fack = th->th_ack;
}
tp->t_ccv.curack = th->th_ack;
- CC_ALGO(tp)->post_recovery(&tp->t_ccv);
+ CC_ALGO(tp)->pre_post_recovery(&tp->t_ccv);
}
- EXIT_RECOVERY(tp->t_flags);
+
+ KASSERT(CC_ALGO(tp)->post_recovery != NULL,
+ ("%s: post_recovery == NULL", __func__));
+ CC_ALGO(tp)->post_recovery(&tp->t_ccv);
tp->t_bytes_acked = 0;
tp->sackhint.delivered_data = 0;
tp->sackhint.prr_delivered = 0;
tp->sackhint.prr_out = 0;
- tp->snd_cwnd = tp->snd_ssthresh;
}
/*
diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -5492,9 +5492,9 @@
INP_WLOCK_ASSERT(tptoinpcb(tp));
rack = (struct tcp_rack *)tp->t_fb_ptr;
/* only alert CC if we alerted when we entered */
- if (CC_ALGO(tp)->post_recovery != NULL) {
+ if (CC_ALGO(tp)->pre_post_recovery != NULL) {
tp->t_ccv.curack = th_ack;
- CC_ALGO(tp)->post_recovery(&tp->t_ccv);
+ CC_ALGO(tp)->pre_post_recovery(&tp->t_ccv);
if (tp->snd_cwnd < tp->snd_ssthresh) {
/*
* Rack has burst control and pacing

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 24, 9:14 AM (1 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39425450
Default Alt Text
D59669.diff (10 KB)

Event Timeline