mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-15 22:41:38 +00:00
bpf, net: introduce bpf_struct_ops_desc.
Move some of members of bpf_struct_ops to bpf_struct_ops_desc. type_id is unavailabe in bpf_struct_ops anymore. Modules should get it from the btf received by kmod's init function. Cc: netdev@vger.kernel.org Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> Link: https://lore.kernel.org/r/20240119225005.668602-4-thinker.li@gmail.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
This commit is contained in:
committed by
Martin KaFai Lau
parent
9567839538
commit
4c5763ed99
@@ -20,6 +20,7 @@ static u32 unsupported_ops[] = {
|
||||
|
||||
static const struct btf_type *tcp_sock_type;
|
||||
static u32 tcp_sock_id, sock_id;
|
||||
static const struct btf_type *tcp_congestion_ops_type;
|
||||
|
||||
static int bpf_tcp_ca_init(struct btf *btf)
|
||||
{
|
||||
@@ -36,6 +37,11 @@ static int bpf_tcp_ca_init(struct btf *btf)
|
||||
tcp_sock_id = type_id;
|
||||
tcp_sock_type = btf_type_by_id(btf, tcp_sock_id);
|
||||
|
||||
type_id = btf_find_by_name_kind(btf, "tcp_congestion_ops", BTF_KIND_STRUCT);
|
||||
if (type_id < 0)
|
||||
return -EINVAL;
|
||||
tcp_congestion_ops_type = btf_type_by_id(btf, type_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -149,7 +155,7 @@ static u32 prog_ops_moff(const struct bpf_prog *prog)
|
||||
u32 midx;
|
||||
|
||||
midx = prog->expected_attach_type;
|
||||
t = bpf_tcp_congestion_ops.type;
|
||||
t = tcp_congestion_ops_type;
|
||||
m = &btf_type_member(t)[midx];
|
||||
|
||||
return __btf_member_bit_offset(t, m) / 8;
|
||||
|
||||
Reference in New Issue
Block a user