diff mbox series

[net-next] veth: Avoid NAPI scheduling on failed SKB forwarding

Message ID 20230824123131.7673-1-liangchen.linux@gmail.com (mailing list archive)
State Accepted
Commit 215eb9f962091ebaab96be2c18cf5d0f5174a4d6
Delegated to: Netdev Maintainers
Headers show
Series [net-next] veth: Avoid NAPI scheduling on failed SKB forwarding | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1330 this patch: 1330
netdev/cc_maintainers warning 5 maintainers not CCed: hawk@kernel.org daniel@iogearbox.net john.fastabend@gmail.com bpf@vger.kernel.org ast@kernel.org
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Liang Chen Aug. 24, 2023, 12:31 p.m. UTC
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.

Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
---
 drivers/net/veth.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 26, 2023, 2 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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.
> 
> Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 614f3e3efab0..e163c6927f56 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -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;