DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/af_xdp: pass cflags to appropriate build components
@ 2023-09-21 10:29 Shibin Koikkara Reeny
  2023-09-21 10:43 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Shibin Koikkara Reeny @ 2023-09-21 10:29 UTC (permalink / raw)
  To: dev, ciara.loftus, bruce.richardson
  Cc: qi.z.zhang, john.mcnamara, Shibin Koikkara Reeny

Commit 33d66940e9ba ("build: use C11 standard") enforces
the C11 standard so some changes need to be made to the
af_xdp driver meson build to ensure that the appropriate
cflags are passed when checking if certain functions are
available in the libbpf/libxdp libraries.

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

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

diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
index 9a8dbb4d49..3319acca65 100644
--- a/drivers/net/af_xdp/meson.build
+++ b/drivers/net/af_xdp/meson.build
@@ -56,17 +56,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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] net/af_xdp: pass cflags to appropriate build components
  2023-09-21 10:29 [PATCH] net/af_xdp: pass cflags to appropriate build components Shibin Koikkara Reeny
@ 2023-09-21 10:43 ` Bruce Richardson
  2023-09-21 10:47 ` Bruce Richardson
  2023-09-22  9:31 ` [PATCH v2] net/af_xdp: fix cflags to appropriate UMEM feature Shibin Koikkara Reeny
  2 siblings, 0 replies; 12+ messages in thread
From: Bruce Richardson @ 2023-09-21 10:43 UTC (permalink / raw)
  To: Shibin Koikkara Reeny
  Cc: dev, ciara.loftus, qi.z.zhang, john.mcnamara, stable

On Thu, Sep 21, 2023 at 10:29:23AM +0000, Shibin Koikkara Reeny wrote:
> Commit 33d66940e9ba ("build: use C11 standard") enforces
> the C11 standard so some changes need to be made to the
> af_xdp driver meson build to ensure that the appropriate
> cflags are passed when checking if certain functions are
> available in the libbpf/libxdp libraries.
> 
> Fixes: 33d66940e9ba ("build: use C11 standard")

Not sure if that is the correct offending commit, or just the commit that
exposes the already-present issue. I'd add the following also to the commit
log:

Fixes: e024c7e838fc ("net/af_xdp: avoid version-based check for shared UMEM")

That fixline would imply a possible backport though, but no issue has been
seen on versions of DPDK not using C11, so I think we skip backporting this
for now. Putting stable@dpdk.org on CC in case the LTS maintainers have
additional input.

For the code fix itself:
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 
> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
> ---
>  drivers/net/af_xdp/meson.build | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
> index 9a8dbb4d49..3319acca65 100644
> --- a/drivers/net/af_xdp/meson.build
> +++ b/drivers/net/af_xdp/meson.build
> @@ -56,17 +56,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
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] net/af_xdp: pass cflags to appropriate build components
  2023-09-21 10:29 [PATCH] net/af_xdp: pass cflags to appropriate build components Shibin Koikkara Reeny
  2023-09-21 10:43 ` Bruce Richardson
@ 2023-09-21 10:47 ` Bruce Richardson
  2023-09-22  9:31 ` [PATCH v2] net/af_xdp: fix cflags to appropriate UMEM feature Shibin Koikkara Reeny
  2 siblings, 0 replies; 12+ messages in thread
From: Bruce Richardson @ 2023-09-21 10:47 UTC (permalink / raw)
  To: Shibin Koikkara Reeny; +Cc: dev, ciara.loftus, qi.z.zhang, john.mcnamara

On Thu, Sep 21, 2023 at 10:29:23AM +0000, Shibin Koikkara Reeny wrote:
> Commit 33d66940e9ba ("build: use C11 standard") enforces
> the C11 standard so some changes need to be made to the
> af_xdp driver meson build to ensure that the appropriate
> cflags are passed when checking if certain functions are
> available in the libbpf/libxdp libraries.
> 

By way of additional follow-up.

Can you please describe the actual issue encountered in the commit log, and
how the code change fixes it.  Ideally, the commit title should also start
with "fix" and a short description of the issue. For example "fix build
with libxdp version..." or "fix compiler error when ...". Focus more on the
problem rather than the solution, since anyone looking at the commit in
future is more likely to be interested in what is solves rather than what
it does.

You can include my ack in a V2 with updated description.

/Bruce

