[ovs-dev] [PATCH 3/3] datapath: Fix build with backported dev_get_stats().

Justin Pettit jpettit at nicira.com
Mon May 17 21:33:01 UTC 2010


An upcoming backport adds dev_get_stats() to a pre-2.6.29 Linux kernel, so we
have to check for the presence of an dev_get_stats() definition instead of for
the particular kernel version.
---
 acinclude.m4                                       |    2 ++
 .../linux-2.6/compat-2.6/include/linux/netdevice.h |    2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index dcd6329..92f058a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -150,6 +150,8 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [
 
   OVS_GREP_IFELSE([$KSRC26/include/linux/netdevice.h], [dev_disable_lro],
                   [OVS_DEFINE([HAVE_DEV_DISABLE_LRO])])
+  OVS_GREP_IFELSE([$KSRC26/include/linux/netdevice.h], [dev_get_stats],
+                  [OVS_DEFINE([HAVE_DEV_GET_STATS])])
 
   # Check for the proto_data_valid member in struct sk_buff.  The [^@]
   # is necessary because some versions of this header remove the
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
index 2a05f37..1e354e7 100644
--- a/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
+++ b/datapath/linux-2.6/compat-2.6/include/linux/netdevice.h
@@ -77,7 +77,7 @@ extern void unregister_netdevice_many(struct list_head *head);
 extern void dev_disable_lro(struct net_device *dev);
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+#ifndef HAVE_DEV_GET_STATS
 static inline const struct net_device_stats *
 dev_get_stats(struct net_device *dev)
 {
-- 
1.7.1





More information about the dev mailing list