[U-Boot] [PATCH 17/26] net: mt7628-eth: free rx descriptor on receiving failure
Weijie Gao
weijie.gao at mediatek.com
Wed Aug 28 06:38:02 UTC 2019
When received a packet with an invalid length recorded in rx descriptor,
we should free this rx descriptor to allow us to continue to receive
following packets.
Without doing so, u-boot will stuck in a dead loop trying to process this
invalid rx descriptor.
This patch adds a call to mt7628_eth_free_pkt() after received an invalid
packet length.
Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
---
drivers/net/mt7628-eth.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mt7628-eth.c b/drivers/net/mt7628-eth.c
index eef25da8a8..8ca2c66edb 100644
--- a/drivers/net/mt7628-eth.c
+++ b/drivers/net/mt7628-eth.c
@@ -139,6 +139,8 @@ struct mt7628_eth_dev {
struct reset_ctl rst_ephy;
};
+static int mt7628_eth_free_pkt(struct udevice *dev, uchar *packet, int length);
+
static int mdio_wait_read(struct mt7628_eth_dev *priv, u32 mask, bool mask_set)
{
void __iomem *base = priv->eth_sw_base;
@@ -400,6 +402,7 @@ static int mt7628_eth_recv(struct udevice *dev, int flags, uchar **packetp)
length = FIELD_GET(RX_DMA_PLEN0, priv->rx_ring[idx].rxd2);
if (length == 0 || length > MTK_QDMA_PAGE_SIZE) {
printf("%s: invalid length (%d bytes)\n", __func__, length);
+ mt7628_eth_free_pkt(dev, NULL, 0);
return -EIO;
}
--
2.17.1
More information about the U-Boot
mailing list