[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] netfront: fix missing rx_refill_timer when allocate memory failed


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Fri, 06 Dec 2013 11:22:02 +0000
  • Delivery-date: Fri, 06 Dec 2013 11:22:09 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Ma JieYue <jieyue.majy@xxxxxxxxxxxxxxx>
# Date 1386328625 -3600
# Node ID 2993033a77ca312a3370f0e77d74b68a9d0df708
# Parent  2427f3a0bac88b02829e4c3d75a349c596fa0dd7
netfront: fix missing rx_refill_timer when allocate memory failed

There was a bug in xennet_alloc_rx_buffers, when allocating page or
sk_buff failed, and at the same time rx_batch queue not empty,
the rx_refill_timer timer won't be scheduled. If finally the remaining
request buffers in rx ring less than what backend driver expected,
the backend driver would think of rx ring as full and start dropping packets.
In such situation, there is no way for the netfront driver to recover
automatically, so that the device can not work properly.

The patch fixes the problem by always scheduling rx_refill_timer timer when
alloc_page or __netdev_alloc_skb fails, no matter whether rx_batch queue is
empty or not. It ensures that the rx ring request buffers will finally meet
the backend needs.

Signed-off-by: Ma JieYue <jieyue.majy@xxxxxxxxxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 2427f3a0bac8 -r 2993033a77ca drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Mon Oct 21 11:47:32 2013 +0200
+++ b/drivers/xen/netfront/netfront.c   Fri Dec 06 12:17:05 2013 +0100
@@ -756,12 +756,13 @@ static void network_alloc_rx_buffers(str
                if (!page) {
                        kfree_skb(skb);
 no_skb:
+                       /* Could not allocate enough skbuffs. Try again later. 
*/
+                       mod_timer(&np->rx_refill_timer,
+                                 jiffies + (HZ/10));
+
                        /* Any skbuffs queued for refill? Force them out. */
                        if (i != 0)
                                goto refill;
-                       /* Could not allocate any skbuffs. Try again later. */
-                       mod_timer(&np->rx_refill_timer,
-                                 jiffies + (HZ/10));
                        break;
                }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.