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 ca->key = jhash(ca->name, sizeof(ca->name), strlen(ca->name)); in tcp_update_congestion_control()
154 if (ca->key == TCP_CA_UNSPEC || !existing || strcmp(existing->name, ca->name)) { in tcp_update_congestion_control()
156 ca->name); in tcp_update_congestion_control()
165 list_add_tail_rcu(&ca->list, &tcp_cong_list); in tcp_update_congestion_control()
167 pr_debug("%s updated\n", ca->name); in tcp_update_congestion_control()
182 const struct tcp_congestion_ops *ca; in tcp_ca_get_key_by_name() local
188 ca = tcp_ca_find_autoload(name); in tcp_ca_get_key_by_name()
189 if (ca) { in tcp_ca_get_key_by_name()
190 key = ca->key; in tcp_ca_get_key_by_name()
191 *ecn_ca = ca->flags & TCP_CONG_NEEDS_ECN; in tcp_ca_get_key_by_name()
200 const struct tcp_congestion_ops *ca; in tcp_ca_get_name_by_key() local
204 ca = tcp_ca_find_key(key); in tcp_ca_get_name_by_key()
205 if (ca) { in tcp_ca_get_name_by_key()
206 strscpy(buffer, ca->name, TCP_CA_NAME_MAX); in tcp_ca_get_name_by_key()
219 const struct tcp_congestion_ops *ca; in tcp_assign_congestion_control() local
222 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_assign_congestion_control()
223 if (unlikely(!bpf_try_module_get(ca, ca->owner))) in tcp_assign_congestion_control()
224 ca = &tcp_reno; in tcp_assign_congestion_control()
225 icsk->icsk_ca_ops = ca; in tcp_assign_congestion_control()
229 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_assign_congestion_control()
250 const struct tcp_congestion_ops *ca) in tcp_reinit_congestion_control() argument
255 icsk->icsk_ca_ops = ca; in tcp_reinit_congestion_control()
259 if (ca->flags & TCP_CONG_NEEDS_ECN) in tcp_reinit_congestion_control()
281 struct tcp_congestion_ops *ca; in tcp_set_default_congestion_control() local
286 ca = tcp_ca_find_autoload(name); in tcp_set_default_congestion_control()
287 if (!ca) { in tcp_set_default_congestion_control()
289 } else if (!bpf_try_module_get(ca, ca->owner)) { in tcp_set_default_congestion_control()
292 !(ca->flags & TCP_CONG_NON_RESTRICTED)) { in tcp_set_default_congestion_control()
296 prev = xchg(&net->ipv4.tcp_congestion_control, ca); in tcp_set_default_congestion_control()
300 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_default_congestion_control()
319 struct tcp_congestion_ops *ca; in tcp_get_available_congestion_control() local
323 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_available_congestion_control()
326 offs == 0 ? "" : " ", ca->name); in tcp_get_available_congestion_control()
337 const struct tcp_congestion_ops *ca; in tcp_get_default_congestion_control() local
340 ca = rcu_dereference(net->ipv4.tcp_congestion_control); in tcp_get_default_congestion_control()
341 strscpy(name, ca->name, TCP_CA_NAME_MAX); in tcp_get_default_congestion_control()
348 struct tcp_congestion_ops *ca; in tcp_get_allowed_congestion_control() local
353 list_for_each_entry_rcu(ca, &tcp_cong_list, list) { in tcp_get_allowed_congestion_control()
354 if (!(ca->flags & TCP_CONG_NON_RESTRICTED)) in tcp_get_allowed_congestion_control()
358 offs == 0 ? "" : " ", ca->name); in tcp_get_allowed_congestion_control()
369 struct tcp_congestion_ops *ca; in tcp_set_allowed_congestion_control() local
380 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
381 if (!ca) { in tcp_set_allowed_congestion_control()
388 list_for_each_entry_rcu(ca, &tcp_cong_list, list) in tcp_set_allowed_congestion_control()
389 ca->flags &= ~TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
393 ca = tcp_ca_find(name); in tcp_set_allowed_congestion_control()
394 WARN_ON(!ca); in tcp_set_allowed_congestion_control()
395 if (ca) in tcp_set_allowed_congestion_control()
396 ca->flags |= TCP_CONG_NON_RESTRICTED; in tcp_set_allowed_congestion_control()
414 const struct tcp_congestion_ops *ca; in tcp_set_congestion_control() local
422 ca = tcp_ca_find(name); in tcp_set_congestion_control()
424 ca = tcp_ca_find_autoload(name); in tcp_set_congestion_control()
427 if (ca == icsk->icsk_ca_ops) { in tcp_set_congestion_control()
432 if (!ca) in tcp_set_congestion_control()
434 else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || cap_net_admin)) in tcp_set_congestion_control()
436 else if (!bpf_try_module_get(ca, ca->owner)) in tcp_set_congestion_control()
439 tcp_reinit_congestion_control(sk, ca); in tcp_set_congestion_control()