Message ID | 20160310145911.22901.28762.stgit@firesoul |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
Hello. On 03/10/2016 05:59 PM, Jesper Dangaard Brouer wrote: > Some drivers reuse/share code paths that free SKBs between NAPI > and none-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> > --- > net/core/skbuff.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > index 7af7ec635d90..bc62baa54ceb 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) > if (unlikely(!skb)) > return; > > - /* if budget is 0 assume netpoll w/ IRQs disabled */ > + /* Zero budget indicate none-NAPI context called us, like netpoll */ Non-NAPI? [...] MBR, Sergei
On Thu, 10 Mar 2016 20:21:55 +0300 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote: > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c > > @@ -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 none-NAPI context called us, like netpoll */ > > Non-NAPI? Okay, I'll send a V4. Hope there are no more nitpicking changes... I'll also adjust the subj none-NAPI -> non-NAPI, and hope that does not disturb patchwork.
I've split out the bulk free adjustments, from the bulk alloc patches, as I want the adjustment to napi_consume_skb be in same kernel cycle the API was introduced. Adjustments based on discussion: Subj: "mlx4: use napi_consume_skb API to get bulk free operations" http://thread.gmane.org/gmane.linux.network/402503/focus=403386 Patchset based on net-next at commit 3ebeac1d0295 V4: more nitpicks from Sergei V3: spelling fixes from Sergei --- Jesper Dangaard Brouer (3): net: adjust napi_consume_skb to handle non-NAPI callers mlx4: use napi_consume_skb API to get bulk free operations mlx5: use napi_consume_skb API to get bulk free operations drivers/net/ethernet/mellanox/mlx4/en_tx.c | 15 +++++++++------ drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 2 +- net/core/skbuff.c | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) --
From: Jesper Dangaard Brouer <brouer@redhat.com> Date: Fri, 11 Mar 2016 09:43:48 +0100 > I've split out the bulk free adjustments, from the bulk alloc patches, > as I want the adjustment to napi_consume_skb be in same kernel cycle > the API was introduced. > > Adjustments based on discussion: > Subj: "mlx4: use napi_consume_skb API to get bulk free operations" > http://thread.gmane.org/gmane.linux.network/402503/focus=403386 > > Patchset based on net-next at commit 3ebeac1d0295 > > V4: more nitpicks from Sergei > V3: spelling fixes from Sergei Series applied, thanks Jesper.
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 7af7ec635d90..bc62baa54ceb 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) if (unlikely(!skb)) return; - /* if budget is 0 assume netpoll w/ IRQs disabled */ + /* Zero budget indicate none-NAPI context called us, like netpoll */ if (unlikely(!budget)) { - dev_consume_skb_irq(skb); + dev_consume_skb_any(skb); return; }
Some drivers reuse/share code paths that free SKBs between NAPI and none-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> --- net/core/skbuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)