All of lore.kernel.org
 help / color / mirror / Atom feed
From: mgherzan@gmail.com (Mircea Gherzan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next 1/2] ARM: net: bpf_jit_32: add XOR instruction for BPF JIT
Date: Wed, 14 Nov 2012 00:00:04 +0100	[thread overview]
Message-ID: <50A2D0F4.3090202@gmail.com> (raw)
In-Reply-To: <20121108012828.GA23143@thinkbox>

Am 08.11.2012 02:28, schrieb Daniel Borkmann:
> This patch is a follow-up for patch "filter: add XOR instruction for use
> with X/K" that implements BPF ARM JIT parts for the BPF XOR operation.
> 
> Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
> Cc: Mircea Gherzan <mgherzan@gmail.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/net/bpf_jit_32.c |   15 ++++++++++-----
>  arch/arm/net/bpf_jit_32.h |    2 ++
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
> index c641fb6..8be702d 100644
> --- a/arch/arm/net/bpf_jit_32.c
> +++ b/arch/arm/net/bpf_jit_32.c
> @@ -646,6 +646,16 @@ load_ind:
>  			update_on_xread(ctx);
>  			emit(ARM_ORR_R(r_A, r_A, r_X), ctx);
>  			break;
> +		case BPF_S_ALU_XOR_K:
> +			/* A ^= K; */
> +			OP_IMM3(ARM_EOR, r_A, r_A, k, ctx);
> +			break;
> +		case BPF_S_ANC_ALU_XOR_X:
> +		case BPF_S_ALU_XOR_X:
> +			/* A ^= X */
> +			update_on_xread(ctx);
> +			emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
> +			break;
>  		case BPF_S_ALU_AND_K:
>  			/* A &= K */
>  			OP_IMM3(ARM_AND, r_A, r_A, k, ctx);
> @@ -762,11 +772,6 @@ b_epilogue:
>  			update_on_xread(ctx);
>  			emit(ARM_MOV_R(r_A, r_X), ctx);
>  			break;
> -		case BPF_S_ANC_ALU_XOR_X:
> -			/* A ^= X */
> -			update_on_xread(ctx);
> -			emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
> -			break;
>  		case BPF_S_ANC_PROTOCOL:
>  			/* A = ntohs(skb->protocol) */
>  			ctx->seen |= SEEN_SKB;
> diff --git a/arch/arm/net/bpf_jit_32.h b/arch/arm/net/bpf_jit_32.h
> index 7fa2f7d..afb8462 100644
> --- a/arch/arm/net/bpf_jit_32.h
> +++ b/arch/arm/net/bpf_jit_32.h
> @@ -69,6 +69,7 @@
>  #define ARM_INST_CMP_I		0x03500000
>  
>  #define ARM_INST_EOR_R		0x00200000
> +#define ARM_INST_EOR_I		0x02200000
>  
>  #define ARM_INST_LDRB_I		0x05d00000
>  #define ARM_INST_LDRB_R		0x07d00000
> @@ -135,6 +136,7 @@
>  #define ARM_CMP_I(rn, imm)	_AL3_I(ARM_INST_CMP, 0, rn, imm)
>  
>  #define ARM_EOR_R(rd, rn, rm)	_AL3_R(ARM_INST_EOR, rd, rn, rm)
> +#define ARM_EOR_I(rd, rn, imm)	_AL3_I(ARM_INST_EOR, rd, rn, imm)
>  
>  #define ARM_LDR_I(rt, rn, off)	(ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \
>  				 | (off))

Acked-by: Mircea Gherzan <mgherzan@gmail.com>

WARNING: multiple messages have this Message-ID (diff)
From: Mircea Gherzan <mgherzan@gmail.com>
To: Daniel Borkmann <dxchgb@gmail.com>
Cc: davem@davemloft.net, Arnd Bergmann <arnd@arndb.de>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/2] ARM: net: bpf_jit_32: add XOR instruction for BPF JIT
Date: Wed, 14 Nov 2012 00:00:04 +0100	[thread overview]
Message-ID: <50A2D0F4.3090202@gmail.com> (raw)
In-Reply-To: <20121108012828.GA23143@thinkbox>

