[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <550AF483.8040202@plumgrid.com>
Date: Thu, 19 Mar 2015 09:08:35 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: Michal Sekletar <msekleta@...hat.com>, netdev@...r.kernel.org
CC: Jiri Pirko <jpirko@...hat.com>, Ralf Baechle <ralf@...ux-mips.org>,
Russell King <linux@....linux.org.uk>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next v2] filter: introduce SKF_AD_VLAN_TPID BPF extension
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists