diff options
author | Weijie Gao <weijie.gao@mediatek.com> | 2019-09-25 17:45:34 +0800 |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2019-10-25 17:20:44 +0200 |
commit | c88ee3ea0a77c0547ce5297e4c2e7378a5cb29ae (patch) | |
tree | a0bc174bf04cdc04926cfdbb78a1811a865e5a9f | |
parent | f079321009841bbb7c3a357febc08441c579f3f2 (diff) | |
download | u-boot-c88ee3ea0a77c0547ce5297e4c2e7378a5cb29ae.tar.gz |
net: mt7628-eth: free rx descriptor on receiving failure
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.
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
-rw-r--r-- | drivers/net/mt7628-eth.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/mt7628-eth.c b/drivers/net/mt7628-eth.c index abfdc75ad8..d77da26d50 100644 --- a/drivers/net/mt7628-eth.c +++ b/drivers/net/mt7628-eth.c @@ -142,6 +142,8 @@ struct mt7628_eth_dev { struct phy_device *phy; }; +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; @@ -403,6 +405,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; } |