public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: add kdoc for napi_consume_skb()
@ 2026-01-19 22:41 Jakub Kicinski
  2026-01-20  1:48 ` Jason Xing
  2026-01-21  2:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-01-19 22:41 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	kernelxing

Looks like AI reviewers miss that napi_consume_skb() must have
a real budget passed to it. Let's see if adding a real kdoc will
help them figure this out.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: kernelxing@tencent.com
---
 net/core/skbuff.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index c29677f7857c..3fa01cc90613 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1499,9 +1499,20 @@ void napi_skb_free_stolen_head(struct sk_buff *skb)
 	napi_skb_cache_put(skb);
 }
 
+/**
+ * napi_consume_skb() - consume skb in NAPI context, try to feed skb cache
+ * @skb: buffer to free
+ * @budget: NAPI budget
+ *
+ * Non-zero @budget must come from the @budget argument passed by the core
+ * to a NAPI poll function. Note that core may pass budget of 0 to NAPI poll
+ * for example when polling for netpoll / netconsole.
+ *
+ * Passing @budget of 0 is safe from any context, it turns this function
+ * into dev_consume_skb_any().
+ */
 void napi_consume_skb(struct sk_buff *skb, int budget)
 {
-	/* Zero budget indicate non-NAPI context called us, like netpoll */
 	if (unlikely(!budget || !skb)) {
 		dev_consume_skb_any(skb);
 		return;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: add kdoc for napi_consume_skb()
  2026-01-19 22:41 [PATCH net-next] net: add kdoc for napi_consume_skb() Jakub Kicinski
@ 2026-01-20  1:48 ` Jason Xing
  2026-01-21  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Xing @ 2026-01-20  1:48 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, kernelxing

On Tue, Jan 20, 2026 at 6:41 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> Looks like AI reviewers miss that napi_consume_skb() must have
> a real budget passed to it. Let's see if adding a real kdoc will
> help them figure this out.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

It does make sense if we add more useful comments like this to help AI
review examine the patches on the mailing list.

Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>

Thanks,
Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: add kdoc for napi_consume_skb()
  2026-01-19 22:41 [PATCH net-next] net: add kdoc for napi_consume_skb() Jakub Kicinski
  2026-01-20  1:48 ` Jason Xing
@ 2026-01-21  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-21  2:40 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, kernelxing

Hello:

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

On Mon, 19 Jan 2026 14:41:40 -0800 you wrote:
> Looks like AI reviewers miss that napi_consume_skb() must have
> a real budget passed to it. Let's see if adding a real kdoc will
> help them figure this out.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: kernelxing@tencent.com
> 
> [...]

Here is the summary with links:
  - [net-next] net: add kdoc for napi_consume_skb()
    https://git.kernel.org/netdev/net-next/c/cd18e8ac030e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-21  2:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 22:41 [PATCH net-next] net: add kdoc for napi_consume_skb() Jakub Kicinski
2026-01-20  1:48 ` Jason Xing
2026-01-21  2:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox