public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox•net>
To: Johannes Berg <johannes@sipsolutions•net>
Cc: "netdev@vger•kernel.org" <netdev@vger•kernel.org>,
	Alexei Starovoitov <ast@kernel•org>
Subject: Re: eBPF - little-endian load instructions?
Date: Tue, 11 Apr 2017 13:22:40 +0200	[thread overview]
Message-ID: <58ECBC80.1050009@iogearbox.net> (raw)
In-Reply-To: <1491909330.31620.21.camel@sipsolutions.net>

On 04/11/2017 01:15 PM, Johannes Berg wrote:
>
>> Are you working with an skb at that point in time in wifi?
>
> Yes.
>
>> There are
>> 3 different ways of accessing skb data, see [1] slide 7 - 10. The BPF
>> LD_ABS/IND instructions were carried over from cBPF and are the only
>> ones that convert to host endianess. It can be used in eBPF as well,
>> but there are more efficient ways like 'direct packet access' or
>> helpers such as bpf_skb_load_bytes() that load the raw buffers as-is,
>> which is probably what you want if I understand you correctly.
>
> Sounds like, yeah.
>
>> There are instructions to convert endianess, see __bpf_prog_run(),
>> the ALU_END_TO_BE, ALU_END_TO_LE labels for details. There's a
>> BPF_ENDIAN() macro used in the test suite and other places.
>
> Ok, thanks! :)
>
> So sounds like I don't need anything special - should have a patch to
> hook up the wifi stuff soon.

Yeah, you shouldn't need anything special. In case the wifi progs have
their own BPF program type, I wouldn't even add it to may_access_skb()
to not further encourage LD_ABS/IND usage. F.e. lwt BPF programs are not
hooked up there either.

Thanks,
Daniel

  reply	other threads:[~2017-04-11 11:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 10:38 eBPF - little-endian load instructions? Johannes Berg
2017-04-11 11:06 ` Daniel Borkmann
2017-04-11 11:15   ` Johannes Berg
2017-04-11 11:22     ` Daniel Borkmann [this message]
2017-04-11 11:26       ` Johannes Berg
2017-04-12 13:02   ` Johannes Berg
2017-04-12 16:58     ` Alexei Starovoitov
2017-04-12 19:38       ` Johannes Berg
2017-04-13  3:08         ` Alexei Starovoitov
2017-04-13  5:58           ` Johannes Berg
2017-04-14 18:42             ` Alexei Starovoitov
2017-04-15  7:06               ` Johannes Berg

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=58ECBC80.1050009@iogearbox.net \
    --to=daniel@iogearbox$(echo .)net \
    --cc=ast@kernel$(echo .)org \
    --cc=johannes@sipsolutions$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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