net/mlx5: Don't advertise IPsec netdev support for non-IPsec device
authorLeon Romanovsky <leonro@nvidia.com>
Sun, 20 Mar 2022 13:50:16 +0000 (15:50 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 4 May 2022 05:59:17 +0000 (22:59 -0700)
Device that lacks proper IPsec capabilities won't pass mlx5e_ipsec_init()
later, so no need to advertise HW netdev offload support for something that
isn't going to work anyway.

Fixes: 8ad893e516a7 ("net/mlx5e: Remove dependency in IPsec initialization flows")
Reviewed-by: Raed Salem <raeds@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c

index 81c9831..28729b1 100644 (file)
@@ -454,6 +454,9 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv)
        struct mlx5_core_dev *mdev = priv->mdev;
        struct net_device *netdev = priv->netdev;
 
+       if (!mlx5_ipsec_device_caps(mdev))
+               return;
+
        if (!(mlx5_ipsec_device_caps(mdev) & MLX5_ACCEL_IPSEC_CAP_ESP) ||
            !MLX5_CAP_ETH(mdev, swp)) {
                mlx5_core_dbg(mdev, "mlx5e: ESP and SWP offload not supported\n");