From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, nbd@nbd.name,
lorenzo.bianconi83@gmail.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
conor@kernel.org, linux-arm-kernel@lists.infradead.org,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, devicetree@vger.kernel.org,
catalin.marinas@arm.com, will@kernel.org, upstream@airoha.com,
angelogioacchino.delregno@collabora.com,
benjamin.larsson@genexis.eu, rkannoth@marvell.com,
sgoutham@marvell.com, arnd@arndb.de, horms@kernel.org
Subject: Re: [PATCH v6 net-next 2/2] net: airoha: Introduce ethernet support for EN7581 SoC
Date: Tue, 9 Jul 2024 23:41:21 +0200 [thread overview]
Message-ID: <Zo2ugWhc3wHqyKLq@lore-desk> (raw)
In-Reply-To: <68a37d33-6155-4ffc-a0ad-8c5a5b8fed25@lunn.ch>
[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]
> > +static int airoha_qdma_init_rx_queue(struct airoha_eth *eth,
> > + struct airoha_queue *q, int ndesc)
> > +{
> > + struct page_pool_params pp_params = {
> > + .order = 0,
> > + .pool_size = 256,
> > + .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
> > + .dma_dir = DMA_FROM_DEVICE,
> > + .max_len = PAGE_SIZE,
> > + .nid = NUMA_NO_NODE,
> > + .dev = eth->dev,
> > + .napi = &q->napi,
> > + };
>
> I think you can make this const.
ack
>
> > +static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np)
> > +{
>
> > + port = netdev_priv(dev);
> > + mutex_init(&port->stats.mutex);
> > + port->dev = dev;
> > + port->eth = eth;
> > + port->id = id;
> > +
> > + err = register_netdev(dev);
> > + if (err)
> > + return err;
> > +
> > + eth->ports[index] = port;
>
> eth->ports[index] appears to be used in
> airoha_qdma_rx_process(). There is a small race condition here, since
> the interface could be in use before register_netdev() returns,
> e.g. NFS root. It would be better to do the assignment before
> registering the interface.
actually I check eth->ports[] is not NULL before accessing it in
airoha_qdma_rx_process():
p = airoha_qdma_get_gdm_port(eth, desc);
if (p < 0 || !eth->ports[p]) {
...
}
Moreover, in airoha_alloc_gdm_port(), I set eth->ports[index] pointer just if
register_netdev() is successful in order to avoid to call unregister_netdev()
on an not-registered net_device in the airoha_probe() error path. I guess we can
even check reg_state for this:
for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
...
if (dev->reg_state == NETREG_REGISTERED)
unregister_netdev(dev);
}
What do you prefer?
Regards,
Lorenzo
>
> These are quite minor, so please add to the next version:
>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>
> Andrew
>
> ---
> pw-bot: cr
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-07-09 21:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 6:05 [PATCH v6 net-next 0/2] Introduce EN7581 ethernet support Lorenzo Bianconi
2024-07-09 6:05 ` [PATCH v6 net-next 1/2] dt-bindings: net: airoha: Add EN7581 ethernet controller Lorenzo Bianconi
2024-07-09 16:35 ` Rob Herring (Arm)
2024-07-09 6:05 ` [PATCH v6 net-next 2/2] net: airoha: Introduce ethernet support for EN7581 SoC Lorenzo Bianconi
2024-07-09 13:11 ` Simon Horman
2024-07-09 17:39 ` Andrew Lunn
2024-07-09 21:41 ` Lorenzo Bianconi [this message]
2024-07-09 23:23 ` Andrew Lunn
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=Zo2ugWhc3wHqyKLq@lore-desk \
--to=lorenzo@kernel.org \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=arnd@arndb.de \
--cc=benjamin.larsson@genexis.eu \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=conor@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=robh+dt@kernel.org \
--cc=sgoutham@marvell.com \
--cc=upstream@airoha.com \
--cc=will@kernel.org \
/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).