> Fixes: 33d66940e9ba ("build: use C11 standard")
> 
> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
> ---
>  drivers/net/af_xdp/meson.build | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
> index 9a8dbb4d49..3319acca65 100644
> --- a/drivers/net/af_xdp/meson.build
> +++ b/drivers/net/af_xdp/meson.build
> @@ -56,17 +56,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
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] net/af_xdp: fix cflags to appropriate UMEM feature
  2023-09-21 10:29 [PATCH] net/af_xdp: pass cflags to appropriate build components Shibin Koikkara Reeny
  2023-09-21 10:43 ` Bruce Richardson
  2023-09-21 10:47 ` Bruce Richardson
@ 2023-09-22  9:31 ` Shibin Koikkara Reeny
  2023-09-28  9:25   ` [PATCH v3] net/af_xdp: fix missing " Shibin Koikkara Reeny
  2 siblings, 1 reply; 12+ messages in thread
From: Shibin Koikkara Reeny @ 2023-09-22  9:31 UTC (permalink / raw)
  To: dev, ciara.loftus, bruce.richardson
  Cc: qi.z.zhang, john.mcnamara, stable, Shibin Koikkara Reeny

Fix missing RTE_NET_AF_XDP_SHARED_UMEM flag in
xsk_socket__create_shared().

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.

Fixes: e024c7e838fc ("net/af_xdp: avoid version-based check for shared UMEM")
Fixes: 33d66940e9ba ("build: use C11 standard")

Fix is for the commit e024c7e838fc ("net/af_xdp: avoid
version-based check for shared UMEM") fixline would imply
a possible backport though, but no issue has been seen on
version of DPDK not using C11, so I will be skipping
backporting this for now.
Commit 33d66940e9ba ("build: use C11 standard") enforces
the C11 standard so some changes need to be made to the
af_xdp driver meson build to ensure that the appropriate
cflags are passed when checking if certain functions are
available in the libbpf/libxdp libraries.

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

diff --git a/drivers/net/af_xdp/meson.build b/drivers/net/af_xdp/meson.build
index 9a8dbb4d49..3319acca65 100644
--- a/drivers/net/af_xdp/meson.build
+++ b/drivers/net/af_xdp/meson.build
@@ -56,17 +56,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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3] net/af_xdp: fix missing UMEM feature
  2023-09-22  9:31 ` [PATCH v2] net/af_xdp: fix cflags to appropriate UMEM feature Shibin Koikkara Reeny
@ 2023-09-28  9:25   ` Shibin Koikkara Reeny
  2023-09-28  9:32     ` Bruce Richardson
  2023-10-02 12:48     ` [PATCH v4] " Shibin Koikkara Reeny
  0 siblings, 2 replies; 12+ messages in thread
From: Shibin Koikkara Reeny @ 2023-09-28  9:25 UTC (permalink / raw)
  To: dev, ciara.loftus, bruce.richardson
  Cc: qi.z.zhang, john.mcnamara, Shibin Koikkara Reeny

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 Option Controlling C
Dialect [1].

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

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

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(-)

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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] net/af_xdp: fix missing UMEM feature
  2023-09-28  9:25   ` [PATCH v3] net/af_xdp: fix missing " Shibin Koikkara Reeny
@ 2023-09-28  9:32     ` Bruce Richardson
  2023-09-29 11:45       ` Ferruh Yigit
  2023-10-02 12:48     ` [PATCH v4] " Shibin Koikkara Reeny
  1 sibling, 1 reply; 12+ messages in thread
From: Bruce Richardson @ 2023-09-28  9:32 UTC (permalink / raw)
  To: Shibin Koikkara Reeny; +Cc: dev, ciara.loftus, qi.z.zhang, john.mcnamara

On Thu, Sep 28, 2023 at 09:25:53AM +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 Option Controlling C
> Dialect [1].
> 

Minor nit, this patch provides the alternative keywords using macros rather than any
C dialect options.

> Fixes: 33d66940e9ba ("build: use C11 standard")
> 
> [1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
> 
> v3: Used alternative keywords fix.
> v2: Added original commit causing the issue.
> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
> ---

Acked-by: Bruce Richardson <bruce.richardson@intel.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] net/af_xdp: fix missing UMEM feature
  2023-09-28  9:32     ` Bruce Richardson
@ 2023-09-29 11:45       ` Ferruh Yigit
  0 siblings, 0 replies; 12+ messages in thread
