[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151230175530.26257.2642.stgit@john-Precision-Tower-5810>
Date: Wed, 30 Dec 2015 09:55:30 -0800
From: John Fastabend <john.fastabend@...il.com>
To: daniel@...earbox.net, eric.dumazet@...il.com, jhs@...atatu.com,
aduyck@...antis.com, brouer@...hat.com, davem@...emloft.net
Cc: john.r.fastabend@...el.com, netdev@...r.kernel.org,
john.fastabend@...il.com
Subject: [RFC PATCH 12/12] net: sched: pfifo_fast new option to deque
multiple pkts
Now that pfifo_fast is using the alf_queue data structures we can
dequeue multiple skbs and save some overhead.
This works because the bulk dequeue logic accepts skb lists already.
Signed-off-by: John Fastabend <john.r.fastabend@...el.com>
---
include/net/sch_generic.h | 2 +-
net/sched/sch_generic.c | 30 ++++++++++++++++++++----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 2c57278..95c11ed 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -128,7 +128,7 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
static inline bool qdisc_may_bulk(const struct Qdisc *qdisc)
{
- return qdisc->flags & TCQ_F_ONETXQUEUE;
+ return (qdisc->flags & TCQ_F_ONETXQUEUE) & !(qdisc->flags & TCQ_F_NOLOCK);
}
static inline int qdisc_avail_bulklimit(const struct netdev_queue *txq)
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 480cf63..ec5e78e 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -507,25 +507,35 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc)
static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
{
struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
- struct sk_buff *skb = NULL;
- int band;
+ struct sk_buff *skb[8+1] = {NULL};
+ int band, i, elems = 0;
- for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) {
+ if (this_cpu_ptr(qdisc->cpu_qstats)->qlen < 8)
+ return NULL;
+
+ for (band = 0; band < PFIFO_FAST_BANDS && !skb[0]; band++) {
struct alf_queue *q = band2list(priv, band);
if (alf_queue_empty(q))
continue;
- alf_mc_dequeue(q, &skb, 1);
+ elems = alf_mc_dequeue(q, skb, 8);
+
+ /* link array of skbs for driver to process */
+ for (i = 0; i < elems; i++)
+ skb[i]->next = skb[i+1];
}
- if (likely(skb)) {
- qdisc_qstats_cpu_backlog_dec(qdisc, skb);
- qdisc_bstats_cpu_update(qdisc, skb);
- qdisc_qstats_cpu_qlen_dec(qdisc);
+ if (likely(skb[0])) {
+ for (i = 0; i < elems; i++) {
+ qdisc_qstats_cpu_backlog_dec(qdisc, skb[i]);
+ qdisc_bstats_cpu_update(qdisc, skb[i]);
+ }
+
+ this_cpu_ptr(qdisc->cpu_qstats)->qlen -= elems;
}
- return skb;
+ return skb[0];
}
static void pfifo_fast_reset(struct Qdisc *qdisc)
@@ -579,7 +589,7 @@ static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt)
}
/* Can by-pass the queue discipline */
- qdisc->flags |= TCQ_F_CAN_BYPASS;
+ //qdisc->flags |= TCQ_F_CAN_BYPASS;
qdisc->flags |= TCQ_F_NOLOCK;
qdisc->flags |= TCQ_F_CPUSTATS;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists