Lines Matching full:ca

51 	struct tcp_congestion_ops *ca = tcp_ca_find(name);  in tcp_ca_find_autoload()  local
54 if (!ca && capable(CAP_NET_ADMIN)) { in tcp_ca_find_autoload()
58 ca = tcp_ca_find(name); in tcp_ca_find_autoload()
61 return ca; in tcp_ca_find_autoload()
77 int tcp_validate_congestion_control(struct tcp_congestion_ops *ca) in tcp_validate_congestion_control() argument
80 if (!ca->ssthresh || !ca->undo_cwnd || in tcp_validate_congestion_control()
81 !(ca->cong_avoid || ca->cong_control)) { in tcp_validate_congestion_control()
82 pr_err("%s does not implement required ops\n", ca->name); in tcp_validate_congestion_control()
92 int tcp_register_congestion_control(struct tcp_congestion_ops *ca) in tcp_register_congestion_control() argument
96 ret = tcp_validate_congestion_control(ca); in tcp_register_congestion_control()
100 ca->key = jhash(ca->name, sizeof(ca->name), strlen(ca->name)); in tcp_register_congestion_control()
103 if (ca->key == TCP_CA_UNSPEC || tcp_ca_find_key(ca->key)) { in tcp_register_congestion_control()
105 ca->name); in tcp_register_congestion_control()
108 list_add_tail_rcu(&ca->list, &tcp_cong_list); in tcp_register_congestion_control()
109 pr_debug("%s registered\n", ca->name); in tcp_register_congestion_control()
123 void tcp_unregister_congestion_control(struct tcp_congestion_ops *ca) in tcp_unregister_congestion_control() argument
126 list_del_rcu(&ca->list); in tcp_unregister_congestion_control()
140 /* Replace a registered old ca with a new one.
142 * The new ca must have the same name as the old one, that has been
145 int tcp_update_congestion_control(struct tcp_congestion_ops *ca, struct tcp_congestion_ops *old_ca) in tcp_update_congestion_control() argument
150 ret = tcp_validate_congestion_control(ca); in tcp_update_congestion_control()
154 ca->key = jhash(ca->name, sizeof(ca->name), strlen(ca->name)); in tcp_update_congestion_control()
158 if (ca->key == TCP_CA_UNSPEC || !existing || strcmp(existing->name, ca->name)) { in tcp_update_congestion_control()
160 ca->name); in tcp_update_congestion_control()
169 list_add_tail_rcu(&ca->list, &tcp_cong_list); in tcp_update_congestion_control()
171 pr_debug("%s updated\n", ca->name); in tcp_update_congestion_control()
186 const struct tcp_congestion_ops *ca; in tcp_ca_get_key_by_name() local
192 ca = tcp_ca_find_autoload(name); in tcp_ca_get_key_by_name()
193 if (ca) { in tcp_ca_get_key_by_name()
194 key = ca->key; in tcp_ca_get_key_by_name()
195 *ecn_ca = ca->flags & TCP_CONG_NEEDS_ECN; in tcp_ca_get_key_by_name()
204 const struct tcp_congestion_ops *ca; in tcp_ca_get_name_by_key() local
208 ca = tcp_ca_find_key(key); in tcp_ca_get_name_by_key()
209 if (ca) in tcp_ca_get_name_by_key()
210 ret = strncpy(buffer, ca->name, in tcp_ca_get_name_by_key()
222 const struct tcp_congestion_ops *ca; in tcp_assign_congestion_control() local
225 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_assign_congestion_control()
226 if (unlikely(!bpf_try_module_get(ca, ca->owner))) in tcp_assign_congestion_control()
227 ca = &tcp_reno; in tcp_assign_congestion_control()
228 icsk->icsk_ca_ops = ca; in tcp_assign_congestion_control()
232 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_assign_congestion_control()
253 const struct tcp_congestion_ops *ca) in tcp_reinit_congestion_control() argument
258 icsk->icsk_ca_ops = ca; in tcp_reinit_congestion_control()
262 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_reinit_congestion_control()
284 struct tcp_congestion_ops *ca; in tcp_set_default_congestion_control() local
289 ca = tcp_ca_find_autoload(name); in tcp_set_default_congestion_control()
290 if (!ca) { in tcp_set_default_congestion_control()
292 } else if (!bpf_try_module_get(ca, ca->owner)) { in tcp_set_default_congestion_control()
295 !(ca->flags & TCP_CONG_NON_RESTRICTED)) { in tcp_set_default_congestion_control()
299 prev = xchg(&net->ipv4.tcp_congestion_control, ca); in tcp_set_default_congestion_control()
303 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_default_congestion_control()
322 struct tcp_congestion_ops *ca; in tcp_get_available_congestion_control() local
326 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_available_congestion_control()
329 offs == 0 ? "" : " ", ca->name); in tcp_get_available_congestion_control()
340 const struct tcp_congestion_ops *ca; in tcp_get_default_congestion_control() local
343 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_get_default_congestion_control()
344 strncpy(name, ca->name, TCP_CA_NAME_MAX); in tcp_get_default_congestion_control()
351 struct tcp_congestion_ops *ca; in tcp_get_allowed_congestion_control() local
356 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_allowed_congestion_control()
357 if (!(ca->flags & TCP_CONG_NON_RESTRICTED)) in tcp_get_allowed_congestion_control()
361 offs == 0 ? "" : " ", ca->name); in tcp_get_allowed_congestion_control()
372 struct tcp_congestion_ops *ca; in tcp_set_allowed_congestion_control() local
383 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
384 if (!ca) { in tcp_set_allowed_congestion_control()
391 list_for_each_entry_rcu(ca, &tcp_cong_list, list) in tcp_set_allowed_congestion_control()
392 ca->flags &= ~TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
396 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
397 WARN_ON(!ca); in tcp_set_allowed_congestion_control()
398 if (ca) in tcp_set_allowed_congestion_control()
399 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
417 const struct tcp_congestion_ops *ca; in tcp_set_congestion_control() local
425 ca = tcp_ca_find(name); in tcp_set_congestion_control()
427 ca = tcp_ca_find_autoload(name); in tcp_set_congestion_control()
430 if (ca == icsk->icsk_ca_ops) { in tcp_set_congestion_control()
435 if (!ca) in tcp_set_congestion_control()
437 else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin)) in tcp_set_congestion_control()
439 else if (!bpf_try_module_get(ca, ca->owner)) in tcp_set_congestion_control()
442 tcp_reinit_congestion_control(sk, ca); in tcp_set_congestion_control()