[ovs-dev,1/6] datapath: Fix netdev_master_upper_dev_link for 4.14

Message ID 1512518481-5944-2-git-send-email-gvrose8192@gmail.com
State New
Headers show
Series
  • Enable OVS on Linux 4.14 kernel
Related show

Commit Message

Greg Rose Dec. 6, 2017, 12:01 a.m.
An extended netlink ack has been added for 4.14 - add compat layer
changes so that it compiles for all kernels up to and including
4.14.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 acinclude.m4                                    |  3 +++
 datapath/linux/compat/include/linux/netdevice.h | 15 ++++++++++++++-
 datapath/vport-netdev.c                         |  9 ++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 1179a40..6511a24 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -785,6 +785,9 @@  AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_ops],
                         [list],
                         [OVS_DEFINE([HAVE_LIST_IN_NF_HOOK_OPS])])
+  OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h],
+                        [netdev_master_upper_dev_link], [extack],
+                        [OVS_DEFINE([HAVE_UPPER_DEV_LINK_EXTACK])])
 
   if cmp -s datapath/linux/kcompat.h.new \
             datapath/linux/kcompat.h >/dev/null 2>&1; then
diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
index 3c3cf42..c460332 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -101,13 +101,26 @@  static inline bool netif_needs_gso(struct sk_buff *skb,
 #ifndef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH
 static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev,
 					       struct net_device *upper_dev,
-					       void *upper_priv, void *upper_info)
+					       void *upper_priv,
+					       void *upper_info, void *extack)
 {
 	return netdev_master_upper_dev_link(dev, upper_dev);
 }
 #define netdev_master_upper_dev_link rpl_netdev_master_upper_dev_link
 
 #endif
+#else
+#ifndef HAVE_UPPER_DEV_LINK_EXTACK
+static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev,
+					       struct net_device *upper_dev,
+					       void *upper_priv,
+					       void *upper_info, void *extack)
+{
+	return netdev_master_upper_dev_link(dev, upper_dev, upper_priv,
+					    upper_info);
+}
+#define netdev_master_upper_dev_link rpl_netdev_master_upper_dev_link
+#endif
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 697c442..e2d8eaf 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -112,8 +112,15 @@  struct vport *ovs_netdev_link(struct vport *vport, const char *name)
 	}
 
 	rtnl_lock();
+#ifdef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH
 	err = netdev_master_upper_dev_link(vport->dev,
-					   get_dpdev(vport->dp), NULL, NULL);
+					   get_dpdev(vport->dp),
+					   NULL, NULL);
+#else
+	err = netdev_master_upper_dev_link(vport->dev,
+					   get_dpdev(vport->dp),
+					   NULL, NULL, NULL);
+#endif
 	if (err)
 		goto error_unlock;