aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_cong.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_cong.c')
-rw-r--r--net/ipv4/tcp_cong.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index ccd88407e0cd..86b26539e54b 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)
126#endif 126#endif
127 127
128 if (ca) { 128 if (ca) {
129 ca->non_restricted = 1; /* default is always allowed */ 129 ca->flags |= TCP_CONG_NON_RESTRICTED; /* default is always allowed */
130 list_move(&ca->list, &tcp_cong_list); 130 list_move(&ca->list, &tcp_cong_list);
131 ret = 0; 131 ret = 0;
132 } 132 }
@@ -181,7 +181,7 @@ void tcp_get_allowed_congestion_control(char *buf, size_t maxlen)
181 *buf = '\0'; 181 *buf = '\0';
182 rcu_read_lock(); 182 rcu_read_lock();
183 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { 183 list_for_each_entry_rcu(ca, &tcp_cong_list, list) {
184 if (!ca->non_restricted) 184 if (!(ca->flags & TCP_CONG_NON_RESTRICTED))
185 continue; 185 continue;
186 offs += snprintf(buf + offs, maxlen - offs, 186 offs += snprintf(buf + offs, maxlen - offs,
187 "%s%s", 187 "%s%s",
@@ -212,16 +212,16 @@ int tcp_set_allowed_congestion_control(char *val)
212 } 212 }
213 } 213 }
214 214
215 /* pass 2 clear */ 215 /* pass 2 clear old values */
216 list_for_each_entry_rcu(ca, &tcp_cong_list, list) 216 list_for_each_entry_rcu(ca, &tcp_cong_list, list)
217 ca->non_restricted = 0; 217 ca->flags &= ~TCP_CONG_NON_RESTRICTED;
218 218
219 /* pass 3 mark as allowed */ 219 /* pass 3 mark as allowed */
220 while ((name = strsep(&val, " ")) && *name) { 220 while ((name = strsep(&val, " ")) && *name) {
221 ca = tcp_ca_find(name); 221 ca = tcp_ca_find(name);
222 WARN_ON(!ca); 222 WARN_ON(!ca);
223 if (ca) 223 if (ca)
224 ca->non_restricted = 1; 224 ca->flags |= TCP_CONG_NON_RESTRICTED;
225 } 225 }
226out: 226out:
227 spin_unlock(&tcp_cong_list_lock); 227 spin_unlock(&tcp_cong_list_lock);
@@ -256,7 +256,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
256 if (!ca) 256 if (!ca)
257 err = -ENOENT; 257 err = -ENOENT;
258 258
259 else if (!(ca->non_restricted || capable(CAP_NET_ADMIN))) 259 else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || capable(CAP_NET_ADMIN)))
260 err = -EPERM; 260 err = -EPERM;
261 261
262 else if (!try_module_get(ca->owner)) 262 else if (!try_module_get(ca->owner))
@@ -371,8 +371,8 @@ u32 tcp_reno_min_cwnd(const struct sock *sk)
371EXPORT_SYMBOL_GPL(tcp_reno_min_cwnd); 371EXPORT_SYMBOL_GPL(tcp_reno_min_cwnd);
372 372
373struct tcp_congestion_ops tcp_reno = { 373struct tcp_congestion_ops tcp_reno = {
374 .flags = TCP_CONG_NON_RESTRICTED,
374 .name = "reno", 375 .name = "reno",
375 .non_restricted = 1,
376 .owner = THIS_MODULE, 376 .owner = THIS_MODULE,
377 .ssthresh = tcp_reno_ssthresh, 377 .ssthresh = tcp_reno_ssthresh,
378 .cong_avoid = tcp_reno_cong_avoid, 378 .cong_avoid = tcp_reno_cong_avoid,