Skip to content

Commit d4b00d1

Browse files
AkshGarg-19kuba-moo
authored andcommitted
net: ethernet: ti: am65-cpsw-qos: fix IET verify retry mechanism
The am65_cpsw_iet_verify_wait() function attempts verification 20 times, toggling the AM65_CPSW_PN_IET_MAC_LINKFAIL bit in each iteration. When the LINKFAIL bit transitions from 1 to 0, the MAC merge layer initiates the verification process and waits for the timeout configured in MAC_VERIFY_CNT before automatically retransmitting. The MAC_VERIFY_CNT register is configured according to the user-defined verify/response timeout in am65_cpsw_iet_set_verify_timeout_count(). As per IEEE 802.3 Clause 99, the hardware performs this automatic retry up to 3 times. Current implementation toggles LINKFAIL after the user-configured verify/response timeout in each iteration, forcing the hardware to restart verification instead of respecting the MAC_VERIFY_CNT timeout. This bypasses the hardware's automatic retry mechanism. Fix this by moving the LINKFAIL bit toggle outside the retry loop and reducing the retry count from 20 to 3. The software now only monitors the status register while the hardware autonomously handles the 3 verification attempts at proper MAC_VERIFY_CNT intervals. 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-3-a-garg7@ti.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 49b3916 commit d4b00d1

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -317,20 +317,21 @@ static int am65_cpsw_iet_verify_wait(struct am65_cpsw_port *port)
317317
u32 ctrl, status;
318318
int try;
319319

320-
try = 20;
321-
do {
322-
/* Reset the verify state machine by writing 1
323-
* to LINKFAIL
324-
*/
325-
ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
326-
ctrl |= AM65_CPSW_PN_IET_MAC_LINKFAIL;
327-
writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
320+
try = 3;
328321

329-
/* Clear MAC_LINKFAIL bit to start Verify. */
330-
ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
331-
ctrl &= ~AM65_CPSW_PN_IET_MAC_LINKFAIL;
332-
writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
322+
/* Reset the verify state machine by writing 1
323+
* to LINKFAIL
324+
*/
325+
ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
326+
ctrl |= AM65_CPSW_PN_IET_MAC_LINKFAIL;
327+
writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
333328

329+
/* Clear MAC_LINKFAIL bit to start Verify. */
330+
ctrl = readl(port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
331+
ctrl &= ~AM65_CPSW_PN_IET_MAC_LINKFAIL;
332+
writel(ctrl, port->port_base + AM65_CPSW_PN_REG_IET_CTRL);
333+
334+
do {
334335
msleep(port->qos.iet.verify_time_ms);
335336

336337
status = readl(port->port_base + AM65_CPSW_PN_REG_IET_STATUS);
@@ -352,7 +353,7 @@ static int am65_cpsw_iet_verify_wait(struct am65_cpsw_port *port)
352353
netdev_dbg(port->ndev, "MAC Merge verify error\n");
353354
return -ENODEV;
354355
}
355-
} while (try-- > 0);
356+
} while (--try > 0);
356357

357358
netdev_dbg(port->ndev, "MAC Merge verify timeout\n");
358359
return -ETIMEDOUT;

0 commit comments

Comments
 (0)