Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Tariq Toukan <tariqt@mellanox.com>
Subject: Re: [net 7/9] net/mlx5e: kTLS, Call WARN_ONCE on netdev mismatch
Date: Thu, 25 Jul 2019 13:49:50 -0700	[thread overview]
Message-ID: <20190725134950.74733e62@cakuba.netronome.com> (raw)
In-Reply-To: <20190725203618.11011-8-saeedm@mellanox.com>

On Thu, 25 Jul 2019 20:36:48 +0000, Saeed Mahameed wrote:
> From: Tariq Toukan <tariqt@mellanox.com>
> 
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
> index ea032f54197e..3766545ce259 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c
> @@ -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)))

Ah, nit: the unlikely is probably unnecessary but that's no big deal.

#define WARN_ON_ONCE(condition) ({			\
	static int __warned;				\
	int __ret_warn_once = !!(condition);		\
							\
	if (unlikely(__ret_warn_once && !__warned)) {	\
		__warned = true;			\
		WARN_ON(1);				\
	}						\
	unlikely(__ret_warn_once);			\
})

>  		goto err_out;
>  
>  	priv_tx = mlx5e_get_ktls_tx_priv_ctx(tls_ctx);


  parent reply	other threads:[~2019-07-25 20:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25 20:36 [pull request][net 0/9] Mellanox, mlx5 fixes 2019-07-25 Saeed Mahameed
2019-07-25 20:36 ` [net 1/9] net/mlx5: Use reversed order when unregister devices Saeed Mahameed
2019-07-25 20:36 ` [net 2/9] net/mlx5: Add missing RDMA_RX capabilities Saeed Mahameed
2019-07-25 20:36 ` [net 3/9] net/mlx5: Fix modify_cq_in alignment Saeed Mahameed
2019-07-25 20:36 ` [net 4/9] net/mlx5e: Fix wrong max num channels indication Saeed Mahameed
2019-07-25 20:36 ` [net 5/9] net/mlx5e: Fix matching of speed to PRM link modes Saeed Mahameed
2019-07-25 20:36 ` [net 6/9] net/mlx5e: Prevent encap flow counter update async to user query Saeed Mahameed
2019-07-25 20:36 ` [net 7/9] net/mlx5e: kTLS, Call WARN_ONCE on netdev mismatch Saeed Mahameed
2019-07-25 20:48   ` Jakub Kicinski
2019-07-25 20:49   ` Jakub Kicinski [this message]
2019-07-26 21:41     ` Saeed Mahameed
2019-07-25 20:36 ` [net 8/9] nfp: tls: rename tls packet counters Saeed Mahameed
2019-07-25 20:50   ` Jakub Kicinski
2019-07-25 20:36 ` [net 9/9] Documentation: TLS: fix stat counters description Saeed Mahameed
2019-07-25 20:53   ` Jakub Kicinski
2019-07-26 21:34 ` [pull request][net 0/9] Mellanox, mlx5 fixes 2019-07-25 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190725134950.74733e62@cakuba.netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=tariqt@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox