diff mbox

net/vmxnet3: Flush packets when device gets activated

Message ID 1439897142-28072-1-git-send-email-shmulik.ladkani@ravellosystems.com
State New
Headers show

Commit Message

Shmulik Ladkani Aug. 18, 2015, 11:25 a.m. UTC
As of a90a7425cf592a3afeff3eaf32f543b83050ee5c 'tap: Drop tap_can_send'
vmxnet3 (with tap networking) can no longer receive once device is
deactivated.
Alas, as the device is initially "inactive", this brakes vmxnet3
receive functionality.

vmxnet3_can_receive() checks its internal 'device_active' flag (among
other tests).
However, as of a90a7425cf, if 'device_active' is false, packets will be
queued by tap_send (at qemu_net_queue_send).

However, vmxnet3 never flushes the queue, even if the device is later
activated.

Fix by calling 'qemu_flush_queued_packets()' when vmxnet3 device gets
active.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
---
 hw/net/vmxnet3.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Dmitry Fleytman Aug. 19, 2015, 5:32 p.m. UTC | #1
ACK.

> On Aug 18, 2015, at 04:25 AM, Shmulik Ladkani <shmulik.ladkani@ravellosystems.com> wrote:
> 
> As of a90a7425cf592a3afeff3eaf32f543b83050ee5c 'tap: Drop tap_can_send'
> vmxnet3 (with tap networking) can no longer receive once device is
> deactivated.
> Alas, as the device is initially "inactive", this brakes vmxnet3
> receive functionality.
> 
> vmxnet3_can_receive() checks its internal 'device_active' flag (among
> other tests).
> However, as of a90a7425cf, if 'device_active' is false, packets will be
> queued by tap_send (at qemu_net_queue_send).
> 
> However, vmxnet3 never flushes the queue, even if the device is later
> activated.
> 
> Fix by calling 'qemu_flush_queued_packets()' when vmxnet3 device gets
> active.
> 
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
> ---
> hw/net/vmxnet3.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
> index 59b06b8..8387571 100644
> --- a/hw/net/vmxnet3.c
> +++ b/hw/net/vmxnet3.c
> @@ -1561,6 +1561,7 @@ static void vmxnet3_activate_device(VMXNET3State *s)
>     vmxnet3_reset_mac(s);
> 
>     s->device_active = true;
> +    qemu_flush_queued_packets(qemu_get_queue(s->nic));
> }
> 
> static void vmxnet3_handle_command(VMXNET3State *s, uint64_t cmd)
> -- 
> 1.9.1
>
Fam Zheng Aug. 19, 2015, 6:45 p.m. UTC | #2
On Tue, 08/18 14:25, Shmulik Ladkani wrote:
> As of a90a7425cf592a3afeff3eaf32f543b83050ee5c 'tap: Drop tap_can_send'
> vmxnet3 (with tap networking) can no longer receive once device is
> deactivated.
> Alas, as the device is initially "inactive", this brakes vmxnet3
> receive functionality.
> 
> vmxnet3_can_receive() checks its internal 'device_active' flag (among
> other tests).
> However, as of a90a7425cf, if 'device_active' is false, packets will be
> queued by tap_send (at qemu_net_queue_send).
> 
> However, vmxnet3 never flushes the queue, even if the device is later
> activated.
> 
> Fix by calling 'qemu_flush_queued_packets()' when vmxnet3 device gets
> active.
> 
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>

Looks like the previous patch to fix this fell between the cracks and never
made it to qemu.git?

http://patchwork.ozlabs.org/patch/489847/

Stefan, any idea?

Fam
Stefan Hajnoczi Sept. 2, 2015, 1:48 p.m. UTC | #3
On Thu, Aug 20, 2015 at 02:45:47AM +0800, Fam Zheng wrote:
> On Tue, 08/18 14:25, Shmulik Ladkani wrote:
> > As of a90a7425cf592a3afeff3eaf32f543b83050ee5c 'tap: Drop tap_can_send'
> > vmxnet3 (with tap networking) can no longer receive once device is
> > deactivated.
> > Alas, as the device is initially "inactive", this brakes vmxnet3
> > receive functionality.
> > 
> > vmxnet3_can_receive() checks its internal 'device_active' flag (among
> > other tests).
> > However, as of a90a7425cf, if 'device_active' is false, packets will be
> > queued by tap_send (at qemu_net_queue_send).
> > 
> > However, vmxnet3 never flushes the queue, even if the device is later
> > activated.
> > 
> > Fix by calling 'qemu_flush_queued_packets()' when vmxnet3 device gets
> > active.
> > 
> > Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
> 
> Looks like the previous patch to fix this fell between the cracks and never
> made it to qemu.git?
> 
> http://patchwork.ozlabs.org/patch/489847/
> 
> Stefan, any idea?

Shmulik: Please test the patch that Fam linked
Shmulik Ladkani Sept. 4, 2015, 7:12 a.m. UTC | #4
Hi Stefan,

On Wed, 2 Sep 2015 14:48:57 +0100 Stefan Hajnoczi <stefanha@redhat.com> wrote:
> On Thu, Aug 20, 2015 at 02:45:47AM +0800, Fam Zheng wrote:
> > Looks like the previous patch to fix this fell between the cracks and never
> > made it to qemu.git?
> > 
> > http://patchwork.ozlabs.org/patch/489847/
> > 
> > Stefan, any idea?
> 
> Shmulik: Please test the patch that Fam linked

Added a "Tested-by" to the relevant post.

Stefan, I assume this should go into v2.4.1?
Otherwise, vmxnet3 has no rx connectivity.

Regards,
Shmulik
diff mbox

Patch

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 59b06b8..8387571 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1561,6 +1561,7 @@  static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_reset_mac(s);
 
     s->device_active = true;
+    qemu_flush_queued_packets(qemu_get_queue(s->nic));
 }
 
 static void vmxnet3_handle_command(VMXNET3State *s, uint64_t cmd)