All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@plumgrid.com>
To: Michal Sekletar <msekleta@redhat.com>, netdev@vger.kernel.org
Cc: Jiri Pirko <jpirko@redhat.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Russell King <linux@arm.linux.org.uk>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next v2] filter: introduce SKF_AD_VLAN_TPID BPF extension
Date: Thu, 19 Mar 2015 09:08:35 -0700	[thread overview]
Message-ID: <550AF483.8040202@plumgrid.com> (raw)
In-Reply-To: <1426763414-10091-1-git-send-email-msekleta@redhat.com>

On 3/19/15 4:10 AM, Michal Sekletar wrote:
> If vlan offloading takes place then vlan header is removed from frame
> and its contents, both vlan_tci and vlan_proto, is available to userspace via
> TPACKET interface. However, only vlan_tci can be used in BPF filters.
>
> This commit introduces new BPF extension. It makes possible to load value of
> vlan_proto (vlan TPID) to register A.

Agree with the idea, though we need to decide whether to do ntohs on
vlan_proto or not. Since right now your patch makes it consistent
on different architectures.

For arch where extended BPF jit is available the following:
 > +	case SKF_AD_OFF + SKF_AD_VLAN_TPID:
...
 > +		/* A = ntohs(A) [emitting a nop or swap16] */
 > +		*insn = BPF_ENDIAN(BPF_FROM_BE, BPF_REG_A, 16);

will make sure that it's doing ntohs,
whereas arm JIT is doing normal 16-bit load.
ppc can be both big and little, so PPC_LHZ_OFFS is incorrect.

Since it's a new field, I think it makes sense not to do ntohs at all.
Let bpf programs do htons(PROTO_CONSTANT), since it can be done at
compile time instead of run-time.

  reply	other threads:[~2015-03-19 16:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 11:10 [PATCH net-next v2] filter: introduce SKF_AD_VLAN_TPID BPF extension Michal Sekletar
2015-03-19 16:08 ` Alexei Starovoitov [this message]
2015-03-20 10:27   ` Michal Sekletar
2015-03-21  2:23     ` Alexei Starovoitov
2015-03-21  9:49       ` Daniel Borkmann
2015-03-21 15:41         ` Alexei Starovoitov
2015-03-19 17:45 ` Denis Kirjanov

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=550AF483.8040202@plumgrid.com \
    --to=ast@plumgrid.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=jpirko@redhat.com \
    --cc=linux@arm.linux.org.uk \
    --cc=msekleta@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=schwidefsky@de.ibm.com \
    /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.