qemu-arm
[Top][All Lists]
Advanced

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

Re: [PATCH] hw/net: npcm7xx_emc fix missing queue_flush


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] hw/net: npcm7xx_emc fix missing queue_flush
Date: Fri, 3 Dec 2021 22:42:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0

On 12/3/21 22:27, Patrick Venture wrote:
> The rx_active boolean change to true should always trigger a try_read
> call that flushes the queue.
> 
> Signed-off-by: Patrick Venture <venture@google.com>
> ---
>  hw/net/npcm7xx_emc.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
> index 7c892f820f..97522e6388 100644
> --- a/hw/net/npcm7xx_emc.c
> +++ b/hw/net/npcm7xx_emc.c
> @@ -581,13 +581,6 @@ static ssize_t emc_receive(NetClientState *nc, const 
> uint8_t *buf, size_t len1)
>      return len;
>  }
>  
> -static void emc_try_receive_next_packet(NPCM7xxEMCState *emc)
> -{
> -    if (emc_can_receive(qemu_get_queue(emc->nic))) {
> -        qemu_flush_queued_packets(qemu_get_queue(emc->nic));
> -    }
> -}

What about modifying as emc_flush_rx() or emc_receive_and_flush()
helper instead?

 static void emc_flush_rx(NPCM7xxEMCState *emc)
 {
     emc->rx_active = true;
     qemu_flush_queued_packets(qemu_get_queue(emc->nic));
 }

>  static uint64_t npcm7xx_emc_read(void *opaque, hwaddr offset, unsigned size)
>  {
>      NPCM7xxEMCState *emc = opaque;
> @@ -704,6 +697,7 @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
>          }
>          if (value & REG_MCMDR_RXON) {
>              emc->rx_active = true;
> +            qemu_flush_queued_packets(qemu_get_queue(emc->nic));
>          } else {
>              emc_halt_rx(emc, 0);
>          }
> @@ -740,7 +734,7 @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
>      case REG_RSDR:
>          if (emc->regs[REG_MCMDR] & REG_MCMDR_RXON) {
>              emc->rx_active = true;
> -            emc_try_receive_next_packet(emc);
> +            qemu_flush_queued_packets(qemu_get_queue(emc->nic));
>          }
>          break;
>      case REG_MIIDA:
> 




reply via email to

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