Skip to contentSkip to conversation

veth: Avoid NAPI scheduling on failed SKB forwarding

PATCH Applied Liang Chen 2 participants 2 messages Aug 24, 2023 – Aug 26, 2023

Subsystems (2)
lore
Share & tools
lore

Liang Chen

author
#0 lore raw

PATCH 1/1 veth: Avoid NAPI scheduling on failed SKB forwarding

When an skb fails to be forwarded to the peer(e.g., skb data buffer length exceeds MTU), it will not be added to the peer's receive queue. Therefore, we should schedule the peer's NAPI poll function only when skb forwarding is successful to avoid unnecessary overhead.

---
 drivers/net/veth.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/veth.c +2 -3
index 614f3e3efab0..e163c6927f56 100644
@@ -373,14 +373,13 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (likely(veth_forward_skb(rcv, skb, rq, use_napi) == NET_RX_SUCCESS)) {
 		if (!use_napi)
 			dev_lstats_add(dev, length);
+		else
+			__veth_xdp_flush(rq);
 	} else {
 drop:
 		atomic64_inc(&priv->dropped);
 	}
 
-	if (use_napi)
-		__veth_xdp_flush(rq);
-
 	rcu_read_unlock();
 
 	return NETDEV_TX_OK;
Signature · 1 line
2.40.1
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 24 Aug 2023 20:31:31 +0800 you wrote:

When an skb fails to be forwarded to the peer(e.g., skb data buffer length exceeds MTU), it will not be added to the peer's receive queue. Therefore, we should schedule the peer's NAPI poll function only when skb forwarding is successful to avoid unnecessary overhead.

[...]

Here is the summary with links:
- [net-next] veth: Avoid NAPI scheduling on failed SKB forwarding

    https://git.kernel.org/netdev/net-next/c/215eb9f96209

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html