// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* Copyright (c) 2019 Mellanox Technologies */ #include #include "mlx5_core.h" #include "eswitch.h" 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, extack); } static const struct devlink_ops mlx5_devlink_ops = { #ifdef CONFIG_MLX5_ESWITCH .eswitch_mode_set = mlx5_devlink_eswitch_mode_set, .eswitch_mode_get = mlx5_devlink_eswitch_mode_get, .eswitch_inline_mode_set = mlx5_devlink_eswitch_inline_mode_set, .eswitch_inline_mode_get = mlx5_devlink_eswitch_inline_mode_get, .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, }; struct devlink *mlx5_devlink_alloc(void) { return devlink_alloc(&mlx5_devlink_ops, sizeof(struct mlx5_core_dev)); } void mlx5_devlink_free(struct devlink *devlink) { devlink_free(devlink); } int mlx5_devlink_register(struct devlink *devlink, struct device *dev) { return devlink_register(devlink, dev); } void mlx5_devlink_unregister(struct devlink *devlink) { devlink_unregister(devlink); }