Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-21 Thread Alexei Starovoitov
On Fri, Mar 22, 2019 at 11:46:52AM +0900, Sergey Senozhatsky wrote: > On (03/21/19 08:49), Stanislav Fomichev wrote: > > On 03/21, Sergey Senozhatsky wrote: > > > On (03/20/19 20:24), Alexei Starovoitov wrote: > > > > On Wed, Mar 20, 2019 at 09:53:33PM +0900, Sergey Senozhatsky wrote: > > > > > Not

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-21 Thread Sergey Senozhatsky
On (03/21/19 08:49), Stanislav Fomichev wrote: > On 03/21, Sergey Senozhatsky wrote: > > On (03/20/19 20:24), Alexei Starovoitov wrote: > > > On Wed, Mar 20, 2019 at 09:53:33PM +0900, Sergey Senozhatsky wrote: > > > > Not all compilers have __builtin_bswap16() and __builtin_bswap32(), > > > > thus

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-21 Thread Stanislav Fomichev
On 03/21, Sergey Senozhatsky wrote: > On (03/20/19 20:24), Alexei Starovoitov wrote: > > On Wed, Mar 20, 2019 at 09:53:33PM +0900, Sergey Senozhatsky wrote: > > > Not all compilers have __builtin_bswap16() and __builtin_bswap32(), > > > thus not all compilers are able to compile the following code:

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Sergey Senozhatsky
On (03/20/19 20:24), Alexei Starovoitov wrote: > On Wed, Mar 20, 2019 at 09:53:33PM +0900, Sergey Senozhatsky wrote: > > Not all compilers have __builtin_bswap16() and __builtin_bswap32(), > > thus not all compilers are able to compile the following code: > > > > (__builtin_constant_p(x) ?

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Alexei Starovoitov
On Wed, Mar 20, 2019 at 09:53:33PM +0900, Sergey Senozhatsky wrote: > Not all compilers have __builtin_bswap16() and __builtin_bswap32(), > thus not all compilers are able to compile the following code: > > (__builtin_constant_p(x) ? \ > ___constant_swab16(x) : __builtin_bs

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Sergey Senozhatsky
On (03/20/19 15:27), Stanislav Fomichev wrote: [..] > > Inside kernel clang compiler header (linux/compiler-clang.h) does not > > define __HAVE_BUILTIN_BSWAP16__. So it will go to the "else" branch in > > the above. So I think it should work with clang + bpf. > Hm, isn't it the opposite of what w

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Yonghong Song
On 3/20/19 5:03 PM, Stanislav Fomichev wrote: > On 03/21, Daniel Borkmann wrote: >> On 03/20/2019 11:45 PM, Yonghong Song wrote: >>> On 3/20/19 3:27 PM, Stanislav Fomichev wrote: On 03/20, Yonghong Song wrote: > On 3/20/19 10:13 AM, Stanislav Fomichev wrote: >> On 03/20, Sergey Senoz

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Sergey Senozhatsky
On (03/20/19 10:13), Stanislav Fomichev wrote: > Tested them locally with the compiler I saw the initial issues with - all > fine, I don't see any errors with the older gcc. Thanks! > One last question I have is: what happens in the llvm+bpf case? Have > you tested that? I think LLVM has all the

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Stanislav Fomichev
On 03/21, Daniel Borkmann wrote: > On 03/20/2019 11:45 PM, Yonghong Song wrote: > > On 3/20/19 3:27 PM, Stanislav Fomichev wrote: > >> On 03/20, Yonghong Song wrote: > >>> On 3/20/19 10:13 AM, Stanislav Fomichev wrote: > On 03/20, Sergey Senozhatsky wrote: > > Not all compilers have __buil

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Daniel Borkmann
On 03/20/2019 11:45 PM, Yonghong Song wrote: > On 3/20/19 3:27 PM, Stanislav Fomichev wrote: >> On 03/20, Yonghong Song wrote: >>> On 3/20/19 10:13 AM, Stanislav Fomichev wrote: On 03/20, Sergey Senozhatsky wrote: > Not all compilers have __builtin_bswap16() and __builtin_bswap32(), >

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Yonghong Song
On 3/20/19 3:27 PM, Stanislav Fomichev wrote: > On 03/20, Yonghong Song wrote: >> >> >> On 3/20/19 10:13 AM, Stanislav Fomichev wrote: >>> On 03/20, Sergey Senozhatsky wrote: Not all compilers have __builtin_bswap16() and __builtin_bswap32(), thus not all compilers are able to compile t

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Stanislav Fomichev
On 03/20, Yonghong Song wrote: > > > On 3/20/19 10:13 AM, Stanislav Fomichev wrote: > > On 03/20, Sergey Senozhatsky wrote: > >> Not all compilers have __builtin_bswap16() and __builtin_bswap32(), > >> thus not all compilers are able to compile the following code: > >> > >> (__builtin_co

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Yonghong Song
On 3/20/19 10:13 AM, Stanislav Fomichev wrote: > On 03/20, Sergey Senozhatsky wrote: >> Not all compilers have __builtin_bswap16() and __builtin_bswap32(), >> thus not all compilers are able to compile the following code: >> >> (__builtin_constant_p(x) ? \ >> ___constant

Re: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Stanislav Fomichev
On 03/20, Sergey Senozhatsky wrote: > Not all compilers have __builtin_bswap16() and __builtin_bswap32(), > thus not all compilers are able to compile the following code: > > (__builtin_constant_p(x) ? \ > ___constant_swab16(x) : __builtin_bswap16(x)) > > That's the reason

[PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection

2019-03-20 Thread Sergey Senozhatsky
Not all compilers have __builtin_bswap16() and __builtin_bswap32(), thus not all compilers are able to compile the following code: (__builtin_constant_p(x) ? \ ___constant_swab16(x) : __builtin_bswap16(x)) That's the reason why bpf_ntohl() doesn't work on GCC < 4.8, for in