qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH arm-devs v1 13/13] net/cadence_gem: Dont rx pack


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH arm-devs v1 13/13] net/cadence_gem: Dont rx packets when no rx buffer available
Date: Mon, 2 Dec 2013 12:31:55 +0000

On 2 December 2013 07:16, Peter Crosthwaite
<address@hidden> wrote:

Missing apostrophe in Subject.

> Return false from can_recieve() when no valid buffer descriptor is

"can_receive"

> available. Ensures against mass packet droppage in some applications.
>
> Signed-off-by: Peter Crosthwaite <address@hidden>
> ---
>
>  hw/net/cadence_gem.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
> index 8c2d8fc..a0499ac 100644
> --- a/hw/net/cadence_gem.c
> +++ b/hw/net/cadence_gem.c
> @@ -463,6 +463,15 @@ static int gem_can_receive(NetClientState *nc)
>          return 0;
>      }
>
> +    if (rx_desc_get_ownership(s->rx_desc) == 1) {
> +        if (s->can_rx_state != 2) {
> +            s->can_rx_state = 2;
> +            DB_PRINT("cant receive - busy buffer descriptor 0x%x\n",

"can't".

> +                     s->rx_desc_addr);
> +        }
> +        return 0;
> +    }
> +
>      if (s->can_rx_state != 0) {
>          s->can_rx_state = 0;
>          DB_PRINT("can receive 0x%x\n", s->rx_desc_addr);
> @@ -1144,7 +1153,7 @@ static void gem_write(void *opaque, hwaddr offset, 
> uint64_t val,
>              /* Reset to start of Q when transmit disabled. */
>              s->tx_desc_addr = s->regs[GEM_TXQBASE];
>          }
> -        if (val & GEM_NWCTRL_RXENA) {
> +        if (gem_can_receive(qemu_get_queue(s->nic))) {
>              qemu_flush_queued_packets(qemu_get_queue(s->nic));
>          }
>          break;
> --
> 1.8.4.4
>

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]