From: Ferruh Yigit @ 2023-09-29 11:45 UTC (permalink / raw)
  To: Bruce Richardson, Shibin Koikkara Reeny
  Cc: dev, ciara.loftus, qi.z.zhang, john.mcnamara

On 9/28/2023 10:32 AM, Bruce Richardson wrote:
> On Thu, Sep 28, 2023 at 09:25:53AM +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 Option Controlling C
>> Dialect [1].
>>
> 
> Minor nit, this patch provides the alternative keywords using macros rather than any
> C dialect options.
> 

Fixed while merging.

>> Fixes: 33d66940e9ba ("build: use C11 standard")
>>
>> [1] https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
>>
>> v3: Used alternative keywords fix.
>> v2: Added original commit causing the issue.
>> Signed-off-by: Shibin Koikkara Reeny <shibin.koikkara.reeny@intel.com>
>> ---
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> 

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4] net/af_xdp: fix missing UMEM feature
  2023-09-28  9:25   ` [PATCH v3] net/af_xdp: fix missing " Shibin Koikkara Reeny
  2023-09-28  9:32     ` Bruce Richardson
@ 2023-10-02 12:48     ` Shibin Koikkara Reeny
  2023-10-02 13:01       ` Bruce Richardson
  1 sibling, 1 reply; 12+ messages in thread
From: Shibin Koikkara Reeny @ 2023-10-02 12:48 UTC (permalink / raw)
  To: dev, ciara.loftus, bruce.richardson
  Cc: qi.z.zhang, john.mcnamara, Shibin Koikkara Reeny

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(-)

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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4] net/af_xdp: fix missing UMEM feature
  2023-10-02 12:48     ` [PATCH v4] " Shibin Koikkara Reeny
@ 2023-10-02 13:01       ` Bruce Richardson
  2023-10-02 13:15         ` Ferruh Yigit
  0 siblings, 1 reply; 12+ messages in thread
From: Bruce Richardson @ 2023-10-02 13:01 UTC (permalink / raw)
  To: Shibin Koikkara Reeny; +Cc: dev, ciara.loftus, qi.z.zhang, john.mcnamara

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>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4] net/af_xdp: fix missing UMEM feature
  2023-10-02 13:01       ` Bruce Richardson
@ 2023-10-02 13:15         ` Ferruh Yigit
  2023-10-02 13:23           ` Bruce Richardson
  0 siblings, 1 reply; 12+ messages in thread
From: Ferruh Yigit @ 2023-10-02 13:15 UTC (permalink / raw)
  To: Bruce Richardson, Shibin Koikkara Reeny
  Cc: dev, ciara.loftus, qi.z.zhang, john.mcnamara

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4] net/af_xdp: fix missing UMEM feature
  2023-10-02 13:15         ` Ferruh Yigit
@ 2023-10-02 13:23           ` Bruce Richardson
  2023-10-03  9:36             ` Ferruh Yigit
  0 siblings, 1 reply; 12+ messages in thread
From: Bruce Richardson @ 2023-10-02 13:23 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Shibin Koikkara Reeny, dev, ciara.loftus, qi.z.zhang, john.mcnamara

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. 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4] net/af_xdp: fix missing UMEM feature
  2023-10-02 13:23           ` Bruce Richardson
@ 2023-10-03  9:36             ` Ferruh Yigit
  0 siblings, 0 replies; 12+ messages in thread
From: Ferruh Yigit @ 2023-10-03  9:36 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: Shibin Koikkara Reeny, dev, ciara.loftus, qi.z.zhang, john.mcnamara

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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-10-03  9:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-21 10:29 [PATCH] net/af_xdp: pass cflags to appropriate build components Shibin Koikkara Reeny
2023-09-21 10:43 ` Bruce Richardson
2023-09-21 10:47 ` Bruce Richardson
2023-09-22  9:31 ` [PATCH v2] net/af_xdp: fix cflags to appropriate UMEM feature Shibin Koikkara Reeny
2023-09-28  9:25   ` [PATCH v3] net/af_xdp: fix missing " Shibin Koikkara Reeny
2023-09-28  9:32     ` Bruce Richardson
2023-09-29 11:45       ` Ferruh Yigit
2023-10-02 12:48     ` [PATCH v4] " Shibin Koikkara Reeny
2023-10-02 13:01       ` Bruce Richardson
2023-10-02 13:15         ` Ferruh Yigit
2023-10-02 13:23           ` Bruce Richardson
2023-10-03  9:36             ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).