linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag
@ 2014-06-25 17:34 Denis Kirjanov
  2014-06-25 17:34 ` [PATCH v2 2/2] powerpc: bpf: Fix the broken LD_VLAN_TAG_PRESENT test Denis Kirjanov
  2014-06-27 23:14 ` [PATCH v2 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag David Miller
  0 siblings, 2 replies; 9+ messages in thread
From: Denis Kirjanov @ 2014-06-25 17:34 UTC (permalink / raw)
  To: netdev; +Cc: Denis Kirjanov, linuxppc-dev

To get a full tag (and not just a VID) we should access the TCI
except the VLAN_TAG_PRESENT field (which means that 802.1q header
is present). Also ensure that the VLAN_TAG_PRESENT stay on its place

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
 arch/powerpc/net/bpf_jit_comp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 6dcdade..892167b 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -390,10 +390,12 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
 		case BPF_ANC | SKF_AD_VLAN_TAG:
 		case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT:
 			BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
+			BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000);
+
 			PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
 							  vlan_tci));
 			if (code == (BPF_ANC | SKF_AD_VLAN_TAG))
-				PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
+				PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT);
 			else
 				PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
 			break;
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-06-27 23:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 17:34 [PATCH v2 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag Denis Kirjanov
2014-06-25 17:34 ` [PATCH v2 2/2] powerpc: bpf: Fix the broken LD_VLAN_TAG_PRESENT test Denis Kirjanov
2014-06-26  8:30   ` Michael Ellerman
2014-06-26  8:36     ` Daniel Borkmann
2014-06-27  5:08       ` Michael Ellerman
2014-06-27  9:46         ` Daniel Borkmann
2014-06-26 15:43     ` Denis Kirjanov
2014-06-27 23:14   ` David Miller
2014-06-27 23:14 ` [PATCH v2 1/2] powerpc: bpf: Use correct mask while accessing the VLAN tag David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).