Re: [PATCH 2/7] configure.ac: drop checks for ETH flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/03/2016 12:20 PM, Ján Tomko wrote:
No choices are made at configure time based on these checks.

AC_CHECK_DECLS doesn't make sense if you're using it to check for a #defined name just so you can use the new name that is #defined as a result of the check. That's what's being done here with ETHTOOL_*, so those are pointless.

However, it *can* be useful if you want to check for existence of a function name, global data name, data type, or enum value at compile time (since those *can't* be directly checked with #ifdef - it will always return false). That's what's being done with ETH_FLAG_* (they are all enum values), so I think those have to stay (if you apply this patch, you end up trying to check for them directly with #ifdef, and the result is that several of the items are omitted from the virNetDevEthtoolFeatureCmd flags array).


Drop them and use #ifdefs in virnetdev.c.
---
  configure.ac         |  5 -----
  src/util/virnetdev.c | 20 ++++++++++----------
  2 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8d7d63e..db42173 100644
--- a/configure.ac
+++ b/configure.ac
@@ -402,11 +402,6 @@ AC_CHECK_TYPE([struct sockpeercred],
    [], [[#include <sys/socket.h>
    ]])
-AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO,
-                ETHTOOL_GGSO, ETHTOOL_GGRO, ETHTOOL_GFLAGS, ETHTOOL_GFEATURES],
-  [], [], [[#include <linux/ethtool.h>
-  ]])
-
  dnl Our only use of libtasn1.h is in the testsuite, and can be skipped
  dnl if the header is not present.  Assume -ltasn1 is present if the
  dnl header could be found.
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index fa695d4..c3a35bb 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -85,7 +85,7 @@ VIR_LOG_INIT("util.netdev");
  #endif
#define RESOURCE_FILE_LEN 4096
-#if HAVE_DECL_ETHTOOL_GFEATURES
+#ifdef ETHTOOL_GFEATURES
  # define TX_UDP_TNL 25
  # define GFEATURES_SIZE 2
  # define FEATURE_WORD(blocks, index, field)  ((blocks)[(index) / 32U].field)
@@ -2446,28 +2446,28 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
          {ETHTOOL_GTXCSUM, VIR_NET_DEV_FEAT_GTXCSUM},
          {ETHTOOL_GSG, VIR_NET_DEV_FEAT_GSG},
          {ETHTOOL_GTSO, VIR_NET_DEV_FEAT_GTSO},
-# if HAVE_DECL_ETHTOOL_GGSO
+# ifdef ETHTOOL_GGSO
          {ETHTOOL_GGSO, VIR_NET_DEV_FEAT_GGSO},
  # endif
-# if HAVE_DECL_ETHTOOL_GGRO
+# ifdef ETHTOOL_GGRO
          {ETHTOOL_GGRO, VIR_NET_DEV_FEAT_GGRO},
  # endif
      };
-# if HAVE_DECL_ETHTOOL_GFLAGS
+# ifdef ETHTOOL_GFLAGS
      /* ethtool masks */
      struct virNetDevEthtoolFeatureCmd flags[] = {
-#  if HAVE_DECL_ETH_FLAG_LRO
+#  ifdef ETH_FLAG_LRO
          {ETH_FLAG_LRO, VIR_NET_DEV_FEAT_LRO},
  #  endif
-#  if HAVE_DECL_ETH_FLAG_TXVLAN
+#  ifdef ETH_FLAG_TXVLAN
          {ETH_FLAG_RXVLAN, VIR_NET_DEV_FEAT_RXVLAN},
          {ETH_FLAG_TXVLAN, VIR_NET_DEV_FEAT_TXVLAN},
  #  endif
-#  if HAVE_DECL_ETH_FLAG_NTUBLE
+#  ifdef ETH_FLAG_NTUPLE
          {ETH_FLAG_NTUPLE, VIR_NET_DEV_FEAT_NTUPLE},
  #  endif
-#  if HAVE_DECL_ETH_FLAG_RXHASH
+#  ifdef ETH_FLAG_RXHASH
          {ETH_FLAG_RXHASH, VIR_NET_DEV_FEAT_RXHASH},
  #  endif
      };
@@ -2479,7 +2479,7 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
              ignore_value(virBitmapSetBit(bitmap, ethtool_cmds[i].feat));
      }
-# if HAVE_DECL_ETHTOOL_GFLAGS
+# ifdef ETHTOOL_GFLAGS
      cmd.cmd = ETHTOOL_GFLAGS;
      if (virNetDevFeatureAvailable(fd, ifr, &cmd)) {
          for (i = 0; i < ARRAY_CARDINALITY(flags); i++) {
@@ -2491,7 +2491,7 @@ virNetDevGetEthtoolFeatures(virBitmapPtr bitmap,
  }
-# if HAVE_DECL_ETHTOOL_GFEATURES
+# ifdef ETHTOOL_GFEATURES
  /**
   * virNetDevGFeatureAvailable
   * This function checks for the availability of a network device gfeature


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]