common/mlx5: redefine Netlink include

Message ID 1580659153-25436-1-git-send-email-matan@mellanox.com (mailing list archive)
State Rejected, archived
Delegated to: Raslan Darawsheh
Headers
Series common/mlx5: redefine Netlink include |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matan Azrad Feb. 2, 2020, 3:59 p.m. UTC
  The new RDMA-CORE versions may have the same sub-path to include the
linux Netlink header file.

It uses the pre-proccessor command #include_next what breaks the PMD gcc
compilation of common/mlx5_netlink.h file in debug mode.

Use specific include for linux/netlink.h to be taken from
/usr/include/linux.

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/common/mlx5/mlx5_nl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Slava Ovsiienko Feb. 3, 2020, 11:42 a.m. UTC | #1
> -----Original Message-----
> From: Matan Azrad <matan@mellanox.com>
> Sent: Sunday, February 2, 2020 17:59
> To: Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org
> Subject: [PATCH] common/mlx5: redefine Netlink include
> 
> The new RDMA-CORE versions may have the same sub-path to include the
> linux Netlink header file.
> 
> It uses the pre-proccessor command #include_next what breaks the PMD gcc
> compilation of common/mlx5_netlink.h file in debug mode.
> 
> Use specific include for linux/netlink.h to be taken from /usr/include/linux.
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/common/mlx5/mlx5_nl.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/common/mlx5/mlx5_nl.h
> b/drivers/common/mlx5/mlx5_nl.h index 2c3f837..ebaa655 100644
> --- a/drivers/common/mlx5/mlx5_nl.h
> +++ b/drivers/common/mlx5/mlx5_nl.h
> @@ -5,7 +5,7 @@
>  #ifndef RTE_PMD_MLX5_NL_H_
>  #define RTE_PMD_MLX5_NL_H_
> 
> -#include <linux/netlink.h>
> +#include "/usr/include/linux/netlink.h"
> 
>  #include <rte_ether.h>
> 
> --
> 1.8.3.1
  
Raslan Darawsheh Feb. 3, 2020, 12:23 p.m. UTC | #2
Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Matan Azrad
> Sent: Sunday, February 2, 2020 5:59 PM
> To: Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] common/mlx5: redefine Netlink include
> 
> The new RDMA-CORE versions may have the same sub-path to include the
> linux Netlink header file.
> 
> It uses the pre-proccessor command #include_next what breaks the PMD
> gcc compilation of common/mlx5_netlink.h file in debug mode.
> 
> Use specific include for linux/netlink.h to be taken from /usr/include/linux.
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/common/mlx5/mlx5_nl.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/common/mlx5/mlx5_nl.h
> b/drivers/common/mlx5/mlx5_nl.h index 2c3f837..ebaa655 100644
> --- a/drivers/common/mlx5/mlx5_nl.h
> +++ b/drivers/common/mlx5/mlx5_nl.h
> @@ -5,7 +5,7 @@
>  #ifndef RTE_PMD_MLX5_NL_H_
>  #define RTE_PMD_MLX5_NL_H_
> 
> -#include <linux/netlink.h>
> +#include "/usr/include/linux/netlink.h"
> 
>  #include <rte_ether.h>
> 
> --
> 1.8.3.1

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  
Ferruh Yigit Feb. 3, 2020, 2:24 p.m. UTC | #3
On 2/2/2020 3:59 PM, Matan Azrad wrote:
> The new RDMA-CORE versions may have the same sub-path to include the
> linux Netlink header file.
> 
> It uses the pre-proccessor command #include_next what breaks the PMD gcc
> compilation of common/mlx5_netlink.h file in debug mode.
> 
> Use specific include for linux/netlink.h to be taken from
> /usr/include/linux.
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/common/mlx5/mlx5_nl.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/common/mlx5/mlx5_nl.h b/drivers/common/mlx5/mlx5_nl.h
> index 2c3f837..ebaa655 100644
> --- a/drivers/common/mlx5/mlx5_nl.h
> +++ b/drivers/common/mlx5/mlx5_nl.h
> @@ -5,7 +5,7 @@
>  #ifndef RTE_PMD_MLX5_NL_H_
>  #define RTE_PMD_MLX5_NL_H_
>  
> -#include <linux/netlink.h>
> +#include "/usr/include/linux/netlink.h"

