diff options
author | David S. Miller <davem@davemloft.net> | 2019-02-17 15:27:39 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-02-17 15:27:39 -0800 |
commit | eaec2efbe4dc6be84165fcbc54238d51aa7e6c30 (patch) | |
tree | ca776d2ae616aaa2f697331b90e7009df052b1c1 /net/core/ethtool.c | |
parent | 8e31c47424f7d03d0cc992fe6a9ebfdedf66a709 (diff) | |
parent | 5c5696f3df2acbe738526c7ba76ab7dd38e9ba49 (diff) | |
download | linux-eaec2efbe4dc6be84165fcbc54238d51aa7e6c30.tar.bz2 |
Merge branch 'devlink-add-the-ability-to-update-device-flash'
Jakub Kicinski says:
====================
devlink: add the ability to update device flash
This series is the second step to allow trouble shooting and recovering
devices in bad state without the use of netdevs as handles. We can
already query FW versions over devlink, now we add the ability to update
the FW. This will allow drivers to implement some from of "limp-mode"
where the device can't really be used for networking and hence has no
netdev, but we can interrogate it over devlink and fix the broken FW.
Small but nice advantage of devlink is that it only holds the devlink
instance lock during flashing, unlike ethtool which holds rtnl_lock().
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r-- | net/core/ethtool.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index d2c47cdf25da..1320e8dce559 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -2038,11 +2038,17 @@ static noinline_for_stack int ethtool_flash_device(struct net_device *dev, if (copy_from_user(&efl, useraddr, sizeof(efl))) return -EFAULT; + efl.data[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0; - if (!dev->ethtool_ops->flash_device) - return -EOPNOTSUPP; + if (!dev->ethtool_ops->flash_device) { + int ret; - efl.data[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0; + rtnl_unlock(); + ret = devlink_compat_flash_update(dev, efl.data); + rtnl_lock(); + + return ret; + } return dev->ethtool_ops->flash_device(dev, &efl); } |