Skip to content

Commit 6c2e062

Browse files
MeghanaMalladiTIgregkh
authored andcommitted
net: ti: icssg-prueth: Fix swapped TX stats for MII interfaces.
[ Upstream commit 919d763 ] In MII mode, Tx lines are swapped for port0 and port1, which means Tx port0 receives data from PRU1 and the Tx port1 receives data from PRU0. This is an expected hardware behavior and reading the Tx stats needs to be handled accordingly in the driver. Update the driver to read Tx stats from the PRU1 for port0 and PRU0 for port1. Fixes: c1e10d5 ("net: ti: icssg-prueth: Add ICSSG Stats") Signed-off-by: Meghana Malladi <m-malladi@ti.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250603052904.431203-1-m-malladi@ti.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f34dc85 commit 6c2e062

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/net/ethernet/ti/icssg/icssg_stats.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ void emac_update_hardware_stats(struct prueth_emac *emac)
2929
spin_lock(&prueth->stats_lock);
3030

3131
for (i = 0; i < ARRAY_SIZE(icssg_all_miig_stats); i++) {
32+
/* In MII mode TX lines are swapped inside ICSSG, so read Tx stats
33+
* from slice1 for port0 and slice0 for port1 to get accurate Tx
34+
* stats for a given port
35+
*/
36+
if (emac->phy_if == PHY_INTERFACE_MODE_MII &&
37+
icssg_all_miig_stats[i].offset >= ICSSG_TX_PACKET_OFFSET &&
38+
icssg_all_miig_stats[i].offset <= ICSSG_TX_BYTE_OFFSET)
39+
base = stats_base[slice ^ 1];
3240
regmap_read(prueth->miig_rt,
3341
base + icssg_all_miig_stats[i].offset,
3442
&val);

0 commit comments

Comments
 (0)