[ovs-dev] [PATCH] datapath: Add support for Linux 3.11
James Page
james.page at ubuntu.com
Thu Aug 22 10:04:46 UTC 2013
Disable GRE compat layer for >= 3.11 as datapath is in sync with
the kernel in 3.11 so use of compat no longer required.
Use netdev_notifier_info_to_dev in dp_device_event, provide
for < 3.11 in compat layer. This fix was based on this commit
from the 3.11 kernel:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/net/openvswitch?id=351638e7deeed2ec8ce451b53d33921b3da68f83
Signed-off-by: James Page <james.page at ubuntu.com>
---
FAQ | 2 +-
NEWS | 2 +-
datapath/datapath.c | 4 ++--
datapath/dp_notify.c | 2 +-
datapath/linux/compat/gre.c | 4 ++++
datapath/linux/compat/include/linux/netdevice.h | 11 +++++++++++
datapath/linux/compat/include/net/gre.h | 3 +++
7 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/FAQ b/FAQ
index 75d9007..6eb66d4 100644
--- a/FAQ
+++ b/FAQ
@@ -148,7 +148,7 @@ A: The following table lists the Linux kernel versions against which the
1.9.x 2.6.18 to 3.8
1.10.x 2.6.18 to 3.8
1.11.x 2.6.18 to 3.8
- 1.12.x 2.6.18 to 3.10
+ 1.12.x 2.6.18 to 3.11
Open vSwitch userspace should also work with the Linux kernel module
built into Linux 3.3 and later.
diff --git a/NEWS b/NEWS
index 1246383..ac6cc00 100644
--- a/NEWS
+++ b/NEWS
@@ -22,7 +22,7 @@ v1.12.0 - xx xxx xxxx
through database paths (e.g. Private key option with the database name
should look like "--private-key=db:Open_vSwitch,SSL,private_key").
- Added ovs-dev.py, a utility script helpful for Open vSwitch developers.
- - Support for Linux kernels up to 3.10
+ - Support for Linux kernels up to 3.11
- ovs-ofctl:
* New "ofp-parse" for printing OpenFlow messages read from a file.
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 48f17c0..c01a715 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -62,8 +62,8 @@
#include "vport-netdev.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) || \
- LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
-#error Kernels before 2.6.18 or after 3.9 are not supported by this version of Open vSwitch.
+ LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
+#error Kernels before 2.6.18 or after 3.11 are not supported by this version of Open vSwitch.
#endif
#define REHASH_FLOW_INTERVAL (10 * 60 * HZ)
diff --git a/datapath/dp_notify.c b/datapath/dp_notify.c
index d530893..db670e1 100644
--- a/datapath/dp_notify.c
+++ b/datapath/dp_notify.c
@@ -79,7 +79,7 @@ static int dp_device_event(struct notifier_block *unused, unsigned long event,
void *ptr)
{
struct ovs_net *ovs_net;
- struct net_device *dev = ptr;
+ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct vport *vport = NULL;
if (!ovs_is_internal_dev(dev))
diff --git a/datapath/linux/compat/gre.c b/datapath/linux/compat/gre.c
index 582bd94..d02537a 100644
--- a/datapath/linux/compat/gre.c
+++ b/datapath/linux/compat/gre.c
@@ -19,6 +19,8 @@
#include <linux/kconfig.h>
#if IS_ENABLED(CONFIG_NET_IPGRE_DEMUX)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
+
#include <linux/module.h>
#include <linux/if.h>
#include <linux/if_tunnel.h>
@@ -354,4 +356,6 @@ int gre_cisco_unregister(struct gre_cisco_protocol *proto)
return ret;
}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) */
+
#endif /* CONFIG_NET_IPGRE_DEMUX */
diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
index 2ceff22..4b2b4e5 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -208,4 +208,15 @@ static inline void netdev_upper_dev_unlink(struct net_device *dev,
}
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
+
+/* Simply pass through the passed parameter for Linux < 3.11.0 */
+static inline struct net_device *
+netdev_notifier_info_to_dev(void *info)
+{
+ return info;
+}
+
+#endif
+
#endif
diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h
index 5f46aed..a51b0bc 100644
--- a/datapath/linux/compat/include/net/gre.h
+++ b/datapath/linux/compat/include/net/gre.h
@@ -73,6 +73,8 @@ static inline __be16 tnl_flags_to_gre_flags(__be16 tflags)
}
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
+
#define MAX_GRE_PROTO_PRIORITY 255
struct gre_cisco_protocol {
int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi);
@@ -102,5 +104,6 @@ static inline int ip_gre_calc_hlen(__be16 o_flags)
return addend;
}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) */
#endif
--
1.8.3.2
More information about the dev
mailing list