]> git.sur5r.net Git - u-boot/commitdiff
ppc4xx: Change receive buffer handling in the 4xx emac driver
authorStefan Roese <sr@denx.de>
Thu, 12 Jul 2007 14:32:08 +0000 (16:32 +0200)
committerStefan Roese <sr@denx.de>
Thu, 12 Jul 2007 14:32:08 +0000 (16:32 +0200)
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>
cpu/ppc4xx/4xx_enet.c

index 1200d021af62a832477843e805a32caffdc8e0c6..b90363f47ab5b33631a13d9e94988f00015bda0b 100644 (file)
@@ -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)