1 --- a/net/sched/sch_generic.c
2 +++ b/net/sched/sch_generic.c
3 @@ -449,146 +449,6 @@ struct Qdisc_ops noqueue_qdisc_ops __rea
7 -static const u8 prio2band[TC_PRIO_MAX + 1] = {
8 - 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1
11 -/* 3-band FIFO queue: old style, but should be a bit faster than
12 - generic prio+fifo combination.
15 -#define PFIFO_FAST_BANDS 3
18 - * Private data for a pfifo_fast scheduler containing:
19 - * - queues for the three band
20 - * - bitmap indicating which of the bands contain skbs
22 -struct pfifo_fast_priv {
24 - struct qdisc_skb_head q[PFIFO_FAST_BANDS];
28 - * Convert a bitmap to the first band number where an skb is queued, where:
29 - * bitmap=0 means there are no skbs on any band.
30 - * bitmap=1 means there is an skb on band 0.
31 - * bitmap=7 means there are skbs on all 3 bands, etc.
33 -static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0};
35 -static inline struct qdisc_skb_head *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 - if (qdisc->q.qlen < qdisc_dev(qdisc)->tx_queue_len) {
45 - int band = prio2band[skb->priority & TC_PRIO_MAX];
46 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
47 - struct qdisc_skb_head *list = band2list(priv, band);
49 - priv->bitmap |= (1 << band);
51 - return __qdisc_enqueue_tail(skb, qdisc, list);
54 - return qdisc_drop(skb, qdisc, to_free);
57 -static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
59 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
60 - int band = bitmap2band[priv->bitmap];
62 - if (likely(band >= 0)) {
63 - struct qdisc_skb_head *qh = band2list(priv, band);
64 - struct sk_buff *skb = __qdisc_dequeue_head(qh);
66 - if (likely(skb != NULL)) {
67 - qdisc_qstats_backlog_dec(qdisc, skb);
68 - qdisc_bstats_update(qdisc, skb);
73 - priv->bitmap &= ~(1 << band);
81 -static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc)
83 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
84 - int band = bitmap2band[priv->bitmap];
87 - struct qdisc_skb_head *qh = band2list(priv, band);
95 -static void pfifo_fast_reset(struct Qdisc *qdisc)
98 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
100 - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
101 - __qdisc_reset_queue(band2list(priv, prio));
104 - qdisc->qstats.backlog = 0;
108 -static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
110 - struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
112 - memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1);
113 - if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
114 - goto nla_put_failure;
121 -static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt)
124 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
126 - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
127 - qdisc_skb_head_init(band2list(priv, prio));
129 - /* Can by-pass the queue discipline */
130 - qdisc->flags |= TCQ_F_CAN_BYPASS;
134 -struct Qdisc_ops pfifo_fast_ops __read_mostly = {
135 - .id = "pfifo_fast",
136 - .priv_size = sizeof(struct pfifo_fast_priv),
137 - .enqueue = pfifo_fast_enqueue,
138 - .dequeue = pfifo_fast_dequeue,
139 - .peek = pfifo_fast_peek,
140 - .init = pfifo_fast_init,
141 - .reset = pfifo_fast_reset,
142 - .dump = pfifo_fast_dump,
143 - .owner = THIS_MODULE,
145 -EXPORT_SYMBOL(pfifo_fast_ops);
147 static struct lock_class_key qdisc_tx_busylock;
148 static struct lock_class_key qdisc_running_key;