net: core: dev: Add extack argument to dev_open()
authorPetr Machata <petrm@mellanox.com>
Thu, 6 Dec 2018 17:05:36 +0000 (17:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Dec 2018 21:26:06 +0000 (13:26 -0800)
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_open().

Therefore extend dev_open() with and extra extack argument and update
all users. Most of the calls end up just encoding NULL, but bond and
team drivers have the extack readily available.

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>
23 files changed:
drivers/net/bonding/bond_main.c
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
drivers/net/ethernet/cisco/enic/enic_ethtool.c
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
drivers/net/ethernet/sfc/ethtool.c
drivers/net/ethernet/sfc/falcon/ethtool.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/net_failover.c
drivers/net/team/team.c
drivers/net/wireless/intersil/hostap/hostap_main.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c
drivers/staging/fsl-dpaa2/ethsw/ethsw.c
drivers/staging/unisys/visornic/visornic_main.c
include/linux/netdevice.h
net/bluetooth/6lowpan.c
net/core/dev.c
net/core/netpoll.c
net/ipv4/ipmr.c
net/ipv6/addrconf.c
net/ipv6/ip6mr.c

index 333387f1f1fe66490cda8904a7d6c7aeb2d15287..6b34dbefa7dd2bfe6f21a0b618ef485e6eb69448 100644 (file)
@@ -1538,7 +1538,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
        slave_dev->flags |= IFF_SLAVE;
 
        /* open the slave since the application closed it */
-       res = dev_open(slave_dev);
+       res = dev_open(slave_dev, extack);
        if (res) {
                netdev_dbg(bond_dev, "Opening slave %s failed\n", slave_dev->name);
                goto err_restore_mac;
index a5fd71692c8ba7789eb6cd212a8c1917128e757e..43b42615ad8499e7c237071633a80fc7f2b9200a 100644 (file)
@@ -525,7 +525,7 @@ static int aq_set_ringparam(struct net_device *ndev,
                }
        }
        if (ndev_running)
-               err = dev_open(ndev);
+               err = dev_open(ndev, NULL);
 
 err_exit:
        return err;
index f42f7a6e1559134cabb1a4b568406e803aa31b1f..ebd5c2cf1efec75291f5c84022feeb1387a2ad47 100644 (file)
@@ -241,7 +241,7 @@ static int enic_set_ringparam(struct net_device *netdev,
        }
        enic_init_vnic_resources(enic);
        if (running) {
-               err = dev_open(netdev);
+               err = dev_open(netdev, NULL);
                if (err)
                        goto err_out;
        }
index 774beda040a16a93a80db08e9383a2fe69a85eba..8e9b95871d30810de0e7a12c028ffeecaff0def5 100644 (file)
@@ -624,7 +624,7 @@ static void hns_nic_self_test(struct net_device *ndev,
                clear_bit(NIC_STATE_TESTING, &priv->state);
 
                if (if_running)
-                       (void)dev_open(ndev);
+                       (void)dev_open(ndev, NULL);
        }
        /* Online tests aren't run; pass by default */
 
index 4563638367ace4fd323c721ef6e364fcff373128..e678b6939da39e6d9b099da0976c81b5bda4f914 100644 (file)
@@ -821,7 +821,7 @@ static int hns3_set_ringparam(struct net_device *ndev,
        }
 
        if (if_running)
-               ret = dev_open(ndev);
+               ret = dev_open(ndev, NULL);
 
        return ret;
 }
