U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ti: am65-cpsw-nuss: don't touch DMA after stop
@ 2024-05-08 18:36 A. Sverdlin
  2024-05-10  9:11 ` Roger Quadros
  0 siblings, 1 reply; 3+ messages in thread
From: A. Sverdlin @ 2024-05-08 18:36 UTC (permalink / raw)
  To: u-boot
  Cc: Alexander Sverdlin, Joe Hershberger, Ramon Fried,
	Siddharth Vadapalli, Roger Quadros, Nishanth Menon,
	Matthias Schiffer, Suman Anna, Keerthy, Grygorii Strashko

From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

Contrary to doc/develop/driver-model/ethernet.rst contract, eth_ops
.free_pkt can be called after .stop, there are several error paths in TFTP,
for instance:

eth_halt() <= tftp_handler() <= net_process_received_packet() <= eth_rx()
...
am65_cpsw_free_pkt() <= eth_rx()

Which results in (deliberately "tftpboot"ing non-existing file):

TFTP error: 'File not found' (1)
Not retrying...
am65_cpsw_nuss_port ethernet@8000000port@1: RX dma free_pkt failed -22

Avoid the error message by checking that the interface is still not stopped
in am65_cpsw_free_pkt().

Fixes: 9d0dca1199d1 ("net: ethernet: ti: Introduce am654 gigabit eth switch subsystem driver")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
 drivers/net/ti/am65-cpsw-nuss.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
index 65ade1afd05..646f618afcf 100644
--- a/drivers/net/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ti/am65-cpsw-nuss.c
@@ -523,6 +523,9 @@ static int am65_cpsw_free_pkt(struct udevice *dev, uchar *packet, int length)
 	struct am65_cpsw_common	*common = priv->cpsw_common;
 	int ret;
 
+	if (!common->started)
+		return -ENETDOWN;
+
 	if (length > 0) {
 		u32 pkt = common->rx_next % UDMA_RX_DESC_NUM;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-10 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-08 18:36 [PATCH] net: ti: am65-cpsw-nuss: don't touch DMA after stop A. Sverdlin
2024-05-10  9:11 ` Roger Quadros
2024-05-10 19:40   ` Sverdlin, Alexander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox