Skip to content

Commit fdcf776

Browse files
Ma JieYuedavem330
authored andcommitted
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>
1 parent 018c5bb commit fdcf776

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/net/xen-netfront.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,13 @@ static void xennet_alloc_rx_buffers(struct net_device *dev)
277277
if (!page) {
278278
kfree_skb(skb);
279279
no_skb:
280-
/* Any skbuffs queued for refill? Force them out. */
281-
if (i != 0)
282-
goto refill;
283280
/* Could not allocate any skbuffs. Try again later. */
284281
mod_timer(&np->rx_refill_timer,
285282
jiffies + (HZ/10));
283+
284+
/* Any skbuffs queued for refill? Force them out. */
285+
if (i != 0)
286+
goto refill;
286287
break;
287288
}
288289

0 commit comments

Comments
 (0)