net: Add extack to upper device linking
authorDavid Ahern <dsahern@gmail.com>
Thu, 5 Oct 2017 00:48:47 +0000 (17:48 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Oct 2017 04:39:33 +0000 (21:39 -0700)
Add extack arg to netdev_upper_dev_link and netdev_master_upper_dev_link

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
19 files changed:
drivers/net/bonding/bond_main.c
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/ipvlan/ipvlan_main.c
drivers/net/macsec.c
drivers/net/macvlan.c
drivers/net/macvtap.c
drivers/net/team/team.c
drivers/net/usb/qmi_wwan.c
drivers/net/vrf.c
include/linux/if_macvlan.h
include/linux/netdevice.h
net/8021q/vlan.c
net/8021q/vlan.h
net/8021q/vlan_netlink.c
net/batman-adv/hard-interface.c
net/bridge/br_if.c
net/core/dev.c
net/openvswitch/vport-netdev.c

index 78feb94a36db9152c33ec967f76f335562b73e8c..bc92307c2082f9a2ae891248046efdf80e8d886f 100644 (file)
@@ -1217,14 +1217,15 @@ static enum netdev_lag_tx_type bond_lag_tx_type(struct bonding *bond)
        }
 }
 
-static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave)
+static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave,
+                                     struct netlink_ext_ack *extack)
 {
        struct netdev_lag_upper_info lag_upper_info;
        int err;
 
        lag_upper_info.tx_type = bond_lag_tx_type(bond);
        err = netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
-                                          &lag_upper_info);
+                                          &lag_upper_info, extack);
        if (err)
                return err;
        rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL);
@@ -1710,7 +1711,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
                goto err_detach;
        }
 
-       res = bond_master_upper_dev_link(bond, new_slave);
+       res = bond_master_upper_dev_link(bond, new_slave, extack);
        if (res) {
                netdev_dbg(bond_dev, "Error %d calling bond_master_upper_dev_link\n", res);
                goto err_unregister;
index 98f22551eb455a686fcdb8baada068fcfb6e89ae..1af326a60cbbf05e9479a151e280866878a60488 100644 (file)
@@ -178,7 +178,7 @@ static int rmnet_newlink(struct net *src_net, struct net_device *dev,
        if (err)
                goto err1;
 
-       err = netdev_master_upper_dev_link(dev, real_dev, NULL, NULL);
+       err = netdev_master_upper_dev_link(dev, real_dev, NULL, NULL, extack);
        if (err)
                goto err2;
 
index f300ae61c6c6ced41d706584230187d42750c52a..dfb986421ec6fa64369ae09b1b5a55ca8588528d 100644 (file)
@@ -1748,7 +1748,7 @@ static int netvsc_vf_join(struct net_device *vf_netdev,
                goto rx_handler_failed;
        }
 
-       ret = netdev_upper_dev_link(vf_netdev, ndev);
+       ret = netdev_upper_dev_link(vf_netdev, ndev, NULL);
        if (ret != 0) {
                netdev_err(vf_netdev,
                           "can not set master device %s (err = %d)\n",
index c74893c1e6200849fcd6293e19a7813e21a6ebae..57c3856bab05542320fa0109e1400fb079295c08 100644 (file)
@@ -584,7 +584,7 @@ int ipvlan_link_new(struct net *src_net, struct net_device *dev,
        if (err < 0)
                goto remove_ida;
 
-       err = netdev_upper_dev_link(phy_dev, dev);
+       err = netdev_upper_dev_link(phy_dev, dev, extack);
        if (err) {
                goto unregister_netdev;
        }
index 98e4deaa3a6a1c2f89d55e8f2db54b6fc93380be..ccbe4eaffe4df6b25e3cbceee856bca050640a0d 100644 (file)
@@ -3244,7 +3244,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
                                       &macsec_netdev_addr_lock_key,
                                       macsec_get_nest_level(dev));
 
-       err = netdev_upper_dev_link(real_dev, dev);
+       err = netdev_upper_dev_link(real_dev, dev, extack);
        if (err < 0)
                goto unregister;
 
index 1ffe77e95d46c5ff21a06ce0df9c4992353abde1..858bd66511a270f70a675d6cf4651b512ddc9352 100644 (file)
@@ -1344,7 +1344,8 @@ static int macvlan_changelink_sources(struct macvlan_dev *vlan, u32 mode,
 }
 
 int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
-                          struct nlattr *tb[], struct nlattr *data[])
+                          struct nlattr *tb[], struct nlattr *data[],
+                          struct netlink_ext_ack *extack)
 {
        struct macvlan_dev *vlan = netdev_priv(dev);
        struct macvlan_port *port;
@@ -1433,7 +1434,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
                goto destroy_macvlan_port;
 
        dev->priv_flags |= IFF_MACVLAN;
-       err = netdev_upper_dev_link(lowerdev, dev);
+       err = netdev_upper_dev_link(lowerdev, dev, extack);
        if (err)
                goto unregister_netdev;
 
@@ -1456,7 +1457,7 @@ static int macvlan_newlink(struct net *src_net, struct net_device *dev,
                           struct nlattr *tb[], struct nlattr *data[],
                           struct netlink_ext_ack *extack)
 {
-       return macvlan_common_newlink(src_net, dev, tb, data);
+       return macvlan_common_newlink(src_net, dev, tb, data, extack);
 }
 
 void macvlan_dellink(struct net_device *dev, struct list_head *head)
index c2d0ea2fb01933d46e43b84fbf255901f18e5b91..f62aea2fcfa9c3fb0939a3ee888518e37c0c9c80 100644 (file)
@@ -105,7 +105,7 @@ static int macvtap_newlink(struct net *src_net, struct net_device *dev,
        /* Don't put anything that may fail after macvlan_common_newlink
         * because we can't undo what it does.
         */
-       err = macvlan_common_newlink(src_net, dev, tb, data);
+       err = macvlan_common_newlink(src_net, dev, tb, data, extack);
        if (err) {
                netdev_rx_handler_unregister(dev);
                return err;
index 4359d45aa131af174079785b5f6bbfa8eaa0b8fc..a468439969df7f7166c3116bfaa543f82ae52c91 100644 (file)
@@ -1112,7 +1112,7 @@ static int team_upper_dev_link(struct team *team, struct team_port *port)
 
        lag_upper_info.tx_type = team->mode->lag_tx_type;
        err = netdev_master_upper_dev_link(port->dev, team->dev, NULL,
-                                          &lag_upper_info);
+                                          &lag_upper_info, NULL);
        if (err)
                return err;
        port->dev->priv_flags |= IFF_TEAM_PORT;
index 8c373360827108855717f6d139034ff9f264bf0b..db7279d5b250f8046df82422eceaa78716b79313 100644 (file)
@@ -221,7 +221,7 @@ static int qmimux_register_device(struct net_device *real_dev, u8 mux_id)
        /* Account for reference in struct qmimux_priv_priv */
        dev_hold(real_dev);
 
-       err = netdev_upper_dev_link(real_dev, new_dev);
+       err = netdev_upper_dev_link(real_dev, new_dev, NULL);
        if (err)
                goto out_unregister_netdev;
 
index 4a082ef535334e7bf703305357b1337f6eed7ab2..77d0655a02506f83fa4152957155758ecb40ea9f 100644 (file)
@@ -764,7 +764,8 @@ static void cycle_netdev(struct net_device *dev)
        }
 }
 
-static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
+static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
+                           struct netlink_ext_ack *extack)
 {
        int ret;
 
@@ -775,7 +776,7 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
                return -EOPNOTSUPP;
 
        port_dev->priv_flags |= IFF_L3MDEV_SLAVE;
-       ret = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL);
+       ret = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL, extack);
        if (ret < 0)
                goto err;
 
