]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: add kdoc for napi_consume_skb()
authorJakub Kicinski <kuba@kernel.org>
Mon, 19 Jan 2026 22:41:40 +0000 (14:41 -0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 Jan 2026 02:27:50 +0000 (18:27 -0800)
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.

Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Link: https://patch.msgid.link/20260119224140.1362729-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/skbuff.c

index 1c2b9ae7bce6457395a82d5bd577a9e125eceb95..c57c806edba8524d3d498800e61ae6901fbfe5fb 100644 (file)
@@ -1507,9 +1507,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;