Thread (30 messages) 30 messages, 8 authors, 2024-12-10

Re: [PATCH net-next v1 6/7] phy: dp83td510: add statistics support

flat view

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2024-12-05 12:15:26
Also in: linux-doc, lkml

On Tue, Dec 03, 2024 at 08:56:20AM +0100, Oleksij Rempel wrote:
quoted hunk ↗ jump to hunk
Add support for reporting PHY statistics in the DP83TD510 driver. This
includes cumulative tracking of transmit/receive packet counts, and
error counts. Implemented functions to update and provide statistics via
ethtool, with optional polling support enabled through `PHY_POLL_STATS`.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/phy/dp83td510.c | 98 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 97 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/dp83td510.c b/drivers/net/phy/dp83td510.c
index 92aa3a2b9744..08d61a6a8c61 100644
--- a/drivers/net/phy/dp83td510.c
+++ b/drivers/net/phy/dp83td510.c
@@ -34,6 +34,24 @@
 #define DP83TD510E_CTRL_HW_RESET		BIT(15)
 #define DP83TD510E_CTRL_SW_RESET		BIT(14)
 
+#define DP83TD510E_PKT_STAT_1			0x12b
+#define DP83TD510E_TX_PKT_CNT_15_0_MASK		GENMASK(15, 0)
+
+#define DP83TD510E_PKT_STAT_2			0x12c
+#define DP83TD510E_TX_PKT_CNT_31_16_MASK	GENMASK(15, 0)
+
+#define DP83TD510E_PKT_STAT_3			0x12d
+#define DP83TD510E_TX_ERR_PKT_CNT_MASK		GENMASK(15, 0)
+
+#define DP83TD510E_PKT_STAT_4			0x12e
+#define DP83TD510E_RX_PKT_CNT_15_0_MASK		GENMASK(15, 0)
+
+#define DP83TD510E_PKT_STAT_5			0x12f
+#define DP83TD510E_RX_PKT_CNT_31_16_MASK	GENMASK(15, 0)
+
+#define DP83TD510E_PKT_STAT_6			0x130
+#define DP83TD510E_RX_ERR_PKT_CNT_MASK		GENMASK(15, 0)
I'm not sure I like this pattern of _MASK here. Why not call these
registers e.g. DP83TD510E_RX_PKT_CNT_31_16 ? Given that the full
register value is used, I don't see the need for _MASK and the
FIELD_GET()s, which just add extra complexity to the code and
reduce readability.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help