Page MenuHomeFreeBSD

D20549.id58356.diff
No OneTemporary

D20549.id58356.diff

Index: sys/netinet/cc/cc_dctcp.c
===================================================================
--- sys/netinet/cc/cc_dctcp.c
+++ sys/netinet/cc/cc_dctcp.c
@@ -56,7 +56,8 @@
#include <netinet/cc/cc.h>
#include <netinet/cc/cc_module.h>
-#define MAX_ALPHA_VALUE 1024
+#define DCTCP_SHIFT 10
+#define MAX_ALPHA_VALUE 1<<DCTCP_SHIFT
VNET_DEFINE_STATIC(uint32_t, dctcp_alpha) = 0;
#define V_dctcp_alpha VNET(dctcp_alpha)
VNET_DEFINE_STATIC(uint32_t, dctcp_shift_g) = 4;
@@ -65,14 +66,14 @@
#define V_dctcp_slowstart VNET(dctcp_slowstart)
struct dctcp {
- int bytes_ecn; /* # of marked bytes during a RTT */
- int bytes_total; /* # of acked bytes during a RTT */
- int alpha; /* the fraction of marked bytes */
- int ce_prev; /* CE state of the last segment */
- int save_sndnxt; /* end sequence number of the current window */
- int ece_curr; /* ECE flag in this segment */
- int ece_prev; /* ECE flag in the last segment */
- uint32_t num_cong_events; /* # of congestion events */
+ uint32_t bytes_ecn; /* # of marked bytes during a RTT */
+ uint32_t bytes_total; /* # of acked bytes during a RTT */
+ int alpha; /* the fraction of marked bytes */
+ int ce_prev; /* CE state of the last segment */
+ tcp_seq save_sndnxt; /* end sequence number of the current window */
+ int ece_curr; /* ECE flag in this segment */
+ int ece_prev; /* ECE flag in the last segment */
+ uint32_t num_cong_events; /* # of congestion events */
};
static MALLOC_DEFINE(M_dctcp, "dctcp data",
@@ -379,8 +380,8 @@
* updated every RTT
* Alpha must be round to 0 - MAX_ALPHA_VALUE.
*/
- dctcp_data->alpha = min(alpha_prev - (alpha_prev >> V_dctcp_shift_g) +
- (dctcp_data->bytes_ecn << (10 - V_dctcp_shift_g)) /
+ dctcp_data->alpha = ulmin(alpha_prev - (alpha_prev >> V_dctcp_shift_g) +
+ ((uint64_t)dctcp_data->bytes_ecn << (DCTCP_SHIFT - V_dctcp_shift_g)) /
dctcp_data->bytes_total, MAX_ALPHA_VALUE);
/* Initialize internal parameters for next alpha calculation */
@@ -398,14 +399,10 @@
new = V_dctcp_alpha;
error = sysctl_handle_int(oidp, &new, 0, req);
if (error == 0 && req->newptr != NULL) {
- if (new > 1)
+ if ((new < 0) || (new > MAX_ALPHA_VALUE))
error = EINVAL;
- else {
- if (new > MAX_ALPHA_VALUE)
- V_dctcp_alpha = MAX_ALPHA_VALUE;
- else
- V_dctcp_alpha = new;
- }
+ else
+ V_dctcp_alpha = new;
}
return (error);
@@ -420,7 +417,7 @@
new = V_dctcp_shift_g;
error = sysctl_handle_int(oidp, &new, 0, req);
if (error == 0 && req->newptr != NULL) {
- if (new > 1)
+ if ((new < 0) || (new > DCTCP_SHIFT))
error = EINVAL;
else
V_dctcp_shift_g = new;
@@ -438,7 +435,7 @@
new = V_dctcp_slowstart;
error = sysctl_handle_int(oidp, &new, 0, req);
if (error == 0 && req->newptr != NULL) {
- if (new > 1)
+ if ((new < 0) || (new > 1))
error = EINVAL;
else
V_dctcp_slowstart = new;
@@ -454,7 +451,7 @@
SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, alpha,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_alpha), 0,
&dctcp_alpha_handler,
- "IU", "dctcp alpha parameter");
+ "IU", "dctcp alpha parameter at start of session");
SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, shift_g,
CTLFLAG_VNET|CTLTYPE_UINT|CTLFLAG_RW, &VNET_NAME(dctcp_shift_g), 4,

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 29, 2:09 PM (35 m, 59 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28083933
Default Alt Text
D20549.id58356.diff (3 KB)

Event Timeline