1 From b531d492d5ef1cf9dba0f4888eb5fd8624a6d762 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Fri, 7 Jul 2017 17:23:42 +0200
4 Subject: net: sched: switch default qdisc from pfifo_fast to fq_codel and remove pfifo_fast
6 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 net/sched/sch_generic.c | 140 ------------------------------------------------
9 1 file changed, 140 deletions(-)
11 --- a/net/sched/sch_generic.c
12 +++ b/net/sched/sch_generic.c
13 @@ -612,207 +612,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea
17 -static const u8 prio2band[TC_PRIO_MAX + 1] = {
18 - 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1
21 -/* 3-band FIFO queue: old style, but should be a bit faster than
22 - generic prio+fifo combination.
25 -#define PFIFO_FAST_BANDS 3
28 - * Private data for a pfifo_fast scheduler containing:
29 - * - rings for priority bands
31 -struct pfifo_fast_priv {
32 - struct skb_array q[PFIFO_FAST_BANDS];
35 -static inline struct skb_array *band2list(struct pfifo_fast_priv *priv,
38 - return &priv->q[band];
41 -static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc,
42 - struct sk_buff **to_free)
44 - int band = prio2band[skb->priority & TC_PRIO_MAX];
45 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
46 - struct skb_array *q = band2list(priv, band);
47 - unsigned int pkt_len = qdisc_pkt_len(skb);
50 - err = skb_array_produce(q, skb);
53 - return qdisc_drop_cpu(skb, qdisc, to_free);
55 - qdisc_qstats_atomic_qlen_inc(qdisc);
56 - /* Note: skb can not be used after skb_array_produce(),
57 - * so we better not use qdisc_qstats_cpu_backlog_inc()
59 - this_cpu_add(qdisc->cpu_qstats->backlog, pkt_len);
60 - return NET_XMIT_SUCCESS;
63 -static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
65 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
66 - struct sk_buff *skb = NULL;
69 - for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) {
70 - struct skb_array *q = band2list(priv, band);
72 - if (__skb_array_empty(q))
75 - skb = __skb_array_consume(q);
78 - qdisc_qstats_cpu_backlog_dec(qdisc, skb);
79 - qdisc_bstats_cpu_update(qdisc, skb);
80 - qdisc_qstats_atomic_qlen_dec(qdisc);
86 -static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc)
88 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
89 - struct sk_buff *skb = NULL;
92 - for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) {
93 - struct skb_array *q = band2list(priv, band);
95 - skb = __skb_array_peek(q);
101 -static void pfifo_fast_reset(struct Qdisc *qdisc)
104 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
106 - for (band = 0; band < PFIFO_FAST_BANDS; band++) {
107 - struct skb_array *q = band2list(priv, band);
108 - struct sk_buff *skb;
110 - /* NULL ring is possible if destroy path is due to a failed
111 - * skb_array_init() in pfifo_fast_init() case.
113 - if (!q->ring.queue)
116 - while ((skb = __skb_array_consume(q)) != NULL)
120 - for_each_possible_cpu(i) {
121 - struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i);
127 -static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
129 - struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
131 - memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1);
132 - if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
133 - goto nla_put_failure;
140 -static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt,
141 - struct netlink_ext_ack *extack)
143 - unsigned int qlen = qdisc_dev(qdisc)->tx_queue_len;
144 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
147 - /* guard against zero length rings */
151 - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
152 - struct skb_array *q = band2list(priv, prio);
155 - err = skb_array_init(q, qlen, GFP_KERNEL);
160 - /* Can by-pass the queue discipline */
161 - qdisc->flags |= TCQ_F_CAN_BYPASS;
165 -static void pfifo_fast_destroy(struct Qdisc *sch)
167 - struct pfifo_fast_priv *priv = qdisc_priv(sch);
170 - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
171 - struct skb_array *q = band2list(priv, prio);
173 - /* NULL ring is possible if destroy path is due to a failed
174 - * skb_array_init() in pfifo_fast_init() case.
176 - if (!q->ring.queue)
178 - /* Destroy ring but no need to kfree_skb because a call to
179 - * pfifo_fast_reset() has already done that work.
181 - ptr_ring_cleanup(&q->ring, NULL);
185 -static int pfifo_fast_change_tx_queue_len(struct Qdisc *sch,
186 - unsigned int new_len)
188 - struct pfifo_fast_priv *priv = qdisc_priv(sch);
189 - struct skb_array *bands[PFIFO_FAST_BANDS];
192 - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) {
193 - struct skb_array *q = band2list(priv, prio);
198 - return skb_array_resize_multiple(bands, PFIFO_FAST_BANDS, new_len,
202 -struct Qdisc_ops pfifo_fast_ops __read_mostly = {
203 - .id = "pfifo_fast",
204 - .priv_size = sizeof(struct pfifo_fast_priv),
205 - .enqueue = pfifo_fast_enqueue,
206 - .dequeue = pfifo_fast_dequeue,
207 - .peek = pfifo_fast_peek,
208 - .init = pfifo_fast_init,
209 - .destroy = pfifo_fast_destroy,
210 - .reset = pfifo_fast_reset,
211 - .dump = pfifo_fast_dump,
212 - .change_tx_queue_len = pfifo_fast_change_tx_queue_len,
213 - .owner = THIS_MODULE,
214 - .static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS,
216 -EXPORT_SYMBOL(pfifo_fast_ops);
218 static struct lock_class_key qdisc_tx_busylock;
219 static struct lock_class_key qdisc_running_key;