mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
net/mlx5: Split function_setup() to enable and open functions
[ Upstream commit 2059cf51f3 ]
mlx5_cmd_init_hca() is taking ~0.2 seconds. In case of a user who
desire to disable some of the SF aux devices, and with large scale-1K
SFs for example, this user will waste more than 3 minutes on
mlx5_cmd_init_hca() which isn't needed at this stage.
Downstream patch will change SFs which are probe over the E-switch,
local SFs, to be probed without any aux dev. In order to support this,
split function_setup() to avoid executing mlx5_cmd_init_hca().
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Stable-dep-of: c8b3f38d2dae ("net/mlx5: Always stop health timer during driver removal")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0c42eef3f0
commit
0819acb87b
@@ -1093,7 +1093,7 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
|
|||||||
mlx5_devcom_unregister_device(dev->priv.devcom);
|
mlx5_devcom_unregister_device(dev->priv.devcom);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot, u64 timeout)
|
static int mlx5_function_enable(struct mlx5_core_dev *dev, bool boot, u64 timeout)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -1158,39 +1158,6 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot, u64 timeout
|
|||||||
goto reclaim_boot_pages;
|
goto reclaim_boot_pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = set_hca_ctrl(dev);
|
|
||||||
if (err) {
|
|
||||||
mlx5_core_err(dev, "set_hca_ctrl failed\n");
|
|
||||||
goto reclaim_boot_pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = set_hca_cap(dev);
|
|
||||||
if (err) {
|
|
||||||
mlx5_core_err(dev, "set_hca_cap failed\n");
|
|
||||||
goto reclaim_boot_pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = mlx5_satisfy_startup_pages(dev, 0);
|
|
||||||
if (err) {
|
|
||||||
mlx5_core_err(dev, "failed to allocate init pages\n");
|
|
||||||
goto reclaim_boot_pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = mlx5_cmd_init_hca(dev, sw_owner_id);
|
|
||||||
if (err) {
|
|
||||||
mlx5_core_err(dev, "init hca failed\n");
|
|
||||||
goto reclaim_boot_pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
mlx5_set_driver_version(dev);
|
|
||||||
|
|
||||||
err = mlx5_query_hca_caps(dev);
|
|
||||||
if (err) {
|
|
||||||
mlx5_core_err(dev, "query hca failed\n");
|
|
||||||
goto reclaim_boot_pages;
|
|
||||||
}
|
|
||||||
mlx5_start_health_fw_log_up(dev);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
reclaim_boot_pages:
|
reclaim_boot_pages:
|
||||||
@@ -1206,7 +1173,55 @@ err_cmd_cleanup:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlx5_function_teardown(struct mlx5_core_dev *dev, bool boot)
|
static void mlx5_function_disable(struct mlx5_core_dev *dev, bool boot)
|
||||||
|
{
|
||||||
|
mlx5_reclaim_startup_pages(dev);
|
||||||
|
mlx5_core_disable_hca(dev, 0);
|
||||||
|
mlx5_stop_health_poll(dev, boot);
|
||||||
|
mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
|
||||||
|
mlx5_cmd_cleanup(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5_function_open(struct mlx5_core_dev *dev)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = set_hca_ctrl(dev);
|
||||||
|
if (err) {
|
||||||
|
mlx5_core_err(dev, "set_hca_ctrl failed\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = set_hca_cap(dev);
|
||||||
|
if (err) {
|
||||||
|
mlx5_core_err(dev, "set_hca_cap failed\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = mlx5_satisfy_startup_pages(dev, 0);
|
||||||
|
if (err) {
|
||||||
|
mlx5_core_err(dev, "failed to allocate init pages\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = mlx5_cmd_init_hca(dev, sw_owner_id);
|
||||||
|
if (err) {
|
||||||
|
mlx5_core_err(dev, "init hca failed\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
mlx5_set_driver_version(dev);
|
||||||
|
|
||||||
|
err = mlx5_query_hca_caps(dev);
|
||||||
|
if (err) {
|
||||||
|
mlx5_core_err(dev, "query hca failed\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
mlx5_start_health_fw_log_up(dev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5_function_close(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -1215,15 +1230,33 @@ static int mlx5_function_teardown(struct mlx5_core_dev *dev, bool boot)
|
|||||||
mlx5_core_err(dev, "tear_down_hca failed, skip cleanup\n");
|
mlx5_core_err(dev, "tear_down_hca failed, skip cleanup\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
mlx5_reclaim_startup_pages(dev);
|
|
||||||
mlx5_core_disable_hca(dev, 0);
|
|
||||||
mlx5_stop_health_poll(dev, boot);
|
|
||||||
mlx5_cmd_set_state(dev, MLX5_CMDIF_STATE_DOWN);
|
|
||||||
mlx5_cmd_cleanup(dev);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot, u64 timeout)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = mlx5_function_enable(dev, boot, timeout);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = mlx5_function_open(dev);
|
||||||
|
if (err)
|
||||||
|
mlx5_function_disable(dev, boot);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5_function_teardown(struct mlx5_core_dev *dev, bool boot)
|
||||||
|
{
|
||||||
|
int err = mlx5_function_close(dev);
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
mlx5_function_disable(dev, boot);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int mlx5_load(struct mlx5_core_dev *dev)
|
static int mlx5_load(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|||||||
Reference in New Issue
Block a user