diff options
author | Jiri Pirko | 2019-06-04 15:40:38 +0200 |
---|---|---|
committer | David S. Miller | 2019-06-04 23:21:40 +0200 |
commit | 9c8bca2637b8441a18bb846a1d74293cb990724e (patch) | |
tree | d02110cbf0174a001a46867ad71a19dd6972bbcb /drivers/net/ethernet/mellanox/mlx5/core/main.c | |
parent | mlxsw: Move firmware flash implementation to devlink (diff) | |
download | kernel-qcow2-linux-9c8bca2637b8441a18bb846a1d74293cb990724e.tar.gz kernel-qcow2-linux-9c8bca2637b8441a18bb846a1d74293cb990724e.tar.xz kernel-qcow2-linux-9c8bca2637b8441a18bb846a1d74293cb990724e.zip |
mlx5: Move firmware flash implementation to devlink
Benefit from the devlink flash update implementation and ethtool
fallback to it and move firmware flash implementation there.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/main.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/main.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index b27f9537256c..2fc2162901de 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1214,6 +1214,25 @@ out: return err; } +static int mlx5_devlink_flash_update(struct devlink *devlink, + const char *file_name, + const char *component, + struct netlink_ext_ack *extack) +{ + struct mlx5_core_dev *dev = devlink_priv(devlink); + const struct firmware *fw; + int err; + + if (component) + return -EOPNOTSUPP; + + err = request_firmware_direct(&fw, file_name, &dev->pdev->dev); + if (err) + return err; + + return mlx5_firmware_flash(dev, fw); +} + static const struct devlink_ops mlx5_devlink_ops = { #ifdef CONFIG_MLX5_ESWITCH .eswitch_mode_set = mlx5_devlink_eswitch_mode_set, @@ -1223,6 +1242,7 @@ static const struct devlink_ops mlx5_devlink_ops = { .eswitch_encap_mode_set = mlx5_devlink_eswitch_encap_mode_set, .eswitch_encap_mode_get = mlx5_devlink_eswitch_encap_mode_get, #endif + .flash_update = mlx5_devlink_flash_update, }; static int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) |