[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1492063125.19193.1.camel@sipsolutions.net>
Date: Thu, 13 Apr 2017 07:58:45 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>
Subject: Re: eBPF - little-endian load instructions?
On Wed, 2017-04-12 at 20:08 -0700, Alexei Starovoitov wrote:
> it's really llvm bug that i need fix. It's plain broken
> to generate what effectively is nop insn for march=bpfeb
> My only excuse that when that code was written llvm had only
> march=bpfel.
> bpfeb was added much later.
So I'm confused now. Is bpf intended to be endian-independent or not?
It sounded at first like it was, even if I have a hard time imagining
how that would even work.
> > #define be32_to_cpu bswap32
> > or
> > #define be32_to_cpu(x) (x)
> > depending on the build architecture, I guess.
>
> yeah. that's what we should have in bpf_helpers.h
But that sounds more like it isn't.
> ntoh is enough for any networking code,
> so I guess we can live without real bswap insn.
Well, my reason for asking this is that wireless actually as a little-
endian wire protocol, unlike other network stuff :)
(Even at a bit level it's defined to transfer the LSB first, but that
doesn't really get visible at the level of the CPU that can only
address bytes.)
johannes
Powered by blists - more mailing lists