[ovs-dev] [PATCH] datapath: Fix datapath build on Centos 6.5 (2.6.31-431) kernels

Ben Pfaff blp at ovn.org
Mon Jan 11 23:23:13 UTC 2016


From: Sabyasachi Sengupta <sabyasachi.sengupta at alcatel-lucent.com>

The build was failing with following error:

----
  CC [M]  /home/sabyasse/Linux/src/sandbox/ovs_v1/datapath/linux/vport.o
/home/sabyasse/Linux/src/sandbox/ovs_v1/datapath/linux/vport.c: In
function ‘ovs_vport_get_stats’:
/home/sabyasse/Linux/src/sandbox/ovs_v1/datapath/linux/vport.c:328:
error: implicit declaration of function ‘dev_get_stats64’
----

The issue is fixed by checking for existence of dev_get_stats64 in
netdevice.h and then using it (in C6.7+, 2.6.32-594 kernels). For
previous kernels use compat rpl_dev_get_stats.
---
This patch was originally submitted at:
	https://github.com/openvswitch/ovs/pull/105
I'm submitting here because I don't think any datapath reviewers
follow github pull requests.

 acinclude.m4                                    | 1 +
 datapath/linux/compat/include/linux/netdevice.h | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/acinclude.m4 b/acinclude.m4
index 9d652c2..51cb950 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -358,6 +358,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                   [OVS_DEFINE([HAVE_SOCK_CREATE_KERN_NET])])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_disable_lro])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_get_stats])
+  OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_get_stats64])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_get_by_index_rcu])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [dev_recursion_level])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [__skb_gso_segment])
diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
index 19a7b8e..6143343 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -268,7 +268,13 @@ struct rtnl_link_stats64 *rpl_dev_get_stats(struct net_device *dev,
 
 #if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)
 /* Only required on RHEL 6. */
+#ifdef HAVE_DEV_GET_STATS64
 #define dev_get_stats dev_get_stats64
+#else
+#define dev_get_stats rpl_dev_get_stats
+struct rtnl_link_stats64 *rpl_dev_get_stats(struct net_device *dev,
+					struct rtnl_link_stats64 *storage);
+#endif
 #endif
 
 #ifndef netdev_dbg
-- 
2.1.3




More information about the dev mailing list