diff mbox series

[06/10] dp8393x: Clear RRRA command register bit only when appropriate

Message ID d3fdb6ca3fa26e495dd89136ee7f06cd94d1f0f7.1576286757.git.fthain@telegraphics.com.au
State New
Headers show
Series Fixes for DP8393X SONIC device emulation | expand

Commit Message

Finn Thain Dec. 14, 2019, 1:25 a.m. UTC
It doesn't make sense to clear the command register bit unless the
command was actually issued.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
 hw/net/dp8393x.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Philippe Mathieu-Daudé Dec. 14, 2019, 1:31 p.m. UTC | #1
On 12/14/19 2:25 AM, Finn Thain wrote:
> It doesn't make sense to clear the command register bit unless the
> command was actually issued.
> 
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   hw/net/dp8393x.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
> index 494deb42bf..3fdc6cc6f9 100644
> --- a/hw/net/dp8393x.c
> +++ b/hw/net/dp8393x.c
> @@ -337,9 +337,6 @@ static void dp8393x_do_read_rra(dp8393xState *s)
>           s->regs[SONIC_ISR] |= SONIC_ISR_RBE;
>           dp8393x_update_irq(s);
>       }
> -
> -    /* Done */
> -    s->regs[SONIC_CR] &= ~SONIC_CR_RRRA;
>   }
>   
>   static void dp8393x_do_software_reset(dp8393xState *s)
> @@ -548,8 +545,10 @@ static void dp8393x_do_command(dp8393xState *s, uint16_t command)
>           dp8393x_do_start_timer(s);
>       if (command & SONIC_CR_RST)
>           dp8393x_do_software_reset(s);
> -    if (command & SONIC_CR_RRRA)
> +    if (command & SONIC_CR_RRRA) {
>           dp8393x_do_read_rra(s);
> +        s->regs[SONIC_CR] &= ~SONIC_CR_RRRA;
> +    }
>       if (command & SONIC_CR_LCAM)
>           dp8393x_do_load_cam(s);
>   }
>
diff mbox series

Patch

diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 494deb42bf..3fdc6cc6f9 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -337,9 +337,6 @@  static void dp8393x_do_read_rra(dp8393xState *s)
         s->regs[SONIC_ISR] |= SONIC_ISR_RBE;
         dp8393x_update_irq(s);
     }
-
-    /* Done */
-    s->regs[SONIC_CR] &= ~SONIC_CR_RRRA;
 }
 
 static void dp8393x_do_software_reset(dp8393xState *s)
@@ -548,8 +545,10 @@  static void dp8393x_do_command(dp8393xState *s, uint16_t command)
         dp8393x_do_start_timer(s);
     if (command & SONIC_CR_RST)
         dp8393x_do_software_reset(s);
-    if (command & SONIC_CR_RRRA)
+    if (command & SONIC_CR_RRRA) {
         dp8393x_do_read_rra(s);
+        s->regs[SONIC_CR] &= ~SONIC_CR_RRRA;
+    }
     if (command & SONIC_CR_LCAM)
         dp8393x_do_load_cam(s);
 }