hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAGKEX
--------------------------------
When use bcc tools, we met below issue: [root@localhost tools]# ./tcpconnect In file included from /virtual/main.c:15: In file included from include/net/sock.h:59: include/linux/filter.h:1502:7: error: use of undeclared identifier \ 'BPF_GNET_TCP_RECVMSG'; did you mean 'GNET_TCP_RECVMSG'? case BPF_GNET_TCP_RECVMSG: ^~~~~~~~~~~~~~~~~~~~ GNET_TCP_RECVMSG include/linux/filter.h:1491:2: note: 'GNET_TCP_RECVMSG' declared here GNET_TCP_RECVMSG = 0, ^ This is because we used it in the header file by mistake. Move the reference to filter.c.
Fixes: 64ba5634c4c6 ("net: add some bpf hooks in tcp stack for network numa relationship") Fixes: e79b3265e23d ("net: add one bpf prog type for network numa relationship") Signed-off-by: Liu Jian liujian56@huawei.com --- include/linux/filter.h | 17 ----------------- net/core/filter.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/include/linux/filter.h b/include/linux/filter.h index 2a0c2dd47599..273f69057384 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1495,23 +1495,6 @@ enum gnet_bpf_attach_type { MAX_GNET_BPF_ATTACH_TYPE };
-static inline enum gnet_bpf_attach_type -to_gnet_bpf_attach_type(enum bpf_attach_type attach_type) -{ - switch (attach_type) { - case BPF_GNET_TCP_RECVMSG: - return GNET_TCP_RECVMSG; - case BPF_GNET_SK_DST_SET: - return GNET_SK_DST_SET; - case BPF_GNET_RCV_NIC_NODE: - return GNET_RCV_NIC_NODE; - case BPF_GNET_SEND_NIC_NODE: - return GNET_SEND_NIC_NODE; - default: - return GNET_BPF_ATTACH_TYPE_INVALID; - } -} - struct gnet_bpf { struct bpf_prog __rcu *progs[MAX_GNET_BPF_ATTACH_TYPE]; u32 flags[MAX_GNET_BPF_ATTACH_TYPE]; diff --git a/net/core/filter.c b/net/core/filter.c index 838813229564..9c94b6a03d20 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -10699,6 +10699,23 @@ EXPORT_SYMBOL(gnet_bpf_progs); struct static_key_false gnet_bpf_enabled_key[MAX_GNET_BPF_ATTACH_TYPE]; EXPORT_SYMBOL(gnet_bpf_enabled_key);
+static inline enum gnet_bpf_attach_type +to_gnet_bpf_attach_type(enum bpf_attach_type attach_type) +{ + switch (attach_type) { + case BPF_GNET_TCP_RECVMSG: + return GNET_TCP_RECVMSG; + case BPF_GNET_SK_DST_SET: + return GNET_SK_DST_SET; + case BPF_GNET_RCV_NIC_NODE: + return GNET_RCV_NIC_NODE; + case BPF_GNET_SEND_NIC_NODE: + return GNET_SEND_NIC_NODE; + default: + return GNET_BPF_ATTACH_TYPE_INVALID; + } +} + int gnet_bpf_prog_attach(const union bpf_attr *attr, enum bpf_prog_type ptype, struct bpf_prog *prog) {