aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netfront.c
diff options
context:
space:
mode:
authorMa JieYue <jieyue.majy@alibaba-inc.com>2013-11-14 23:26:13 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-18 13:56:05 -0500
commitfdcf77659c103388a67f40f2f8db239b57c1ce4e (patch)
tree3754bf21a8cdd5ce60dcb82b8c1052eb7439c463 /drivers/net/xen-netfront.c
parent018c5bba052b3a383d83cf0c756da0e7bc748397 (diff)
xen-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@alibaba-inc.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netfront.c')
-rw-r--r--drivers/net/xen-netfront.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index dd1011e55cb5..5bd20d99acc8 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -277,12 +277,13 @@ static void xennet_alloc_rx_buffers(struct net_device *dev)
277 if (!page) { 277 if (!page) {
278 kfree_skb(skb); 278 kfree_skb(skb);
279no_skb: 279no_skb:
280 /* Any skbuffs queued for refill? Force them out. */
281 if (i != 0)
282 goto refill;
283 /* Could not allocate any skbuffs. Try again later. */ 280 /* Could not allocate any skbuffs. Try again later. */
284 mod_timer(&np->rx_refill_timer, 281 mod_timer(&np->rx_refill_timer,
285 jiffies + (HZ/10)); 282 jiffies + (HZ/10));
283
284 /* Any skbuffs queued for refill? Force them out. */
285 if (i != 0)
286 goto refill;
286 break; 287 break;
287 } 288 }
288 289