* [bpf-next PATCH] bpf: Add rx_queue_mapping to bpf_sock
@ 2020-05-22 0:11 Amritha Nambiar
2020-05-22 10:37 ` kbuild test robot
0 siblings, 1 reply; 3+ messages in thread
From: Amritha Nambiar @ 2020-05-22 0:11 UTC (permalink / raw)
To: netdev, davem, daniel, ast; +Cc: kafai, sridhar.samudrala, amritha.nambiar
Add "rx_queue_mapping" to bpf_sock. This gives read access for the
existing field (sk_rx_queue_mapping) of struct sock from bpf_sock.
Semantics for the bpf_sock rx_queue_mapping access are similar to
sk_rx_queue_get(), i.e the value NO_QUEUE_MAPPING is not allowed
and -1 is returned in that case.
Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
---
include/uapi/linux/bpf.h | 1 +
net/core/filter.c | 13 +++++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 97e1fd19ff58..d2acd5aeae8d 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -3530,6 +3530,7 @@ struct bpf_sock {
__u32 dst_ip4;
__u32 dst_ip6[4];
__u32 state;
+ __u32 rx_queue_mapping;
};
struct bpf_tcp_sock {
diff --git a/net/core/filter.c b/net/core/filter.c
index bd2853d23b50..ae58957854de 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6829,6 +6829,7 @@ bool bpf_sock_is_valid_access(int off, int size, enum bpf_access_type type,
case offsetof(struct bpf_sock, protocol):
case offsetof(struct bpf_sock, dst_port):
case offsetof(struct bpf_sock, src_port):
+ case offsetof(struct bpf_sock, rx_queue_mapping):
case bpf_ctx_range(struct bpf_sock, src_ip4):
case bpf_ctx_range_till(struct bpf_sock, src_ip6[0], src_ip6[3]):
case bpf_ctx_range(struct bpf_sock, dst_ip4):
@@ -7872,6 +7873,18 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
skc_state),
target_size));
break;
+ case offsetof(struct bpf_sock, rx_queue_mapping):
+ *insn++ = BPF_LDX_MEM(
+ BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
+ si->dst_reg, si->src_reg,
+ bpf_target_off(struct sock, sk_rx_queue_mapping,
+ sizeof_field(struct sock,
+ sk_rx_queue_mapping),
+ target_size));
+ *insn++ = BPF_JMP_IMM(BPF_JNE, si->dst_reg, NO_QUEUE_MAPPING,
+ 1);
+ *insn++ = BPF_MOV64_IMM(si->dst_reg, -1);
+ break;
}
return insn - insn_buf;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [bpf-next PATCH] bpf: Add rx_queue_mapping to bpf_sock
2020-05-22 0:11 [bpf-next PATCH] bpf: Add rx_queue_mapping to bpf_sock Amritha Nambiar
@ 2020-05-22 10:37 ` kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-22 10:37 UTC (permalink / raw)
To: Amritha Nambiar, netdev, davem, daniel, ast
Cc: kbuild-all, clang-built-linux, kafai, sridhar.samudrala, amritha.nambiar
[-- Attachment #1: Type: text/plain, Size: 16096 bytes --]
Hi Amritha,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master net/master net-next/master v5.7-rc6 next-20200521]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Amritha-Nambiar/bpf-Add-rx_queue_mapping-to-bpf_sock/20200522-081144
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: x86_64-randconfig-a013-20200521 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:386:6: note: expanded from macro 'bytes_to_bpf_size'
if (bytes == sizeof(u8)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:388:11: note: expanded from macro 'bytes_to_bpf_size'
else if (bytes == sizeof(u16)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:390:11: note: expanded from macro 'bytes_to_bpf_size'
else if (bytes == sizeof(u32)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:392:11: note: expanded from macro 'bytes_to_bpf_size'
else if (bytes == sizeof(u64)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
net/core/filter.c:7880:32: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
bpf_target_off(struct sock, sk_rx_queue_mapping,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:500:35: note: expanded from macro 'bpf_target_off'
BUILD_BUG_ON(sizeof_field(TYPE, MEMBER) != (SIZE)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/build_bug.h:50:19: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler.h:338:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler.h:330:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
net/core/filter.c:7882:11: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
sk_rx_queue_mapping),
^~~~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:500:47: note: expanded from macro 'bpf_target_off'
BUILD_BUG_ON(sizeof_field(TYPE, MEMBER) != (SIZE)); ^
include/linux/build_bug.h:50:19: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler.h:338:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler.h:330:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
net/core/filter.c:7882:11: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
sk_rx_queue_mapping),
^~~~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:501:18: note: expanded from macro 'bpf_target_off'
*(PTR_SIZE) = (SIZE); ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
>> net/core/filter.c:7880:4: error: no member named 'sk_rx_queue_mapping' in 'sock'
bpf_target_off(struct sock, sk_rx_queue_mapping,
^ ~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:502:3: note: expanded from macro 'bpf_target_off'
offsetof(TYPE, MEMBER); ^ ~~~~~~
include/linux/stddef.h:17:32: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
^ ~~~~~~
include/linux/compiler_types.h:129:35: note: expanded from macro '__compiler_offsetof'
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
^ ~
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
>> net/core/filter.c:7880:4: error: initializing '__s16' (aka 'short') with an expression of incompatible type 'void'
bpf_target_off(struct sock, sk_rx_queue_mapping,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:499:2: note: expanded from macro 'bpf_target_off'
({ ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
9 errors generated.
vim +7878 net/core/filter.c
7722
7723 u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
7724 const struct bpf_insn *si,
7725 struct bpf_insn *insn_buf,
7726 struct bpf_prog *prog, u32 *target_size)
7727 {
7728 struct bpf_insn *insn = insn_buf;
7729 int off;
7730
7731 switch (si->off) {
7732 case offsetof(struct bpf_sock, bound_dev_if):
7733 BUILD_BUG_ON(sizeof_field(struct sock, sk_bound_dev_if) != 4);
7734
7735 if (type == BPF_WRITE)
7736 *insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
7737 offsetof(struct sock, sk_bound_dev_if));
7738 else
7739 *insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->src_reg,
7740 offsetof(struct sock, sk_bound_dev_if));
7741 break;
7742
7743 case offsetof(struct bpf_sock, mark):
7744 BUILD_BUG_ON(sizeof_field(struct sock, sk_mark) != 4);
7745
7746 if (type == BPF_WRITE)
7747 *insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
7748 offsetof(struct sock, sk_mark));
7749 else
7750 *insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->src_reg,
7751 offsetof(struct sock, sk_mark));
7752 break;
7753
7754 case offsetof(struct bpf_sock, priority):
7755 BUILD_BUG_ON(sizeof_field(struct sock, sk_priority) != 4);
7756
7757 if (type == BPF_WRITE)
7758 *insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
7759 offsetof(struct sock, sk_priority));
7760 else
7761 *insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->src_reg,
7762 offsetof(struct sock, sk_priority));
7763 break;
7764
7765 case offsetof(struct bpf_sock, family):
7766 *insn++ = BPF_LDX_MEM(
7767 BPF_FIELD_SIZEOF(struct sock_common, skc_family),
7768 si->dst_reg, si->src_reg,
7769 bpf_target_off(struct sock_common,
7770 skc_family,
7771 sizeof_field(struct sock_common,
7772 skc_family),
7773 target_size));
7774 break;
7775
7776 case offsetof(struct bpf_sock, type):
7777 *insn++ = BPF_LDX_MEM(
7778 BPF_FIELD_SIZEOF(struct sock, sk_type),
7779 si->dst_reg, si->src_reg,
7780 bpf_target_off(struct sock, sk_type,
7781 sizeof_field(struct sock, sk_type),
7782 target_size));
7783 break;
7784
7785 case offsetof(struct bpf_sock, protocol):
7786 *insn++ = BPF_LDX_MEM(
7787 BPF_FIELD_SIZEOF(struct sock, sk_protocol),
7788 si->dst_reg, si->src_reg,
7789 bpf_target_off(struct sock, sk_protocol,
7790 sizeof_field(struct sock, sk_protocol),
7791 target_size));
7792 break;
7793
7794 case offsetof(struct bpf_sock, src_ip4):
7795 *insn++ = BPF_LDX_MEM(
7796 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7797 bpf_target_off(struct sock_common, skc_rcv_saddr,
7798 sizeof_field(struct sock_common,
7799 skc_rcv_saddr),
7800 target_size));
7801 break;
7802
7803 case offsetof(struct bpf_sock, dst_ip4):
7804 *insn++ = BPF_LDX_MEM(
7805 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7806 bpf_target_off(struct sock_common, skc_daddr,
7807 sizeof_field(struct sock_common,
7808 skc_daddr),
7809 target_size));
7810 break;
7811
7812 case bpf_ctx_range_till(struct bpf_sock, src_ip6[0], src_ip6[3]):
7813 #if IS_ENABLED(CONFIG_IPV6)
7814 off = si->off;
7815 off -= offsetof(struct bpf_sock, src_ip6[0]);
7816 *insn++ = BPF_LDX_MEM(
7817 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7818 bpf_target_off(
7819 struct sock_common,
7820 skc_v6_rcv_saddr.s6_addr32[0],
7821 sizeof_field(struct sock_common,
7822 skc_v6_rcv_saddr.s6_addr32[0]),
7823 target_size) + off);
7824 #else
7825 (void)off;
7826 *insn++ = BPF_MOV32_IMM(si->dst_reg, 0);
7827 #endif
7828 break;
7829
7830 case bpf_ctx_range_till(struct bpf_sock, dst_ip6[0], dst_ip6[3]):
7831 #if IS_ENABLED(CONFIG_IPV6)
7832 off = si->off;
7833 off -= offsetof(struct bpf_sock, dst_ip6[0]);
7834 *insn++ = BPF_LDX_MEM(
7835 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7836 bpf_target_off(struct sock_common,
7837 skc_v6_daddr.s6_addr32[0],
7838 sizeof_field(struct sock_common,
7839 skc_v6_daddr.s6_addr32[0]),
7840 target_size) + off);
7841 #else
7842 *insn++ = BPF_MOV32_IMM(si->dst_reg, 0);
7843 *target_size = 4;
7844 #endif
7845 break;
7846
7847 case offsetof(struct bpf_sock, src_port):
7848 *insn++ = BPF_LDX_MEM(
7849 BPF_FIELD_SIZEOF(struct sock_common, skc_num),
7850 si->dst_reg, si->src_reg,
7851 bpf_target_off(struct sock_common, skc_num,
7852 sizeof_field(struct sock_common,
7853 skc_num),
7854 target_size));
7855 break;
7856
7857 case offsetof(struct bpf_sock, dst_port):
7858 *insn++ = BPF_LDX_MEM(
7859 BPF_FIELD_SIZEOF(struct sock_common, skc_dport),
7860 si->dst_reg, si->src_reg,
7861 bpf_target_off(struct sock_common, skc_dport,
7862 sizeof_field(struct sock_common,
7863 skc_dport),
7864 target_size));
7865 break;
7866
7867 case offsetof(struct bpf_sock, state):
7868 *insn++ = BPF_LDX_MEM(
7869 BPF_FIELD_SIZEOF(struct sock_common, skc_state),
7870 si->dst_reg, si->src_reg,
7871 bpf_target_off(struct sock_common, skc_state,
7872 sizeof_field(struct sock_common,
7873 skc_state),
7874 target_size));
7875 break;
7876 case offsetof(struct bpf_sock, rx_queue_mapping):
7877 *insn++ = BPF_LDX_MEM(
> 7878 BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
7879 si->dst_reg, si->src_reg,
> 7880 bpf_target_off(struct sock, sk_rx_queue_mapping,
7881 sizeof_field(struct sock,
7882 sk_rx_queue_mapping),
7883 target_size));
7884 *insn++ = BPF_JMP_IMM(BPF_JNE, si->dst_reg, NO_QUEUE_MAPPING,
7885 1);
7886 *insn++ = BPF_MOV64_IMM(si->dst_reg, -1);
7887 break;
7888 }
7889
7890 return insn - insn_buf;
7891 }
7892
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36144 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [bpf-next PATCH] bpf: Add rx_queue_mapping to bpf_sock
@ 2020-05-22 10:37 ` kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-22 10:37 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 16432 bytes --]
Hi Amritha,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bpf-next/master]
[also build test ERROR on bpf/master net/master net-next/master v5.7-rc6 next-20200521]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Amritha-Nambiar/bpf-Add-rx_queue_mapping-to-bpf_sock/20200522-081144
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: x86_64-randconfig-a013-20200521 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:386:6: note: expanded from macro 'bytes_to_bpf_size'
if (bytes == sizeof(u8)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:388:11: note: expanded from macro 'bytes_to_bpf_size'
else if (bytes == sizeof(u16)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:390:11: note: expanded from macro 'bytes_to_bpf_size'
else if (bytes == sizeof(u32)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
>> net/core/filter.c:7878:34: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:423:59: note: expanded from macro 'BPF_FIELD_SIZEOF'
const int __size = bytes_to_bpf_size(sizeof_field(type, field)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:392:11: note: expanded from macro 'bytes_to_bpf_size'
else if (bytes == sizeof(u64)) ^
include/linux/filter.h:245:31: note: expanded from macro 'BPF_LDX_MEM'
.code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, ~~~~~~~~~^~~~~
include/uapi/linux/bpf_common.h:17:27: note: expanded from macro 'BPF_SIZE'
#define BPF_SIZE(code) ((code) & 0x18)
^~~~
net/core/filter.c:7880:32: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
bpf_target_off(struct sock, sk_rx_queue_mapping,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:500:35: note: expanded from macro 'bpf_target_off'
BUILD_BUG_ON(sizeof_field(TYPE, MEMBER) != (SIZE)); ^
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/build_bug.h:50:19: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler.h:338:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler.h:330:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
net/core/filter.c:7882:11: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
sk_rx_queue_mapping),
^~~~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:500:47: note: expanded from macro 'bpf_target_off'
BUILD_BUG_ON(sizeof_field(TYPE, MEMBER) != (SIZE)); ^
include/linux/build_bug.h:50:19: note: expanded from macro 'BUILD_BUG_ON'
BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler.h:338:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler.h:330:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
net/core/filter.c:7882:11: error: no member named 'sk_rx_queue_mapping' in 'struct sock'
sk_rx_queue_mapping),
^~~~~~~~~~~~~~~~~~~~~
include/linux/stddef.h:28:57: note: expanded from macro 'sizeof_field'
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
^
include/linux/filter.h:501:18: note: expanded from macro 'bpf_target_off'
*(PTR_SIZE) = (SIZE); ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
>> net/core/filter.c:7880:4: error: no member named 'sk_rx_queue_mapping' in 'sock'
bpf_target_off(struct sock, sk_rx_queue_mapping,
^ ~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:502:3: note: expanded from macro 'bpf_target_off'
offsetof(TYPE, MEMBER); ^ ~~~~~~
include/linux/stddef.h:17:32: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
^ ~~~~~~
include/linux/compiler_types.h:129:35: note: expanded from macro '__compiler_offsetof'
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
^ ~
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
>> net/core/filter.c:7880:4: error: initializing '__s16' (aka 'short') with an expression of incompatible type 'void'
bpf_target_off(struct sock, sk_rx_queue_mapping,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/filter.h:499:2: note: expanded from macro 'bpf_target_off'
({ ^
include/linux/filter.h:248:12: note: expanded from macro 'BPF_LDX_MEM'
.off = OFF, ^~~
9 errors generated.
vim +7878 net/core/filter.c
7722
7723 u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
7724 const struct bpf_insn *si,
7725 struct bpf_insn *insn_buf,
7726 struct bpf_prog *prog, u32 *target_size)
7727 {
7728 struct bpf_insn *insn = insn_buf;
7729 int off;
7730
7731 switch (si->off) {
7732 case offsetof(struct bpf_sock, bound_dev_if):
7733 BUILD_BUG_ON(sizeof_field(struct sock, sk_bound_dev_if) != 4);
7734
7735 if (type == BPF_WRITE)
7736 *insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
7737 offsetof(struct sock, sk_bound_dev_if));
7738 else
7739 *insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->src_reg,
7740 offsetof(struct sock, sk_bound_dev_if));
7741 break;
7742
7743 case offsetof(struct bpf_sock, mark):
7744 BUILD_BUG_ON(sizeof_field(struct sock, sk_mark) != 4);
7745
7746 if (type == BPF_WRITE)
7747 *insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
7748 offsetof(struct sock, sk_mark));
7749 else
7750 *insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->src_reg,
7751 offsetof(struct sock, sk_mark));
7752 break;
7753
7754 case offsetof(struct bpf_sock, priority):
7755 BUILD_BUG_ON(sizeof_field(struct sock, sk_priority) != 4);
7756
7757 if (type == BPF_WRITE)
7758 *insn++ = BPF_STX_MEM(BPF_W, si->dst_reg, si->src_reg,
7759 offsetof(struct sock, sk_priority));
7760 else
7761 *insn++ = BPF_LDX_MEM(BPF_W, si->dst_reg, si->src_reg,
7762 offsetof(struct sock, sk_priority));
7763 break;
7764
7765 case offsetof(struct bpf_sock, family):
7766 *insn++ = BPF_LDX_MEM(
7767 BPF_FIELD_SIZEOF(struct sock_common, skc_family),
7768 si->dst_reg, si->src_reg,
7769 bpf_target_off(struct sock_common,
7770 skc_family,
7771 sizeof_field(struct sock_common,
7772 skc_family),
7773 target_size));
7774 break;
7775
7776 case offsetof(struct bpf_sock, type):
7777 *insn++ = BPF_LDX_MEM(
7778 BPF_FIELD_SIZEOF(struct sock, sk_type),
7779 si->dst_reg, si->src_reg,
7780 bpf_target_off(struct sock, sk_type,
7781 sizeof_field(struct sock, sk_type),
7782 target_size));
7783 break;
7784
7785 case offsetof(struct bpf_sock, protocol):
7786 *insn++ = BPF_LDX_MEM(
7787 BPF_FIELD_SIZEOF(struct sock, sk_protocol),
7788 si->dst_reg, si->src_reg,
7789 bpf_target_off(struct sock, sk_protocol,
7790 sizeof_field(struct sock, sk_protocol),
7791 target_size));
7792 break;
7793
7794 case offsetof(struct bpf_sock, src_ip4):
7795 *insn++ = BPF_LDX_MEM(
7796 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7797 bpf_target_off(struct sock_common, skc_rcv_saddr,
7798 sizeof_field(struct sock_common,
7799 skc_rcv_saddr),
7800 target_size));
7801 break;
7802
7803 case offsetof(struct bpf_sock, dst_ip4):
7804 *insn++ = BPF_LDX_MEM(
7805 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7806 bpf_target_off(struct sock_common, skc_daddr,
7807 sizeof_field(struct sock_common,
7808 skc_daddr),
7809 target_size));
7810 break;
7811
7812 case bpf_ctx_range_till(struct bpf_sock, src_ip6[0], src_ip6[3]):
7813 #if IS_ENABLED(CONFIG_IPV6)
7814 off = si->off;
7815 off -= offsetof(struct bpf_sock, src_ip6[0]);
7816 *insn++ = BPF_LDX_MEM(
7817 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7818 bpf_target_off(
7819 struct sock_common,
7820 skc_v6_rcv_saddr.s6_addr32[0],
7821 sizeof_field(struct sock_common,
7822 skc_v6_rcv_saddr.s6_addr32[0]),
7823 target_size) + off);
7824 #else
7825 (void)off;
7826 *insn++ = BPF_MOV32_IMM(si->dst_reg, 0);
7827 #endif
7828 break;
7829
7830 case bpf_ctx_range_till(struct bpf_sock, dst_ip6[0], dst_ip6[3]):
7831 #if IS_ENABLED(CONFIG_IPV6)
7832 off = si->off;
7833 off -= offsetof(struct bpf_sock, dst_ip6[0]);
7834 *insn++ = BPF_LDX_MEM(
7835 BPF_SIZE(si->code), si->dst_reg, si->src_reg,
7836 bpf_target_off(struct sock_common,
7837 skc_v6_daddr.s6_addr32[0],
7838 sizeof_field(struct sock_common,
7839 skc_v6_daddr.s6_addr32[0]),
7840 target_size) + off);
7841 #else
7842 *insn++ = BPF_MOV32_IMM(si->dst_reg, 0);
7843 *target_size = 4;
7844 #endif
7845 break;
7846
7847 case offsetof(struct bpf_sock, src_port):
7848 *insn++ = BPF_LDX_MEM(
7849 BPF_FIELD_SIZEOF(struct sock_common, skc_num),
7850 si->dst_reg, si->src_reg,
7851 bpf_target_off(struct sock_common, skc_num,
7852 sizeof_field(struct sock_common,
7853 skc_num),
7854 target_size));
7855 break;
7856
7857 case offsetof(struct bpf_sock, dst_port):
7858 *insn++ = BPF_LDX_MEM(
7859 BPF_FIELD_SIZEOF(struct sock_common, skc_dport),
7860 si->dst_reg, si->src_reg,
7861 bpf_target_off(struct sock_common, skc_dport,
7862 sizeof_field(struct sock_common,
7863 skc_dport),
7864 target_size));
7865 break;
7866
7867 case offsetof(struct bpf_sock, state):
7868 *insn++ = BPF_LDX_MEM(
7869 BPF_FIELD_SIZEOF(struct sock_common, skc_state),
7870 si->dst_reg, si->src_reg,
7871 bpf_target_off(struct sock_common, skc_state,
7872 sizeof_field(struct sock_common,
7873 skc_state),
7874 target_size));
7875 break;
7876 case offsetof(struct bpf_sock, rx_queue_mapping):
7877 *insn++ = BPF_LDX_MEM(
> 7878 BPF_FIELD_SIZEOF(struct sock, sk_rx_queue_mapping),
7879 si->dst_reg, si->src_reg,
> 7880 bpf_target_off(struct sock, sk_rx_queue_mapping,
7881 sizeof_field(struct sock,
7882 sk_rx_queue_mapping),
7883 target_size));
7884 *insn++ = BPF_JMP_IMM(BPF_JNE, si->dst_reg, NO_QUEUE_MAPPING,
7885 1);
7886 *insn++ = BPF_MOV64_IMM(si->dst_reg, -1);
7887 break;
7888 }
7889
7890 return insn - insn_buf;
7891 }
7892
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36144 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-22 10:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 0:11 [bpf-next PATCH] bpf: Add rx_queue_mapping to bpf_sock Amritha Nambiar
2020-05-22 10:37 ` kbuild test robot
2020-05-22 10:37 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.