[ovs-dev,1/5] datapath: Check extack argument of rtnl_create_link()
diff mbox series

Message ID 1560210191-9414-2-git-send-email-pkusunyifeng@gmail.com
State Changes Requested
Headers show
Series
  • datapath: Support 5.0.x kernel version
Related show

Commit Message

Yifeng Sun June 10, 2019, 11:43 p.m. UTC
Upstream commit d0522f1cd25edb796548f91e04766fa3cbc3b6df ("net:
Add extack argument to rtnl_create_link") added new argument
to rtnl_create_link(). This introduced compiling errors in
the code of kernel datapath.

This patch fixes this issue.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 acinclude.m4                                  | 3 +++
 datapath/linux/compat/include/net/rtnetlink.h | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Yi-Hung Wei June 12, 2019, 9:18 p.m. UTC | #1
On Mon, Jun 10, 2019 at 4:44 PM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
>
> Upstream commit d0522f1cd25edb796548f91e04766fa3cbc3b6df ("net:
> Add extack argument to rtnl_create_link") added new argument
> to rtnl_create_link(). This introduced compiling errors in
> the code of kernel datapath.
>
> This patch fixes this issue.
>
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> ---
Looks good to me. Thanks!

Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>

Patch
diff mbox series

diff --git a/acinclude.m4 b/acinclude.m4
index 08686044f635..6783512a68f3 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -681,6 +681,9 @@  AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                                    [rcu_read_lock_held])])
   OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [lockdep_rtnl_is_held])
   OVS_GREP_IFELSE([$KSRC/include/linux/rtnetlink.h], [net_rwsem])
+  OVS_FIND_PARAM_IFELSE([$KSRC/include/net/rtnetlink.h],
+                        [rtnl_create_link], [extack],
+                        [OVS_DEFINE([HAVE_RTNL_CREATE_LINK_TAKES_EXTACK])])
 
   # Check for the proto_data_valid member in struct sk_buff.  The [^@]
   # is necessary because some versions of this header remove the
diff --git a/datapath/linux/compat/include/net/rtnetlink.h b/datapath/linux/compat/include/net/rtnetlink.h
index 74d6a27b799f..e026cab9530d 100644
--- a/datapath/linux/compat/include/net/rtnetlink.h
+++ b/datapath/linux/compat/include/net/rtnetlink.h
@@ -32,7 +32,11 @@  static inline struct net_device *rpl_rtnl_create_link(struct net *net, const cha
                                     const struct rtnl_link_ops *ops,
                                     struct nlattr *tb[])
 {
+#ifdef HAVE_RTNL_CREATE_LINK_TAKES_EXTACK
+	return rtnl_create_link(net, (char *) ifname, name_assign_type, ops, tb, NULL);
+#else
 	return rtnl_create_link(net, (char *) ifname, name_assign_type, ops, tb);
+#endif
 }
 #endif