Commit 35f69867 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by David S. Miller

net/mlx5: Don't rely on always true registered field

Devlink is an integral part of mlx5 driver and all flows ensure that
devlink_*_register() will success. That makes the ->registered check
an obsolete.
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent acf34954
...@@ -55,19 +55,15 @@ void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv) ...@@ -55,19 +55,15 @@ void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv)
{ {
struct devlink_port *dl_port = mlx5e_devlink_get_dl_port(priv); struct devlink_port *dl_port = mlx5e_devlink_get_dl_port(priv);
if (dl_port->registered) devlink_port_unregister(dl_port);
devlink_port_unregister(dl_port);
} }
struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev) struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev)
{ {
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
struct devlink_port *port;
if (!netif_device_present(dev)) if (!netif_device_present(dev))
return NULL; return NULL;
port = mlx5e_devlink_get_dl_port(priv);
if (port->registered) return mlx5e_devlink_get_dl_port(priv);
return port;
return NULL;
} }
...@@ -4776,7 +4776,6 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev, ...@@ -4776,7 +4776,6 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
struct net_device *netdev) struct net_device *netdev)
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
struct devlink_port *dl_port;
int err; int err;
mlx5e_build_nic_params(priv, &priv->xsk, netdev->mtu); mlx5e_build_nic_params(priv, &priv->xsk, netdev->mtu);
...@@ -4792,19 +4791,13 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev, ...@@ -4792,19 +4791,13 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
if (err) if (err)
mlx5_core_err(mdev, "TLS initialization failed, %d\n", err); mlx5_core_err(mdev, "TLS initialization failed, %d\n", err);
dl_port = mlx5e_devlink_get_dl_port(priv); mlx5e_health_create_reporters(priv);
if (dl_port->registered)
mlx5e_health_create_reporters(priv);
return 0; return 0;
} }
static void mlx5e_nic_cleanup(struct mlx5e_priv *priv) static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
{ {
struct devlink_port *dl_port = mlx5e_devlink_get_dl_port(priv); mlx5e_health_destroy_reporters(priv);
if (dl_port->registered)
mlx5e_health_destroy_reporters(priv);
mlx5e_tls_cleanup(priv); mlx5e_tls_cleanup(priv);
mlx5e_ipsec_cleanup(priv); mlx5e_ipsec_cleanup(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