The following error is caused by the undefined dev_get_stats64() of kernel
v2.6.32-431. The HAVE_RTNL_LINK_STATS64 does not work because this series
kernel have the "struct rtnl_link_stats64" but neither have 64bit
dev_get_stats() nor dev_get_stats64(), so we should use the compat defined
rpl_dev_get_stats() here.

I just made this patch against branch-2.5 because the master branch are
dropping the support of kernel less than v3.10 now.
----
/root/rpmbuild/BUILD/openvswitch-2.5.1/_default/datapath/linux/vport.c: In 
function 'ovs_vport_get_stats':
/root/rpmbuild/BUILD/openvswitch-2.5.1/_default/datapath/linux/vport.c:328: 
error: implicit declaration of function 'dev_get_stats64'
/root/rpmbuild/BUILD/openvswitch-2.5.1/_default/datapath/linux/vport.c:328: 
warning: assignment makes pointer from integer without a cast
----

Signed-off-by: Wanlong Gao <wanlong....@easystack.cn>
---
 acinclude.m4                                    |  1 +
 datapath/linux/compat/include/linux/netdevice.h | 13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 46336a0..19ac919 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -375,6 +375,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..cb7b586 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -254,6 +254,15 @@ static inline void *skb_gro_remcsum_process(struct sk_buff 
*skb, void *ptr,
 #endif
 #endif
 
+#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
+#undef HAVE_RTNL_LINK_STATS64
+#endif
+#endif
+
 #ifndef HAVE_RTNL_LINK_STATS64
 #define dev_get_stats rpl_dev_get_stats
 struct rtnl_link_stats64 *rpl_dev_get_stats(struct net_device *dev,
@@ -266,10 +275,6 @@ struct rtnl_link_stats64 *rpl_dev_get_stats(struct 
net_device *dev,
 #endif
 #endif
 
-#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)
-/* Only required on RHEL 6. */
-#define dev_get_stats dev_get_stats64
-#endif
 
 #ifndef netdev_dbg
 #define netdev_dbg(__dev, format, args...)                     \
-- 
2.5.0

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to