Lines Matching refs:ca
52 struct tcp_congestion_ops *ca = tcp_ca_find(name); in tcp_ca_find_autoload() local
55 if (!ca && capable(CAP_NET_ADMIN)) { in tcp_ca_find_autoload()
59 ca = tcp_ca_find(name); in tcp_ca_find_autoload()
62 return ca; in tcp_ca_find_autoload()
82 int tcp_register_congestion_control(struct tcp_congestion_ops *ca) in tcp_register_congestion_control() argument
87 if (!ca->ssthresh || !ca->undo_cwnd || in tcp_register_congestion_control()
88 !(ca->cong_avoid || ca->cong_control)) { in tcp_register_congestion_control()
89 pr_err("%s does not implement required ops\n", ca->name); in tcp_register_congestion_control()
93 ca->key = jhash(ca->name, sizeof(ca->name), strlen(ca->name)); in tcp_register_congestion_control()
96 if (ca->key == TCP_CA_UNSPEC || tcp_ca_find_key(ca->key)) { in tcp_register_congestion_control()
98 ca->name); in tcp_register_congestion_control()
101 list_add_tail_rcu(&ca->list, &tcp_cong_list); in tcp_register_congestion_control()
102 pr_debug("%s registered\n", ca->name); in tcp_register_congestion_control()
116 void tcp_unregister_congestion_control(struct tcp_congestion_ops *ca) in tcp_unregister_congestion_control() argument
119 list_del_rcu(&ca->list); in tcp_unregister_congestion_control()
135 const struct tcp_congestion_ops *ca; in tcp_ca_get_key_by_name() local
141 ca = tcp_ca_find_autoload(net, name); in tcp_ca_get_key_by_name()
142 if (ca) { in tcp_ca_get_key_by_name()
143 key = ca->key; in tcp_ca_get_key_by_name()
144 *ecn_ca = ca->flags & TCP_CONG_NEEDS_ECN; in tcp_ca_get_key_by_name()
153 const struct tcp_congestion_ops *ca; in tcp_ca_get_name_by_key() local
157 ca = tcp_ca_find_key(key); in tcp_ca_get_name_by_key()
158 if (ca) in tcp_ca_get_name_by_key()
159 ret = strncpy(buffer, ca->name, in tcp_ca_get_name_by_key()
171 const struct tcp_congestion_ops *ca; in tcp_assign_congestion_control() local
174 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_assign_congestion_control()
175 if (unlikely(!bpf_try_module_get(ca, ca->owner))) in tcp_assign_congestion_control()
176 ca = &tcp_reno; in tcp_assign_congestion_control()
177 icsk->icsk_ca_ops = ca; in tcp_assign_congestion_control()
181 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_assign_congestion_control()
202 const struct tcp_congestion_ops *ca) in tcp_reinit_congestion_control() argument
207 icsk->icsk_ca_ops = ca; in tcp_reinit_congestion_control()
211 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_reinit_congestion_control()
233 struct tcp_congestion_ops *ca; in tcp_set_default_congestion_control() local
238 ca = tcp_ca_find_autoload(net, name); in tcp_set_default_congestion_control()
239 if (!ca) { in tcp_set_default_congestion_control()
241 } else if (!bpf_try_module_get(ca, ca->owner)) { in tcp_set_default_congestion_control()
244 !(ca->flags & TCP_CONG_NON_RESTRICTED)) { in tcp_set_default_congestion_control()
248 prev = xchg(&net->ipv4.tcp_congestion_control, ca); in tcp_set_default_congestion_control()
252 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_default_congestion_control()
271 struct tcp_congestion_ops *ca; in tcp_get_available_congestion_control() local
275 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_available_congestion_control()
278 offs == 0 ? "" : " ", ca->name); in tcp_get_available_congestion_control()
289 const struct tcp_congestion_ops *ca; in tcp_get_default_congestion_control() local
292 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_get_default_congestion_control()
293 strncpy(name, ca->name, TCP_CA_NAME_MAX); in tcp_get_default_congestion_control()
300 struct tcp_congestion_ops *ca; in tcp_get_allowed_congestion_control() local
305 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_allowed_congestion_control()
306 if (!(ca->flags & TCP_CONG_NON_RESTRICTED)) in tcp_get_allowed_congestion_control()
310 offs == 0 ? "" : " ", ca->name); in tcp_get_allowed_congestion_control()
321 struct tcp_congestion_ops *ca; in tcp_set_allowed_congestion_control() local
332 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
333 if (!ca) { in tcp_set_allowed_congestion_control()
340 list_for_each_entry_rcu(ca, &tcp_cong_list, list) in tcp_set_allowed_congestion_control()
341 ca->flags &= ~TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
345 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
346 WARN_ON(!ca); in tcp_set_allowed_congestion_control()
347 if (ca) in tcp_set_allowed_congestion_control()
348 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
366 const struct tcp_congestion_ops *ca; in tcp_set_congestion_control() local
374 ca = tcp_ca_find(name); in tcp_set_congestion_control()
376 ca = tcp_ca_find_autoload(sock_net(sk), name); in tcp_set_congestion_control()
379 if (ca == icsk->icsk_ca_ops) { in tcp_set_congestion_control()
384 if (!ca) in tcp_set_congestion_control()
386 else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin)) in tcp_set_congestion_control()
388 else if (!bpf_try_module_get(ca, ca->owner)) in tcp_set_congestion_control()
391 tcp_reinit_congestion_control(sk, ca); in tcp_set_congestion_control()