@@ -794,7 +795,7 @@ static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
        if (netif_is_l3_master(port_dev) || netif_is_l3_slave(port_dev))
                return -EINVAL;
 
-       return do_vrf_add_slave(dev, port_dev);
+       return do_vrf_add_slave(dev, port_dev, extack);
 }
 
 /* inverse of do_vrf_add_slave */
index c9ec1343d1879cc463ffe50afcee143623350b5d..10e319f41fb141bcbd37c2a6aadc540f1a3d37ed 100644 (file)
@@ -72,7 +72,8 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
 extern void macvlan_common_setup(struct net_device *dev);
 
 extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
-                                 struct nlattr *tb[], struct nlattr *data[]);
+                                 struct nlattr *tb[], struct nlattr *data[],
+                                 struct netlink_ext_ack *extack);
 
 extern void macvlan_count_rx(const struct macvlan_dev *vlan,
                             unsigned int len, bool success,
index 368a5064a487d7791bf90fd2e06586030e99b6a9..31bb3010c69b1bab08b1a632fe7c528243fdca35 100644 (file)
@@ -3919,10 +3919,12 @@ void *netdev_adjacent_get_private(struct list_head *adj_list);
 void *netdev_lower_get_first_private_rcu(struct net_device *dev);
 struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
 struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
-int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
+int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev,
+                         struct netlink_ext_ack *extack);
 int 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,
+                                struct netlink_ext_ack *extack);
 void netdev_upper_dev_unlink(struct net_device *dev,
                             struct net_device *upper_dev);
 void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
index 9649579b5b9f38aff6ce7a990d2dc1ddb1d85e12..71c3e045505bef2099ecdab35cc13b6fedff2f56 100644 (file)
@@ -138,7 +138,7 @@ int vlan_check_real_dev(struct net_device *real_dev,
        return 0;
 }
 
