net/mlx5e: kTLS, Call WARN_ONCE on netdev mismatch
authorTariq Toukan <tariqt@mellanox.com>
Thu, 18 Jul 2019 13:32:31 +0000 (16:32 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 25 Jul 2019 20:31:00 +0000 (13:31 -0700)
A netdev mismatch in the processed TLS SKB should not occur,
and indicates a kernel bug.
Add WARN_ONCE to spot such cases.

Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support")
Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c

index ea032f54197e17a8b829d4b6b37a24573fe7237e..3766545ce2599699a59deb89d2d59de6e8335e0b 100644 (file)
@@ -412,7 +412,7 @@ struct sk_buff *mlx5e_ktls_handle_tx_skb(struct net_device *netdev,
                goto out;
 
        tls_ctx = tls_get_ctx(skb->sk);
-       if (unlikely(tls_ctx->netdev != netdev))
+       if (unlikely(WARN_ON_ONCE(tls_ctx->netdev != netdev)))
                goto err_out;
 
        priv_tx = mlx5e_get_ktls_tx_priv_ctx(tls_ctx);