diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2014-06-23 05:38:49 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-06-26 05:48:20 -0400 |
commit | 9ee1606e8a6316287029c86ef48ddcfe4dec595d (patch) | |
tree | ac92a4aab0e570e76a6d25001aa57cb4a519a055 | |
parent | 55393ee535496f7db15f3b2e9d3cf418f772f71a (diff) |
MIPS: bpf: Use 'andi' instead of 'and' for the VLAN cases
The VLAN_VID_MASK and VLAN_TAG_PRESENT are immediates, so using
'and' which expects 3 registers will produce wrong results. Fix
this by using the 'andi' instruction.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Daniel Borkmann <dborkman@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: netdev@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7124/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/net/bpf_jit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index 95728ea6cb74..fe5041bdc6fb 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
@@ -1317,9 +1317,9 @@ jmp_cmp: | |||
1317 | off = offsetof(struct sk_buff, vlan_tci); | 1317 | off = offsetof(struct sk_buff, vlan_tci); |
1318 | emit_half_load(r_s0, r_skb, off, ctx); | 1318 | emit_half_load(r_s0, r_skb, off, ctx); |
1319 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) | 1319 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) |
1320 | emit_and(r_A, r_s0, VLAN_VID_MASK, ctx); | 1320 | emit_andi(r_A, r_s0, VLAN_VID_MASK, ctx); |
1321 | else | 1321 | else |
1322 | emit_and(r_A, r_s0, VLAN_TAG_PRESENT, ctx); | 1322 | emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx); |
1323 | break; | 1323 | break; |
1324 | case BPF_ANC | SKF_AD_PKTTYPE: | 1324 | case BPF_ANC | SKF_AD_PKTTYPE: |
1325 | off = pkt_type_offset(); | 1325 | off = pkt_type_offset(); |