summaryrefslogtreecommitdiffstats
path: root/sys/netinet/cc.h
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2010-11-16 09:34:31 +0000
committerlstewart <lstewart@FreeBSD.org>2010-11-16 09:34:31 +0000
commitd54d1011fbb7ef126857b4bc2d52d4a83fd12d7c (patch)
treea655b3b37fc9444ec29c5584890472a6cbfe718b /sys/netinet/cc.h
parentc63666dcd4f55b0ce96f16101d217a0e20601539 (diff)
downloadFreeBSD-src-d54d1011fbb7ef126857b4bc2d52d4a83fd12d7c.zip
FreeBSD-src-d54d1011fbb7ef126857b4bc2d52d4a83fd12d7c.tar.gz
Make the CC framework more VIMAGE friendly by adding the machinery to allow
vnets to select their own default CC algorithm independent of each other and the base system. If the base system or a vnet has set a default which gets unloaded, we reset that netstack's default to NewReno. Sponsored by: FreeBSD Foundation Tested by: Mikolaj Golub <to.my.trociny at gmail com> Reviewed by: bz (briefly) MFC after: 3 months
Diffstat (limited to 'sys/netinet/cc.h')
-rw-r--r--sys/netinet/cc.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netinet/cc.h b/sys/netinet/cc.h
index 0d1dab7..aaa1d67 100644
--- a/sys/netinet/cc.h
+++ b/sys/netinet/cc.h
@@ -58,6 +58,10 @@ extern STAILQ_HEAD(cc_head, cc_algo) cc_list;
extern const int tcprexmtthresh;
extern struct cc_algo newreno_cc_algo;
+/* Per-netstack bits. */
+VNET_DECLARE(struct cc_algo *, default_cc_ptr);
+#define V_default_cc_ptr VNET(default_cc_ptr)
+
/* Define the new net.inet.tcp.cc sysctl tree. */
SYSCTL_DECL(_net_inet_tcp_cc);
@@ -146,7 +150,7 @@ struct cc_algo {
#define CC_DATA(tp) ((tp)->ccv->cc_data)
/* Macro to obtain the system default CC algo's struct ptr. */
-#define CC_DEFAULT() STAILQ_FIRST(&cc_list)
+#define CC_DEFAULT() V_default_cc_ptr
extern struct rwlock cc_list_lock;
#define CC_LIST_LOCK_INIT() rw_init(&cc_list_lock, "cc_list")
@@ -155,6 +159,6 @@ extern struct rwlock cc_list_lock;
#define CC_LIST_RUNLOCK() rw_runlock(&cc_list_lock)
#define CC_LIST_WLOCK() rw_wlock(&cc_list_lock)
#define CC_LIST_WUNLOCK() rw_wunlock(&cc_list_lock)
-#define CC_LIST_WLOCK_ASSERT() rw_assert(&cc_list_lock, RA_WLOCKED)
+#define CC_LIST_LOCK_ASSERT() rw_assert(&cc_list_lock, RA_LOCKED)
#endif /* _NETINET_CC_H_ */
OpenPOWER on IntegriCloud