[PATCH u-boot 1/2] drivers/net/aspeednic: Fix RX buffer size

OpenBMC Patches openbmc-patches at stwcx.xyz
Thu Dec 17 10:20:33 AEDT 2015


From: Cyril Bur <cyril.bur at au1.ibm.com>

The hardware defaults to 1600 bytes of RX buffer size, currently we
allocate a little less and there is a chance that the hardware might DMA
more than we've allocated.

In the process of writing this patch, it was discovered that the driver
was incorrectly informing the hardware of its RX buffer size, addressed
that problem too.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 drivers/net/aspeednic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/aspeednic.c b/drivers/net/aspeednic.c
index d75ef67..e7b0b95 100644
--- a/drivers/net/aspeednic.c
+++ b/drivers/net/aspeednic.c
@@ -227,7 +227,7 @@ static u8 g_phy_addr = 0;
 
 #define NUM_RX_DESC PKTBUFSRX
 #define NUM_TX_DESC 1     /* Number of TX descriptors   */
-#define RX_BUFF_SZ  PKTSIZE_ALIGN
+#define RX_BUFF_SZ  1600 /* Hardware defaults to this */
 #define TX_BUFF_SZ  1514
 
 #define TOUT_LOOP   1000000
@@ -1161,7 +1161,7 @@ static int aspeednic_init(struct eth_device* dev, bd_t* bis)
   set_mac_control_register (dev);
 
   for (i = 0; i < NUM_RX_DESC; i++) {
-    rx_ring[i].status = cpu_to_le32(RXPKT_RDY + RX_BUFF_SZ);
+    rx_ring[i].status = cpu_to_le32(RXPKT_RDY);
     rx_ring[i].buf = (u32)(&rx_buffer[i]);
     rx_ring[i].reserved = 0;
   }
@@ -1181,6 +1181,7 @@ static int aspeednic_init(struct eth_device* dev, bd_t* bis)
 
   OUTL(dev, ((u32) &tx_ring), TXR_BADR_REG);
   OUTL(dev, ((u32) &rx_ring), RXR_BADR_REG);
+  OUTL(dev, RX_BUFF_SZ, RBSR_REG);
 
   START_MAC(dev);
 
-- 
2.6.3




More information about the openbmc mailing list