Lines Matching refs:ca

40 	struct tcp_congestion_ops *ca = tcp_ca_find(name);  in tcp_ca_find_autoload()  local
43 if (!ca && capable(CAP_NET_ADMIN)) { in tcp_ca_find_autoload()
47 ca = tcp_ca_find(name); in tcp_ca_find_autoload()
50 return ca; in tcp_ca_find_autoload()
70 int tcp_register_congestion_control(struct tcp_congestion_ops *ca) in tcp_register_congestion_control() argument
75 if (!ca->ssthresh || !ca->undo_cwnd || in tcp_register_congestion_control()
76 !(ca->cong_avoid || ca->cong_control)) { in tcp_register_congestion_control()
77 pr_err("%s does not implement required ops\n", ca->name); in tcp_register_congestion_control()
81 ca->key = jhash(ca->name, sizeof(ca->name), strlen(ca->name)); in tcp_register_congestion_control()
84 if (ca->key == TCP_CA_UNSPEC || tcp_ca_find_key(ca->key)) { in tcp_register_congestion_control()
86 ca->name); in tcp_register_congestion_control()
89 list_add_tail_rcu(&ca->list, &tcp_cong_list); in tcp_register_congestion_control()
90 pr_debug("%s registered\n", ca->name); in tcp_register_congestion_control()
104 void tcp_unregister_congestion_control(struct tcp_congestion_ops *ca) in tcp_unregister_congestion_control() argument
107 list_del_rcu(&ca->list); in tcp_unregister_congestion_control()
123 const struct tcp_congestion_ops *ca; in tcp_ca_get_key_by_name() local
129 ca = tcp_ca_find_autoload(net, name); in tcp_ca_get_key_by_name()
130 if (ca) { in tcp_ca_get_key_by_name()
131 key = ca->key; in tcp_ca_get_key_by_name()
132 *ecn_ca = ca->flags & TCP_CONG_NEEDS_ECN; in tcp_ca_get_key_by_name()
142 const struct tcp_congestion_ops *ca; in tcp_ca_get_name_by_key() local
146 ca = tcp_ca_find_key(key); in tcp_ca_get_name_by_key()
147 if (ca) in tcp_ca_get_name_by_key()
148 ret = strncpy(buffer, ca->name, in tcp_ca_get_name_by_key()
161 const struct tcp_congestion_ops *ca; in tcp_assign_congestion_control() local
164 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_assign_congestion_control()
165 if (unlikely(!try_module_get(ca->owner))) in tcp_assign_congestion_control()
166 ca = &tcp_reno; in tcp_assign_congestion_control()
167 icsk->icsk_ca_ops = ca; in tcp_assign_congestion_control()
171 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_assign_congestion_control()
191 const struct tcp_congestion_ops *ca) in tcp_reinit_congestion_control() argument
196 icsk->icsk_ca_ops = ca; in tcp_reinit_congestion_control()
217 struct tcp_congestion_ops *ca; in tcp_set_default_congestion_control() local
222 ca = tcp_ca_find_autoload(net, name); in tcp_set_default_congestion_control()
223 if (!ca) { in tcp_set_default_congestion_control()
225 } else if (!try_module_get(ca->owner)) { in tcp_set_default_congestion_control()
228 prev = xchg(&net->ipv4.tcp_congestion_control, ca); in tcp_set_default_congestion_control()
232 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_default_congestion_control()
251 struct tcp_congestion_ops *ca; in tcp_get_available_congestion_control() local
255 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_available_congestion_control()
258 offs == 0 ? "" : " ", ca->name); in tcp_get_available_congestion_control()
266 const struct tcp_congestion_ops *ca; in tcp_get_default_congestion_control() local
269 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_get_default_congestion_control()
270 strncpy(name, ca->name, TCP_CA_NAME_MAX); in tcp_get_default_congestion_control()
277 struct tcp_congestion_ops *ca; in tcp_get_allowed_congestion_control() local
282 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_allowed_congestion_control()
283 if (!(ca->flags & TCP_CONG_NON_RESTRICTED)) in tcp_get_allowed_congestion_control()
287 offs == 0 ? "" : " ", ca->name); in tcp_get_allowed_congestion_control()
295 struct tcp_congestion_ops *ca; in tcp_set_allowed_congestion_control() local
306 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
307 if (!ca) { in tcp_set_allowed_congestion_control()
314 list_for_each_entry_rcu(ca, &tcp_cong_list, list) in tcp_set_allowed_congestion_control()
315 ca->flags &= ~TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
319 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
320 WARN_ON(!ca); in tcp_set_allowed_congestion_control()
321 if (ca) in tcp_set_allowed_congestion_control()
322 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
340 const struct tcp_congestion_ops *ca; in tcp_set_congestion_control() local
348 ca = tcp_ca_find(name); in tcp_set_congestion_control()
350 ca = tcp_ca_find_autoload(sock_net(sk), name); in tcp_set_congestion_control()
353 if (ca == icsk->icsk_ca_ops) { in tcp_set_congestion_control()
358 if (!ca) { in tcp_set_congestion_control()
363 if (try_module_get(ca->owner)) { in tcp_set_congestion_control()
365 tcp_reinit_congestion_control(sk, ca); in tcp_set_congestion_control()
367 icsk->icsk_ca_ops = ca; in tcp_set_congestion_control()
373 } else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin)) { in tcp_set_congestion_control()
375 } else if (!try_module_get(ca->owner)) { in tcp_set_congestion_control()
378 tcp_reinit_congestion_control(sk, ca); in tcp_set_congestion_control()