eal/linux: fix build when VFIO is disabled

Message ID 20191211182522.8163-1-alialnu@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series eal/linux: fix build when VFIO is disabled |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation fail apply issues

Commit Message

Ali Alnubani Dec. 11, 2019, 6:25 p.m. UTC
  The header linux/version.h isn't included when CONFIG_RTE_EAL_VFIO
is explicitly disabled. LINUX_VERSION_CODE and KERNEL_VERSION are
therefore undefined, causing the build failure:

  lib/librte_eal/linux/eal/eal.c: In function ‘rte_eal_init’:
  lib/librte_eal/linux/eal/eal.c:1076:32: error: "LINUX_VERSION_CODE" is
    not defined, evaluates to 0 [-Werror=undef]

Fixes: a0dede62a537 ("eal/linux: remove KNI restriction on IOVA")
Cc: vattunuru@marvell.com
Cc: stable@dpdk.org

Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
---
 lib/librte_eal/linux/eal/eal.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

David Marchand Dec. 16, 2019, 5:22 p.m. UTC | #1
On Wed, Dec 11, 2019 at 7:26 PM Ali Alnubani <alialnu@mellanox.com> wrote:
> The header linux/version.h isn't included when CONFIG_RTE_EAL_VFIO
> is explicitly disabled. LINUX_VERSION_CODE and KERNEL_VERSION are
> therefore undefined, causing the build failure:
>
>   lib/librte_eal/linux/eal/eal.c: In function ‘rte_eal_init’:
>   lib/librte_eal/linux/eal/eal.c:1076:32: error: "LINUX_VERSION_CODE" is
>     not defined, evaluates to 0 [-Werror=undef]

The patch itself is ok.
But, out of curiosity, why would you disable vfio support?
  
Ali Alnubani Dec. 22, 2019, 12:13 p.m. UTC | #2
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, December 16, 2019 7:22 PM
> To: Ali Alnubani <alialnu@mellanox.com>
> Cc: dev@dpdk.org; vattunuru@marvell.com; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] eal/linux: fix build when VFIO is disabled
> 
> On Wed, Dec 11, 2019 at 7:26 PM Ali Alnubani <alialnu@mellanox.com>
> wrote:
> > The header linux/version.h isn't included when CONFIG_RTE_EAL_VFIO is
> > explicitly disabled. LINUX_VERSION_CODE and KERNEL_VERSION are
> > therefore undefined, causing the build failure:
> >
> >   lib/librte_eal/linux/eal/eal.c: In function ‘rte_eal_init’:
> >   lib/librte_eal/linux/eal/eal.c:1076:32: error: "LINUX_VERSION_CODE" is
> >     not defined, evaluates to 0 [-Werror=undef]
> 
> The patch itself is ok.
> But, out of curiosity, why would you disable vfio support?

No reason. I noticed the build error by accident actually.
> 
> 
> --
> David Marchand

Regards,
Ali
  
Thomas Monjalon Jan. 19, 2020, 10:42 p.m. UTC | #3
11/12/2019 19:25, Ali Alnubani:
> The header linux/version.h isn't included when CONFIG_RTE_EAL_VFIO
> is explicitly disabled. LINUX_VERSION_CODE and KERNEL_VERSION are
> therefore undefined, causing the build failure:
> 
>   lib/librte_eal/linux/eal/eal.c: In function ‘rte_eal_init’:
>   lib/librte_eal/linux/eal/eal.c:1076:32: error: "LINUX_VERSION_CODE" is
>     not defined, evaluates to 0 [-Werror=undef]
> 
> Fixes: a0dede62a537 ("eal/linux: remove KNI restriction on IOVA")
> Cc: vattunuru@marvell.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ali Alnubani <alialnu@mellanox.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index c4233ec3c..9530ee55f 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -25,6 +25,7 @@ 
 #if defined(RTE_ARCH_X86)
 #include <sys/io.h>
 #endif
+#include <linux/version.h>
 
 #include <rte_compat.h>
 #include <rte_common.h>