ARM: net: add support for BPF_ANC | SKF_AD_PKTTYPE in ARM JIT.
authorNicolas Schichan <nschichan@freebox.fr>
Mon, 27 Jul 2015 13:06:49 +0000 (15:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2015 21:57:40 +0000 (14:57 -0700)
Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/arm/net/bpf_jit_32.c

index c011e2296cb1e681863338972c6ce79f836bb6be..6ff248ca36d95b3ec17b273c5bdd0a0981280602 100644 (file)
@@ -895,6 +895,17 @@ b_epilogue:
                                OP_IMM3(ARM_AND, r_A, r_A, 0x1, ctx);
                        }
                        break;
+               case BPF_ANC | SKF_AD_PKTTYPE:
+                       ctx->seen |= SEEN_SKB;
+                       BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
+                                                 __pkt_type_offset[0]) != 1);
+                       off = PKT_TYPE_OFFSET();
+                       emit(ARM_LDRB_I(r_A, r_skb, off), ctx);
+                       emit(ARM_AND_I(r_A, r_A, PKT_TYPE_MAX), ctx);
+#ifdef __BIG_ENDIAN_BITFIELD
+                       emit(ARM_LSR_I(r_A, r_A, 5), ctx);
+#endif
+                       break;
                case BPF_ANC | SKF_AD_QUEUE:
                        ctx->seen |= SEEN_SKB;
                        BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,