]> git.proxmox.com Git - mirror_ovs.git/commitdiff
net: core: dev: Add extack argument to dev_change_flags()
authorPetr Machata <petrm@mellanox.com>
Wed, 12 Jun 2019 22:35:28 +0000 (15:35 -0700)
committerBen Pfaff <blp@ovn.org>
Thu, 13 Jun 2019 17:03:11 +0000 (10:03 -0700)
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>
Acked-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
acinclude.m4
datapath/linux/compat/include/linux/netdevice.h
datapath/linux/compat/ip6_gre.c
datapath/linux/compat/ip_gre.c
datapath/vport-geneve.c
datapath/vport-gre.c
datapath/vport-lisp.c
datapath/vport-stt.c
datapath/vport-vxlan.c

index eb978e0fae6cff84a5e86ae1e22838b605c07bca..93fbf0ebb84c5da6d533730e0e8a2a2cc4f2f0e6 100644 (file)
@@ -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],
index cf68ed5238d407e3886201e935c8ac09af02e249..126ff23cfa27af47f621ac85e52df9cdd3ef4ebb 100644 (file)
@@ -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 */
index 2ffdda5e1dc314296011ce5d6be988e2c5ca3e39..ca4e661335701089098c10e76b9afa64c87f6124 100644 (file)
@@ -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();
index 89ef45556dcefa13e9cbfd3447e19cbf6de8a9ad..cf8803b53075bfc0c2a1505221fa8056d8855504 100644 (file)
@@ -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();
index 14a54f1997a9a47e2995503e1a010db826e7b903..a5b91246f8ddc75c298c00cad18418a83cdb1225 100644 (file)
@@ -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();
index 1d63734f4141825bd6ff20cd55fe8b98708f7b83..07a8c19df96ed0a4480d8f4c20d2ff0fe5057045 100644 (file)
@@ -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();
index 27f40ab4272f9de56bb8db37a15f4ec0bfc95f5d..5e2bcda88ac858ad030c2ded670d119d54689fa4 100644 (file)
@@ -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();
index 31fa46245503dfa5ac9b34ab347421b3e45d1305..35c4942c5f51ef924e86c74a10658040365e7e20 100644 (file)
@@ -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();
index c7139abc89197750f504435f2998c3a5426cd268..05764467a687bd8a1c11210ef8fe57efe3f56dd9 100644 (file)
@@ -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();