* [PATCH] virtio-net: purge queued rx packets on queue deletion
@ 2020-11-12 9:46 Yuri Benditovich
2020-11-18 3:59 ` Jason Wang
0 siblings, 1 reply; 3+ messages in thread
From: Yuri Benditovich @ 2020-11-12 9:46 UTC (permalink / raw)
To: qemu-devel, jasowang; +Cc: yan
https://bugzilla.redhat.com/show_bug.cgi?id=1829272
When deleting queue pair, purge pending RX packets if any.
Example of problematic flow:
1. Bring up q35 VM with tap (vhost off) and virtio-net or e1000e
2. Run ping flood to the VM NIC ( 1 ms interval)
3. Hot unplug the NIC device (device_del)
During unplug process one or more packets come, the NIC
can't receive, tap disables read_poll
4. Hot plug the device (device_add) with the same netdev
The tap stays with read_poll disabled and does not receive
any packets anymore (tap_send never triggered)
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
net/net.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/net.c b/net/net.c
index 7a2a0fb5ac..a95b417300 100644
--- a/net/net.c
+++ b/net/net.c
@@ -411,10 +411,14 @@ void qemu_del_nic(NICState *nic)
qemu_macaddr_set_free(&nic->conf->macaddr);
- /* If this is a peer NIC and peer has already been deleted, free it now. */
- if (nic->peer_deleted) {
- for (i = 0; i < queues; i++) {
- qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
+ for (i = 0; i < queues; i++) {
+ NetClientState *nc = qemu_get_subqueue(nic, i);
+ /* If this is a peer NIC and peer has already been deleted, free it now. */
+ if (nic->peer_deleted) {
+ qemu_free_net_client(nc->peer);
+ } else if (nc->peer) {
+ /* if there are RX packets pending, complete them */
+ qemu_purge_queued_packets(nc->peer);
}
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] virtio-net: purge queued rx packets on queue deletion
2020-11-12 9:46 [PATCH] virtio-net: purge queued rx packets on queue deletion Yuri Benditovich
@ 2020-11-18 3:59 ` Jason Wang
2020-11-18 6:25 ` Yuri Benditovich
0 siblings, 1 reply; 3+ messages in thread
From: Jason Wang @ 2020-11-18 3:59 UTC (permalink / raw)
To: Yuri Benditovich, qemu-devel; +Cc: yan
On 2020/11/12 下午5:46, Yuri Benditovich wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1829272
> When deleting queue pair, purge pending RX packets if any.
> Example of problematic flow:
> 1. Bring up q35 VM with tap (vhost off) and virtio-net or e1000e
> 2. Run ping flood to the VM NIC ( 1 ms interval)
> 3. Hot unplug the NIC device (device_del)
> During unplug process one or more packets come, the NIC
> can't receive, tap disables read_poll
> 4. Hot plug the device (device_add) with the same netdev
> The tap stays with read_poll disabled and does not receive
> any packets anymore (tap_send never triggered)
>
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Applied.
Thanks
> ---
> net/net.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/net.c b/net/net.c
> index 7a2a0fb5ac..a95b417300 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -411,10 +411,14 @@ void qemu_del_nic(NICState *nic)
>
> qemu_macaddr_set_free(&nic->conf->macaddr);
>
> - /* If this is a peer NIC and peer has already been deleted, free it now. */
> - if (nic->peer_deleted) {
> - for (i = 0; i < queues; i++) {
> - qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
> + for (i = 0; i < queues; i++) {
> + NetClientState *nc = qemu_get_subqueue(nic, i);
> + /* If this is a peer NIC and peer has already been deleted, free it now. */
> + if (nic->peer_deleted) {
> + qemu_free_net_client(nc->peer);
> + } else if (nc->peer) {
> + /* if there are RX packets pending, complete them */
> + qemu_purge_queued_packets(nc->peer);
> }
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] virtio-net: purge queued rx packets on queue deletion
2020-11-18 3:59 ` Jason Wang
@ 2020-11-18 6:25 ` Yuri Benditovich
0 siblings, 0 replies; 3+ messages in thread
From: Yuri Benditovich @ 2020-11-18 6:25 UTC (permalink / raw)
To: Jason Wang; +Cc: Yan Vugenfirer, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 2090 bytes --]
Hi Jason,
Sorry, there is a mistake in the title: should be 'net' instead of
'virtio-net'.
Can you please fix it?
Thanks,
Yuri Benditovich
On Wed, Nov 18, 2020 at 5:59 AM Jason Wang <jasowang@redhat.com> wrote:
>
> On 2020/11/12 下午5:46, Yuri Benditovich wrote:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1829272
> > When deleting queue pair, purge pending RX packets if any.
> > Example of problematic flow:
> > 1. Bring up q35 VM with tap (vhost off) and virtio-net or e1000e
> > 2. Run ping flood to the VM NIC ( 1 ms interval)
> > 3. Hot unplug the NIC device (device_del)
> > During unplug process one or more packets come, the NIC
> > can't receive, tap disables read_poll
> > 4. Hot plug the device (device_add) with the same netdev
> > The tap stays with read_poll disabled and does not receive
> > any packets anymore (tap_send never triggered)
> >
> > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
>
>
> Applied.
>
> Thanks
>
>
> > ---
> > net/net.c | 12 ++++++++----
> > 1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/net.c b/net/net.c
> > index 7a2a0fb5ac..a95b417300 100644
> > --- a/net/net.c
> > +++ b/net/net.c
> > @@ -411,10 +411,14 @@ void qemu_del_nic(NICState *nic)
> >
> > qemu_macaddr_set_free(&nic->conf->macaddr);
> >
> > - /* If this is a peer NIC and peer has already been deleted, free it
> now. */
> > - if (nic->peer_deleted) {
> > - for (i = 0; i < queues; i++) {
> > - qemu_free_net_client(qemu_get_subqueue(nic, i)->peer);
> > + for (i = 0; i < queues; i++) {
> > + NetClientState *nc = qemu_get_subqueue(nic, i);
> > + /* If this is a peer NIC and peer has already been deleted,
> free it now. */
> > + if (nic->peer_deleted) {
> > + qemu_free_net_client(nc->peer);
> > + } else if (nc->peer) {
> > + /* if there are RX packets pending, complete them */
> > + qemu_purge_queued_packets(nc->peer);
> > }
> > }
> >
>
>
[-- Attachment #2: Type: text/html, Size: 2957 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-18 6:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 9:46 [PATCH] virtio-net: purge queued rx packets on queue deletion Yuri Benditovich
2020-11-18 3:59 ` Jason Wang
2020-11-18 6:25 ` Yuri Benditovich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.