-int register_vlan_dev(struct net_device *dev)
+int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack)
 {
        struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
        struct net_device *real_dev = vlan->real_dev;
@@ -174,7 +174,7 @@ int register_vlan_dev(struct net_device *dev)
        if (err < 0)
                goto out_uninit_mvrp;
 
-       err = netdev_upper_dev_link(real_dev, dev);
+       err = netdev_upper_dev_link(real_dev, dev, extack);
        if (err)
                goto out_unregister_netdev;
 
@@ -270,7 +270,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
        vlan->flags = VLAN_FLAG_REORDER_HDR;
 
        new_dev->rtnl_link_ops = &vlan_link_ops;
-       err = register_vlan_dev(new_dev);
+       err = register_vlan_dev(new_dev, NULL);
        if (err < 0)
                goto out_free_newdev;
 
index df8bd65dd370e225c8e410202d8130b9857aac5d..94f8eed9f9b36d5fa8f528fc42e13ae184c60e49 100644 (file)
@@ -107,7 +107,7 @@ void vlan_dev_get_realdev_name(const struct net_device *dev, char *result);
 int vlan_check_real_dev(struct net_device *real_dev,
                        __be16 protocol, u16 vlan_id);
 void vlan_setup(struct net_device *dev);
-int register_vlan_dev(struct net_device *dev);
+int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack);
 void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
 bool vlan_dev_inherit_address(struct net_device *dev,
                              struct net_device *real_dev);
index 5e831de3103e2f7092c7fa15534def403bc62fb4..6e7c5a6a7930a17b95a7e067cc5a77762284b336 100644 (file)
@@ -160,7 +160,7 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
        if (err < 0)
                return err;
 
-       return register_vlan_dev(dev);
+       return register_vlan_dev(dev, extack);
 }
 
 static inline size_t vlan_qos_map_size(unsigned int n)
index e348f76ea8c15c8901294598c02617028063bfd6..f7b413b9297e7aae3f86d4043eff9da5054ba1aa 100644 (file)
@@ -738,7 +738,7 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
        bat_priv = netdev_priv(hard_iface->soft_iface);
 
        ret = netdev_master_upper_dev_link(hard_iface->net_dev,
-                                          soft_iface, NULL, NULL);
+                                          soft_iface, NULL, NULL, NULL);
        if (ret)
                goto err_dev;
 
index f3aef22931ab22c3a47211b2eb634668714066a0..0a3fd727048deb1a47bf6a0a90f15d81947477a8 100644 (file)
@@ -540,7 +540,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 
        dev->priv_flags |= IFF_BRIDGE_PORT;
 
-       err = netdev_master_upper_dev_link(dev, br->dev, NULL, NULL);
+       err = netdev_master_upper_dev_link(dev, br->dev, NULL, NULL, NULL);
        if (err)
                goto err5;
 
index e27a6bc0ac4d0fd70931624f171152c7ff6ac438..fcddccb6be41e028c3da53e4e07d831f1e5d075f 100644 (file)
@@ -6277,11 +6277,13 @@ static void __netdev_adjacent_dev_unlink_neighbour(struct net_device *dev,
 
 static int __netdev_upper_dev_link(struct net_device *dev,
                                   struct net_device *upper_dev, bool master,
-                                  void *upper_priv, void *upper_info)
+                                  void *upper_priv, void *upper_info,
+                                  struct netlink_ext_ack *extack)
 {
        struct netdev_notifier_changeupper_info changeupper_info = {
                .info = {
                        .dev = dev,
+                       .extack = extack,
                },
                .upper_dev = upper_dev,
                .master = master,
@@ -6341,9 +6343,11 @@ rollback:
  * returns zero.
  */
 int netdev_upper_dev_link(struct net_device *dev,
-                         struct net_device *upper_dev)
+                         struct net_device *upper_dev,
+                         struct netlink_ext_ack *extack)
 {
-       return __netdev_upper_dev_link(dev, upper_dev, false, NULL, NULL);
+       return __netdev_upper_dev_link(dev, upper_dev, false,
+                                      NULL, NULL, extack);
 }
 EXPORT_SYMBOL(netdev_upper_dev_link);
 
@@ -6362,10 +6366,11 @@ EXPORT_SYMBOL(netdev_upper_dev_link);
  */
 int 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,
+                                struct netlink_ext_ack *extack)
 {
        return __netdev_upper_dev_link(dev, upper_dev, true,
-                                      upper_priv, upper_info);
+                                      upper_priv, upper_info, extack);
 }
 EXPORT_SYMBOL(netdev_master_upper_dev_link);
 
index 0389398fa4ab81a57a4b27f47ffc879f8904f446..2e5e7a41d8ef833b1d3f5076c91b0c3776259541 100644 (file)
@@ -108,7 +108,8 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name)
 
        rtnl_lock();
        err = netdev_master_upper_dev_link(vport->dev,
-                                          get_dpdev(vport->dp), NULL, NULL);
+                                          get_dpdev(vport->dp),
+                                          NULL, NULL, NULL);
        if (err)
                goto error_unlock;