Skip to content

Commit 49b3916

Browse files
AkshGarg-19kuba-moo
authored andcommitted
net: ethernet: ti: am65-cpsw-qos: fix IET verify/response timeout
The CPSW module uses the MAC_VERIFY_CNT bit field in the CPSW_PN_IET_VERIFY_REG_k register to set the verify/response timeout count. This register specifies the number of clock cycles to wait before resending a verify packet if the verification fails. The verify/response timeout count, as being set by the function am65_cpsw_iet_set_verify_timeout_count() is hardcoded for 125MHz clock frequency, which varies based on PHY mode and link speed. The respective clock frequencies are as follows: - RGMII mode: * 1000 Mbps: 125 MHz * 100 Mbps: 25 MHz * 10 Mbps: 2.5 MHz - QSGMII/SGMII mode: 125 MHz (all speeds) Fix this by adding logic to calculate the correct timeout counts based on the actual PHY interface mode and link speed. Fixes: 49a2eb9 ("net: ethernet: ti: am65-cpsw-qos: Add Frame Preemption MAC Merge support") Signed-off-by: Aksh Garg <a-garg7@ti.com> Link: https://patch.msgid.link/20251106092305.1437347-2-a-garg7@ti.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3072f00 commit 49b3916

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

drivers/net/ethernet/ti/am65-cpsw-qos.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,31 @@ static int am65_cpsw_iet_set_verify_timeout_count(struct am65_cpsw_port *port)
276276
/* The number of wireside clocks contained in the verify
277277
* timeout counter. The default is 0x1312d0
278278
* (10ms at 125Mhz in 1G mode).
279+
* The frequency of the clock depends on the link speed
280+
* and the PHY interface.
279281
*/
280-
val = 125 * HZ_PER_MHZ; /* assuming 125MHz wireside clock */
282+
switch (port->slave.phy_if) {
283+
case PHY_INTERFACE_MODE_RGMII:
284+
case PHY_INTERFACE_MODE_RGMII_ID:
285+
case PHY_INTERFACE_MODE_RGMII_RXID:
286+
case PHY_INTERFACE_MODE_RGMII_TXID:
287+
if (port->qos.link_speed == SPEED_1000)
288+
val = 125 * HZ_PER_MHZ; /* 125 MHz at 1000Mbps*/
289+
else if (port->qos.link_speed == SPEED_100)
290+
val = 25 * HZ_PER_MHZ; /* 25 MHz at 100Mbps*/
291+
else
292+
val = (25 * HZ_PER_MHZ) / 10; /* 2.5 MHz at 10Mbps*/
293+
break;
294+
295+
case PHY_INTERFACE_MODE_QSGMII:
296+
case PHY_INTERFACE_MODE_SGMII:
297+
val = 125 * HZ_PER_MHZ; /* 125 MHz */
298+
break;
281299

300+
default:
301+
netdev_err(port->ndev, "selected mode does not supported IET\n");
302+
return -EOPNOTSUPP;
303+
}
282304
val /= MILLIHZ_PER_HZ; /* count per ms timeout */
283305
val *= verify_time_ms; /* count for timeout ms */
284306

0 commit comments

Comments
 (0)