Skip to content

Commit e7b10a4

Browse files
nealcardwellAlexei Starovoitov
authored andcommitted
tcp: Simplify EBPF TCP_CONGESTION to always init CC
Now that the previous patch ensures we don't initialize the congestion control twice, when EBPF sets the congestion control algorithm at connection establishment we can simplify the code by simply initializing the congestion control module at that time. 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]>
1 parent 8919a9b commit e7b10a4

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

net/core/filter.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4313,8 +4313,6 @@ static const struct bpf_func_proto bpf_get_socket_uid_proto = {
43134313
.arg1_type = ARG_PTR_TO_CTX,
43144314
};
43154315

4316-
#define SOCKOPT_CC_REINIT (1 << 0)
4317-
43184316
static int _bpf_setsockopt(struct sock *sk, int level, int optname,
43194317
char *optval, int optlen, u32 flags)
43204318
{
@@ -4449,13 +4447,12 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname,
44494447
sk->sk_prot->setsockopt == tcp_setsockopt) {
44504448
if (optname == TCP_CONGESTION) {
44514449
char name[TCP_CA_NAME_MAX];
4452-
bool reinit = flags & SOCKOPT_CC_REINIT;
44534450

44544451
strncpy(name, optval, min_t(long, optlen,
44554452
TCP_CA_NAME_MAX-1));
44564453
name[TCP_CA_NAME_MAX-1] = 0;
44574454
ret = tcp_set_congestion_control(sk, name, false,
4458-
reinit, true);
4455+
true, true);
44594456
} else {
44604457
struct inet_connection_sock *icsk = inet_csk(sk);
44614458
struct tcp_sock *tp = tcp_sk(sk);
@@ -4652,8 +4649,6 @@ BPF_CALL_5(bpf_sock_ops_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
46524649
int, level, int, optname, char *, optval, int, optlen)
46534650
{
46544651
u32 flags = 0;
4655-
if (bpf_sock->op > BPF_SOCK_OPS_NEEDS_ECN)
4656-
flags |= SOCKOPT_CC_REINIT;
46574652
return _bpf_setsockopt(bpf_sock->sk, level, optname, optval, optlen,
46584653
flags);
46594654
}

0 commit comments

Comments
 (0)