netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 2/2] PPC: net: bpf_jit_comp: add VLAN instructions for BPF JIT
@ 2012-11-08 21:41 Daniel Borkmann
  2012-11-17  0:06 ` Matt Evans
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Borkmann @ 2012-11-08 21:41 UTC (permalink / raw)
  To: davem; +Cc: matt, benh, netdev

This patch is a follow-up for patch "net: filter: add vlan tag access"
to support the new VLAN_TAG/VLAN_TAG_PRESENT accessors in BPF JIT.

Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
Cc: Matt Evans <matt@ozlabs.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 Disclaimer: uncompiled and untested, since I don't have a PPC machine,
 but it should (hopefully) integrate cleanly; impl. after PPC instruction
 reference.

 arch/powerpc/net/bpf_jit_comp.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index b9434de..e834f1e 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -13,6 +13,8 @@
 #include <asm/cacheflush.h>
 #include <linux/netdevice.h>
 #include <linux/filter.h>
+#include <linux/if_vlan.h>
+
 #include "bpf_jit.h"
 
 #ifndef __BIG_ENDIAN
@@ -89,6 +91,8 @@ static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image,
 	case BPF_S_ANC_IFINDEX:
 	case BPF_S_ANC_MARK:
 	case BPF_S_ANC_RXHASH:
+	case BPF_S_ANC_VLAN_TAG:
+	case BPF_S_ANC_VLAN_TAG_PRESENT:
 	case BPF_S_ANC_CPU:
 	case BPF_S_ANC_QUEUE:
 	case BPF_S_LD_W_ABS:
@@ -382,6 +386,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
 			PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
 							  rxhash));
 			break;
+		case BPF_S_ANC_VLAN_TAG:
+		case BPF_S_ANC_VLAN_TAG_PRESENT:
+			BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
+			PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
+							  vlan_tci));
+			if (filter[i].code == BPF_S_ANC_VLAN_TAG)
+				PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
+			else
+				PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
+			break;
 		case BPF_S_ANC_QUEUE:
 			BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
 						  queue_mapping) != 2);

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

* Re: [PATCH net-next 2/2] PPC: net: bpf_jit_comp: add VLAN instructions for BPF JIT
  2012-11-08 21:41 [PATCH net-next 2/2] PPC: net: bpf_jit_comp: add VLAN instructions for BPF JIT Daniel Borkmann
@ 2012-11-17  0:06 ` Matt Evans
  2012-11-18  3:13   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Evans @ 2012-11-17  0:06 UTC (permalink / raw)
  To: Daniel Borkmann; +Cc: davem, benh, netdev

Hi,

On 08/11/2012, at 9:41 PM, Daniel Borkmann wrote:

> This patch is a follow-up for patch "net: filter: add vlan tag access"
> to support the new VLAN_TAG/VLAN_TAG_PRESENT accessors in BPF JIT.
> 
> Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
> Cc: Matt Evans <matt@ozlabs.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> Disclaimer: uncompiled and untested, since I don't have a PPC machine,
> but it should (hopefully) integrate cleanly; impl. after PPC instruction
> reference.

And for this too,

Acked-by: Matt Evans <matt@ozlabs.org>

Sorry for the delay in reviewing this!

Thanks,


Matt


> 
> arch/powerpc/net/bpf_jit_comp.c |   14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
> index b9434de..e834f1e 100644
> --- a/arch/powerpc/net/bpf_jit_comp.c
> +++ b/arch/powerpc/net/bpf_jit_comp.c
> @@ -13,6 +13,8 @@
> #include <asm/cacheflush.h>
> #include <linux/netdevice.h>
> #include <linux/filter.h>
> +#include <linux/if_vlan.h>
> +
> #include "bpf_jit.h"
> 
> #ifndef __BIG_ENDIAN
> @@ -89,6 +91,8 @@ static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image,
> 	case BPF_S_ANC_IFINDEX:
> 	case BPF_S_ANC_MARK:
> 	case BPF_S_ANC_RXHASH:
> +	case BPF_S_ANC_VLAN_TAG:
> +	case BPF_S_ANC_VLAN_TAG_PRESENT:
> 	case BPF_S_ANC_CPU:
> 	case BPF_S_ANC_QUEUE:
> 	case BPF_S_LD_W_ABS:
> @@ -382,6 +386,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
> 			PPC_LWZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
> 							  rxhash));
> 			break;
> +		case BPF_S_ANC_VLAN_TAG:
> +		case BPF_S_ANC_VLAN_TAG_PRESENT:
> +			BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2);
> +			PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff,
> +							  vlan_tci));
> +			if (filter[i].code == BPF_S_ANC_VLAN_TAG)
> +				PPC_ANDI(r_A, r_A, VLAN_VID_MASK);
> +			else
> +				PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT);
> +			break;
> 		case BPF_S_ANC_QUEUE:
> 			BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
> 						  queue_mapping) != 2);

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

* Re: [PATCH net-next 2/2] PPC: net: bpf_jit_comp: add VLAN instructions for BPF JIT
  2012-11-17  0:06 ` Matt Evans
@ 2012-11-18  3:13   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-11-18  3:13 UTC (permalink / raw)
  To: matt; +Cc: dxchgb, benh, netdev

From: Matt Evans <matt@ozlabs.org>
Date: Sat, 17 Nov 2012 00:06:03 +0000

> Hi,
> 
> On 08/11/2012, at 9:41 PM, Daniel Borkmann wrote:
> 
>> This patch is a follow-up for patch "net: filter: add vlan tag access"
>> to support the new VLAN_TAG/VLAN_TAG_PRESENT accessors in BPF JIT.
>> 
>> Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
>> Cc: Matt Evans <matt@ozlabs.org>
>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> ---
>> Disclaimer: uncompiled and untested, since I don't have a PPC machine,
>> but it should (hopefully) integrate cleanly; impl. after PPC instruction
>> reference.
> 
> And for this too,
> 
> Acked-by: Matt Evans <matt@ozlabs.org>
> 
> Sorry for the delay in reviewing this!

Applied, thanks for reviewing.

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

end of thread, other threads:[~2012-11-18  3:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08 21:41 [PATCH net-next 2/2] PPC: net: bpf_jit_comp: add VLAN instructions for BPF JIT Daniel Borkmann
2012-11-17  0:06 ` Matt Evans
2012-11-18  3:13   ` 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).