Commit c30f3faa authored by Jiri Pirko's avatar Jiri Pirko Committed by Saeed Mahameed

net/mlx5e: Move dl_port to struct mlx5e_dev

No need to have dl_port which is tightly coupled with mlx5e code
in mlx5 core code. Move it to struct mlx5e_dev and loose
mlx5e_devlink_get_dl_port() helper.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent bc1536f3
......@@ -975,6 +975,7 @@ struct mlx5e_priv {
struct mlx5e_dev {
struct mlx5e_priv *priv;
struct devlink_port dl_port;
};
struct mlx5e_rx_handlers {
......
......@@ -38,13 +38,11 @@ mlx5e_devlink_get_port_parent_id(struct mlx5_core_dev *dev, struct netdev_phys_i
}
int mlx5e_devlink_port_register(struct mlx5e_dev *mlx5e_dev,
struct mlx5e_priv *priv,
struct mlx5_core_dev *mdev)
{
struct devlink *devlink = priv_to_devlink(mlx5e_dev);
struct devlink_port_attrs attrs = {};
struct netdev_phys_item_id ppid = {};
struct devlink_port *dl_port;
unsigned int dl_port_index;
if (mlx5_core_is_pf(mdev)) {
......@@ -62,16 +60,13 @@ int mlx5e_devlink_port_register(struct mlx5e_dev *mlx5e_dev,
dl_port_index = mlx5_esw_vport_to_devlink_port_index(mdev, 0);
}
dl_port = mlx5e_devlink_get_dl_port(priv);
memset(dl_port, 0, sizeof(*dl_port));
devlink_port_attrs_set(dl_port, &attrs);
devlink_port_attrs_set(&mlx5e_dev->dl_port, &attrs);
return devlink_port_register(devlink, dl_port, dl_port_index);
return devlink_port_register(devlink, &mlx5e_dev->dl_port,
dl_port_index);
}
void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv)
void mlx5e_devlink_port_unregister(struct mlx5e_dev *mlx5e_dev)
{
struct devlink_port *dl_port = mlx5e_devlink_get_dl_port(priv);
devlink_port_unregister(dl_port);
devlink_port_unregister(&mlx5e_dev->dl_port);
}
......@@ -10,14 +10,7 @@
struct mlx5e_dev *mlx5e_create_devlink(struct device *dev);
void mlx5e_destroy_devlink(struct mlx5e_dev *mlx5e_dev);
int mlx5e_devlink_port_register(struct mlx5e_dev *mlx5e_dev,
struct mlx5e_priv *priv,
struct mlx5_core_dev *mdev);
void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv);
static inline struct devlink_port *
mlx5e_devlink_get_dl_port(struct mlx5e_priv *priv)
{
return &priv->mdev->mlx5e_res.dl_port;
}
void mlx5e_devlink_port_unregister(struct mlx5e_dev *mlx5e_dev);
#endif
......@@ -5921,12 +5921,12 @@ static int mlx5e_probe(struct auxiliary_device *adev,
priv->dfs_root = debugfs_create_dir("nic",
mlx5_debugfs_get_dev_root(priv->mdev));
err = mlx5e_devlink_port_register(mlx5e_dev, priv, mdev);
err = mlx5e_devlink_port_register(mlx5e_dev, mdev);
if (err) {
mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err);
goto err_destroy_netdev;
}
SET_NETDEV_DEVLINK_PORT(netdev, mlx5e_devlink_get_dl_port(priv));
SET_NETDEV_DEVLINK_PORT(netdev, &mlx5e_dev->dl_port);
err = profile->init(mdev, netdev);
if (err) {
......@@ -5956,7 +5956,7 @@ static int mlx5e_probe(struct auxiliary_device *adev,
err_profile_cleanup:
profile->cleanup(priv);
err_devlink_cleanup:
mlx5e_devlink_port_unregister(priv);
mlx5e_devlink_port_unregister(mlx5e_dev);
err_destroy_netdev:
debugfs_remove_recursive(priv->dfs_root);
mlx5e_destroy_netdev(priv);
......@@ -5976,7 +5976,7 @@ static void mlx5e_remove(struct auxiliary_device *adev)
unregister_netdev(priv->netdev);
mlx5e_suspend(adev, state);
priv->profile->cleanup(priv);
mlx5e_devlink_port_unregister(priv);
mlx5e_devlink_port_unregister(mlx5e_dev);
debugfs_remove_recursive(priv->dfs_root);
mlx5e_destroy_netdev(priv);
mlx5e_destroy_devlink(mlx5e_dev);
......
......@@ -679,7 +679,6 @@ struct mlx5e_resources {
u32 mkey;
struct mlx5_sq_bfreg bfreg;
} hw_objs;
struct devlink_port dl_port;
struct net_device *uplink_netdev;
struct mutex uplink_netdev_lock;
struct mlx5_crypto_dek_priv *dek_priv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment