]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
configure: fix check for DEVLINK_CMD_ESWITCH_GET
authorJán Tomko <jtomko@redhat.com>
Mon, 18 Sep 2017 17:21:47 +0000 (13:21 -0400)
committerJán Tomko <jtomko@redhat.com>
Tue, 19 Sep 2017 13:25:10 +0000 (15:25 +0200)
Instead of checking for all possible constants that every
kernel header with devlink support should have (and defining
HAVE_DECL_DEVLINK as 1 if any of them is present due to the
way AC_CHECK_DECLS works), only check for DEVLINK_CMD_ESWITCH_GET.

This is the name of the constant since kernel 4.11. Between 4.8
and 4.11, the now deprecated spelling DEVLINK_CMD_ESWITCH_MODE_GET
was used.

Assume DEVLINK_ESWITCH_MODE_SWITCHDEV is available, since it was
introduced along with the deprecated spelling.

configure.ac
src/util/virnetdev.c

index c9509c7f96edb4aacb59edb11dc4deab69e86a59..d817975a57eee57365e38077551330b5c902c40e 100644 (file)
@@ -628,15 +628,16 @@ if test "$with_linux" = "yes"; then
 fi
 
 dnl
-dnl check for kernel headers required by devlink
+dnl check for DEVLINK_CMD_ESWITCH_GET
+dnl
+dnl Assume DEVLINK_ESWITCH_MODE_SWITCHDEV is also
+dnl available, as it was introudced in kernel 4.8
+dnl along with the original spelling of this constant
+dnl (DEVLINK_CMD_ESWITCH_MODE_GET, not supported by libvirt)
 dnl
 if test "$with_linux" = "yes"; then
     AC_CHECK_HEADERS([linux/devlink.h])
-    AC_CHECK_DECLS([DEVLINK_GENL_VERSION, DEVLINK_GENL_NAME, DEVLINK_ATTR_MAX, DEVLINK_CMD_ESWITCH_GET, DEVLINK_ATTR_BUS_NAME, DEVLINK_ATTR_DEV_NAME, DEVLINK_ATTR_ESWITCH_MODE, DEVLINK_ESWITCH_MODE_SWITCHDEV],
-                   [AC_DEFINE([HAVE_DECL_DEVLINK],
-                              [1],
-                              [whether devlink declarations are available])],
-                   [],
+    AC_CHECK_DECLS([DEVLINK_CMD_ESWITCH_GET], [], [],
                    [[#include <linux/devlink.h>]])
 fi
 
index 04069392540eadce0cf154b4450662805187c058..41a659732be8d505c7afe226a22d9f68e288c59b 100644 (file)
@@ -59,7 +59,7 @@
 # include <net/if_dl.h>
 #endif
 
-#if HAVE_DECL_DEVLINK
+#if HAVE_LINUX_DEVLINK_H
 # include <linux/devlink.h>
 #endif
 
@@ -3120,7 +3120,7 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
 }
 
 
-# if HAVE_DECL_DEVLINK
+# if HAVE_DECL_DEVLINK_CMD_ESWITCH_GET
 /**
  * virNetDevPutExtraHeader
  * reserve and prepare room for an extra header