]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: tsec: Re-arm packet buffer in error case
authorJ. Neuschäfer <j.ne@posteo.net>
Sun, 16 Feb 2025 21:18:13 +0000 (22:18 +0100)
committerPeng Fan <peng.fan@nxp.com>
Mon, 3 Mar 2025 06:18:49 +0000 (14:18 +0800)
When an error is detected in the TSEC receive path, the driver currently
prints an error message, but leaves the corresponding packet descriptor
in its old state (i.e. owned by the CPU side). As a result, the packet
queue can be starved of available buffers if enough errors happen.

To recover from errors, re-arm the packet buffer descriptor after an
error has been detected.

Errors can be provoked by changing a PHY with phy-mode = "rgmii-id" to
phy-mode = "rgmii".

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/net/tsec.c

index b27fc322db55b7b845f8d629348cb34d79de3cc2..bd4ebdd745a6cee5828ef1584518589c7667e667 100644 (file)
@@ -314,6 +314,9 @@ static int tsec_recv(struct udevice *dev, int flags, uchar **packetp)
                        ret = length - 4;
                } else {
                        printf("Got error %x\n", (status & RXBD_STATS));
+
+                       /* Rearm the packet buffer */
+                       tsec_free_pkt(dev, NULL, 0);
                }
        }