]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/mlx5e: TLS, Read capabilities only when it is safe
authorSaeed Mahameed <saeedm@mellanox.com>
Sat, 15 Sep 2018 07:50:02 +0000 (00:50 -0700)
committerSaeed Mahameed <saeedm@mellanox.com>
Mon, 17 Sep 2018 22:12:31 +0000 (15:12 -0700)
Read TLS caps from the core driver only when TLS is supported, i.e
mlx5_accel_is_tls_device returns true.

Fixes: 790af90c00d2 ("net/mlx5e: TLS, build TLS netdev from capabilities")
Change-Id: I5f21ff4d684901af487e366a7e0cf032b54ee9cf
Reported-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c

index eddd7702680bce0284f8518e2f04920116a80e0b..e88340e196f79a4dca519f85ce174c54c144e5af 100644 (file)
@@ -183,12 +183,13 @@ static const struct tlsdev_ops mlx5e_tls_ops = {
 
 void mlx5e_tls_build_netdev(struct mlx5e_priv *priv)
 {
-       u32 caps = mlx5_accel_tls_device_caps(priv->mdev);
        struct net_device *netdev = priv->netdev;
+       u32 caps;
 
        if (!mlx5_accel_is_tls_device(priv->mdev))
                return;
 
+       caps = mlx5_accel_tls_device_caps(priv->mdev);
        if (caps & MLX5_ACCEL_TLS_TX) {
                netdev->features          |= NETIF_F_HW_TLS_TX;
                netdev->hw_features       |= NETIF_F_HW_TLS_TX;