netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resent] virtio_net: Fix stalled inbound traffic on early packets
@ 2007-12-11 11:42 Christian Borntraeger
       [not found] ` <200712111242.28843.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Christian Borntraeger @ 2007-12-11 11:42 UTC (permalink / raw)
  To: Rusty Russell; +Cc: netdev, virtualization, kvm-devel

Hello Rusty,

while implementing and testing virtio on s390 I found a problem in
virtio_net: The current virtio_net driver has a startup race, which
prevents any incoming traffic:

If try_fill_recv submits buffers to the host system data might be
filled in and an interrupt is sent, before napi_enable finishes.
In that case the interrupt will kick skb_recv_done which will then
call netif_rx_schedule. netif_rx_schedule checks, if NAPI_STATE_SCHED
is set - which is not as we did not run napi_enable. No poll routine
is scheduled. Furthermore, skb_recv_done returns false, we disables
interrupts for this device.

One solution is the enable napi before inbound buffer are available.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 drivers/net/virtio_net.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: kvm/drivers/net/virtio_net.c
===================================================================
--- kvm.orig/drivers/net/virtio_net.c
+++ kvm/drivers/net/virtio_net.c
@@ -285,13 +285,15 @@ static int virtnet_open(struct net_devic
 {
 	struct virtnet_info *vi = netdev_priv(dev);
 
+	napi_enable(&vi->napi);
 	try_fill_recv(vi);
 
 	/* If we didn't even get one input buffer, we're useless. */
-	if (vi->num == 0)
+	if (vi->num == 0) {
+		napi_disable(&vi->napi);
 		return -ENOMEM;
+	}
 
-	napi_enable(&vi->napi);
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-12-18  6:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-11 11:42 [PATCH resent] virtio_net: Fix stalled inbound traffic on early packets Christian Borntraeger
     [not found] ` <200712111242.28843.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-12-11 12:48   ` [PATCH resent] virtio_net: Fix stalled inbound trafficon " Dor Laor
     [not found]     ` <475E8716.2010500-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-11 12:57       ` Dor Laor
     [not found]         ` <475E892D.9060400-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-11 13:16           ` Christian Borntraeger
2007-12-12  1:54             ` [kvm-devel] " Rusty Russell
2007-12-12 11:39               ` Christian Borntraeger
2007-12-12 15:48                 ` Dor Laor
     [not found]                   ` <476002E7.5050301-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-12 18:14                     ` Christian Borntraeger
     [not found]                       ` <200712121914.38135.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-12-13 13:24                         ` Dor Laor
2007-12-13 18:30                           ` [kvm-devel] " Christian Borntraeger
     [not found]                             ` <200712131930.31602.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-12-18  6:54                               ` Rusty Russell
2007-12-11 13:19         ` [kvm-devel] " Christian Borntraeger
2007-12-11 15:27           ` Christian Borntraeger
     [not found]             ` <200712111627.21364.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-12-11 23:34               ` Dor Laor
2007-12-12 11:27                 ` [kvm-devel] " Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).