net/mlx5e: Move MACsec initialization from profile init stage to profile enable stage
authorEmeel Hakim <ehakim@nvidia.com>
Wed, 21 Sep 2022 18:10:52 +0000 (11:10 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 23 Sep 2022 01:01:33 +0000 (18:01 -0700)
Postpone MACsec initialization to the mlx5e profile enable stage to have
user access region (UAR) pages and other resources ready before MACsec
initialization to initialize advanced steering operation (ASO) hardware
resources.

Reviewed-by: Raed Salem <raeds@nvidia.com>
Signed-off-by: Emeel Hakim <ehakim@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 905025a10a8a4a399be170fb96cef97f6c3d6aeb..4503de92ac801e1d9fc8551ac2c9a8288832f6f6 100644 (file)
@@ -5055,10 +5055,6 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
        }
        priv->fs = fs;
 
-       err = mlx5e_macsec_init(priv);
-       if (err)
-               mlx5_core_err(mdev, "MACsec initialization failed, %d\n", err);
-
        err = mlx5e_ipsec_init(priv);
        if (err)
                mlx5_core_err(mdev, "IPSec initialization failed, %d\n", err);
@@ -5076,7 +5072,6 @@ static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
        mlx5e_health_destroy_reporters(priv);
        mlx5e_ktls_cleanup(priv);
        mlx5e_ipsec_cleanup(priv);
-       mlx5e_macsec_cleanup(priv);
        mlx5e_fs_cleanup(priv->fs);
 }
 
@@ -5202,9 +5197,14 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
 {
        struct net_device *netdev = priv->netdev;
        struct mlx5_core_dev *mdev = priv->mdev;
+       int err;
 
        mlx5e_fs_init_l2_addr(priv->fs, netdev);
 
+       err = mlx5e_macsec_init(priv);
+       if (err)
+               mlx5_core_err(mdev, "MACsec initialization failed, %d\n", err);
+
        /* Marking the link as currently not needed by the Driver */
        if (!netif_running(netdev))
                mlx5e_modify_admin_state(mdev, MLX5_PORT_DOWN);
@@ -5262,6 +5262,7 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
        mlx5e_disable_async_events(priv);
        mlx5_lag_remove_netdev(mdev, priv->netdev);
        mlx5_vxlan_reset_to_default(mdev->vxlan);
+       mlx5e_macsec_cleanup(priv);
 }
 
 int mlx5e_update_nic_rx(struct mlx5e_priv *priv)