[PATCH u-boot 2/2] drivers/net/aspeednic: Fix unreliable networking

Joel Stanley joel at jms.id.au
Thu Dec 17 10:39:26 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>
>
> Hardware must be told to move data from its RX FIFO to system memory where
> the driver can then consume it.  There are two mechanisms for this, a 'do
> this automatically' register which can be set on device init or simply a
> 'copy data now' polling style which is what this patch does.
>
> Both options were investigated and as the entire network stack of u-boot is
> polling and we're only polling when we expect to receive a message it make
> sense to continue this down to the hardware level as well, doing the
> automatic copy actually causes more noise and unnecessary work.
>
> It should be noted that the NIC was largely functional before this patch.
> It appears that the reason it was working was that the hardware would quite
> happily DMA into the receive ring as long as there was was spare space.
> During heavy loads or on busy networks the receiving ring can fill up which
> causes the hardware to stop (and never resume) its DMA activities unless
> explicitly told to.
>
> Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>

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

> ---
>  drivers/net/aspeednic.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/net/aspeednic.c b/drivers/net/aspeednic.c
> index e7b0b95..d70c7ab 100644
> --- a/drivers/net/aspeednic.c
> +++ b/drivers/net/aspeednic.c
> @@ -1334,6 +1334,12 @@ static int aspeednic_recv(struct eth_device* dev)
>         * to the adapter.
>         */
>        rx_ring[rx_new].status &= cpu_to_le32(0x7FFFFFFF);
> +
> +      /*
> +       * Ask the hardware for any other packets now that we have a known
> +       * spare slot
> +       */
> +      OUTL(dev, POLL_DEMAND, RXPD_REG);
>  //      rx_ring[rx_new].status = cpu_to_le32(RXPKT_RDY);
>      }
>
> @@ -1342,6 +1348,12 @@ static int aspeednic_recv(struct eth_device* dev)
>      rx_new = (rx_new + 1) % rxRingSize;
>    }
>
> +  /*
> +   * Ask the hardware for more packets so that they'll be DMAed by the time
> +   * we return to this loop
> +   */
> +  OUTL(dev, POLL_DEMAND, RXPD_REG);
> +
>    return length;
>  }
>
> --
> 2.6.3
>
>
> _______________________________________________
> openbmc mailing list
> openbmc at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc


More information about the openbmc mailing list