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(!bpf_try_module_get(ca, 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()
192 const struct tcp_congestion_ops *ca) in tcp_reinit_congestion_control() argument
197 icsk->icsk_ca_ops = ca; in tcp_reinit_congestion_control()
201 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_reinit_congestion_control()
223 struct tcp_congestion_ops *ca; in tcp_set_default_congestion_control() local
228 ca = tcp_ca_find_autoload(net, name); in tcp_set_default_congestion_control()
229 if (!ca) { in tcp_set_default_congestion_control()
231 } else if (!bpf_try_module_get(ca, ca->owner)) { in tcp_set_default_congestion_control()
234 prev = xchg(&net->ipv4.tcp_congestion_control, ca); in tcp_set_default_congestion_control()
238 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_default_congestion_control()
257 struct tcp_congestion_ops *ca; in tcp_get_available_congestion_control() local
261 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_available_congestion_control()
264 offs == 0 ? "" : " ", ca->name); in tcp_get_available_congestion_control()
275 const struct tcp_congestion_ops *ca; in tcp_get_default_congestion_control() local
278 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_get_default_congestion_control()
279 strncpy(name, ca->name, TCP_CA_NAME_MAX); in tcp_get_default_congestion_control()
286 struct tcp_congestion_ops *ca; in tcp_get_allowed_congestion_control() local
291 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_allowed_congestion_control()
292 if (!(ca->flags & TCP_CONG_NON_RESTRICTED)) in tcp_get_allowed_congestion_control()
296 offs == 0 ? "" : " ", ca->name); in tcp_get_allowed_congestion_control()
307 struct tcp_congestion_ops *ca; in tcp_set_allowed_congestion_control() local
318 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
319 if (!ca) { in tcp_set_allowed_congestion_control()
326 list_for_each_entry_rcu(ca, &tcp_cong_list, list) in tcp_set_allowed_congestion_control()
327 ca->flags &= ~TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
331 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
332 WARN_ON(!ca); in tcp_set_allowed_congestion_control()
333 if (ca) in tcp_set_allowed_congestion_control()
334 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
352 const struct tcp_congestion_ops *ca; in tcp_set_congestion_control() local
360 ca = tcp_ca_find(name); in tcp_set_congestion_control()
362 ca = tcp_ca_find_autoload(sock_net(sk), name); in tcp_set_congestion_control()
365 if (ca == icsk->icsk_ca_ops) { in tcp_set_congestion_control()
370 if (!ca) in tcp_set_congestion_control()
372 else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin)) in tcp_set_congestion_control()
374 else if (!bpf_try_module_get(ca, ca->owner)) in tcp_set_congestion_control()
377 tcp_reinit_congestion_control(sk, ca); in tcp_set_congestion_control()