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

Joel Stanley joel at jms.id.au
Thu Dec 17 10:38:42 AEDT 2015


On Thu, Dec 17, 2015 at 9:50 AM, OpenBMC Patches
<openbmc-patches at stwcx.xyz> wrote:
> 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.

Thanks Cyril, great work.

> Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>

Reviewed-by: Joel Stanley <joel at jms.id.au>

> ---
>  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
>
>
> _______________________________________________
> openbmc mailing list
> openbmc at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc


More information about the openbmc mailing list