UPSTREAM: tcp: simplify tcp_set_congestion_control(): Always reinitialize

Now that the previous patches ensure that all call sites for
tcp_set_congestion_control() want to initialize congestion control, we
can simplify tcp_set_congestion_control() by removing the reinit
argument and the code to support it.

Change-Id: I540be122f644b05c35887358aee1484b8d04f65f
Signed-off-by: Neal Cardwell <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Yuchung Cheng <[email protected]>
Acked-by: Kevin Yang <[email protected]>
Cc: Lawrence Brakmo <[email protected]>
This commit is contained in:
Neal Cardwell 2020-09-10 15:35:34 -04:00 • committed by basamaryan
commit 2a7fa4a40c
No known key found for this signature in database
GPG key ID: 210D5384FB2A5885
4 changed files with 5 additions and 13 deletions

View file

@ -2901,7 +2901,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
name[val] = 0;
lock_sock(sk);
err = tcp_set_congestion_control(sk, name, true, true,
err = tcp_set_congestion_control(sk, name, true,
ns_capable(sock_net(sk)->user_ns,
CAP_NET_ADMIN));
release_sock(sk);

View file

@ -343,7 +343,7 @@ out:
* already initialized.
*/
int tcp_set_congestion_control(struct sock *sk, const char *name, bool load,
bool reinit, bool cap_net_admin)
bool cap_net_admin)
{
struct inet_connection_sock *icsk = inet_csk(sk);
const struct tcp_congestion_ops *ca;
@ -367,15 +367,8 @@ int tcp_set_congestion_control(struct sock *sk, const char *name, bool load,
if (!ca) {
err = -ENOENT;
} else if (!load) {
const struct tcp_congestion_ops *old_ca = icsk->icsk_ca_ops;
if (bpf_try_module_get(ca, ca->owner)) {
if (reinit) {
tcp_reinit_congestion_control(sk, ca);
} else {
icsk->icsk_ca_ops = ca;
bpf_module_put(old_ca, old_ca->owner);
}
tcp_reinit_congestion_control(sk, ca);
} else {
err = -EBUSY;
}