Am 08.11.2012 02:28, schrieb Daniel Borkmann:
> This patch is a follow-up for patch "filter: add XOR instruction for use
> with X/K" that implements BPF ARM JIT parts for the BPF XOR operation.
> 
> Signed-off-by: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
> Cc: Mircea Gherzan <mgherzan@gmail.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/net/bpf_jit_32.c |   15 ++++++++++-----
>  arch/arm/net/bpf_jit_32.h |    2 ++
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
> index c641fb6..8be702d 100644
> --- a/arch/arm/net/bpf_jit_32.c
> +++ b/arch/arm/net/bpf_jit_32.c
> @@ -646,6 +646,16 @@ load_ind:
>  			update_on_xread(ctx);
>  			emit(ARM_ORR_R(r_A, r_A, r_X), ctx);
>  			break;
> +		case BPF_S_ALU_XOR_K:
> +			/* A ^= K; */
> +			OP_IMM3(ARM_EOR, r_A, r_A, k, ctx);
> +			break;
> +		case BPF_S_ANC_ALU_XOR_X:
> +		case BPF_S_ALU_XOR_X:
> +			/* A ^= X */
> +			update_on_xread(ctx);
> +			emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
> +			break;
>  		case BPF_S_ALU_AND_K:
>  			/* A &= K */
>  			OP_IMM3(ARM_AND, r_A, r_A, k, ctx);
> @@ -762,11 +772,6 @@ b_epilogue:
>  			update_on_xread(ctx);
>  			emit(ARM_MOV_R(r_A, r_X), ctx);
>  			break;
> -		case BPF_S_ANC_ALU_XOR_X:
> -			/* A ^= X */
> -			update_on_xread(ctx);
> -			emit(ARM_EOR_R(r_A, r_A, r_X), ctx);
> -			break;
>  		case BPF_S_ANC_PROTOCOL:
>  			/* A = ntohs(skb->protocol) */
>  			ctx->seen |= SEEN_SKB;
> diff --git a/arch/arm/net/bpf_jit_32.h b/arch/arm/net/bpf_jit_32.h
> index 7fa2f7d..afb8462 100644
> --- a/arch/arm/net/bpf_jit_32.h
> +++ b/arch/arm/net/bpf_jit_32.h
> @@ -69,6 +69,7 @@
>  #define ARM_INST_CMP_I		0x03500000
>  
>  #define ARM_INST_EOR_R		0x00200000
> +#define ARM_INST_EOR_I		0x02200000
>  
>  #define ARM_INST_LDRB_I		0x05d00000
>  #define ARM_INST_LDRB_R		0x07d00000
> @@ -135,6 +136,7 @@
>  #define ARM_CMP_I(rn, imm)	_AL3_I(ARM_INST_CMP, 0, rn, imm)
>  
>  #define ARM_EOR_R(rd, rn, rm)	_AL3_R(ARM_INST_EOR, rd, rn, rm)
> +#define ARM_EOR_I(rd, rn, imm)	_AL3_I(ARM_INST_EOR, rd, rn, imm)
>  
>  #define ARM_LDR_I(rt, rn, off)	(ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \
>  				 | (off))

Acked-by: Mircea Gherzan <mgherzan@gmail.com>

  parent reply	other threads:[~2012-11-13 23:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08  1:28 [PATCH net-next 1/2] ARM: net: bpf_jit_32: add XOR instruction for BPF JIT Daniel Borkmann
2012-11-08  1:28 ` Daniel Borkmann
2012-11-09 21:39 ` David Miller
2012-11-09 21:39   ` David Miller
2012-11-13 23:00 ` Mircea Gherzan [this message]
2012-11-13 23:00   ` Mircea Gherzan
2012-11-13 23:21   ` David Miller
2012-11-13 23:21     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A2D0F4.3090202@gmail.com \
    --to=mgherzan@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.