mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
net/mlx5: Lag, move devcom registration to LAG layer
Move the devcom registration for the HCA_PORTS component from the core initialization path into the LAG logic. This better reflects the logical ownership of this component and ensures proper alignment with the LAG lifecycle. Signed-off-by: Shay Drory <shayd@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/1757940070-618661-3-git-send-email-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
f05a82fbcc
commit
5a977b5833
|
|
@ -1404,6 +1404,34 @@ static int __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mlx5_lag_unregister_hca_devcom_comp(struct mlx5_core_dev *dev)
|
||||||
|
{
|
||||||
|
mlx5_devcom_unregister_component(dev->priv.hca_devcom_comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mlx5_lag_register_hca_devcom_comp(struct mlx5_core_dev *dev)
|
||||||
|
{
|
||||||
|
struct mlx5_devcom_match_attr attr = {
|
||||||
|
.key.val = mlx5_query_nic_system_image_guid(dev),
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This component is use to sync adding core_dev to lag_dev and to sync
|
||||||
|
* changes of mlx5_adev_devices between LAG layer and other layers.
|
||||||
|
*/
|
||||||
|
dev->priv.hca_devcom_comp =
|
||||||
|
mlx5_devcom_register_component(dev->priv.devc,
|
||||||
|
MLX5_DEVCOM_HCA_PORTS,
|
||||||
|
&attr, NULL, dev);
|
||||||
|
if (IS_ERR(dev->priv.hca_devcom_comp)) {
|
||||||
|
mlx5_core_err(dev,
|
||||||
|
"Failed to register devcom HCA component, err: %ld\n",
|
||||||
|
PTR_ERR(dev->priv.hca_devcom_comp));
|
||||||
|
return PTR_ERR(dev->priv.hca_devcom_comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void mlx5_lag_remove_mdev(struct mlx5_core_dev *dev)
|
void mlx5_lag_remove_mdev(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
struct mlx5_lag *ldev;
|
struct mlx5_lag *ldev;
|
||||||
|
|
@ -1425,6 +1453,7 @@ void mlx5_lag_remove_mdev(struct mlx5_core_dev *dev)
|
||||||
}
|
}
|
||||||
mlx5_ldev_remove_mdev(ldev, dev);
|
mlx5_ldev_remove_mdev(ldev, dev);
|
||||||
mutex_unlock(&ldev->lock);
|
mutex_unlock(&ldev->lock);
|
||||||
|
mlx5_lag_unregister_hca_devcom_comp(dev);
|
||||||
mlx5_ldev_put(ldev);
|
mlx5_ldev_put(ldev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1435,7 +1464,7 @@ void mlx5_lag_add_mdev(struct mlx5_core_dev *dev)
|
||||||
if (!mlx5_lag_is_supported(dev))
|
if (!mlx5_lag_is_supported(dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IS_ERR_OR_NULL(dev->priv.hca_devcom_comp))
|
if (mlx5_lag_register_hca_devcom_comp(dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
recheck:
|
recheck:
|
||||||
|
|
|
||||||
|
|
@ -973,30 +973,6 @@ static void mlx5_pci_close(struct mlx5_core_dev *dev)
|
||||||
mlx5_pci_disable_device(dev);
|
mlx5_pci_disable_device(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlx5_register_hca_devcom_comp(struct mlx5_core_dev *dev)
|
|
||||||
{
|
|
||||||
struct mlx5_devcom_match_attr attr = {
|
|
||||||
.key.val = mlx5_query_nic_system_image_guid(dev),
|
|
||||||
};
|
|
||||||
|
|
||||||
/* This component is use to sync adding core_dev to lag_dev and to sync
|
|
||||||
* changes of mlx5_adev_devices between LAG layer and other layers.
|
|
||||||
*/
|
|
||||||
if (!mlx5_lag_is_supported(dev))
|
|
||||||
return;
|
|
||||||
|
|
||||||
dev->priv.hca_devcom_comp =
|
|
||||||
mlx5_devcom_register_component(dev->priv.devc, MLX5_DEVCOM_HCA_PORTS,
|
|
||||||
&attr, NULL, dev);
|
|
||||||
if (IS_ERR(dev->priv.hca_devcom_comp))
|
|
||||||
mlx5_core_err(dev, "Failed to register devcom HCA component\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mlx5_unregister_hca_devcom_comp(struct mlx5_core_dev *dev)
|
|
||||||
{
|
|
||||||
mlx5_devcom_unregister_component(dev->priv.hca_devcom_comp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mlx5_init_once(struct mlx5_core_dev *dev)
|
static int mlx5_init_once(struct mlx5_core_dev *dev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -1005,7 +981,6 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)
|
||||||
if (IS_ERR(dev->priv.devc))
|
if (IS_ERR(dev->priv.devc))
|
||||||
mlx5_core_warn(dev, "failed to register devcom device %ld\n",
|
mlx5_core_warn(dev, "failed to register devcom device %ld\n",
|
||||||
PTR_ERR(dev->priv.devc));
|
PTR_ERR(dev->priv.devc));
|
||||||
mlx5_register_hca_devcom_comp(dev);
|
|
||||||
|
|
||||||
err = mlx5_query_board_id(dev);
|
err = mlx5_query_board_id(dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -1143,7 +1118,6 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)
|
||||||
err_irq_cleanup:
|
err_irq_cleanup:
|
||||||
mlx5_irq_table_cleanup(dev);
|
mlx5_irq_table_cleanup(dev);
|
||||||
err_devcom:
|
err_devcom:
|
||||||
mlx5_unregister_hca_devcom_comp(dev);
|
|
||||||
mlx5_devcom_unregister_device(dev->priv.devc);
|
mlx5_devcom_unregister_device(dev->priv.devc);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
@ -1174,7 +1148,6 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
|
||||||
mlx5_events_cleanup(dev);
|
mlx5_events_cleanup(dev);
|
||||||
mlx5_eq_table_cleanup(dev);
|
mlx5_eq_table_cleanup(dev);
|
||||||
mlx5_irq_table_cleanup(dev);
|
mlx5_irq_table_cleanup(dev);
|
||||||
mlx5_unregister_hca_devcom_comp(dev);
|
|
||||||
mlx5_devcom_unregister_device(dev->priv.devc);
|
mlx5_devcom_unregister_device(dev->priv.devc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user