Patchwork [v1,2/3] xilinx_ethlite: Flush queued packets on SW service

login
register
mail settings
Submitter Peter Crosthwaite
Date Jan. 26, 2013, 8:36 p.m.
Message ID <f9e13fcb-db98-4700-b59c-9f131c934475@TX2EHSMHS015.ehs.local>
Download mbox | patch
Permalink /patch/215935/
State New
Headers show

Comments

Peter Crosthwaite - Jan. 26, 2013, 8:36 p.m.
Software services a received packet by clearing the CTRL_S bit in the RX_CTRLn
register. If this bit is cleared, flush any packets queued for the device.

Reported-by: John Williams <john.williams@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
 hw/xilinx_ethlite.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
Edgar Iglesias - Jan. 27, 2013, 12:15 a.m.
On Sat, Jan 26, 2013 at 12:36:23PM -0800, Peter Crosthwaite wrote:
> Software services a received packet by clearing the CTRL_S bit in the RX_CTRLn
> register. If this bit is cleared, flush any packets queued for the device.

Applied

> 
> Reported-by: John Williams <john.williams@xilinx.com>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
>  hw/xilinx_ethlite.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xilinx_ethlite.c b/hw/xilinx_ethlite.c
> index 972b85e..9463e92 100644
> --- a/hw/xilinx_ethlite.c
> +++ b/hw/xilinx_ethlite.c
> @@ -135,11 +135,14 @@ eth_write(void *opaque, hwaddr addr,
>              break;
>  
>          /* Keep these native.  */
> +        case R_RX_CTRL0:
> +        case R_RX_CTRL1:
> +            if (!(value & CTRL_S)) {
> +                qemu_flush_queued_packets(&s->nic->nc);
> +            }
>          case R_TX_LEN0:
>          case R_TX_LEN1:
>          case R_TX_GIE0:
> -        case R_RX_CTRL0:
> -        case R_RX_CTRL1:
>              D(qemu_log("%s addr=%x val=%x\n", __func__, addr * 4, value));
>              s->regs[addr] = value;
>              break;
> -- 
> 1.7.12.1.396.g16eed7c
> 
>

Patch

diff --git a/hw/xilinx_ethlite.c b/hw/xilinx_ethlite.c
index 972b85e..9463e92 100644
--- a/hw/xilinx_ethlite.c
+++ b/hw/xilinx_ethlite.c
@@ -135,11 +135,14 @@  eth_write(void *opaque, hwaddr addr,
             break;
 
         /* Keep these native.  */
+        case R_RX_CTRL0:
+        case R_RX_CTRL1:
+            if (!(value & CTRL_S)) {
+                qemu_flush_queued_packets(&s->nic->nc);
+            }
         case R_TX_LEN0:
         case R_TX_LEN1:
         case R_TX_GIE0:
-        case R_RX_CTRL0:
-        case R_RX_CTRL1:
             D(qemu_log("%s addr=%x val=%x\n", __func__, addr * 4, value));
             s->regs[addr] = value;
             break;