diff options
| author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-04-23 22:26:16 -0700 | 
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-25 22:29:45 -0700 | 
| commit | 164891aadf1721fca4dce473bb0e0998181537c6 (patch) | |
| tree | 991393ec7306da475cb306fcc7cb084f737ebadc /net/ipv4/tcp_cong.c | |
| parent | 65d1b4a7e73fe0e1f5275ad7d2d3547981480886 (diff) | |
| download | olio-linux-3.10-164891aadf1721fca4dce473bb0e0998181537c6.tar.xz olio-linux-3.10-164891aadf1721fca4dce473bb0e0998181537c6.zip  | |
[TCP]: Congestion control API update.
Do some simple changes to make congestion control API faster/cleaner.
* use ktime_t rather than timeval
* merge rtt sampling into existing ack callback
  this means one indirect call versus two per ack.
* use flags bits to store options/settings
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_cong.c')
| -rw-r--r-- | net/ipv4/tcp_cong.c | 14 | 
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index ccd88407e0c..86b26539e54 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c @@ -126,7 +126,7 @@ int tcp_set_default_congestion_control(const char *name)  #endif  	if (ca) { -		ca->non_restricted = 1;	/* default is always allowed */ +		ca->flags |= TCP_CONG_NON_RESTRICTED;	/* default is always allowed */  		list_move(&ca->list, &tcp_cong_list);  		ret = 0;  	} @@ -181,7 +181,7 @@ void tcp_get_allowed_congestion_control(char *buf, size_t maxlen)  	*buf = '\0';  	rcu_read_lock();  	list_for_each_entry_rcu(ca, &tcp_cong_list, list) { -		if (!ca->non_restricted) +		if (!(ca->flags & TCP_CONG_NON_RESTRICTED))  			continue;  		offs += snprintf(buf + offs, maxlen - offs,  				 "%s%s", @@ -212,16 +212,16 @@ int tcp_set_allowed_congestion_control(char *val)  		}  	} -	/* pass 2 clear */ +	/* pass 2 clear old values */  	list_for_each_entry_rcu(ca, &tcp_cong_list, list) -		ca->non_restricted = 0; +		ca->flags &= ~TCP_CONG_NON_RESTRICTED;  	/* pass 3 mark as allowed */  	while ((name = strsep(&val, " ")) && *name) {  		ca = tcp_ca_find(name);  		WARN_ON(!ca);  		if (ca) -			ca->non_restricted = 1; +			ca->flags |= TCP_CONG_NON_RESTRICTED;  	}  out:  	spin_unlock(&tcp_cong_list_lock); @@ -256,7 +256,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)  	if (!ca)  		err = -ENOENT; -	else if (!(ca->non_restricted || capable(CAP_NET_ADMIN))) +	else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || capable(CAP_NET_ADMIN)))  		err = -EPERM;  	else if (!try_module_get(ca->owner)) @@ -371,8 +371,8 @@ u32 tcp_reno_min_cwnd(const struct sock *sk)  EXPORT_SYMBOL_GPL(tcp_reno_min_cwnd);  struct tcp_congestion_ops tcp_reno = { +	.flags		= TCP_CONG_NON_RESTRICTED,  	.name		= "reno", -	.non_restricted = 1,  	.owner		= THIS_MODULE,  	.ssthresh	= tcp_reno_ssthresh,  	.cong_avoid	= tcp_reno_cong_avoid,  |