kernel/3.1[02]: add Winbond W25X05 SPI flash support
[openwrt.git] / target / linux / generic / patches-3.12 / 663-remove_pfifo_fast.patch
1 --- a/net/sched/sch_generic.c
2 +++ b/net/sched/sch_generic.c
3 @@ -401,140 +401,6 @@ static struct Qdisc noqueue_qdisc = {
4         .busylock       =       __SPIN_LOCK_UNLOCKED(noqueue_qdisc.busylock),
5  };
6  
7 -
8 -static const u8 prio2band[TC_PRIO_MAX + 1] = {
9 -       1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1
10 -};
11 -
12 -/* 3-band FIFO queue: old style, but should be a bit faster than
13 -   generic prio+fifo combination.
14 - */
15 -
16 -#define PFIFO_FAST_BANDS 3
17 -
18 -/*
19 - * Private data for a pfifo_fast scheduler containing:
20 - *     - queues for the three band
21 - *     - bitmap indicating which of the bands contain skbs
22 - */
23 -struct pfifo_fast_priv {
24 -       u32 bitmap;
25 -       struct sk_buff_head q[PFIFO_FAST_BANDS];
26 -};
27 -
28 -/*
29 - * Convert a bitmap to the first band number where an skb is queued, where:
30 - *     bitmap=0 means there are no skbs on any band.
31 - *     bitmap=1 means there is an skb on band 0.
32 - *     bitmap=7 means there are skbs on all 3 bands, etc.
33 - */
34 -static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0};
35 -
36 -static inline struct sk_buff_head *band2list(struct pfifo_fast_priv *priv,
37 -                                            int band)
38 -{
39 -       return priv->q + band;
40 -}
41 -
42 -static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc)
43 -{
44 -       if (skb_queue_len(&qdisc->q) < 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 sk_buff_head *list = band2list(priv, band);
48 -
49 -               priv->bitmap |= (1 << band);
50 -               qdisc->q.qlen++;
51 -               return __qdisc_enqueue_tail(skb, qdisc, list);
52 -       }
53 -
54 -       return qdisc_drop(skb, qdisc);
55 -}
56 -
57 -static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
58 -{
59 -       struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
60 -       int band = bitmap2band[priv->bitmap];
61 -
62 -       if (likely(band >= 0)) {
63 -               struct sk_buff_head *list = band2list(priv, band);
64 -               struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list);
65 -
66 -               qdisc->q.qlen--;
67 -               if (skb_queue_empty(list))
68 -                       priv->bitmap &= ~(1 << band);
69 -
70 -               return skb;
71 -       }
72 -
73 -       return NULL;
74 -}
75 -
76 -static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc)
77 -{
78 -       struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
79 -       int band = bitmap2band[priv->bitmap];
80 -
81 -       if (band >= 0) {
82 -               struct sk_buff_head *list = band2list(priv, band);
83 -
84 -               return skb_peek(list);
85 -       }
86 -
87 -       return NULL;
88 -}
89 -
90 -static void pfifo_fast_reset(struct Qdisc *qdisc)
91 -{
92 -       int prio;
93 -       struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
94 -
95 -       for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
96 -               __qdisc_reset_queue(qdisc, band2list(priv, prio));
97 -
98 -       priv->bitmap = 0;
99 -       qdisc->qstats.backlog = 0;
100 -       qdisc->q.qlen = 0;
101 -}
102 -
103 -static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
104 -{
105 -       struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
106 -
107 -       memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1);
108 -       if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
109 -               goto nla_put_failure;
110 -       return skb->len;
111 -
112 -nla_put_failure:
113 -       return -1;
114 -}
115 -
116 -static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt)
117 -{
118 -       int prio;
119 -       struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
120 -
121 -       for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
122 -               skb_queue_head_init(band2list(priv, prio));
123 -
124 -       /* Can by-pass the queue discipline */
125 -       qdisc->flags |= TCQ_F_CAN_BYPASS;
126 -       return 0;
127 -}
128 -
129 -struct Qdisc_ops pfifo_fast_ops __read_mostly = {
130 -       .id             =       "pfifo_fast",
131 -       .priv_size      =       sizeof(struct pfifo_fast_priv),
132 -       .enqueue        =       pfifo_fast_enqueue,
133 -       .dequeue        =       pfifo_fast_dequeue,
134 -       .peek           =       pfifo_fast_peek,
135 -       .init           =       pfifo_fast_init,
136 -       .reset          =       pfifo_fast_reset,
137 -       .dump           =       pfifo_fast_dump,
138 -       .owner          =       THIS_MODULE,
139 -};
140 -
141  static struct lock_class_key qdisc_tx_busylock;
142  
143  struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,