mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-22 22:51:55 +00:00
net/mlx5: Move esw multiport devlink param to eswitch code
Move the param registration and handling code into the eswitch code as they are related to each other. No point in having the devlink param registration done in separate file. Signed-off-by: Shay Drory <shayd@nvidia.com> Reviewed-by: Moshe Shemesh <moshe@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
2059cf51f3
commit
3f90840305
@ -7,7 +7,6 @@
|
|||||||
#include "fw_reset.h"
|
#include "fw_reset.h"
|
||||||
#include "fs_core.h"
|
#include "fs_core.h"
|
||||||
#include "eswitch.h"
|
#include "eswitch.h"
|
||||||
#include "lag/lag.h"
|
|
||||||
#include "esw/qos.h"
|
#include "esw/qos.h"
|
||||||
#include "sf/dev/dev.h"
|
#include "sf/dev/dev.h"
|
||||||
#include "sf/sf.h"
|
#include "sf/sf.h"
|
||||||
@ -427,33 +426,6 @@ static int mlx5_devlink_large_group_num_validate(struct devlink *devlink, u32 id
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5_devlink_esw_multiport_set(struct devlink *devlink, u32 id,
|
|
||||||
struct devlink_param_gset_ctx *ctx)
|
|
||||||
{
|
|
||||||
struct mlx5_core_dev *dev = devlink_priv(devlink);
|
|
||||||
|
|
||||||
if (!MLX5_ESWITCH_MANAGER(dev))
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
if (ctx->val.vbool)
|
|
||||||
return mlx5_lag_mpesw_enable(dev);
|
|
||||||
|
|
||||||
mlx5_lag_mpesw_disable(dev);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mlx5_devlink_esw_multiport_get(struct devlink *devlink, u32 id,
|
|
||||||
struct devlink_param_gset_ctx *ctx)
|
|
||||||
{
|
|
||||||
struct mlx5_core_dev *dev = devlink_priv(devlink);
|
|
||||||
|
|
||||||
if (!MLX5_ESWITCH_MANAGER(dev))
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
ctx->val.vbool = mlx5_lag_is_mpesw(dev);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int mlx5_devlink_eq_depth_validate(struct devlink *devlink, u32 id,
|
static int mlx5_devlink_eq_depth_validate(struct devlink *devlink, u32 id,
|
||||||
@ -527,12 +499,6 @@ static const struct devlink_param mlx5_devlink_params[] = {
|
|||||||
BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
|
BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
mlx5_devlink_large_group_num_validate),
|
mlx5_devlink_large_group_num_validate),
|
||||||
DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_ESW_MULTIPORT,
|
|
||||||
"esw_multiport", DEVLINK_PARAM_TYPE_BOOL,
|
|
||||||
BIT(DEVLINK_PARAM_CMODE_RUNTIME),
|
|
||||||
mlx5_devlink_esw_multiport_get,
|
|
||||||
mlx5_devlink_esw_multiport_set,
|
|
||||||
NULL),
|
|
||||||
#endif
|
#endif
|
||||||
DEVLINK_PARAM_GENERIC(IO_EQ_SIZE, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
|
DEVLINK_PARAM_GENERIC(IO_EQ_SIZE, BIT(DEVLINK_PARAM_CMODE_DRIVERINIT),
|
||||||
NULL, NULL, mlx5_devlink_eq_depth_validate),
|
NULL, NULL, mlx5_devlink_eq_depth_validate),
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
#include "esw/qos.h"
|
#include "esw/qos.h"
|
||||||
#include "mlx5_core.h"
|
#include "mlx5_core.h"
|
||||||
#include "lib/eq.h"
|
#include "lib/eq.h"
|
||||||
|
#include "lag/lag.h"
|
||||||
#include "eswitch.h"
|
#include "eswitch.h"
|
||||||
#include "fs_core.h"
|
#include "fs_core.h"
|
||||||
#include "devlink.h"
|
#include "devlink.h"
|
||||||
@ -1709,6 +1710,38 @@ err:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5_devlink_esw_multiport_set(struct devlink *devlink, u32 id,
|
||||||
|
struct devlink_param_gset_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct mlx5_core_dev *dev = devlink_priv(devlink);
|
||||||
|
|
||||||
|
if (!MLX5_ESWITCH_MANAGER(dev))
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
|
if (ctx->val.vbool)
|
||||||
|
return mlx5_lag_mpesw_enable(dev);
|
||||||
|
|
||||||
|
mlx5_lag_mpesw_disable(dev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5_devlink_esw_multiport_get(struct devlink *devlink, u32 id,
|
||||||
|
struct devlink_param_gset_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct mlx5_core_dev *dev = devlink_priv(devlink);
|
||||||
|
|
||||||
|
ctx->val.vbool = mlx5_lag_is_mpesw(dev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct devlink_param mlx5_eswitch_params[] = {
|
||||||
|
DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_ESW_MULTIPORT,
|
||||||
|
"esw_multiport", DEVLINK_PARAM_TYPE_BOOL,
|
||||||
|
BIT(DEVLINK_PARAM_CMODE_RUNTIME),
|
||||||
|
mlx5_devlink_esw_multiport_get,
|
||||||
|
mlx5_devlink_esw_multiport_set, NULL),
|
||||||
|
};
|
||||||
|
|
||||||
int mlx5_eswitch_init(struct mlx5_core_dev *dev)
|
int mlx5_eswitch_init(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
struct mlx5_eswitch *esw;
|
struct mlx5_eswitch *esw;
|
||||||
@ -1717,9 +1750,16 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
|
|||||||
if (!MLX5_VPORT_MANAGER(dev) && !MLX5_ESWITCH_MANAGER(dev))
|
if (!MLX5_VPORT_MANAGER(dev) && !MLX5_ESWITCH_MANAGER(dev))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err = devl_params_register(priv_to_devlink(dev), mlx5_eswitch_params,
|
||||||
|
ARRAY_SIZE(mlx5_eswitch_params));
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
esw = kzalloc(sizeof(*esw), GFP_KERNEL);
|
esw = kzalloc(sizeof(*esw), GFP_KERNEL);
|
||||||
if (!esw)
|
if (!esw) {
|
||||||
return -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
goto unregister_param;
|
||||||
|
}
|
||||||
|
|
||||||
esw->dev = dev;
|
esw->dev = dev;
|
||||||
esw->manager_vport = mlx5_eswitch_manager_vport(dev);
|
esw->manager_vport = mlx5_eswitch_manager_vport(dev);
|
||||||
@ -1779,6 +1819,9 @@ abort:
|
|||||||
if (esw->work_queue)
|
if (esw->work_queue)
|
||||||
destroy_workqueue(esw->work_queue);
|
destroy_workqueue(esw->work_queue);
|
||||||
kfree(esw);
|
kfree(esw);
|
||||||
|
unregister_param:
|
||||||
|
devl_params_unregister(priv_to_devlink(dev), mlx5_eswitch_params,
|
||||||
|
ARRAY_SIZE(mlx5_eswitch_params));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1802,6 +1845,8 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw)
|
|||||||
esw_offloads_cleanup(esw);
|
esw_offloads_cleanup(esw);
|
||||||
mlx5_esw_vports_cleanup(esw);
|
mlx5_esw_vports_cleanup(esw);
|
||||||
kfree(esw);
|
kfree(esw);
|
||||||
|
devl_params_unregister(priv_to_devlink(esw->dev), mlx5_eswitch_params,
|
||||||
|
ARRAY_SIZE(mlx5_eswitch_params));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vport Administration */
|
/* Vport Administration */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user