summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-02-04 12:35:49 -0800
committerBen Pfaff <blp@nicira.com>2011-02-04 12:36:21 -0800
commit1269f7ae5f4bf23205de2cd45220b2382af78393 (patch)
treec34356f33f39ad797ab262015fdeac2ce84e2818 /include
parent5e5ce0741f8b7dbee54d1407e7b0af5ee813b38f (diff)
downloadopenvswitch-1269f7ae5f4bf23205de2cd45220b2382af78393.tar.gz
datapath: Tolerate backporting of rtnl_link_stats64 (as in RHEL 6).
Red Hat Enterprise Linux 6 has a 2.6.32 kernel but it backports the rtnl_link_stats64 structure that was introduced in 2.6.35, so we need to check whether it was defined instead of just guessing based on the kernel version number. Build-tested only, on 2.6.32-71.14.1.el6 (RHEL 6), linux-2.6.18-128.1.6.el5.xs5.5.0.496.101 (XenServer 5.5.0), 2.6.18-128.1.6.el5.xs5.5.0.505.1024xen (XenServer 5.5.0 update 1), and upstream 2.6.18, 2.6.26, 2.6.29, 2.6.33, 2.6.34, 2.6.36, all for i386, plus 2.6.36 for x86-64. My machine's userspace headers have <linux/if_link.h> but not rtnl_link_stats64. Jesse Gross tested the case where <linux/if_link.h> has rtnl_link_stats64, on Ubuntu 10.10. Reported-by: Geoff White <gwhite@nicira.com> Tested-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/if_link.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 4afc22b66..55d99e46e 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -3,6 +3,10 @@
#include <linux/version.h>
+#ifdef HAVE_RTNL_LINK_STATS64
+#include_next <linux/if_link.h>
+#else /* !HAVE_RTNL_LINK_STATS64 */
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
#include_next <linux/if_link.h>
#else
@@ -13,9 +17,8 @@
* turn only really needs __u64. */
#include <linux/types.h>
#include <linux/netlink.h>
-#endif
+#endif /* kernel < 2.6.19 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
/* The main device statistics structure */
struct rtnl_link_stats64 {
__u64 rx_packets; /* total packets received */
@@ -48,6 +51,6 @@ struct rtnl_link_stats64 {
__u64 rx_compressed;
__u64 tx_compressed;
};
-#endif /* linux kernel < 2.6.35 */
+#endif /* !HAVE_RTNL_LINK_STATS64 */
#endif