summaryrefslogtreecommitdiff
path: root/cpu/ppc4xx
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2007-07-12 16:32:08 +0200
committerStefan Roese <sr@denx.de>2007-07-12 16:32:08 +0200
commita2e1c7098cf9574386b0c96841dfc8ea5cc93578 (patch)
tree25677af9bc069f9d4a17b1b14e4712b784d145d1 /cpu/ppc4xx
parent53629f439cc9daba166812749d2cf3102aca7aac (diff)
downloadu-boot-imx-a2e1c7098cf9574386b0c96841dfc8ea5cc93578.zip
u-boot-imx-a2e1c7098cf9574386b0c96841dfc8ea5cc93578.tar.gz
u-boot-imx-a2e1c7098cf9574386b0c96841dfc8ea5cc93578.tar.bz2
ppc4xx: Change receive buffer handling in the 4xx emac driver
This change fixes a bug in the receive buffer handling, that could lead to problems upon high network traffic (broadcasts...). Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'cpu/ppc4xx')
-rw-r--r--cpu/ppc4xx/4xx_enet.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpu/ppc4xx/4xx_enet.c b/cpu/ppc4xx/4xx_enet.c
index 1200d02..b90363f 100644
--- a/cpu/ppc4xx/4xx_enet.c
+++ b/cpu/ppc4xx/4xx_enet.c
@@ -1415,10 +1415,8 @@ static void enet_rcv (struct eth_device *dev, unsigned long malisr)
if ((MAL_RX_CTRL_EMPTY & hw_p->rx[i].ctrl)
|| (loop_count >= NUM_RX_BUFF))
break;
+
loop_count++;
- hw_p->rx_slot++;
- if (NUM_RX_BUFF == hw_p->rx_slot)
- hw_p->rx_slot = 0;
handled++;
data_len = (unsigned long) hw_p->rx[i].data_len; /* Get len */
if (data_len) {
@@ -1468,6 +1466,10 @@ static void enet_rcv (struct eth_device *dev, unsigned long malisr)
if (NUM_RX_BUFF == hw_p->rx_i_index)
hw_p->rx_i_index = 0;
+ hw_p->rx_slot++;
+ if (NUM_RX_BUFF == hw_p->rx_slot)
+ hw_p->rx_slot = 0;
+
/* AS.HARNOIS
* free receive buffer only when
* buffer has been handled (eth_rx)