Commit 3955dec5 authored by Michał Mirosław's avatar Michał Mirosław Committed by David S. Miller

net/bpf_jit: MIPS: split VLAN_PRESENT bit handling from VLAN_TCI

Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4ef3a142
...@@ -1159,19 +1159,22 @@ static int build_body(struct jit_ctx *ctx) ...@@ -1159,19 +1159,22 @@ static int build_body(struct jit_ctx *ctx)
emit_load(r_A, r_skb, off, ctx); emit_load(r_A, r_skb, off, ctx);
break; break;
case BPF_ANC | SKF_AD_VLAN_TAG: case BPF_ANC | SKF_AD_VLAN_TAG:
case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
ctx->flags |= SEEN_SKB | SEEN_A; ctx->flags |= SEEN_SKB | SEEN_A;
BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
vlan_tci) != 2); vlan_tci) != 2);
off = offsetof(struct sk_buff, vlan_tci); off = offsetof(struct sk_buff, vlan_tci);
emit_half_load_unsigned(r_s0, r_skb, off, ctx); emit_half_load_unsigned(r_A, r_skb, off, ctx);
if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { #ifdef VLAN_TAG_PRESENT
emit_andi(r_A, r_s0, (u16)~VLAN_TAG_PRESENT, ctx); emit_andi(r_A, r_A, (u16)~VLAN_TAG_PRESENT, ctx);
} else { #endif
emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx); break;
/* return 1 if present */ case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
emit_sltu(r_A, r_zero, r_A, ctx); ctx->flags |= SEEN_SKB | SEEN_A;
} emit_load_byte(r_A, r_skb, PKT_VLAN_PRESENT_OFFSET(), ctx);
if (PKT_VLAN_PRESENT_BIT)
emit_srl(r_A, r_A, PKT_VLAN_PRESENT_BIT, ctx);
if (PKT_VLAN_PRESENT_BIT < 7)
emit_andi(r_A, r_A, 1, ctx);
break; break;
case BPF_ANC | SKF_AD_PKTTYPE: case BPF_ANC | SKF_AD_PKTTYPE:
ctx->flags |= SEEN_SKB; ctx->flags |= SEEN_SKB;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment