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 via email to