diff mbox series

[ovs-dev,V2,10/16] datapath: Fixup RTNL ops for kernel 4.13

Message ID 1505164269-9455-10-git-send-email-gvrose8192@gmail.com
State Accepted
Headers show
Series [ovs-dev,V2,01/16] acinclude: Check for SKB_GSO_UDP | expand

Commit Message

Gregory Rose Sept. 11, 2017, 9:11 p.m. UTC
The RTNL ops validate and newlink functions now take the extended
netlink ack parameter.  Use the new HAVE_EXT_ACK_IN_RTNL_LINKOPS
define to check if the additional parameter is present and add the
parameter if so.

While in the modules remove the checks for Linux kernels < 2.3.39
since they are no longer supported since 2.5.x.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/linux/compat/lisp.c | 21 ++++++++++-----------
 datapath/linux/compat/stt.c  | 11 +++++++++++
 2 files changed, 21 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/datapath/linux/compat/lisp.c b/datapath/linux/compat/lisp.c
index c505fad..34f8232 100644
--- a/datapath/linux/compat/lisp.c
+++ b/datapath/linux/compat/lisp.c
@@ -608,7 +608,12 @@  static const struct nla_policy lisp_policy[IFLA_LISP_MAX + 1] = {
 	[IFLA_LISP_PORT]              = { .type = NLA_U16 },
 };
 
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
+static int lisp_validate(struct nlattr *tb[], struct nlattr *data[],
+			 struct netlink_ext_ack __always_unused *extack)
+#else
 static int lisp_validate(struct nlattr *tb[], struct nlattr *data[])
+#endif
 {
 	if (tb[IFLA_ADDRESS]) {
 		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
@@ -660,17 +665,15 @@  static int lisp_configure(struct net *net, struct net_device *dev,
 	return 0;
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
 static int lisp_newlink(struct net *net, struct net_device *dev,
-		struct nlattr *tb[], struct nlattr *data[])
-{
+		struct nlattr *tb[], struct nlattr *data[],
+		struct netlink_ext_ack __always_unused *extack)
 #else
-static int lisp_newlink(struct net_device *dev,
+static int lisp_newlink(struct net *net, struct net_device *dev,
 		struct nlattr *tb[], struct nlattr *data[])
-
-{
-	struct net *net = &init_net;
 #endif
+{
 	__be16 dst_port = htons(LISP_UDP_PORT);
 
 	if (data[IFLA_LISP_PORT])
@@ -679,11 +682,7 @@  static int lisp_newlink(struct net_device *dev,
 	return lisp_configure(net, dev, dst_port);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 static void lisp_dellink(struct net_device *dev, struct list_head *head)
-#else
-static void lisp_dellink(struct net_device *dev)
-#endif
 {
 	struct lisp_dev *lisp = netdev_priv(dev);
 
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
index 964d993..07f5892 100644
--- a/datapath/linux/compat/stt.c
+++ b/datapath/linux/compat/stt.c
@@ -1909,7 +1909,12 @@  static const struct nla_policy stt_policy[IFLA_STT_MAX + 1] = {
 	[IFLA_STT_PORT]              = { .type = NLA_U16 },
 };
 
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
+static int stt_validate(struct nlattr *tb[], struct nlattr *data[],
+			struct netlink_ext_ack __always_unused *extack)
+#else
 static int stt_validate(struct nlattr *tb[], struct nlattr *data[])
+#endif
 {
 	if (tb[IFLA_ADDRESS]) {
 		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
@@ -1961,8 +1966,14 @@  static int stt_configure(struct net *net, struct net_device *dev,
 	return 0;
 }
 
+#ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
+static int stt_newlink(struct net *net, struct net_device *dev,
+		struct nlattr *tb[], struct nlattr *data[],
+		struct netlink_ext_ack __always_unused *extack)
+#else
 static int stt_newlink(struct net *net, struct net_device *dev,
 		struct nlattr *tb[], struct nlattr *data[])
+#endif
 {
 	__be16 dst_port = htons(STT_DST_PORT);