diff options
author | Jörn-Thorben Hinz <jthinz@mailbox.tu-berlin.de> | 2022-06-22 21:12:24 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-06-23 09:49:57 -0700 |
commit | 9f0265e921dee14096943ee11f793fa076aa7a72 (patch) | |
tree | 24bcc369f281f23bf64702a6432529dcbf2a7677 /kernel | |
parent | 41c95dd6a604dc3f5fae55c99c138cc8e7fec76e (diff) | |
download | linux-stable-9f0265e921dee14096943ee11f793fa076aa7a72.tar.gz linux-stable-9f0265e921dee14096943ee11f793fa076aa7a72.tar.bz2 linux-stable-9f0265e921dee14096943ee11f793fa076aa7a72.zip |
bpf: Require only one of cong_avoid() and cong_control() from a TCP CC
Remove the check for required and optional functions in a struct
tcp_congestion_ops from bpf_tcp_ca.c. Rely on
tcp_register_congestion_control() to reject a BPF CC that does not
implement all required functions, as it will do for a non-BPF CC.
When a CC implements tcp_congestion_ops.cong_control(), the alternate
cong_avoid() is not in use in the TCP stack. Previously, a BPF CC was
still forced to implement cong_avoid() as a no-op since it was
non-optional in bpf_tcp_ca.c.
Signed-off-by: Jörn-Thorben Hinz <jthinz@mailbox.tu-berlin.de>
Reviewed-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/r/20220622191227.898118-3-jthinz@mailbox.tu-berlin.de
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/bpf/bpf_struct_ops.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index d9a3c9207240..7e0068c3399c 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -503,10 +503,9 @@ static int bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, goto unlock; } - /* Error during st_ops->reg(). It is very unlikely since - * the above init_member() should have caught it earlier - * before reg(). The only possibility is if there was a race - * in registering the struct_ops (under the same name) to + /* Error during st_ops->reg(). Can happen if this struct_ops needs to be + * verified as a whole, after all init_member() calls. Can also happen if + * there was a race in registering the struct_ops (under the same name) to * a sub-system through different struct_ops's maps. */ set_memory_nx((long)st_map->image, 1); |