All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <ast@plumgrid.com>
To: Daniel Borkmann <daniel@iogearbox.net>, davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] ebpf, filter: do not convert skb->protocol to host endianess during runtime
Date: Thu, 19 Mar 2015 11:50:57 -0700	[thread overview]
Message-ID: <550B1A91.6030502@plumgrid.com> (raw)
In-Reply-To: <daaebd74ce31bd9ef7509c7083ba03d67af008bd.1426789778.git.daniel@iogearbox.net>

On 3/19/15 11:38 AM, Daniel Borkmann wrote:
> Commit c24973957975 ("bpf: allow BPF programs access 'protocol' and 'vlan_tci'
> fields") has added support for accessing protocol, vlan_present and vlan_tci
> into the skb offset map.
>
> As referenced in the below discussion, accessing skb->protocol from an eBPF
> program should be converted without handling endianess.
>
> The reason for this is that an eBPF program could simply do a check more
> naturally, by f.e. testing skb->protocol == htons(ETH_P_IP), where the LLVM
> compiler resolves htons() against a constant automatically during compilation
> time, as opposed to an otherwise needed run time conversion.
>
> After all, the way of programming both from a user perspective differs quite
> a lot, i.e. bpf_asm ["ld proto"] versus a C subset/LLVM.
>
> Reference: https://patchwork.ozlabs.org/patch/450819/
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> ---
>   (Follow-up from our previous discussion)

sure. let's save few run-time cycles.

Acked-by: Alexei Starovoitov <ast@plumgrid.com>

  reply	other threads:[~2015-03-19 18:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 18:38 [PATCH net-next] ebpf, filter: do not convert skb->protocol to host endianess during runtime Daniel Borkmann
2015-03-19 18:50 ` Alexei Starovoitov [this message]
2015-03-20 19:24 ` 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=550B1A91.6030502@plumgrid.com \
    --to=ast@plumgrid.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --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 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.