[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240628163226.GJ783093@kernel.org>
Date: Fri, 28 Jun 2024 17:32:26 +0100
From: Simon Horman <horms@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-arm-kernel@...ts.infradead.org,
netdev@...r.kernel.org,
Horia Geantă <horia.geanta@....com>,
Pankaj Gupta <pankaj.gupta@....com>,
Gaurav Jain <gaurav.jain@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 3/4] crypto: caam: Unembed net_dev structure from qi
On Mon, Jun 24, 2024 at 09:21:21AM -0700, Breno Leitao wrote:
> Embedding net_device into structures prohibits the usage of flexible
> arrays in the net_device structure. For more details, see the discussion
> at [1].
>
> Un-embed the net_devices from struct caam_qi_pcpu_priv by converting them
> into pointers, and allocating them dynamically. Use the leverage
> alloc_netdev_dummy() to allocate the net_device object at
> caam_qi_init().
>
> The free of the device occurs at caam_qi_shutdown().
>
> Link: https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/ [1]
> Signed-off-by: Breno Leitao <leitao@...ian.org>
> ---
> PS: Unfortunately due to lack of hardware, this was not tested in real
> hardware.
>
> drivers/crypto/caam/qi.c | 43 ++++++++++++++++++++++++++++++++--------
> 1 file changed, 35 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c
...
> @@ -530,6 +530,7 @@ static void caam_qi_shutdown(void *data)
>
> if (kill_fq(qidev, per_cpu(pcpu_qipriv.rsp_fq, i)))
> dev_err(qidev, "Rsp FQ kill failed, cpu: %d\n", i);
> + free_netdev(pcpu_qipriv.net_dev);
Hi Breno,
I don't think you can access pcpu_qipriv.net_dev like this,
as pcpu_qipriv is a per-cpu variable. Perhaps this?
free_netdev(per_cpu(pcpu_qipriv.net_dev, i));
Flagged by Sparse.
> }
>
> qman_delete_cgr_safe(&priv->cgr);
...
Powered by blists - more mailing lists