It is odd to change the include to the exact path, can't this be fixed other
way, can you please give more details on the issue and the macro etc..?
  
Matan Azrad Feb. 3, 2020, 3:02 p.m. UTC | #4
From: Ferruh Yigit
> On 2/2/2020 3:59 PM, Matan Azrad wrote:
> > The new RDMA-CORE versions may have the same sub-path to include the
> > linux Netlink header file.
> >
> > It uses the pre-proccessor command #include_next what breaks the PMD
> > gcc compilation of common/mlx5_netlink.h file in debug mode.
> >
> > Use specific include for linux/netlink.h to be taken from
> > /usr/include/linux.
> >
> > Signed-off-by: Matan Azrad <matan@mellanox.com>
> > ---
> >  drivers/common/mlx5/mlx5_nl.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/common/mlx5/mlx5_nl.h
> > b/drivers/common/mlx5/mlx5_nl.h index 2c3f837..ebaa655 100644
> > --- a/drivers/common/mlx5/mlx5_nl.h
> > +++ b/drivers/common/mlx5/mlx5_nl.h
> > @@ -5,7 +5,7 @@
> >  #ifndef RTE_PMD_MLX5_NL_H_
> >  #define RTE_PMD_MLX5_NL_H_
> >
> > -#include <linux/netlink.h>
> > +#include "/usr/include/linux/netlink.h"
> 
> It is odd to change the include to the exact path, can't this be fixed other
> way, can you please give more details on the issue and the macro etc..?

I tried to find other solution but didn't find.

As I wrote in commit log, the #include_next (from RDMA-CORE) is not compiled when we compile with mlx5 debug mode (pedantic).
The error is " error: #include_next is a GCC extension [-Werror]"
Even If I wrap the relevant include line to disable pedantic it is not compiled with gcc.

So, I changed to include specific path from the linux headers.

Do you have other suggestion?

Matan
  
Ferruh Yigit Feb. 3, 2020, 4:51 p.m. UTC | #5
On 2/3/2020 3:02 PM, Matan Azrad wrote:
> 
> 
> From: Ferruh Yigit
>> On 2/2/2020 3:59 PM, Matan Azrad wrote:
>>> The new RDMA-CORE versions may have the same sub-path to include the
>>> linux Netlink header file.
>>>
>>> It uses the pre-proccessor command #include_next what breaks the PMD
>>> gcc compilation of common/mlx5_netlink.h file in debug mode.
>>>
>>> Use specific include for linux/netlink.h to be taken from
>>> /usr/include/linux.
>>>
>>> Signed-off-by: Matan Azrad <matan@mellanox.com>
>>> ---
>>>  drivers/common/mlx5/mlx5_nl.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/common/mlx5/mlx5_nl.h
>>> b/drivers/common/mlx5/mlx5_nl.h index 2c3f837..ebaa655 100644
>>> --- a/drivers/common/mlx5/mlx5_nl.h
>>> +++ b/drivers/common/mlx5/mlx5_nl.h
>>> @@ -5,7 +5,7 @@
>>>  #ifndef RTE_PMD_MLX5_NL_H_
>>>  #define RTE_PMD_MLX5_NL_H_
>>>
>>> -#include <linux/netlink.h>
>>> +#include "/usr/include/linux/netlink.h"
>>
>> It is odd to change the include to the exact path, can't this be fixed other
>> way, can you please give more details on the issue and the macro etc..?
> 
> I tried to find other solution but didn't find.
> 
> As I wrote in commit log, the #include_next (from RDMA-CORE) is not compiled when we compile with mlx5 debug mode (pedantic).
> The error is " error: #include_next is a GCC extension [-Werror]"
> Even If I wrap the relevant include line to disable pedantic it is not compiled with gcc.
> 
> So, I changed to include specific path from the linux headers.
Is there another "linux/netlink.h" in the rdma-core? In which version, I can't
find it.

Isn't rdma libraries/header installed into system folders? Are you providing -I
to include a custom path, does it work if you provide it as '-idirafter' instead?

Please provide more details than commit log...

> 
> Do you have other suggestion?

drop 'pedantic'? Why mlx drivers are using it?
  
