All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: "Herbert Xu" <herbert@gondor.apana.org.au>,
	"Horia Geantă" <horia.geanta@nxp.com>,
	"Gaurav Jain" <gaurav.jain@nxp.com>,
	netdev@vger.kernel.org, "Pankaj Gupta" <pankaj.gupta@nxp.com>,
	linuxppc-dev@lists.ozlabs.org,
	"David S. Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] crypto: caam: Unembed net_dev structure from qi
Date: Fri, 28 Jun 2024 17:32:26 +0100	[thread overview]
Message-ID: <20240628163226.GJ783093@kernel.org> (raw)
In-Reply-To: <20240624162128.1665620-3-leitao@debian.org>

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@debian.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);

...

WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	"Horia Geantă" <horia.geanta@nxp.com>,
	"Pankaj Gupta" <pankaj.gupta@nxp.com>,
	"Gaurav Jain" <gaurav.jain@nxp.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 3/4] crypto: caam: Unembed net_dev structure from qi
Date: Fri, 28 Jun 2024 17:32:26 +0100	[thread overview]
Message-ID: <20240628163226.GJ783093@kernel.org> (raw)
In-Reply-To: <20240624162128.1665620-3-leitao@debian.org>

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@debian.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);

...


  reply	other threads:[~2024-06-28 16:33 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 16:21 [PATCH 1/4] soc: fsl: qbman: FSL_DPAA depends on COMPILE_TEST Breno Leitao
2024-06-24 16:21 ` Breno Leitao
2024-06-24 16:21 ` [PATCH 2/4] crypto: caam: Depend on COMPILE_TEST also Breno Leitao
2024-06-24 16:21   ` Breno Leitao
2024-06-29 11:29   ` kernel test robot
2024-06-29 11:29     ` kernel test robot
2024-06-24 16:21 ` [PATCH 3/4] crypto: caam: Unembed net_dev structure from qi Breno Leitao
2024-06-24 16:21   ` Breno Leitao
2024-06-28 16:32   ` Simon Horman [this message]
2024-06-28 16:32     ` Simon Horman
2024-07-02 13:32     ` Breno Leitao
2024-07-02 13:32       ` Breno Leitao
2024-06-24 16:21 ` [PATCH 4/4] crypto: caam: Unembed net_dev structure in dpaa2 Breno Leitao
2024-06-24 16:21   ` Breno Leitao
2024-06-25 14:39 ` [PATCH 1/4] soc: fsl: qbman: FSL_DPAA depends on COMPILE_TEST Jakub Kicinski
2024-06-25 14:39   ` Jakub Kicinski
2024-06-25 22:06   ` Herbert Xu
2024-06-25 22:06     ` Herbert Xu
2024-06-26 12:09 ` kernel test robot
2024-06-26 12:09   ` kernel test robot
2024-06-26 14:06   ` Vladimir Oltean
2024-06-26 14:06     ` Vladimir Oltean
2024-06-27 18:40     ` Breno Leitao
2024-06-27 18:40       ` Breno Leitao
2024-07-08 13:37       ` Vladimir Oltean
2024-07-08 13:37         ` Vladimir Oltean
2024-07-08 19:08         ` Breno Leitao
2024-07-08 19:08           ` Breno Leitao
2024-07-09 13:58           ` Vladimir Oltean
2024-07-09 13:58             ` Vladimir Oltean
2024-07-09 15:15             ` Breno Leitao
2024-07-09 15:15               ` Breno Leitao
2024-07-09 15:25               ` Vladimir Oltean
2024-07-09 15:25                 ` Vladimir Oltean
2024-06-29 13:55 ` kernel test robot
2024-06-29 13:55   ` kernel test robot

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=20240628163226.GJ783093@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=gaurav.jain@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=leitao@debian.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=pankaj.gupta@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.