net: adjust napi_consume_skb to handle non-NAPI callers
authorJesper Dangaard Brouer <brouer@redhat.com>
Fri, 11 Mar 2016 08:43:58 +0000 (09:43 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Mar 2016 02:35:35 +0000 (22:35 -0400)
Some drivers reuse/share code paths that free SKBs between NAPI
and non-NAPI calls. Adjust napi_consume_skb to handle this
use-case.

Before, calls from netpoll (w/ IRQs disabled) was handled and
indicated with a budget zero indication.  Use the same zero
indication to handle calls not originating from NAPI/softirq.
Simply handled by using dev_consume_skb_any().

This adds an extra branch+call for the netpoll case (checking
in_irq() + irqs_disabled()), but that is okay as this is a slowpath.

Suggested-by: Alexander Duyck <aduyck@mirantis.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c

index 51d768e7bc90b5fd2344008813312c496c1690a3..f044f970f1a63c9040ec7c763e2b19a690b55269 100644 (file)
@@ -801,9 +801,9 @@ void napi_consume_skb(struct sk_buff *skb, int budget)
        if (unlikely(!skb))
                return;
 
-       /* if budget is 0 assume netpoll w/ IRQs disabled */
+       /* Zero budget indicate non-NAPI context called us, like netpoll */
        if (unlikely(!budget)) {
-               dev_consume_skb_irq(skb);
+               dev_consume_skb_any(skb);
                return;
        }