summaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-02-14 13:40:45 -0800
committerDavid S. Miller <davem@davemloft.net>2019-02-17 15:27:38 -0800
commit4eceba17200c03a2678edbdcff5d800aded607be (patch)
tree0cd0a1b32c2e5ee05076378de22418abb3d0c9de /net/core/ethtool.c
parent76726ccb7f461c83040e7082cf95fe1dea2afd1f (diff)
downloadlinux-4eceba17200c03a2678edbdcff5d800aded607be.tar.gz
linux-4eceba17200c03a2678edbdcff5d800aded607be.tar.bz2
linux-4eceba17200c03a2678edbdcff5d800aded607be.zip
ethtool: add compat for flash update
If driver does not support ethtool flash update operation call into devlink. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c12
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);
}