index 3143588ffd77736479758d2bb7eae4f14ba5df9c..600d7b895cf2ff7be6d0d7b9bd856f7e3ed03796 100644 (file)
@@ -539,7 +539,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
        /* We need rx buffers and interrupts. */
        already_up = (efx->net_dev->flags & IFF_UP);
        if (!already_up) {
-               rc = dev_open(efx->net_dev);
+               rc = dev_open(efx->net_dev, NULL);
                if (rc) {
                        netif_err(efx, drv, efx->net_dev,
                                  "failed opening device.\n");
index 1ccdb7a82e2a76e8ab1c43e079dd052c82573ad1..72cedec945c1869003f891078e5ca071a72efbc7 100644 (file)
@@ -517,7 +517,7 @@ static void ef4_ethtool_self_test(struct net_device *net_dev,
        /* We need rx buffers and interrupts. */
        already_up = (efx->net_dev->flags & IFF_UP);
        if (!already_up) {
-               rc = dev_open(efx->net_dev);
+               rc = dev_open(efx->net_dev, NULL);
                if (rc) {
                        netif_err(efx, drv, efx->net_dev,
                                  "failed opening device.\n");
index c728ed1375b2acf5d5130f3ef9422a3855c1c249..d20496f0ebd06a22fa5f50b4965570edd56997df 100644 (file)
@@ -4082,7 +4082,7 @@ static void stmmac_reset_subtask(struct stmmac_priv *priv)
 
        set_bit(STMMAC_DOWN, &priv->state);
        dev_close(priv->dev);
-       dev_open(priv->dev);
+       dev_open(priv->dev, NULL);
        clear_bit(STMMAC_DOWN, &priv->state);
        clear_bit(STMMAC_RESETING, &priv->state);
        rtnl_unlock();
index 85936ed9e9525913b39f58d7a61b63b8a228fc5f..c65620adab522049514784200a5083f132dbc7d2 100644 (file)
@@ -137,7 +137,7 @@ static int netvsc_open(struct net_device *net)
                 * slave as up. If open fails, then slave will be
                 * still be offline (and not used).
                 */
-               ret = dev_open(vf_netdev);
+               ret = dev_open(vf_netdev, NULL);
                if (ret)
                        netdev_warn(net,
                                    "unable to open slave: %s: %d\n",
@@ -2002,7 +2002,7 @@ static void __netvsc_vf_setup(struct net_device *ndev,
        netif_addr_unlock_bh(ndev);
 
        if (netif_running(ndev)) {
-               ret = dev_open(vf_netdev);
+               ret = dev_open(vf_netdev, NULL);
                if (ret)
                        netdev_warn(vf_netdev,
                                    "unable to open: %d\n", ret);
index e964d312f4ca32acda1e13adbca0fb42b0cf465b..ed1166adaa2fd8a270f55f575d18739e4be462ad 100644 (file)
@@ -40,14 +40,14 @@ static int net_failover_open(struct net_device *dev)
 
        primary_dev = rtnl_dereference(nfo_info->primary_dev);
        if (primary_dev) {
-               err = dev_open(primary_dev);
+               err = dev_open(primary_dev, NULL);
                if (err)
                        goto err_primary_open;
        }
 
        standby_dev = rtnl_dereference(nfo_info->standby_dev);
        if (standby_dev) {
-               err = dev_open(standby_dev);
+               err = dev_open(standby_dev, NULL);
                if (err)
                        goto err_standby_open;
        }
@@ -517,7 +517,7 @@ static int net_failover_slave_register(struct net_device *slave_dev,
        dev_hold(slave_dev);
 
        if (netif_running(failover_dev)) {
-               err = dev_open(slave_dev);
+               err = dev_open(slave_dev, NULL);
                if (err && (err != -EBUSY)) {
                        netdev_err(failover_dev, "Opening slave %s failed err:%d\n",
                                   slave_dev->name, err);
@@ -680,7 +680,7 @@ static int net_failover_slave_name_change(struct net_device *slave_dev,
        /* We need to bring up the slave after the rename by udev in case
         * open failed with EBUSY when it was registered.
         */
-       dev_open(slave_dev);
+       dev_open(slave_dev, NULL);
 
        return 0;
 }
index 364f514d56d87368e173c56a8e28b45debe08af3..93576e0240dd49f758b490a09731edb278a28c97 100644 (file)
@@ -1212,7 +1212,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
                goto err_port_enter;
        }
 
-       err = dev_open(port_dev);
+       err = dev_open(port_dev, extack);
        if (err) {
                netdev_dbg(dev, "Device %s opening failed\n",
                           portname);
index 012930d354344633e7f4f3f1e175e6d86ba9066c..b0e7c0a0617e4ee766d2387b9f18a337fa3e9779 100644 (file)
@@ -690,7 +690,7 @@ static int prism2_open(struct net_device *dev)
                /* Master radio interface is needed for all operation, so open
                 * it automatically when any virtual net_device is opened. */
                local->master_dev_auto_open = 1;
-               dev_open(local->dev);
+               dev_open(local->dev, NULL);
        }
 
        netif_device_attach(dev);
index 2836231c1c5df64b5440f1c1b106b641581cea68..f108d4b44605805b3430a7fc7890340645b92146 100644 (file)
@@ -1007,7 +1007,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
                        qeth_l2_set_rx_mode(card->dev);
                } else {
                        rtnl_lock();
-                       dev_open(card->dev);
+                       dev_open(card->dev, NULL);
                        rtnl_unlock();
                }
        }
index eca68da39d05d6fb510e4bae6aab9533bb636215..42a7cdc59b76af1a8e220f4097a16702a950cab9 100644 (file)
@@ -2417,7 +2417,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
                        __qeth_l3_open(card->dev);
                        qeth_l3_set_rx_mode(card->dev);
                } else {
-                       dev_open(card->dev);
+                       dev_open(card->dev, NULL);
                }
                rtnl_unlock();
        }
index 4fa37d6e598b8c59e9cf78812d8a12285531f984..daabaceeea52fa360bb7d641cb6598833a0c2b16 100644 (file)
@@ -1172,7 +1172,7 @@ static int ethsw_open(struct ethsw_core *ethsw)
 
        for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
                port_priv = ethsw->ports[i];
-               err = dev_open(port_priv->netdev);
+               err = dev_open(port_priv->netdev, NULL);
                if (err) {
                        netdev_err(port_priv->netdev, "dev_open err %d\n", err);
                        return err;
index 3647b8f1ed286963c9e781446669bd0b46db723e..5eeb4b93b45bc2e1783f965a47addc313e73f732 100644 (file)
@@ -2095,7 +2095,7 @@ static int visornic_resume(struct visor_device *dev,
        mod_timer(&devdata->irq_poll_timer, msecs_to_jiffies(2));
 
        rtnl_lock();
-       dev_open(netdev);
+       dev_open(netdev, NULL);
        rtnl_unlock();
 
        complete_func(dev, 0);
index 94fb2e12f117e6d50da5d0c2aeb89562568e788b..d79be3055f5f10dfafb1948e29248eb801db6b9a 100644 (file)
@@ -2605,7 +2605,7 @@ struct net_device *dev_get_by_name(struct net *net, const char *name);
 struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
 struct net_device *__dev_get_by_name(struct net *net, const char *name);
 int dev_alloc_name(struct net_device *dev, const char *name);
-int dev_open(struct net_device *dev);
+int dev_open(struct net_device *dev, struct netlink_ext_ack *extack);
 void dev_close(struct net_device *dev);
 void dev_close_many(struct list_head *head, bool unlink);
 void dev_disable_lro(struct net_device *dev);
index 828e87fe802788d13f13f39efc68ce7558dfb245..9d79c7de234a968683cb956318041b1fe503f74d 100644 (file)
@@ -607,7 +607,7 @@ static void ifup(struct net_device *netdev)
        int err;
 
        rtnl_lock();
-       err = dev_open(netdev);
+       err = dev_open(netdev, NULL);
        if (err < 0)
                BT_INFO("iface %s cannot be opened (%d)", netdev->name, err);
        rtnl_unlock();
index 04a6b7100aac8f55fb74d57d852382d1548733e8..b801c1aafd709f9b627e06a4f333d04a0f35dbc8 100644 (file)
@@ -1406,7 +1406,8 @@ static int __dev_open(struct net_device *dev)
 
 /**
  *     dev_open        - prepare an interface for use.
- *     @dev:   device to open
+ *     @dev: device to open
+ *     @extack: netlink extended ack
  *
  *     Takes a device from down to up state. The device's private open
  *     function is invoked and then the multicast lists are loaded. Finally
@@ -1416,7 +1417,7 @@ static int __dev_open(struct net_device *dev)
  *     Calling this function on an active interface is a nop. On a failure
  *     a negative errno code is returned.
  */
-int dev_open(struct net_device *dev)
+int dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
 {
        int ret;
 
index 2b9fdbc43205f3d8cf826b2074493aa5e72401fb..36a2b63ffd6dc30083815ac2e60a939c5957dac1 100644 (file)
@@ -663,7 +663,7 @@ int netpoll_setup(struct netpoll *np)
 
                np_info(np, "device %s not up yet, forcing it\n", np->dev_name);
 
-               err = dev_open(ndev);
+               err = dev_open(ndev, NULL);
 
                if (err) {
                        np_err(np, "failed to open %s\n", ndev->name);
index 5cbc749a50aaee0bc984b8d0a237ec92355614ad..ea04e38f56e9ccbc6d24c3ecdf95371044cf3ffb 100644 (file)
@@ -506,7 +506,7 @@ static struct net_device *ipmr_new_tunnel(struct net *net, struct vifctl *v)
                        dev->flags |= IFF_MULTICAST;
                        if (!ipmr_init_vif_indev(dev))
                                goto failure;
-                       if (dev_open(dev))
+                       if (dev_open(dev, NULL))
                                goto failure;
                        dev_hold(dev);
                }
@@ -589,7 +589,7 @@ static struct net_device *ipmr_reg_vif(struct net *net, struct mr_table *mrt)
 
        if (!ipmr_init_vif_indev(dev))
                goto failure;
-       if (dev_open(dev))
+       if (dev_open(dev, NULL))
                goto failure;
 
        dev_hold(dev);
index 045597b9a7c05bd5fdb796358af64f4da6bb22dc..521e471f1cf92017933deda65bff1d13ddde0ec2 100644 (file)
@@ -2820,7 +2820,7 @@ int addrconf_set_dstaddr(struct net *net, void __user *arg)
                        dev = __dev_get_by_name(net, p.name);
                        if (!dev)
                                goto err_exit;
-                       err = dev_open(dev);
+                       err = dev_open(dev, NULL);
                }
        }
 #endif
index e2ea691e42c6d6efe4ddf845e01422bf31e9fc4e..8c63494400c434f047a9d8f593294e49bbae1610 100644 (file)
@@ -655,7 +655,7 @@ static struct net_device *ip6mr_reg_vif(struct net *net, struct mr_table *mrt)
                return NULL;
        }
 
-       if (dev_open(dev))
+       if (dev_open(dev, NULL))
                goto failure;
 
        dev_hold(dev);