Page MenuHomeFreeBSD

D43838.diff
No OneTemporary

D43838.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
@@ -121,25 +121,25 @@
#define CCF_HYSTART_CAN_SH_CWND 0x0800 /* Can hystart when going CSS -> CA slam the cwnd */
#define CCF_HYSTART_CONS_SSTH 0x1000 /* Should hystart use the more conservative ssthresh */
-/* ACK types passed to the ack_received() hook. */
-#define CC_ACK 0x0001 /* Regular in sequence ACK. */
-#define CC_DUPACK 0x0002 /* Duplicate ACK. */
-#define CC_PARTIALACK 0x0004 /* Not yet. */
-#define CC_SACK 0x0008 /* Not yet. */
+typedef enum {
+ /* ACK types passed to the ack_received() hook. */
+ CC_ACK = 0x0001, /* Regular in sequence ACK. */
+ CC_DUPACK = 0x0002, /* Duplicate ACK. */
+ CC_PARTIALACK = 0x0004, /* Not yet. */
+ CC_SACK = 0x0008, /* Not yet. */
+ /* Congestion signal types passed to the cong_signal() hook. */
+ CC_ECN = 0x0100, /* ECN marked packet received. */
+ CC_RTO = 0x0200, /* RTO fired. */
+ CC_RTO_ERR = 0x0400, /* RTO fired in error. */
+ CC_NDUPACK = 0x0800, /* Threshold of dupack's reached. */
+ /*
+ * The highest order 8 bits (0x01000000 - 0x80000000) are reserved
+ * for CC algos to declare their own congestion signal types.
+ */
+ CC_SIGPRIVMASK = 0xFF000000 /* Mask to check if sig is private. */
+} ccsignal_t;
#endif /* defined(_KERNEL) || defined(_WANT_TCPCB) */
-/*
- * Congestion signal types passed to the cong_signal() hook. The highest order 8
- * bits (0x01000000 - 0x80000000) are reserved for CC algos to declare their own
- * congestion signal types.
- */
-#define CC_ECN 0x00000001 /* ECN marked packet received. */
-#define CC_RTO 0x00000002 /* RTO fired. */
-#define CC_RTO_ERR 0x00000004 /* RTO fired in error. */
-#define CC_NDUPACK 0x00000008 /* Threshold of dupack's reached. */
-
-#define CC_SIGPRIVMASK 0xFF000000 /* Mask to check if sig is private. */
-
#ifdef _KERNEL
/*
* Structure to hold data and function pointers that together represent a
@@ -175,10 +175,10 @@
void (*conn_init)(struct cc_var *ccv);
/* Called on receipt of an ack. */
- void (*ack_received)(struct cc_var *ccv, uint16_t type);
+ void (*ack_received)(struct cc_var *ccv, ccsignal_t type);
/* Called on detection of a congestion signal. */
- void (*cong_signal)(struct cc_var *ccv, uint32_t type);
+ void (*cong_signal)(struct cc_var *ccv, ccsignal_t type);
/* Called after exiting congestion recovery. */
void (*post_recovery)(struct cc_var *ccv);
@@ -236,8 +236,8 @@
*/
void newreno_cc_post_recovery(struct cc_var *);
void newreno_cc_after_idle(struct cc_var *);
-void newreno_cc_cong_signal(struct cc_var *, uint32_t );
-void newreno_cc_ack_received(struct cc_var *, uint16_t);
+void newreno_cc_cong_signal(struct cc_var *, ccsignal_t);
+void newreno_cc_ack_received(struct cc_var *, ccsignal_t);
/* Called to temporarily keep an algo from going away during change */
void cc_refer(struct cc_algo *algo);
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
@@ -505,7 +505,7 @@
}
void
-newreno_cc_ack_received(struct cc_var *ccv, uint16_t type)
+newreno_cc_ack_received(struct cc_var *ccv, ccsignal_t type)
{
if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
(ccv->flags & CCF_CWND_LIMITED)) {
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
@@ -221,8 +221,8 @@
static void cdg_conn_init(struct cc_var *ccv);
static int cdg_cb_init(struct cc_var *ccv, void *ptr);
static void cdg_cb_destroy(struct cc_var *ccv);
-static void cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type);
-static void cdg_ack_received(struct cc_var *ccv, uint16_t ack_type);
+static void cdg_cong_signal(struct cc_var *ccv, ccsignal_t signal_type);
+static void cdg_ack_received(struct cc_var *ccv, ccsignal_t ack_type);
static size_t cdg_data_sz(void);
struct cc_algo cdg_cc_algo = {
@@ -450,11 +450,11 @@
}
static void
-cdg_cong_signal(struct cc_var *ccv, uint32_t signal_type)
+cdg_cong_signal(struct cc_var *ccv, ccsignal_t signal_type)
{
struct cdg *cdg_data = ccv->cc_data;
- switch(signal_type) {
+ switch((int)signal_type) {
case CC_CDG_DELAY:
CCV(ccv, snd_ssthresh) = cdg_window_decrease(ccv,
CCV(ccv, snd_cwnd), V_cdg_beta_delay);
@@ -571,7 +571,7 @@
}
static void
-cdg_ack_received(struct cc_var *ccv, uint16_t ack_type)
+cdg_ack_received(struct cc_var *ccv, ccsignal_t ack_type)
{
struct cdg *cdg_data;
struct ertt *e_t;
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
@@ -88,10 +88,10 @@
/* Largest possible number returned by random(). */
#define RANDOM_MAX INT_MAX
-static void chd_ack_received(struct cc_var *ccv, uint16_t ack_type);
+static void chd_ack_received(struct cc_var *ccv, ccsignal_t ack_type);
static void chd_cb_destroy(struct cc_var *ccv);
static int chd_cb_init(struct cc_var *ccv, void *ptr);
-static void chd_cong_signal(struct cc_var *ccv, uint32_t signal_type);
+static void chd_cong_signal(struct cc_var *ccv, ccsignal_t signal_type);
static void chd_conn_init(struct cc_var *ccv);
static int chd_mod_init(void);
static size_t chd_data_sz(void);
@@ -235,7 +235,7 @@
* ack_type == CC_ACK.
*/
static void
-chd_ack_received(struct cc_var *ccv, uint16_t ack_type)
+chd_ack_received(struct cc_var *ccv, ccsignal_t ack_type)
{
struct chd *chd_data;
struct ertt *e_t;
@@ -336,7 +336,7 @@
}
static void
-chd_cong_signal(struct cc_var *ccv, uint32_t signal_type)
+chd_cong_signal(struct cc_var *ccv, ccsignal_t signal_type)
{
struct ertt *e_t;
struct chd *chd_data;
@@ -346,7 +346,7 @@
chd_data = ccv->cc_data;
qdly = imax(e_t->rtt, chd_data->maxrtt_in_rtt) - e_t->minrtt;
- switch(signal_type) {
+ switch((int)signal_type) {
case CC_CHD_DELAY:
chd_window_decrease(ccv); /* Set new ssthresh. */
CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
@@ -387,6 +387,7 @@
default:
newreno_cc_cong_signal(ccv, signal_type);
+ break;
}
}
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
@@ -73,10 +73,10 @@
#include <netinet/cc/cc_cubic.h>
#include <netinet/cc/cc_module.h>
-static void cubic_ack_received(struct cc_var *ccv, uint16_t type);
+static void cubic_ack_received(struct cc_var *ccv, ccsignal_t type);
static void cubic_cb_destroy(struct cc_var *ccv);
static int cubic_cb_init(struct cc_var *ccv, void *ptr);
-static void cubic_cong_signal(struct cc_var *ccv, uint32_t type);
+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);
@@ -233,7 +233,7 @@
}
static void
-cubic_ack_received(struct cc_var *ccv, uint16_t type)
+cubic_ack_received(struct cc_var *ccv, ccsignal_t type)
{
struct cubic *cubic_data;
unsigned long W_est, W_cubic;
@@ -417,7 +417,7 @@
* Perform any necessary tasks before we enter congestion recovery.
*/
static void
-cubic_cong_signal(struct cc_var *ccv, uint32_t type)
+cubic_cong_signal(struct cc_var *ccv, ccsignal_t type)
{
struct cubic *cubic_data;
uint32_t mss, pipe;
@@ -503,6 +503,8 @@
cubic_data->cwnd_epoch = cubic_data->undo_cwnd_epoch;
cubic_data->t_epoch = cubic_data->undo_t_epoch;
break;
+ default:
+ break;
}
}
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
@@ -79,11 +79,11 @@
uint32_t num_cong_events; /* # of congestion events */
};
-static void dctcp_ack_received(struct cc_var *ccv, uint16_t type);
+static void dctcp_ack_received(struct cc_var *ccv, ccsignal_t type);
static void dctcp_after_idle(struct cc_var *ccv);
static void dctcp_cb_destroy(struct cc_var *ccv);
static int dctcp_cb_init(struct cc_var *ccv, void *ptr);
-static void dctcp_cong_signal(struct cc_var *ccv, uint32_t type);
+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_ecnpkt_handler(struct cc_var *ccv);
@@ -104,7 +104,7 @@
};
static void
-dctcp_ack_received(struct cc_var *ccv, uint16_t type)
+dctcp_ack_received(struct cc_var *ccv, ccsignal_t type)
{
struct dctcp *dctcp_data;
int bytes_acked = 0;
@@ -237,7 +237,7 @@
* Perform any necessary tasks before we enter congestion recovery.
*/
static void
-dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
+dctcp_cong_signal(struct cc_var *ccv, ccsignal_t type)
{
struct dctcp *dctcp_data;
uint32_t cwin, mss, pipe;
@@ -308,6 +308,8 @@
dctcp_data->save_sndnxt += CCV(ccv, t_maxseg);
dctcp_data->num_cong_events++;
break;
+ default:
+ break;
}
} else
newreno_cc_cong_signal(ccv, type);
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
@@ -80,7 +80,7 @@
/* Largest possible number returned by random(). */
#define RANDOM_MAX INT_MAX
-static void hd_ack_received(struct cc_var *ccv, uint16_t ack_type);
+static void hd_ack_received(struct cc_var *ccv, ccsignal_t ack_type);
static int hd_mod_init(void);
static size_t hd_data_sz(void);
@@ -138,7 +138,7 @@
* as NewReno in all other circumstances.
*/
static void
-hd_ack_received(struct cc_var *ccv, uint16_t ack_type)
+hd_ack_received(struct cc_var *ccv, ccsignal_t ack_type)
{
struct ertt *e_t;
int qdly;
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
@@ -136,10 +136,10 @@
(((diff) / hz) * (((diff) << HTCP_ALPHA_INC_SHIFT) / (4 * hz))) \
) >> HTCP_ALPHA_INC_SHIFT)
-static void htcp_ack_received(struct cc_var *ccv, uint16_t type);
+static void htcp_ack_received(struct cc_var *ccv, ccsignal_t type);
static void htcp_cb_destroy(struct cc_var *ccv);
static int htcp_cb_init(struct cc_var *ccv, void *ptr);
-static void htcp_cong_signal(struct cc_var *ccv, uint32_t type);
+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);
@@ -190,7 +190,7 @@
};
static void
-htcp_ack_received(struct cc_var *ccv, uint16_t type)
+htcp_ack_received(struct cc_var *ccv, ccsignal_t type)
{
struct htcp *htcp_data;
@@ -278,7 +278,7 @@
* Perform any necessary tasks before we enter congestion recovery.
*/
static void
-htcp_cong_signal(struct cc_var *ccv, uint32_t type)
+htcp_cong_signal(struct cc_var *ccv, ccsignal_t type)
{
struct htcp *htcp_data;
uint32_t mss, pipe;
@@ -345,6 +345,8 @@
if (CCV(ccv, t_rxtshift) >= 2)
htcp_data->t_last_cong = ticks;
break;
+ default:
+ break;
}
}
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
@@ -84,9 +84,9 @@
#include <netinet/cc/cc_newreno.h>
static void newreno_cb_destroy(struct cc_var *ccv);
-static void newreno_ack_received(struct cc_var *ccv, uint16_t type);
+static void newreno_ack_received(struct cc_var *ccv, ccsignal_t type);
static void newreno_after_idle(struct cc_var *ccv);
-static void newreno_cong_signal(struct cc_var *ccv, uint32_t type);
+static void newreno_cong_signal(struct cc_var *ccv, ccsignal_t type);
static int newreno_ctl_output(struct cc_var *ccv, struct sockopt *sopt, void *buf);
static void newreno_newround(struct cc_var *ccv, uint32_t round_cnt);
static void newreno_rttsample(struct cc_var *ccv, uint32_t usec_rtt, uint32_t rxtcnt, uint32_t fas);
@@ -212,7 +212,7 @@
}
static void
-newreno_ack_received(struct cc_var *ccv, uint16_t type)
+newreno_ack_received(struct cc_var *ccv, ccsignal_t type)
{
struct newreno *nreno;
@@ -363,7 +363,7 @@
* Perform any necessary tasks before we enter congestion recovery.
*/
static void
-newreno_cong_signal(struct cc_var *ccv, uint32_t type)
+newreno_cong_signal(struct cc_var *ccv, ccsignal_t type)
{
struct newreno *nreno;
uint32_t beta, beta_ecn, cwin, factor, mss, pipe;
@@ -442,6 +442,8 @@
}
CCV(ccv, snd_cwnd) = mss;
break;
+ default:
+ break;
}
}
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
@@ -84,12 +84,12 @@
* Private signal type for rate based congestion signal.
* See <netinet/cc.h> for appropriate bit-range to use for private signals.
*/
-#define CC_VEGAS_RATE 0x01000000
+#define CC_VEGAS_RATE 0x04000000
-static void vegas_ack_received(struct cc_var *ccv, uint16_t ack_type);
+static void vegas_ack_received(struct cc_var *ccv, ccsignal_t ack_type);
static void vegas_cb_destroy(struct cc_var *ccv);
static int vegas_cb_init(struct cc_var *ccv, void *ptr);
-static void vegas_cong_signal(struct cc_var *ccv, uint32_t signal_type);
+static void vegas_cong_signal(struct cc_var *ccv, ccsignal_t signal_type);
static void vegas_conn_init(struct cc_var *ccv);
static int vegas_mod_init(void);
static size_t vegas_data_sz(void);
@@ -124,7 +124,7 @@
* has been used.
*/
static void
-vegas_ack_received(struct cc_var *ccv, uint16_t ack_type)
+vegas_ack_received(struct cc_var *ccv, ccsignal_t ack_type)
{
struct ertt *e_t;
struct vegas *vegas_data;
@@ -203,7 +203,7 @@
* handled here, otherwise it falls back to newreno's congestion handling.
*/
static void
-vegas_cong_signal(struct cc_var *ccv, uint32_t signal_type)
+vegas_cong_signal(struct cc_var *ccv, ccsignal_t signal_type)
{
struct vegas *vegas_data;
int presignalrecov;
@@ -215,7 +215,7 @@
else
presignalrecov = 0;
- switch(signal_type) {
+ switch((int)signal_type) {
case CC_VEGAS_RATE:
if (!IN_RECOVERY(CCV(ccv, t_flags))) {
CCV(ccv, snd_cwnd) = max(2 * CCV(ccv, t_maxseg),
@@ -228,6 +228,7 @@
default:
newreno_cc_cong_signal(ccv, signal_type);
+ break;
}
if (IN_RECOVERY(CCV(ccv, t_flags)) && !presignalrecov)

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 3:18 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14530689
Default Alt Text
D43838.diff (13 KB)

Event Timeline