[v4] net/af_xdp: fix missing UMEM feature

Message ID 20231002124852.76374-1-shibin.koikkara.reeny@intel.com (mailing list archive)
State Not Applicable, archived
Delegated to: Ferruh Yigit
Headers
Series [v4] net/af_xdp: fix missing UMEM feature |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Koikkara Reeny, Shibin Oct. 2, 2023, 12:48 p.m. UTC
  Shared UMEM feature is missing in the af_xdp driver build
after the commit 33d66940e9ba ("build: use C11 standard").

Runtime Error log while using Shared UMEM feature:
rte_pmd_af_xdp_probe(): Initializing pmd_af_xdp for net_af_xdp0
init_internals(): Shared UMEM feature not available. Check kernel
and libbpf version
rte_pmd_af_xdp_probe(): Failed to init internals
vdev_probe(): failed to initialize net_af_xdp0 device
EAL: Bus (vdev) probe failed.

Reason for the missing UMEM feature is because the C11 standard
doesn't include the GNU compiler extensions typeof and asm, used
by the libbpf and libxdp header files.

Meson error log:
 In file included from
dpdk/build/meson-private/tmpf74nkhqd/testfile.c:5:
/usr/local/include/bpf/xsk.h: In function 'xsk_prod_nb_free':
/usr/local/include/bpf/xsk.h:165:26: error: expected ';' before '___p1'
  165 |         r->cached_cons = libbpf_smp_load_acquire(r->consumer);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/bpf/xsk.h:165:26: error: 'asm' undeclared (first use
in this function)
...
/usr/local/include/bpf/xsk.h:199:9: error: unknown type name 'typeof'
  199 |         libbpf_smp_store_release(prod->producer, *prod->producer
      + nb);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~

Fix is to provide alternative keywords by using macros [1].

Fixes: 33d66940e9ba ("build: use C11 standard")

