From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Simon Horman <horms@kernel.org>
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, andrew@lunn.ch, arnd@arndb.de
Subject: Re: [PATCH v4 2/2] net: airoha: Introduce ethernet support for EN7581 SoC
Date: Mon, 1 Jul 2024 16:26:10 +0200 [thread overview]
Message-ID: <ZoK8glSv-mtNPOLX@lore-desk> (raw)
In-Reply-To: <20240701135319.GE17134@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 3812 bytes --]
> On Sat, Jun 29, 2024 at 05:01:38PM +0200, Lorenzo Bianconi wrote:
> > Add airoha_eth driver in order to introduce ethernet support for
> > Airoha EN7581 SoC available on EN7581 development board (en7581-evb).
> > en7581-evb networking architecture is composed by airoha_eth as mac
> > controller (cpu port) and a mt7530 dsa based switch.
> > EN7581 mac controller is mainly composed by Frame Engine (FE) and
> > QoS-DMA (QDMA) modules. FE is used for traffic offloading (just basic
> > functionalities are supported now) while QDMA is used for DMA operation
> > and QOS functionalities between mac layer and the dsa switch (hw QoS is
> > not available yet and it will be added in the future).
> > Currently only hw lan features are available, hw wan will be added with
> > subsequent patches.
> >
> > Tested-by: Benjamin Larsson <benjamin.larsson@genexis.eu>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> Hi Lorenzo,
>
> Some minor feedback from my side.
Hi Simon,
>
> > +static void airoha_qdma_set_irqmask(struct airoha_eth *eth, int index,
> > + u32 clear, u32 set)
> > +{
> > + unsigned long flags;
> > +
> > + if (WARN_ON_ONCE(index >= ARRAY_SIZE(eth->irqmask)))
> > + return;
> > +
> > + spin_lock_irqsave(ð->irq_lock, flags);
> > +
> > + eth->irqmask[index] &= ~clear;
> > + eth->irqmask[index] |= set;
> > + airoha_qdma_wr(eth, REG_INT_ENABLE(index), eth->irqmask[index]);
> > + /* Read irq_enable register in order to guarantee the update above
> > + * completes in the spinlock critical section.
> > + */
> > + airoha_rr(eth, REG_INT_ENABLE(index));
>
> airoha_rr() expects an __iomem pointer as it's first argument,
> but the type of eth is struct airoha_eth *eth.
>
> Should this be using airoha_qdma_rr() instead?
ack, right. Thx for pointing this out. I will fix it in v5.
>
> Flagged by Sparse.
>
> > +
> > + spin_unlock_irqrestore(ð->irq_lock, flags);
> > +}
>
> ...
>
> > +static void airoha_ethtool_get_strings(struct net_device *dev, u32 sset,
> > + u8 *data)
> > +{
> > + int i;
> > +
> > + if (sset != ETH_SS_STATS)
> > + return;
> > +
> > + for (i = 0; i < ARRAY_SIZE(airoha_ethtool_stats_name); i++) {
> > + memcpy(data + i * ETH_GSTRING_LEN,
> > + airoha_ethtool_stats_name[i], ETH_GSTRING_LEN);
> > + }
> > +
> > + data += ETH_GSTRING_LEN * ARRAY_SIZE(airoha_ethtool_stats_name);
> > + page_pool_ethtool_stats_get_strings(data);
> > +}
>
> W=1 allmodconfig builds on x86_64 with gcc-13 complain about the use
> of memcpy above because the source is (often?) less than ETH_GSTRING_LEN
> bytes long.
>
> I think the preferred solution is to use ethtool_puts(),
> something like this (compile tested only!):
>
> @@ -2291,12 +2291,9 @@ static void airoha_ethtool_get_strings(struct net_device *dev, u32 sset,
> if (sset != ETH_SS_STATS)
> return;
>
> - for (i = 0; i < ARRAY_SIZE(airoha_ethtool_stats_name); i++) {
> - memcpy(data + i * ETH_GSTRING_LEN,
> - airoha_ethtool_stats_name[i], ETH_GSTRING_LEN);
> - }
> + for (i = 0; i < ARRAY_SIZE(airoha_ethtool_stats_name); i++)
> + ethtool_puts(&data, airoha_ethtool_stats_name[i]);
>
> - data += ETH_GSTRING_LEN * ARRAY_SIZE(airoha_ethtool_stats_name);
> page_pool_ethtool_stats_get_strings(data);
> }
>
ack, I will fix it in v5.
>
> ...
>
> > +static int airoha_alloc_gdm_port(struct airoha_eth *eth, struct device_node *np)
> > +{
> > + const __be32 *id_ptr = of_get_property(np, "reg", NULL);
> > + struct net_device *dev;
> > + struct airoha_gdm_port *port;
>
> nit: reverse xmas tree
ack, I will fix it in v5.
Regards,
Lorenzo
>
> > + int err, index;
> > + u32 id;
>
> ...
>
> --
> pw-bot: changes-requested
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-07-01 14:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-29 15:01 [PATCH v4 0/2] Introduce EN7581 ethernet support Lorenzo Bianconi
2024-06-29 15:01 ` [PATCH v4 1/2] dt-bindings: net: airoha: Add EN7581 ethernet controller Lorenzo Bianconi
2024-07-01 18:21 ` Rob Herring
2024-07-02 9:01 ` Lorenzo Bianconi
2024-06-29 15:01 ` [PATCH v4 2/2] net: airoha: Introduce ethernet support for EN7581 SoC Lorenzo Bianconi
2024-07-01 13:53 ` Simon Horman
2024-07-01 14:26 ` Lorenzo Bianconi [this message]
2024-07-02 7:17 ` Simon Horman
2024-07-02 8:38 ` Lorenzo Bianconi
2024-07-03 11:17 ` 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=ZoK8glSv-mtNPOLX@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).