Matan Azrad Feb. 3, 2020, 5:08 p.m. UTC | #6
Hi

From: Ferruh Yigit
> On 2/3/2020 3:02 PM, Matan Azrad wrote:
> >
> >
> > From: Ferruh Yigit
> >> On 2/2/2020 3:59 PM, Matan Azrad wrote:
> >>> The new RDMA-CORE versions may have the same sub-path to include
> the
> >>> linux Netlink header file.
> >>>
> >>> It uses the pre-proccessor command #include_next what breaks the
> PMD
> >>> gcc compilation of common/mlx5_netlink.h file in debug mode.
> >>>
> >>> Use specific include for linux/netlink.h to be taken from
> >>> /usr/include/linux.
> >>>
> >>> Signed-off-by: Matan Azrad <matan@mellanox.com>
> >>> ---
> >>>  drivers/common/mlx5/mlx5_nl.h | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/common/mlx5/mlx5_nl.h
> >>> b/drivers/common/mlx5/mlx5_nl.h index 2c3f837..ebaa655 100644
> >>> --- a/drivers/common/mlx5/mlx5_nl.h
> >>> +++ b/drivers/common/mlx5/mlx5_nl.h
> >>> @@ -5,7 +5,7 @@
> >>>  #ifndef RTE_PMD_MLX5_NL_H_
> >>>  #define RTE_PMD_MLX5_NL_H_
> >>>
> >>> -#include <linux/netlink.h>
> >>> +#include "/usr/include/linux/netlink.h"
> >>
> >> It is odd to change the include to the exact path, can't this be
> >> fixed other way, can you please give more details on the issue and the
> macro etc..?
> >
> > I tried to find other solution but didn't find.
> >
> > As I wrote in commit log, the #include_next (from RDMA-CORE) is not
> compiled when we compile with mlx5 debug mode (pedantic).
> > The error is " error: #include_next is a GCC extension [-Werror]"
> > Even If I wrap the relevant include line to disable pedantic it is not compiled
> with gcc.
> >
> > So, I changed to include specific path from the linux headers.
> Is there another "linux/netlink.h" in the rdma-core? In which version, I can't
> find it.
> 
> Isn't rdma libraries/header installed into system folders? Are you providing -I
> to include a custom path, does it work if you provide it as '-idirafter' instead?

Yes you right, -idirafter is working, thanks.
You can drop this patch.
  
Stephen Hemminger Feb. 4, 2020, 8:59 a.m. UTC | #7
On Sun,  2 Feb 2020 15:59:13 +0000
Matan Azrad <matan@mellanox.com> wrote:

> The new RDMA-CORE versions may have the same sub-path to include the
> linux Netlink header file.
> 
> It uses the pre-proccessor command #include_next what breaks the PMD gcc
> compilation of common/mlx5_netlink.h file in debug mode.
> 
> Use specific include for linux/netlink.h to be taken from
> /usr/include/linux.
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/common/mlx5/mlx5_nl.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/common/mlx5/mlx5_nl.h b/drivers/common/mlx5/mlx5_nl.h
> index 2c3f837..ebaa655 100644
> --- a/drivers/common/mlx5/mlx5_nl.h
> +++ b/drivers/common/mlx5/mlx5_nl.h
> @@ -5,7 +5,7 @@
>  #ifndef RTE_PMD_MLX5_NL_H_
>  #define RTE_PMD_MLX5_NL_H_
>  
> -#include <linux/netlink.h>
> +#include "/usr/include/linux/netlink.h"

I think this should be fixed with CFLAGS, not hard coding path to netlink.h
Doing it this way is sure to break some cross build environments.
  

Patch

diff --git a/drivers/common/mlx5/mlx5_nl.h b/drivers/common/mlx5/mlx5_nl.h
index 2c3f837..ebaa655 100644
--- a/drivers/common/mlx5/mlx5_nl.h
+++ b/drivers/common/mlx5/mlx5_nl.h
@@ -5,7 +5,7 @@ 
 #ifndef RTE_PMD_MLX5_NL_H_
 #define RTE_PMD_MLX5_NL_H_
 
-#include <linux/netlink.h>
+#include "/usr/include/linux/netlink.h"
 
 #include <rte_ether.h>