mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
veth: wake the peer txq when deleting NAPI
Since commitdc82a33297("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops"), only the peer's veth_poll() wakes a txq that veth_xmit() stopped on a full ptr_ring. If veth_xmit() stops the txq after the last poll before napi_disable(), its __veth_xdp_flush() can no longer schedule NAPI. Nothing wakes the txq, also not after NAPI is added back, so the device stops transmitting for good. This can happen whenever the peer deletes its NAPI: when it goes down, turns GRO off, detaches XDP or reduces its RX channels. Wake the peer txq in veth_napi_del_range() once NAPI is deleted, also when the peer is down, as opening it does not restart its queues. Reproduced in virtme-ng with a pktgen flood while toggling GRO on the peer, with a udelay() before netif_tx_stop_queue() to widen the race: the txq got stuck within four toggles without this patch, and not in 300 with it. Without the udelay() it was not hit in 1200 toggles. Fixes:dc82a33297("veth: apply qdisc backpressure on full ptr_ring to reduce TX drops") Signed-off-by: Simon Schippers <[email protected]> Reviewed-by: Tianyi Gao <[email protected]> Tested-by: Tianyi Gao <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
This commit is contained in:
committed by
Paolo Abeni
parent
8a0b03058f
commit
b2f4c44d7d
@@ -1087,6 +1087,7 @@ static int __veth_napi_enable(struct net_device *dev)
|
||||
static void veth_napi_del_range(struct net_device *dev, int start, int end)
|
||||
{
|
||||
struct veth_priv *priv = netdev_priv(dev);
|
||||
struct net_device *peer;
|
||||
int i;
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
@@ -1099,11 +1100,17 @@ static void veth_napi_del_range(struct net_device *dev, int start, int end)
|
||||
}
|
||||
synchronize_net();
|
||||
|
||||
peer = rtnl_dereference(priv->peer);
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
struct veth_rq *rq = &priv->rq[i];
|
||||
|
||||
rq->rx_notify_masked = false;
|
||||
ptr_ring_cleanup(&rq->xdp_ring, veth_ptr_free);
|
||||
|
||||
/* veth_poll() can no longer wake a txq stopped on a full ring */
|
||||
if (peer && i < peer->num_tx_queues)
|
||||
netif_wake_subqueue(peer, i);
|
||||
}
|
||||
|
||||
for (i = start; i < end; i++) {
|
||||
|
||||
Reference in New Issue
Block a user