diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2016-03-11 03:43:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-13 22:35:35 -0400 |
commit | 885eb0a516e4d686849b91c5a1ba25c70b7a6540 (patch) | |
tree | d6c23320fc70f5b5ab7354574a26447e5065d5e5 | |
parent | c45569755e828a8458d125bb93feb1d90ac9be6f (diff) |
net: adjust napi_consume_skb to handle non-NAPI callers
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>
-rw-r--r-- | net/core/skbuff.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 51d768e7bc90..f044f970f1a6 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -801,9 +801,9 @@ void napi_consume_skb(struct sk_buff *skb, int budget) | |||
801 | if (unlikely(!skb)) | 801 | if (unlikely(!skb)) |
802 | return; | 802 | return; |
803 | 803 | ||
804 | /* if budget is 0 assume netpoll w/ IRQs disabled */ | 804 | /* Zero budget indicate non-NAPI context called us, like netpoll */ |
805 | if (unlikely(!budget)) { | 805 | if (unlikely(!budget)) { |
806 | dev_consume_skb_irq(skb); | 806 | dev_consume_skb_any(skb); |
807 | return; | 807 | return; |
808 | } | 808 | } |
809 | 809 | ||