Skip to content

Commit 919d763

Browse files
MeghanaMalladiTIPaolo Abeni
authored andcommitted
net: ti: icssg-prueth: Fix swapped TX stats for MII interfaces.
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>
1 parent 12c331b commit 919d763

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

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

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

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

0 commit comments

Comments
 (0)