Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ee1606e authored by Markos Chandras's avatar Markos Chandras Committed by Ralf Baechle
Browse files

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: default avatarMarkos 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: default avatarRalf Baechle <ralf@linux-mips.org>
parent 55393ee5
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1317,9 +1317,9 @@ static int build_body(struct jit_ctx *ctx)
			off = offsetof(struct sk_buff, vlan_tci);
			off = offsetof(struct sk_buff, vlan_tci);
			emit_half_load(r_s0, r_skb, off, ctx);
			emit_half_load(r_s0, r_skb, off, ctx);
			if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
			if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
				emit_and(r_A, r_s0, VLAN_VID_MASK, ctx);
				emit_andi(r_A, r_s0, VLAN_VID_MASK, ctx);
			else
			else
				emit_and(r_A, r_s0, VLAN_TAG_PRESENT, ctx);
				emit_andi(r_A, r_s0, VLAN_TAG_PRESENT, ctx);
			break;
			break;
		case BPF_ANC | SKF_AD_PKTTYPE:
		case BPF_ANC | SKF_AD_PKTTYPE:
			off = pkt_type_offset();
			off = pkt_type_offset();