diff mbox

[net-next,5/6] net/bpf_jit: SPARC: split VLAN_PRESENT bit handling from VLAN_TCI

Message ID b4e1dcbeed867f958e90551263865d4eb046ae25.1483492355.git.mirq-linux@rere.qmqm.pl
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Michał Mirosław Jan. 4, 2017, 1:18 a.m. UTC
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 arch/sparc/net/bpf_jit_comp.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

kernel test robot Jan. 4, 2017, 12:59 p.m. UTC | #1
Hi Michał,

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Micha-Miros-aw/Prepare-BPF-for-VLAN_TAG_PRESENT-cleanup/20170104-190258
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/compiler.h:58:0,
                    from include/uapi/linux/stddef.h:1,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/list.h:4,
                    from include/linux/module.h:9,
                    from include/linux/moduleloader.h:5,
                    from arch/sparc/net/bpf_jit_comp.c:1:
   arch/sparc/net/bpf_jit_comp.c: In function 'bpf_jit_compile':
>> include/linux/compiler-gcc.h:159:2: error: 'struct sk_buff' has no member named '__pkt_vlan_present_offset'; did you mean '__pkt_type_offset'?
     __builtin_offsetof(a, b)
     ^
   include/linux/stddef.h:16:32: note: in expansion of macro '__compiler_offsetof'
    #define offsetof(TYPE, MEMBER) __compiler_offsetof(TYPE, MEMBER)
                                   ^~~~~~~~~~~~~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:228:26: note: in expansion of macro 'offsetof'
    do { unsigned int _off = offsetof(STRUCT, FIELD);   \
                             ^~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:270:2: note: in expansion of macro '__emit_load8'
     __emit_load8(r_SKB, struct sk_buff, FIELD, DEST)
     ^~~~~~~~~~~~
>> arch/sparc/net/bpf_jit_comp.c:611:5: note: in expansion of macro '__emit_skb_load8'
        __emit_skb_load8(__pkt_vlan_present_offset, r_A);
        ^~~~~~~~~~~~~~~~

vim +159 include/linux/compiler-gcc.h

cb984d10 Joe Perches    2015-06-25  153  #  error Your version of gcc miscompiles the __weak directive
cb984d10 Joe Perches    2015-06-25  154  # endif
cb984d10 Joe Perches    2015-06-25  155  #endif
cb984d10 Joe Perches    2015-06-25  156  
cb984d10 Joe Perches    2015-06-25  157  #define __used			__attribute__((__used__))
cb984d10 Joe Perches    2015-06-25  158  #define __compiler_offsetof(a, b)					\
cb984d10 Joe Perches    2015-06-25 @159  	__builtin_offsetof(a, b)
cb984d10 Joe Perches    2015-06-25  160  
0d025d27 Josh Poimboeuf 2016-08-30  161  #if GCC_VERSION >= 40100
cb984d10 Joe Perches    2015-06-25  162  # define __compiletime_object_size(obj) __builtin_object_size(obj, 0)

:::::: The code at line 159 was first introduced by commit
:::::: cb984d101b30eb7478d32df56a0023e4603cba7f compiler-gcc: integrate the various compiler-gcc[345].h files

:::::: TO: Joe Perches <joe@perches.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index a6d9204a6a0b..61cc15dc86f7 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -601,15 +601,17 @@  void bpf_jit_compile(struct bpf_prog *fp)
 				emit_skb_load32(hash, r_A);
 				break;
 			case BPF_ANC | SKF_AD_VLAN_TAG:
-			case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
 				emit_skb_load16(vlan_tci, r_A);
-				if (code != (BPF_ANC | SKF_AD_VLAN_TAG)) {
-					emit_alu_K(SRL, 12);
-					emit_andi(r_A, 1, r_A);
-				} else {
-					emit_loadimm(~VLAN_TAG_PRESENT, r_TMP);
-					emit_and(r_A, r_TMP, r_A);
-				}
+#ifdef VLAN_TAG_PRESENT
+				emit_loadimm(~VLAN_TAG_PRESENT, r_TMP);
+				emit_and(r_A, r_TMP, r_A);
+#endif
+				break;
+			case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
+				__emit_skb_load8(__pkt_vlan_present_offset, r_A);
+				if (PKT_VLAN_PRESENT_BIT)
+					emit_alu_K(SRL, PKT_VLAN_PRESENT_BIT);
+				emit_andi(r_A, 1, r_A);
 				break;
 			case BPF_LD | BPF_W | BPF_LEN:
 				emit_skb_load32(len, r_A);