Thread (27 messages) 27 messages, 3 authors, 4d ago

RE: [PATCH net-next 11/17] net: dsa: mv88e6xxx: Move available stats into info structure

From: Jagielski, Jedrzej <hidden>
Date: 2026-07-06 07:17:47
Also in: lkml

From: Luke Howard <redacted> 
Sent: Friday, July 3, 2026 9:47 AM
quoted hunk ↗ jump to hunk
From: Andrew Lunn <andrew@lunn.ch>

Different families of switches have different statistics available.
This information is current hard coded into functions, however this
information will also soon be needed when getting statistics from the
RMU. Move it into the info structure.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/dsa/mv88e6xxx/chip.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 6431d25f3cfa2..5c0a1e2b0507d 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1303,6 +1303,9 @@ static size_t mv88e6095_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
				       const struct mv88e6xxx_hw_stat *stat,
				       uint64_t *data)
{
+	if (!(stat->type & chip->info->stats_type))
+		return 0;
+
Is everything fine with this patch?
There's nothing beside adding checks to some of the functions
(which is reverted in the upcoming patch) what does not
seem to be corresponding to the commit msg
quoted hunk ↗ jump to hunk
	*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port, 0,
					    MV88E6XXX_G1_STATS_OP_HIST_RX);
	return 1;
@@ -1312,6 +1315,9 @@ static size_t mv88e6250_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
				       const struct mv88e6xxx_hw_stat *stat,
				       uint64_t *data)
{
+	if (!(stat->type & chip->info->stats_type))
+		return 0;
+
	*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port, 0,
					    MV88E6XXX_G1_STATS_OP_HIST_RX);
	return 1;
@@ -1321,6 +1327,9 @@ static size_t mv88e6320_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
				       const struct mv88e6xxx_hw_stat *stat,
				       uint64_t *data)
{
+	if (!(stat->type & chip->info->stats_type))
+		return 0;
+
	*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port,
					    MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9,
					    MV88E6XXX_G1_STATS_OP_HIST_RX);
@@ -1331,6 +1340,9 @@ static size_t mv88e6390_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
				       const struct mv88e6xxx_hw_stat *stat,
				       uint64_t *data)
{
+	if (!(stat->type & chip->info->stats_type))
+		return 0;
+
	*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port,
					    MV88E6XXX_G1_STATS_OP_BANK_1_BIT_10,
					    0);

-- 
2.43.0
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help