Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: Markos Chandras <markos.chandras@imgtec.com>
Cc: <linux-mips@linux-mips.org>,
	"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v3 13/14] MIPS: net: Add BPF JIT
Date: Thu, 24 Apr 2014 17:31:14 +0100	[thread overview]
Message-ID: <20140424163114.GD36716@pburton-linux.le.imgtec.org> (raw)
In-Reply-To: <1398351013-29490-1-git-send-email-markos.chandras@imgtec.com>

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

On Thu, Apr 24, 2014 at 03:50:13PM +0100, Markos Chandras wrote:
> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
> new file mode 100644
> index 0000000..864e5b7
> --- /dev/null
> +++ b/arch/mips/net/bpf_jit.c

... cut ...

> +			off = offsetof(struct sk_buff, protocol);
> +			emit_half_load(r_A, r_skb, off, ctx);
> +#ifdef CONFIG_CPU_LITTLE_ENDIAN
> +			/* This needs little endian fixup */
> +			if (cpu_has_mips_r1) {

Doesn't cpu_has_mips_r1 cover everything >= r1? ie. everything will now
take this path, including systems >= r2. Don't you want the inverse
(!cpu_has_mips_r2) instead?

Paul

> +				/* Get first byte */
> +				emit_andi(r_tmp_imm, r_A, 0xff, ctx);
> +				/* Shift it */
> +				emit_sll(r_tmp, r_tmp_imm, 8, ctx);
> +				/* Get second byte */
> +				emit_srl(r_tmp_imm, r_A, 8, ctx);
> +				emit_andi(r_tmp_imm, r_tmp_imm, 0xff, ctx);
> +				/* Put everyting together in r_A */
> +				emit_or(r_A, r_tmp, r_tmp_imm, ctx);
> +			} else {
> +				/* R2 and later have the wsbh instruction */
> +				emit_wsbh(r_A, r_A, ctx);
> +			}

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Paul Burton <paul.burton@imgtec.com>
To: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v3 13/14] MIPS: net: Add BPF JIT
Date: Thu, 24 Apr 2014 17:31:14 +0100	[thread overview]
Message-ID: <20140424163114.GD36716@pburton-linux.le.imgtec.org> (raw)
Message-ID: <20140424163114.mgH2K9lkdgqWG1BX3B3PJMN_7exDXgXKr-2fQltIPo4@z> (raw)
In-Reply-To: <1398351013-29490-1-git-send-email-markos.chandras@imgtec.com>

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

On Thu, Apr 24, 2014 at 03:50:13PM +0100, Markos Chandras wrote:
> diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
> new file mode 100644
> index 0000000..864e5b7
> --- /dev/null
> +++ b/arch/mips/net/bpf_jit.c

... cut ...

> +			off = offsetof(struct sk_buff, protocol);
> +			emit_half_load(r_A, r_skb, off, ctx);
> +#ifdef CONFIG_CPU_LITTLE_ENDIAN
> +			/* This needs little endian fixup */
> +			if (cpu_has_mips_r1) {

Doesn't cpu_has_mips_r1 cover everything >= r1? ie. everything will now
take this path, including systems >= r2. Don't you want the inverse
(!cpu_has_mips_r2) instead?

Paul

> +				/* Get first byte */
> +				emit_andi(r_tmp_imm, r_A, 0xff, ctx);
> +				/* Shift it */
> +				emit_sll(r_tmp, r_tmp_imm, 8, ctx);
> +				/* Get second byte */
> +				emit_srl(r_tmp_imm, r_A, 8, ctx);
> +				emit_andi(r_tmp_imm, r_tmp_imm, 0xff, ctx);
> +				/* Put everyting together in r_A */
> +				emit_or(r_A, r_tmp, r_tmp_imm, ctx);
> +			} else {
> +				/* R2 and later have the wsbh instruction */
> +				emit_wsbh(r_A, r_A, ctx);
> +			}

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-04-24 16:31 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 11:47 [PATCH 00/14] Initial BPF-JIT support for MIPS Markos Chandras
2014-04-08 11:47 ` Markos Chandras
2014-04-08 11:47 ` [PATCH 01/14] MIPS: uasm: Add u3u2u1 instruction builders Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 02/14] MIPS: uasm: Add u2u1 " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 03/14] MIPS: uasm: Add sllv uasm instruction Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 04/14] MIPS: uasm: Add srlv " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 05/14] MIPS: uasm: Add divu " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 06/14] MIPS: uasm: Add mfhi " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 07/14] MIPS: uasm: Add jalr " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 08/14] MIPS: uasm: Add sltiu " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 09/14] MIPS: uasm: Add sltu " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 10/14] MIPS: uasm: Add wsbh " Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 11/14] MIPS: uasm: Add lh uam instruction Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 12/14] MIPS: uasm: Add mul uasm instruction Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-08 11:47 ` [PATCH 13/14] MIPS: net: Add BPF JIT Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-09 16:00   ` [PATCH v2 " Markos Chandras
2014-04-09 16:00     ` Markos Chandras
2014-04-09 22:28     ` Jonas Gorski
2014-04-10  7:46       ` Markos Chandras
2014-04-10  7:46         ` Markos Chandras
2014-04-10  3:40     ` Alexei Starovoitov
2014-04-10  8:06       ` Markos Chandras
2014-04-10  8:06         ` Markos Chandras
2014-04-24 14:50   ` [PATCH v3 " Markos Chandras
2014-04-24 14:50     ` Markos Chandras
2014-04-24 16:31     ` Paul Burton [this message]
2014-04-24 16:31       ` Paul Burton
2014-04-25 12:06       ` Markos Chandras
2014-04-25 12:06         ` Markos Chandras
2014-04-29 15:58     ` [PATCH v4 " Markos Chandras
2014-04-29 15:58       ` Markos Chandras
2014-04-08 11:47 ` [PATCH 14/14] MIPS: Enable the BPF_JIT symbol for MIPS Markos Chandras
2014-04-08 11:47   ` Markos Chandras
2014-04-09 16:02   ` [PATCH v2 " Markos Chandras
2014-04-09 16:02     ` Markos Chandras
2014-04-08 18:38 ` [PATCH 00/14] Initial BPF-JIT support " Florian Fainelli
2014-04-09  8:55   ` Markos Chandras
2014-04-09 10:11     ` Jonas Gorski
2014-04-09 10:56       ` Markos Chandras
2014-04-09 10:56         ` Markos Chandras

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=20140424163114.GD36716@pburton-linux.le.imgtec.org \
    --to=paul.burton@imgtec.com \
    --cc=davem@davemloft.net \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox