From: Stephen Hemminger <shemminger@osdl.org>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: David Miller <davem@davemloft.net>,
hagen@jauu.net, jheffner@psc.edu, netdev@vger.kernel.org
Subject: [RFC] tcp: available congetsion control
Date: Fri, 27 Oct 2006 20:10:37 -0700 [thread overview]
Message-ID: <20061027201037.1bc85ae1@localhost.localdomain> (raw)
In-Reply-To: <20061027174816.29bd6563@localhost.localdomain>
Nice way to see what congestion control modules are loaded.
It does impose a soft limit of 32 possibilities.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
---
include/linux/sysctl.h | 1 +
include/net/tcp.h | 3 +++
net/ipv4/sysctl_net_ipv4.c | 25 ++++++++++++++++++++++++-
net/ipv4/tcp_cong.c | 14 ++++++++++++++
4 files changed, 42 insertions(+), 1 deletion(-)
--- skge.orig/include/linux/sysctl.h
+++ skge/include/linux/sysctl.h
@@ -418,6 +418,7 @@ enum
NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
NET_CIPSOV4_RBM_OPTFMT=120,
NET_CIPSOV4_RBM_STRICTVALID=121,
+ NET_TCP_AVAIL_CONG_CONTROL=122,
};
enum {
--- skge.orig/include/net/tcp.h
+++ skge/include/net/tcp.h
@@ -621,6 +621,8 @@ enum tcp_ca_event {
* Interface for adding new TCP congestion control handlers
*/
#define TCP_CA_NAME_MAX 16
+#define TCP_CA_MAX 32
+
struct tcp_congestion_ops {
struct list_head list;
@@ -659,6 +661,7 @@ extern void tcp_unregister_congestion_co
extern void tcp_init_congestion_control(struct sock *sk);
extern void tcp_cleanup_congestion_control(struct sock *sk);
extern int tcp_set_default_congestion_control(const char *name);
+extern void tcp_get_available_congestion_control(char *name, int maxlen);
extern void tcp_get_default_congestion_control(char *name);
extern int tcp_set_congestion_control(struct sock *sk, const char *name);
extern void tcp_slow_start(struct tcp_sock *tp);
--- skge.orig/net/ipv4/sysctl_net_ipv4.c
+++ skge/net/ipv4/sysctl_net_ipv4.c
@@ -108,6 +108,22 @@ static int proc_tcp_congestion_control(c
return ret;
}
+static int proc_tcp_available_congestion_control(ctl_table *ctl,
+ int write, struct file * filp,
+ void __user *buffer, size_t *lenp,
+ loff_t *ppos)
+{
+ char val[TCP_CA_MAX*(TCP_CA_NAME_MAX+1)];
+ ctl_table tbl = {
+ .data = val,
+ .maxlen = TCP_CA_MAX*(TCP_CA_NAME_MAX+1),
+ };
+
+ tcp_get_available_congestion_control(val, tbl.maxlen);
+
+ return proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
+}
+
static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
int nlen, void __user *oldval,
size_t __user *oldlenp,
@@ -133,9 +149,9 @@ static int __init tcp_congestion_default
{
return tcp_set_default_congestion_control(CONFIG_DEFAULT_TCP_CONG);
}
-
late_initcall(tcp_congestion_default);
+
ctl_table ipv4_table[] = {
{
.ctl_name = NET_IPV4_TCP_TIMESTAMPS,
@@ -738,6 +754,13 @@ ctl_table ipv4_table[] = {
.proc_handler = &proc_dointvec,
},
#endif /* CONFIG_NETLABEL */
+ {
+ .ctl_name = NET_TCP_AVAIL_CONG_CONTROL,
+ .procname = "tcp_available_congestion_control",
+ .mode = 0444,
+ .maxlen = TCP_CA_MAX*(TCP_CA_NAME_MAX+1),
+ .proc_handler = &proc_tcp_available_congestion_control,
+ },
{ .ctl_name = 0 }
};
--- skge.orig/net/ipv4/tcp_cong.c
+++ skge/net/ipv4/tcp_cong.c
@@ -144,6 +144,20 @@ void tcp_get_default_congestion_control(
rcu_read_unlock();
}
+/* Build string with list of available congestion control values */
+void tcp_get_available_congestion_control(char *name, int maxlen)
+{
+ struct tcp_congestion_ops *ca;
+ int offs = 0;
+
+ rcu_read_lock();
+ list_for_each_entry_rcu(ca, &tcp_cong_list, list) {
+ offs += snprintf(name + offs, maxlen - offs, "%s%s",
+ offs == 0 ? "" : " ", ca->name);
+ }
+ rcu_read_unlock();
+}
+
/* Change congestion control for socket */
int tcp_set_congestion_control(struct sock *sk, const char *name)
{
next prev parent reply other threads:[~2006-10-28 3:11 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-25 18:08 [RFC] tcp: setsockopt congestion control autoload Stephen Hemminger
2006-10-25 23:21 ` Patrick McHardy
2006-10-26 5:22 ` Evgeniy Polyakov
2006-10-26 14:34 ` Stephen Hemminger
2006-10-26 14:57 ` Evgeniy Polyakov
2006-10-26 15:23 ` Stephen Hemminger
2006-10-26 17:05 ` Patrick McHardy
2006-10-26 20:55 ` David Miller
2006-10-26 17:29 ` John Heffner
2006-10-26 20:57 ` David Miller
2006-10-26 22:44 ` Hagen Paul Pfeifer
2006-10-26 22:53 ` John Heffner
2006-10-26 23:52 ` [PATCH] Check if user has CAP_NET_ADMIN to change congestion control algorithm Hagen Paul Pfeifer
2006-10-26 23:59 ` Ian McDonald
2006-10-27 0:07 ` David Miller
2006-10-27 0:20 ` Ian McDonald
2006-10-27 0:02 ` David Miller
2006-10-27 10:43 ` Hagen Paul Pfeifer
2006-10-27 14:41 ` Stephen Hemminger
2006-10-27 15:21 ` Hagen Paul Pfeifer
2006-10-27 15:48 ` Stephen Hemminger
2006-10-27 17:30 ` [PATCH] tcp: don't allow unfair congestion control to be built without warning Stephen Hemminger
2006-10-27 17:43 ` John Heffner
2006-10-27 17:59 ` [PATCH] tcp: allow restricting congestion control choices Stephen Hemminger
2006-10-27 21:17 ` [PATCH] tcp: don't allow unfair congestion control to be built without warning David Miller
2006-10-27 21:24 ` Stephen Hemminger
2006-10-27 21:37 ` David Miller
2006-10-27 21:59 ` Stephen Hemminger
2006-10-27 22:12 ` David Miller
2006-10-27 22:21 ` Stephen Hemminger
2006-10-27 22:24 ` David Miller
2006-10-28 0:48 ` Stephen Hemminger
2006-10-28 3:10 ` Stephen Hemminger [this message]
2006-10-27 21:22 ` [PATCH] Check if user has CAP_NET_ADMIN to change congestion control algorithm David Miller
2006-10-27 1:03 ` Stephen Hemminger
2006-10-27 18:14 ` [PATCH] tcp: setsockopt congestion control autoload Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061027201037.1bc85ae1@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=davem@davemloft.net \
--cc=hagen@jauu.net \
--cc=jheffner@psc.edu \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).