1 --- a/net/sched/sch_generic.c
2 +++ b/net/sched/sch_generic.c
3 @@ -435,139 +435,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 sk_buff_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 sk_buff_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)
43 - if (skb_queue_len(&qdisc->q) < qdisc_dev(qdisc)->tx_queue_len) {
44 - int band = prio2band[skb->priority & TC_PRIO_MAX];
45 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
46 - struct sk_buff_head *list = band2list(priv, band);
48 - priv->bitmap |= (1 << band);
50 - return __qdisc_enqueue_tail(skb, qdisc, list);
53 - return qdisc_drop(skb, qdisc);
56 -static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
58 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
59 - int band = bitmap2band[priv->bitmap];
61 - if (likely(band >= 0)) {
62 - struct sk_buff_head *list = band2list(priv, band);
63 - struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list);
66 - if (skb_queue_empty(list))
67 - priv->bitmap &= ~(1 << band);
75 -static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc)
77 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
78 - int band = bitmap2band[priv->bitmap];
81 - struct sk_buff_head *list = band2list(priv, band);
83 - return skb_peek(list);
89 -static void pfifo_fast_reset(struct Qdisc *qdisc)
92 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
94 - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
95 - __qdisc_reset_queue(qdisc, band2list(priv, prio));
98 - qdisc->qstats.backlog = 0;
102 -static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
104 - struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
106 - memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1);
107 - if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
108 - goto nla_put_failure;
115 -static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt)
118 - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
120 - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
121 - __skb_queue_head_init(band2list(priv, prio));
123 - /* Can by-pass the queue discipline */
124 - qdisc->flags |= TCQ_F_CAN_BYPASS;
128 -struct Qdisc_ops pfifo_fast_ops __read_mostly = {
129 - .id = "pfifo_fast",
130 - .priv_size = sizeof(struct pfifo_fast_priv),
131 - .enqueue = pfifo_fast_enqueue,
132 - .dequeue = pfifo_fast_dequeue,
133 - .peek = pfifo_fast_peek,
134 - .init = pfifo_fast_init,
135 - .reset = pfifo_fast_reset,
136 - .dump = pfifo_fast_dump,
137 - .owner = THIS_MODULE,
140 static struct lock_class_key qdisc_tx_busylock;
142 struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,