From: Jakub Kicinski <kuba@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com,
linux-crypto@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 3/4] crypto: caam: Unembed net_dev structure from qi
Date: Wed, 3 Jul 2024 19:45:33 -0700 [thread overview]
Message-ID: <20240703194533.5a00ea5d@kernel.org> (raw)
In-Reply-To: <20240702185557.3699991-4-leitao@debian.org>
On Tue, 2 Jul 2024 11:55:53 -0700 Breno Leitao wrote:
> +static void free_caam_qi_pcpu_netdev(const cpumask_t *cpus)
> +{
> + struct caam_qi_pcpu_priv *priv;
> + int i;
> +
> + for_each_cpu(i, cpus) {
> + priv = per_cpu_ptr(&pcpu_qipriv, i);
> + free_netdev(priv->net_dev);
> + }
> +}
> +
> int caam_qi_init(struct platform_device *caam_pdev)
> {
> int err, i;
> struct device *ctrldev = &caam_pdev->dev, *qidev;
> struct caam_drv_private *ctrlpriv;
> const cpumask_t *cpus = qman_affine_cpus();
> + cpumask_t clean_mask;
>
> ctrlpriv = dev_get_drvdata(ctrldev);
> qidev = ctrldev;
> @@ -743,6 +756,8 @@ int caam_qi_init(struct platform_device *caam_pdev)
> return err;
> }
>
> + cpumask_clear(&clean_mask);
> +
> /*
> * Enable the NAPI contexts on each of the core which has an affine
> * portal.
> @@ -751,10 +766,16 @@ int caam_qi_init(struct platform_device *caam_pdev)
> struct caam_qi_pcpu_priv *priv = per_cpu_ptr(&pcpu_qipriv, i);
> struct caam_napi *caam_napi = &priv->caam_napi;
> struct napi_struct *irqtask = &caam_napi->irqtask;
> - struct net_device *net_dev = &priv->net_dev;
> + struct net_device *net_dev;
>
> + net_dev = alloc_netdev_dummy(0);
> + if (!net_dev) {
> + err = -ENOMEM;
> + goto fail;
free_netdev() doesn't take NULL, free_caam_qi_pcpu_netdev()
will feed it one if we fail here
> + }
> + cpumask_set_cpu(i, &clean_mask);
> + priv->net_dev = net_dev;
> net_dev->dev = *qidev;
> - INIT_LIST_HEAD(&net_dev->napi_list);
>
> netif_napi_add_tx_weight(net_dev, irqtask, caam_qi_poll,
> CAAM_NAPI_WEIGHT);
> @@ -766,16 +787,22 @@ int caam_qi_init(struct platform_device *caam_pdev)
> dma_get_cache_alignment(), 0, NULL);
> if (!qi_cache) {
> dev_err(qidev, "Can't allocate CAAM cache\n");
> - free_rsp_fqs();
> - return -ENOMEM;
> + err = -ENOMEM;
> + goto fail2;
> }
>
> caam_debugfs_qi_init(ctrlpriv);
>
> err = devm_add_action_or_reset(qidev, caam_qi_shutdown, ctrlpriv);
> if (err)
> - return err;
> + goto fail2;
>
> dev_info(qidev, "Linux CAAM Queue I/F driver initialised\n");
> return 0;
> +
> +fail2:
> + free_rsp_fqs();
> +fail:
> + free_caam_qi_pcpu_netdev(&clean_mask);
next prev parent reply other threads:[~2024-07-04 2:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 18:55 [PATCH net-next v3 0/3] crypto: caam: Unembed net_dev Breno Leitao
2024-07-02 18:55 ` [PATCH net-next v3 1/4] crypto: caam: Avoid unused imx8m_machine_match variable Breno Leitao
2024-07-05 10:11 ` Horia Geanta
2024-07-08 11:29 ` Breno Leitao
2024-07-09 10:44 ` Horia Geanta
2024-07-02 18:55 ` [PATCH net-next v3 2/4] crypto: caam: Make CRYPTO_DEV_FSL_CAAM dependent of COMPILE_TEST Breno Leitao
2024-07-02 18:55 ` [PATCH net-next v3 3/4] crypto: caam: Unembed net_dev structure from qi Breno Leitao
2024-07-04 2:45 ` Jakub Kicinski [this message]
2024-07-04 16:15 ` Breno Leitao
2024-07-04 17:18 ` Jakub Kicinski
2024-07-02 18:55 ` [PATCH net-next v3 4/4] crypto: caam: Unembed net_dev structure in dpaa2 Breno Leitao
2024-07-03 5:45 ` [EXT] " Gaurav Jain
2024-07-03 11:26 ` Breno Leitao
2024-07-04 18:00 ` [PATCH net-next v3 0/3] crypto: caam: Unembed net_dev patchwork-bot+netdevbpf
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=20240703194533.5a00ea5d@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=horms@kernel.org \
--cc=leitao@debian.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).