Skip to contentSkip to conversation

qoriq eth.c bugfix: handle received corrupted frames correctly

PATCH New Daniel Inderbitzin 2 participants 2 messages Jul 10, 2015 – Aug 12, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qoriq eth.c bugfix: handle received corrupted frames correctly

From: Daniel Inderbitzin <[email protected]>

The rxbd is not correctly handled in case of a frame physical error (FPE) or frame size error (FSE). The rxbd must be cleared and advanced in case of an error to avoid receive stall.

---

 drivers/net/fm/eth.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/fm/eth.c +3 -2
index d7a37f3..6702f5a 100644
@@ -520,6 +520,7 @@ static int fm_eth_recv(struct eth_device *dev)
 	u16 status, len;
 	u8 *data;
 	u16 offset_out;
+	int ret = 1;
 
 	fm_eth = (struct fm_eth *)dev->priv;
 	pram = fm_eth->rx_pram;
@@ -533,7 +534,7 @@ static int fm_eth_recv(struct eth_device *dev)
 			net_process_received_packet(data, len);
 		} else {
 			printf("%s: Rx error\n", dev->name);
-			return 0;
+			ret = 0;
 		}
 
 		/* clear the RxBDs */
@@ -559,7 +560,7 @@ static int fm_eth_recv(struct eth_device *dev)
 	}
 	fm_eth->cur_rxbd = (void *)rxbd;
 
-	return 1;
+	return ret;
 }
 
 static int fm_eth_init_mac(struct fm_eth *fm_eth, struct ccsr_fman *reg)
Signature · 1 line
2.4.5
#1 lore raw

PATCH 1/1 qoriq eth.c bugfix: handle received corrupted frames correctly

Hi Daniel,

Quoted 7 lines · Daniel Inderbitzin

From: Daniel Inderbitzin <[email protected]>

The rxbd is not correctly handled in case of a frame physical error (FPE) or frame size error (FSE). The rxbd must be cleared and advanced in case of an error to avoid receive stall.

Applied to u-boot-net, thanks!
-Joe