Skip to content

Commit 1447f93

Browse files
nschichandavem330
authored andcommitted
ARM: net: add support for BPF_ANC | SKF_AD_PKTTYPE in ARM JIT.
Signed-off-by: Nicolas Schichan <nschichan@freebox.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e11f40b commit 1447f93

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/arm/net/bpf_jit_32.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,17 @@ static int build_body(struct jit_ctx *ctx)
895895
OP_IMM3(ARM_AND, r_A, r_A, 0x1, ctx);
896896
}
897897
break;
898+
case BPF_ANC | SKF_AD_PKTTYPE:
899+
ctx->seen |= SEEN_SKB;
900+
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
901+
__pkt_type_offset[0]) != 1);
902+
off = PKT_TYPE_OFFSET();
903+
emit(ARM_LDRB_I(r_A, r_skb, off), ctx);
904+
emit(ARM_AND_I(r_A, r_A, PKT_TYPE_MAX), ctx);
905+
#ifdef __BIG_ENDIAN_BITFIELD
906+
emit(ARM_LSR_I(r_A, r_A, 5), ctx);
907+
#endif
908+
break;
898909
case BPF_ANC | SKF_AD_QUEUE:
899910
ctx->seen |= SEEN_SKB;
900911
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,

0 commit comments

Comments
 (0)