diff mbox series

[ovs-dev,4/5] net: core: dev: Add extack argument to dev_change_flags()

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

Commit Message

Yifeng Sun June 10, 2019, 11:43 p.m. UTC
From: Petr Machata <petrm@mellanox.com>

Upstream commit:
    commit 567c5e13be5cc74d24f5eb54cf353c2e2277189b
    Author: Petr Machata <petrm@mellanox.com>
    Date:   Thu Dec 6 17:05:42 2018 +0000

    net: core: dev: Add extack argument to dev_change_flags()

    In order to pass extack together with NETDEV_PRE_UP notifications, it's
    necessary to route the extack to __dev_open() from diverse (possibly
    indirect) callers. One prominent API through which the notification is
    invoked is dev_change_flags().

    Therefore extend dev_change_flags() with and extra extack argument and
    update all users. Most of the calls end up just encoding NULL, but
    several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.

    Since the function declaration line is changed anyway, name the other
    function arguments to placate checkpatch.

    Signed-off-by: Petr Machata <petrm@mellanox.com>
    Acked-by: Jiri Pirko <jiri@mellanox.com>
    Reviewed-by: Ido Schimmel <idosch@mellanox.com>
    Reviewed-by: David Ahern <dsahern@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

This patch backports the above upstream patch and also adds fixes
in compat code.

Cc: Petr Machata <petrm@mellanox.com>
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 acinclude.m4                                    |  3 +++
 datapath/linux/compat/include/linux/netdevice.h | 10 ++++++++++
 datapath/linux/compat/ip6_gre.c                 |  4 ++--
 datapath/linux/compat/ip_gre.c                  |  4 ++--
 datapath/vport-geneve.c                         |  2 +-
 datapath/vport-gre.c                            |  2 +-
 datapath/vport-lisp.c                           |  2 +-
 datapath/vport-stt.c                            |  2 +-
 datapath/vport-vxlan.c                          |  2 +-
 9 files changed, 22 insertions(+), 9 deletions(-)

Comments

0-day Robot June 11, 2019, 12:11 a.m. UTC | #1
Bleep bloop.  Greetings Yifeng Sun, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Author Petr Machata <petrm@mellanox.com> needs to sign off.
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Yifeng Sun <pkusunyifeng@gmail.com>
Lines checked: 192, Warnings: 1, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Yi-Hung Wei June 12, 2019, 9:19 p.m. UTC | #2
On Mon, Jun 10, 2019 at 4:45 PM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
>
> From: Petr Machata <petrm@mellanox.com>
>
> Upstream commit:
>     commit 567c5e13be5cc74d24f5eb54cf353c2e2277189b
>     Author: Petr Machata <petrm@mellanox.com>
>     Date:   Thu Dec 6 17:05:42 2018 +0000
>
>     net: core: dev: Add extack argument to dev_change_flags()
>
>     In order to pass extack together with NETDEV_PRE_UP notifications, it's
>     necessary to route the extack to __dev_open() from diverse (possibly
>     indirect) callers. One prominent API through which the notification is
>     invoked is dev_change_flags().
>
>     Therefore extend dev_change_flags() with and extra extack argument and
>     update all users. Most of the calls end up just encoding NULL, but
>     several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.
>
>     Since the function declaration line is changed anyway, name the other
>     function arguments to placate checkpatch.
>
>     Signed-off-by: Petr Machata <petrm@mellanox.com>
>     Acked-by: Jiri Pirko <jiri@mellanox.com>
>     Reviewed-by: Ido Schimmel <idosch@mellanox.com>
>     Reviewed-by: David Ahern <dsahern@gmail.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
>
> This patch backports the above upstream patch and also adds fixes
> in compat code.
>
> Cc: Petr Machata <petrm@mellanox.com>
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> ---
LGTM.

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

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index eb978e0fae6c..93fbf0ebb84c 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -617,6 +617,9 @@  AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
                         [max_mtu])
   OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops_extended],
                         [ndo_change_mtu], [OVS_DEFINE([HAVE_RHEL7_MAX_MTU])])
+  OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h],
+                        [dev_change_flags], [extack],
+                        [OVS_DEFINE([HAVE_DEV_CHANGE_FLAGS_TAKES_EXTACK])])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state])
   OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hook_state],
diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
index cf68ed5238d4..126ff23cfa27 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -323,4 +323,14 @@  static inline void netif_keep_dst(struct net_device *dev)
 }
 #endif
 
+#ifndef HAVE_DEV_CHANGE_FLAGS_TAKES_EXTACK
+static inline int rpl_dev_change_flags(struct net_device *dev,
+				       unsigned int flags,
+				       struct netlink_ext_ack *extack)
+{
+	return dev_change_flags(dev, flags);
+}
+#define dev_change_flags rpl_dev_change_flags
+#endif
+
 #endif /* __LINUX_NETDEVICE_WRAPPER_H */
diff --git a/datapath/linux/compat/ip6_gre.c b/datapath/linux/compat/ip6_gre.c
index 2ffdda5e1dc3..ca4e66133570 100644
--- a/datapath/linux/compat/ip6_gre.c
+++ b/datapath/linux/compat/ip6_gre.c
@@ -2647,7 +2647,7 @@  static struct vport *erspan6_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
@@ -2748,7 +2748,7 @@  static struct vport *ip6gre_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index 89ef45556dce..cf8803b53075 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -1500,7 +1500,7 @@  static struct vport *erspan_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
@@ -1554,7 +1554,7 @@  static struct vport *ipgre_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
diff --git a/datapath/vport-geneve.c b/datapath/vport-geneve.c
index 14a54f1997a9..a5b91246f8dd 100644
--- a/datapath/vport-geneve.c
+++ b/datapath/vport-geneve.c
@@ -93,7 +93,7 @@  static struct vport *geneve_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index 1d63734f4141..07a8c19df96e 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -68,7 +68,7 @@  static struct vport *gre_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
index 27f40ab4272f..5e2bcda88ac8 100644
--- a/datapath/vport-lisp.c
+++ b/datapath/vport-lisp.c
@@ -92,7 +92,7 @@  static struct vport *lisp_tnl_create(const struct vport_parms *parms)
 		ovs_vport_free(vport);
 		return ERR_CAST(dev);
 	}
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
diff --git a/datapath/vport-stt.c b/datapath/vport-stt.c
index 31fa46245503..35c4942c5f51 100644
--- a/datapath/vport-stt.c
+++ b/datapath/vport-stt.c
@@ -95,7 +95,7 @@  static struct vport *stt_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();
diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c
index c7139abc8919..05764467a687 100644
--- a/datapath/vport-vxlan.c
+++ b/datapath/vport-vxlan.c
@@ -162,7 +162,7 @@  static struct vport *vxlan_tnl_create(const struct vport_parms *parms)
 		return ERR_CAST(dev);
 	}
 
-	err = dev_change_flags(dev, dev->flags | IFF_UP);
+	err = dev_change_flags(dev, dev->flags | IFF_UP, NULL);
 	if (err < 0) {
 		rtnl_delete_link(dev);
 		rtnl_unlock();