OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 |
||
5 | |||
6 | Signed-off-by: Felix Fietkau <nbd@nbd.name> |
||
7 | --- |
||
8 | net/sched/sch_generic.c | 140 ------------------------------------------------ |
||
9 | 1 file changed, 140 deletions(-) |
||
10 | |||
11 | --- a/net/sched/sch_generic.c |
||
12 | +++ b/net/sched/sch_generic.c |
||
13 | @@ -595,208 +595,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea |
||
14 | .owner = THIS_MODULE, |
||
15 | }; |
||
16 | |||
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 |
||
19 | -}; |
||
20 | - |
||
21 | -/* 3-band FIFO queue: old style, but should be a bit faster than |
||
22 | - generic prio+fifo combination. |
||
23 | - */ |
||
24 | - |
||
25 | -#define PFIFO_FAST_BANDS 3 |
||
26 | - |
||
27 | -/* |
||
28 | - * Private data for a pfifo_fast scheduler containing: |
||
29 | - * - rings for priority bands |
||
30 | - */ |
||
31 | -struct pfifo_fast_priv { |
||
32 | - struct skb_array q[PFIFO_FAST_BANDS]; |
||
33 | -}; |
||
34 | - |
||
35 | -static inline struct skb_array *band2list(struct pfifo_fast_priv *priv, |
||
36 | - int band) |
||
37 | -{ |
||
38 | - return &priv->q[band]; |
||
39 | -} |
||
40 | - |
||
41 | -static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc, |
||
42 | - struct sk_buff **to_free) |
||
43 | -{ |
||
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); |
||
48 | - int err; |
||
49 | - |
||
50 | - err = skb_array_produce(q, skb); |
||
51 | - |
||
52 | - if (unlikely(err)) |
||
53 | - return qdisc_drop_cpu(skb, qdisc, to_free); |
||
54 | - |
||
55 | - qdisc_qstats_cpu_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() |
||
58 | - */ |
||
59 | - this_cpu_add(qdisc->cpu_qstats->backlog, pkt_len); |
||
60 | - return NET_XMIT_SUCCESS; |
||
61 | -} |
||
62 | - |
||
63 | -static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) |
||
64 | -{ |
||
65 | - struct pfifo_fast_priv *priv = qdisc_priv(qdisc); |
||
66 | - struct sk_buff *skb = NULL; |
||
67 | - int band; |
||
68 | - |
||
69 | - for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) { |
||
70 | - struct skb_array *q = band2list(priv, band); |
||
71 | - |
||
72 | - if (__skb_array_empty(q)) |
||
73 | - continue; |
||
74 | - |
||
75 | - skb = __skb_array_consume(q); |
||
76 | - } |
||
77 | - if (likely(skb)) { |
||
78 | - qdisc_qstats_cpu_backlog_dec(qdisc, skb); |
||
79 | - qdisc_bstats_cpu_update(qdisc, skb); |
||
80 | - qdisc_qstats_cpu_qlen_dec(qdisc); |
||
81 | - } |
||
82 | - |
||
83 | - return skb; |
||
84 | -} |
||
85 | - |
||
86 | -static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc) |
||
87 | -{ |
||
88 | - struct pfifo_fast_priv *priv = qdisc_priv(qdisc); |
||
89 | - struct sk_buff *skb = NULL; |
||
90 | - int band; |
||
91 | - |
||
92 | - for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) { |
||
93 | - struct skb_array *q = band2list(priv, band); |
||
94 | - |
||
95 | - skb = __skb_array_peek(q); |
||
96 | - } |
||
97 | - |
||
98 | - return skb; |
||
99 | -} |
||
100 | - |
||
101 | -static void pfifo_fast_reset(struct Qdisc *qdisc) |
||
102 | -{ |
||
103 | - int i, band; |
||
104 | - struct pfifo_fast_priv *priv = qdisc_priv(qdisc); |
||
105 | - |
||
106 | - for (band = 0; band < PFIFO_FAST_BANDS; band++) { |
||
107 | - struct skb_array *q = band2list(priv, band); |
||
108 | - struct sk_buff *skb; |
||
109 | - |
||
110 | - /* NULL ring is possible if destroy path is due to a failed |
||
111 | - * skb_array_init() in pfifo_fast_init() case. |
||
112 | - */ |
||
113 | - if (!q->ring.queue) |
||
114 | - continue; |
||
115 | - |
||
116 | - while ((skb = __skb_array_consume(q)) != NULL) |
||
117 | - kfree_skb(skb); |
||
118 | - } |
||
119 | - |
||
120 | - for_each_possible_cpu(i) { |
||
121 | - struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i); |
||
122 | - |
||
123 | - q->backlog = 0; |
||
124 | - q->qlen = 0; |
||
125 | - } |
||
126 | -} |
||
127 | - |
||
128 | -static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb) |
||
129 | -{ |
||
130 | - struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS }; |
||
131 | - |
||
132 | - memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1); |
||
133 | - if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt)) |
||
134 | - goto nla_put_failure; |
||
135 | - return skb->len; |
||
136 | - |
||
137 | -nla_put_failure: |
||
138 | - return -1; |
||
139 | -} |
||
140 | - |
||
141 | -static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt, |
||
142 | - struct netlink_ext_ack *extack) |
||
143 | -{ |
||
144 | - unsigned int qlen = qdisc_dev(qdisc)->tx_queue_len; |
||
145 | - struct pfifo_fast_priv *priv = qdisc_priv(qdisc); |
||
146 | - int prio; |
||
147 | - |
||
148 | - /* guard against zero length rings */ |
||
149 | - if (!qlen) |
||
150 | - return -EINVAL; |
||
151 | - |
||
152 | - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { |
||
153 | - struct skb_array *q = band2list(priv, prio); |
||
154 | - int err; |
||
155 | - |
||
156 | - err = skb_array_init(q, qlen, GFP_KERNEL); |
||
157 | - if (err) |
||
158 | - return -ENOMEM; |
||
159 | - } |
||
160 | - |
||
161 | - /* Can by-pass the queue discipline */ |
||
162 | - qdisc->flags |= TCQ_F_CAN_BYPASS; |
||
163 | - return 0; |
||
164 | -} |
||
165 | - |
||
166 | -static void pfifo_fast_destroy(struct Qdisc *sch) |
||
167 | -{ |
||
168 | - struct pfifo_fast_priv *priv = qdisc_priv(sch); |
||
169 | - int prio; |
||
170 | - |
||
171 | - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { |
||
172 | - struct skb_array *q = band2list(priv, prio); |
||
173 | - |
||
174 | - /* NULL ring is possible if destroy path is due to a failed |
||
175 | - * skb_array_init() in pfifo_fast_init() case. |
||
176 | - */ |
||
177 | - if (!q->ring.queue) |
||
178 | - continue; |
||
179 | - /* Destroy ring but no need to kfree_skb because a call to |
||
180 | - * pfifo_fast_reset() has already done that work. |
||
181 | - */ |
||
182 | - ptr_ring_cleanup(&q->ring, NULL); |
||
183 | - } |
||
184 | -} |
||
185 | - |
||
186 | -static int pfifo_fast_change_tx_queue_len(struct Qdisc *sch, |
||
187 | - unsigned int new_len) |
||
188 | -{ |
||
189 | - struct pfifo_fast_priv *priv = qdisc_priv(sch); |
||
190 | - struct skb_array *bands[PFIFO_FAST_BANDS]; |
||
191 | - int prio; |
||
192 | - |
||
193 | - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++) { |
||
194 | - struct skb_array *q = band2list(priv, prio); |
||
195 | - |
||
196 | - bands[prio] = q; |
||
197 | - } |
||
198 | - |
||
199 | - return skb_array_resize_multiple(bands, PFIFO_FAST_BANDS, new_len, |
||
200 | - GFP_KERNEL); |
||
201 | -} |
||
202 | - |
||
203 | -struct Qdisc_ops pfifo_fast_ops __read_mostly = { |
||
204 | - .id = "pfifo_fast", |
||
205 | - .priv_size = sizeof(struct pfifo_fast_priv), |
||
206 | - .enqueue = pfifo_fast_enqueue, |
||
207 | - .dequeue = pfifo_fast_dequeue, |
||
208 | - .peek = pfifo_fast_peek, |
||
209 | - .init = pfifo_fast_init, |
||
210 | - .destroy = pfifo_fast_destroy, |
||
211 | - .reset = pfifo_fast_reset, |
||
212 | - .dump = pfifo_fast_dump, |
||
213 | - .change_tx_queue_len = pfifo_fast_change_tx_queue_len, |
||
214 | - .owner = THIS_MODULE, |
||
215 | - .static_flags = TCQ_F_NOLOCK | TCQ_F_CPUSTATS, |
||
216 | -}; |
||
217 | -EXPORT_SYMBOL(pfifo_fast_ops); |
||
218 | - |
||
219 | static struct lock_class_key qdisc_tx_busylock; |
||
220 | static struct lock_class_key qdisc_running_key; |
||
221 |