From: Simon Horman <horms@kernel.org>
To: Ioana Ciornei <ioana.ciornei@nxp.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next 2/5] net: dpaa2-mac: retrieve MAC statistics in one firmware command
Date: Sun, 1 Mar 2026 16:09:25 +0000 [thread overview]
Message-ID: <aaRktVdeVUubxBLc@horms.kernel.org> (raw)
In-Reply-To: <20260225150648.1542206-3-ioana.ciornei@nxp.com>
On Wed, Feb 25, 2026 at 05:06:45PM +0200, Ioana Ciornei wrote:
...
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
...
> +static void dpaa2_mac_setup_stats(struct dpaa2_mac *mac, struct dpaa2_mac_stats *stats,
> + size_t num_stats, const struct dpmac_counter *counters)
> +{
> + struct device *dev = mac->net_dev->dev.parent;
> + u32 *cnt_idx;
Hi Ioana,
The type of cnt_idx is u32.
> +
> + stats->idx_dma_mem = kcalloc(num_stats, sizeof(u32), GFP_KERNEL);
> + if (!stats->idx_dma_mem)
> + goto out;
> +
> + stats->values_dma_mem = kcalloc(num_stats, sizeof(u64), GFP_KERNEL);
> + if (!stats->values_dma_mem)
> + goto err_alloc_values;
> +
> + cnt_idx = stats->idx_dma_mem;
As is that of idx_dma_mem. So the types match here.
> + for (size_t i = 0; i < num_stats; i++)
> + *cnt_idx++ = cpu_to_le32((u32)(counters[i].id));
But here __le32 values are assigned to elements of cnt_idx.
I think that the type of both cnt_idx and stats->idx_dma_mem
should probably be __le32 * rather than u32 *.
Flagged by Sparse v0.6.5-rc1.
...
> void dpaa2_mac_get_ethtool_stats(struct dpaa2_mac *mac, u64 *data)
> {
> + struct device *dev = mac->net_dev->dev.parent;
> struct fsl_mc_device *dpmac_dev = mac->mc_dev;
> + u64 *cnt_values;
> int i, err;
> u64 value;
...
> + cnt_values = mac->ethtool_stats.values_dma_mem;
> + for (i = 0; i < DPAA2_MAC_NUM_ETHTOOL_STATS; i++)
> + *(data + i) = le64_to_cpu(*cnt_values++);
Likewise, I think the type of both cnt_values and
mac->ethtool_stats.values_dma_mem should be __le64 8 rather than u64 *.
And there is a similar problem in patch 3/5 centering on the use of
le64_to_cpu() in dpaa2_mac_transfer_stats().
Also flagged by Sparse.
...
next prev parent reply other threads:[~2026-03-01 16:09 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 15:06 [PATCH net-next 0/5] net: dpaa2-mac: export standard statistics Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 1/5] net: dpaa2-mac: extend APIs related to statistics Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 2/5] net: dpaa2-mac: retrieve MAC statistics in one firmware command Ioana Ciornei
2026-02-27 2:26 ` [net-next,2/5] " Jakub Kicinski
2026-02-27 10:37 ` Ioana Ciornei
2026-03-01 16:09 ` Simon Horman [this message]
2026-03-02 12:51 ` [PATCH net-next 2/5] " Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 3/5] net: dpaa2-mac: export standard statistics Ioana Ciornei
2026-02-25 15:06 ` [PATCH net-next 4/5] selftests: forwarding: extend ethtool_std_stats_get with pause statistics Ioana Ciornei
2026-02-27 16:38 ` Petr Machata
2026-03-02 13:57 ` Ioana Ciornei
2026-03-03 13:06 ` Petr Machata
2026-02-25 15:06 ` [PATCH net-next 5/5] selftests: drivers: hw: add tests for the ethtool standard counters Ioana Ciornei
2026-02-25 23:38 ` Andrew Lunn
2026-02-26 7:03 ` Ioana Ciornei
2026-02-26 12:19 ` Ioana Ciornei
2026-02-26 13:31 ` Andrew Lunn
2026-02-26 14:18 ` Ioana Ciornei
2026-02-27 2:25 ` Jakub Kicinski
2026-02-27 7:34 ` Ioana Ciornei
2026-02-27 14:17 ` Andrew Lunn
2026-02-28 0:24 ` Jakub Kicinski
2026-02-28 0:23 ` Jakub Kicinski
2026-02-27 2:22 ` Jakub Kicinski
2026-02-27 13:53 ` Petr Machata
2026-02-28 0:43 ` Jakub Kicinski
2026-02-28 9:11 ` Petr Machata
2026-03-02 12:11 ` Ioana Ciornei
2026-03-03 0:07 ` Jakub Kicinski
2026-03-03 13:53 ` Ioana Ciornei
2026-03-03 16:43 ` Jakub Kicinski
2026-02-27 15:45 ` Petr Machata
2026-03-02 14:15 ` Ioana Ciornei
2026-03-03 13:30 ` Petr Machata
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=aaRktVdeVUubxBLc@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@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