[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <256df7f47312f676f9644f59be8e3b3e2b99da28.camel@mellanox.com>
Date: Fri, 26 Jul 2019 21:41:17 +0000
From: Saeed Mahameed <saeedm@...lanox.com>
To: "jakub.kicinski@...ronome.com" <jakub.kicinski@...ronome.com>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Tariq Toukan <tariqt@...lanox.com>
Subject: Re: [net 7/9] net/mlx5e: kTLS, Call WARN_ONCE on netdev mismatch
On Thu, 2019-07-25 at 13:49 -0700, Jakub Kicinski wrote:
> On Thu, 25 Jul 2019 20:36:48 +0000, Saeed Mahameed wrote:
> > From: Tariq Toukan <tariqt@...lanox.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@...ronome.com>
> > Signed-off-by: Tariq Toukan <tariqt@...lanox.com>
> > Signed-off-by: Saeed Mahameed <saeedm@...lanox.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); \
> })
>
indeed, i see Dave already accepted this, will fix in net-next.
Thanks Jakub !
Powered by blists - more mailing lists