[1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html

v4: Updated the commit message.
v3: Used alternative keywords fix.
v2: Added original commit causing the issue.

Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
---
 drivers/net/af_xdp/meson.build | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
  

Comments

Bruce Richardson Oct. 2, 2023, 1:01 p.m. UTC | #1
On Mon, Oct 02, 2023 at 12:48:52PM +0000, Shibin Koikkara Reeny wrote:
> Shared UMEM feature is missing in the af_xdp driver build
> after the commit 33d66940e9ba ("build: use C11 standard").
> 
> Runtime Error log while using Shared UMEM feature:
> rte_pmd_af_xdp_probe(): Initializing pmd_af_xdp for net_af_xdp0
> init_internals(): Shared UMEM feature not available. Check kernel
> and libbpf version
> rte_pmd_af_xdp_probe(): Failed to init internals
> vdev_probe(): failed to initialize net_af_xdp0 device
> EAL: Bus (vdev) probe failed.
> 
> Reason for the missing UMEM feature is because the C11 standard
> doesn't include the GNU compiler extensions typeof and asm, used
> by the libbpf and libxdp header files.
> 
> Meson error log:
>  In file included from
> dpdk/build/meson-private/tmpf74nkhqd/testfile.c:5:
> /usr/local/include/bpf/xsk.h: In function 'xsk_prod_nb_free':
> /usr/local/include/bpf/xsk.h:165:26: error: expected ';' before '___p1'
>   165 |         r->cached_cons = libbpf_smp_load_acquire(r->consumer);
>       |                          ^~~~~~~~~~~~~~~~~~~~~~~
> /usr/local/include/bpf/xsk.h:165:26: error: 'asm' undeclared (first use
> in this function)
> ...
> /usr/local/include/bpf/xsk.h:199:9: error: unknown type name 'typeof'
>   199 |         libbpf_smp_store_release(prod->producer, *prod->producer
>       + nb);
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fix is to provide alternative keywords by using macros [1].
> 
> Fixes: 33d66940e9ba ("build: use C11 standard")
> 
> [1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
> 
> v4: Updated the commit message.
> v3: Used alternative keywords fix.
> v2: Added original commit causing the issue.
> 
> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>

Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
  
Ferruh Yigit Oct. 2, 2023, 1:15 p.m. UTC | #2
On 10/2/2023 2:01 PM, Bruce Richardson wrote:
> On Mon, Oct 02, 2023 at 12:48:52PM +0000, Shibin Koikkara Reeny wrote:
>> Shared UMEM feature is missing in the af_xdp driver build
>> after the commit 33d66940e9ba ("build: use C11 standard").
>>
>> Runtime Error log while using Shared UMEM feature:
>> rte_pmd_af_xdp_probe(): Initializing pmd_af_xdp for net_af_xdp0
>> init_internals(): Shared UMEM feature not available. Check kernel
>> and libbpf version
>> rte_pmd_af_xdp_probe(): Failed to init internals
>> vdev_probe(): failed to initialize net_af_xdp0 device
>> EAL: Bus (vdev) probe failed.
>>
>> Reason for the missing UMEM feature is because the C11 standard
>> doesn't include the GNU compiler extensions typeof and asm, used
>> by the libbpf and libxdp header files.
>>
>> Meson error log:
>>  In file included from
>> dpdk/build/meson-private/tmpf74nkhqd/testfile.c:5:
>> /usr/local/include/bpf/xsk.h: In function 'xsk_prod_nb_free':
>> /usr/local/include/bpf/xsk.h:165:26: error: expected ';' before '___p1'
>>   165 |         r->cached_cons = libbpf_smp_load_acquire(r->consumer);
>>       |                          ^~~~~~~~~~~~~~~~~~~~~~~
>> /usr/local/include/bpf/xsk.h:165:26: error: 'asm' undeclared (first use
>> in this function)
>> ...
>> /usr/local/include/bpf/xsk.h:199:9: error: unknown type name 'typeof'
>>   199 |         libbpf_smp_store_release(prod->producer, *prod->producer
>>       + nb);
>>       |         ^~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Fix is to provide alternative keywords by using macros [1].
>>
>> Fixes: 33d66940e9ba ("build: use C11 standard")
>>
>> [1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
>>
>> v4: Updated the commit message.
>> v3: Used alternative keywords fix.
>> v2: Added original commit causing the issue.
>>
>> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
> 
> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
>

I already merged the v3, and updated the commit log while merging,
can you please check the next-net [1] if the commit log is good as it is?

[1]
https://git.dpdk.org/next/dpdk-next-net/commit/?id=a499de2602df505e0313ae468817863b29f2311e
  
Bruce Richardson Oct. 2, 2023, 1:23 p.m. UTC | #3
On Mon, Oct 02, 2023 at 02:15:51PM +0100, Ferruh Yigit wrote:
> On 10/2/2023 2:01 PM, Bruce Richardson wrote:
> > On Mon, Oct 02, 2023 at 12:48:52PM +0000, Shibin Koikkara Reeny wrote:
> >> Shared UMEM feature is missing in the af_xdp driver build
> >> after the commit 33d66940e9ba ("build: use C11 standard").
> >>
> >> Runtime Error log while using Shared UMEM feature:
> >> rte_pmd_af_xdp_probe(): Initializing pmd_af_xdp for net_af_xdp0
> >> init_internals(): Shared UMEM feature not available. Check kernel
> >> and libbpf version
> >> rte_pmd_af_xdp_probe(): Failed to init internals
> >> vdev_probe(): failed to initialize net_af_xdp0 device
> >> EAL: Bus (vdev) probe failed.
> >>
> >> Reason for the missing UMEM feature is because the C11 standard
> >> doesn't include the GNU compiler extensions typeof and asm, used
> >> by the libbpf and libxdp header files.
> >>
> >> Meson error log:
> >>  In file included from
> >> dpdk/build/meson-private/tmpf74nkhqd/testfile.c:5:
> >> /usr/local/include/bpf/xsk.h: In function 'xsk_prod_nb_free':
> >> /usr/local/include/bpf/xsk.h:165:26: error: expected ';' before '___p1'
> >>   165 |         r->cached_cons = libbpf_smp_load_acquire(r->consumer);
> >>       |                          ^~~~~~~~~~~~~~~~~~~~~~~
> >> /usr/local/include/bpf/xsk.h:165:26: error: 'asm' undeclared (first use
> >> in this function)
> >> ...
> >> /usr/local/include/bpf/xsk.h:199:9: error: unknown type name 'typeof'
> >>   199 |         libbpf_smp_store_release(prod->producer, *prod->producer
> >>       + nb);
> >>       |         ^~~~~~~~~~~~~~~~~~~~~~~~
> >>
> >> Fix is to provide alternative keywords by using macros [1].
> >>
> >> Fixes: 33d66940e9ba ("build: use C11 standard")
> >>
> >> [1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
> >>
> >> v4: Updated the commit message.
> >> v3: Used alternative keywords fix.
> >> v2: Added original commit causing the issue.
> >>
> >> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
> > 
> > Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
> >
> 
> I already merged the v3, and updated the commit log while merging,
> can you please check the next-net [1] if the commit log is good as it is?
> 
> [1]
> https://git.dpdk.org/next/dpdk-next-net/commit/?id=a499de2602df505e0313ae468817863b29f2311e
>

LGTM anyway.
  
Ferruh Yigit Oct. 3, 2023, 9:36 a.m. UTC | #4
On 10/2/2023 2:23 PM, Bruce Richardson wrote:
> On Mon, Oct 02, 2023 at 02:15:51PM +0100, Ferruh Yigit wrote:
>> On 10/2/2023 2:01 PM, Bruce Richardson wrote:
>>> On Mon, Oct 02, 2023 at 12:48:52PM +0000, Shibin Koikkara Reeny wrote:
>>>> Shared UMEM feature is missing in the af_xdp driver build
>>>> after the commit 33d66940e9ba ("build: use C11 standard").
>>>>
>>>> Runtime Error log while using Shared UMEM feature:
>>>> rte_pmd_af_xdp_probe(): Initializing pmd_af_xdp for net_af_xdp0
>>>> init_internals(): Shared UMEM feature not available. Check kernel
>>>> and libbpf version
>>>> rte_pmd_af_xdp_probe(): Failed to init internals
>>>> vdev_probe(): failed to initialize net_af_xdp0 device
>>>> EAL: Bus (vdev) probe failed.
>>>>
>>>> Reason for the missing UMEM feature is because the C11 standard
>>>> doesn't include the GNU compiler extensions typeof and asm, used
>>>> by the libbpf and libxdp header files.
>>>>
>>>> Meson error log:
>>>>  In file included from
>>>> dpdk/build/meson-private/tmpf74nkhqd/testfile.c:5:
>>>> /usr/local/include/bpf/xsk.h: In function 'xsk_prod_nb_free':
>>>> /usr/local/include/bpf/xsk.h:165:26: error: expected ';' before '___p1'
>>>>   165 |         r->cached_cons = libbpf_smp_load_acquire(r->consumer);
>>>>       |                          ^~~~~~~~~~~~~~~~~~~~~~~
>>>> /usr/local/include/bpf/xsk.h:165:26: error: 'asm' undeclared (first use
>>>> in this function)
>>>> ...
>>>> /usr/local/include/bpf/xsk.h:199:9: error: unknown type name 'typeof'
>>>>   199 |         libbpf_smp_store_release(prod->producer, *prod->producer
>>>>       + nb);
>>>>       |         ^~~~~~~~~~~~~~~~~~~~~~~~
>>>>
>>>> Fix is to provide alternative keywords by using macros [1].
>>>>
>>>> Fixes: 33d66940e9ba ("build: use C11 standard")
>>>>
>>>> [1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
>>>>
>>>> v4: Updated the commit message.
>>>> v3: Used alternative keywords fix.
>>>> v2: Added original commit causing the issue.
>>>>
>>>> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
>>>
>>> Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
>>>
>>
>> I already merged the v3, and updated the commit log while merging,
>> can you please check the next-net [1] if the commit log is good as it is?
>>
>> [1]
>> https://git.dpdk.org/next/dpdk-next-net/commit/?id=a499de2602df505e0313ae468817863b29f2311e
>>
> 
> LGTM anyway. 
>

Shibin, if you also don't have any objection, I will keep the merged
version as it is.
  

Patch

diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
index 9a8dbb4d49..9f33e57fa2 100644
--- a/drivers/net/af_xdp/meson.build
+++ b/drivers/net/af_xdp/meson.build
@@ -48,6 +48,14 @@  endif
 
 if build
   xsk_check_prefix = '''
+#ifndef typeof
+#define typeof __typeof__
+#endif
+
+#ifndef asm
+#define asm __asm__
+#endif
+
 #ifdef RTE_NET_AF_XDP_LIBXDP
 #include <xdp/xsk.h>
 #else
@@ -56,17 +64,17 @@  if build
   '''
 
   if cc.has_function('xsk_socket__create_shared', prefix : xsk_check_prefix,
-                     dependencies : ext_deps)
+                     dependencies : ext_deps, args: cflags)
       cflags += ['-DRTE_NET_AF_XDP_SHARED_UMEM']
   endif
   if cc.has_function('bpf_object__next_program',
                      prefix : '#include <bpf/libbpf.h>',
-                     dependencies : bpf_dep)
+                     dependencies : bpf_dep, args: cflags)
       cflags += ['-DRTE_NET_AF_XDP_LIBBPF_OBJ_OPEN']
   endif
   if cc.has_function('bpf_xdp_attach',
                      prefix : '#include <bpf/libbpf.h>',
-                     dependencies : bpf_dep)
+                     dependencies : bpf_dep, args: cflags)
       cflags += ['-DRTE_NET_AF_XDP_LIBBPF_XDP_ATTACH']
   endif
 endif