aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_teql.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_teql.c')
-rw-r--r--net/sched/sch_teql.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 0444fd0f0d22..537223642b6e 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -78,12 +78,12 @@ struct teql_sched_data
78static int 78static int
79teql_enqueue(struct sk_buff *skb, struct Qdisc* sch) 79teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
80{ 80{
81 struct net_device *dev = sch->dev; 81 struct net_device *dev = qdisc_dev(sch);
82 struct teql_sched_data *q = qdisc_priv(sch); 82 struct teql_sched_data *q = qdisc_priv(sch);
83 83
84 if (q->q.qlen < dev->tx_queue_len) { 84 if (q->q.qlen < dev->tx_queue_len) {
85 __skb_queue_tail(&q->q, skb); 85 __skb_queue_tail(&q->q, skb);
86 sch->bstats.bytes += skb->len; 86 sch->bstats.bytes += qdisc_pkt_len(skb);
87 sch->bstats.packets++; 87 sch->bstats.packets++;
88 return 0; 88 return 0;
89 } 89 }
@@ -107,17 +107,19 @@ static struct sk_buff *
107teql_dequeue(struct Qdisc* sch) 107teql_dequeue(struct Qdisc* sch)
108{ 108{
109 struct teql_sched_data *dat = qdisc_priv(sch); 109 struct teql_sched_data *dat = qdisc_priv(sch);
110 struct netdev_queue *dat_queue;
110 struct sk_buff *skb; 111 struct sk_buff *skb;
111 112
112 skb = __skb_dequeue(&dat->q); 113 skb = __skb_dequeue(&dat->q);
114 dat_queue = netdev_get_tx_queue(dat->m->dev, 0);
113 if (skb == NULL) { 115 if (skb == NULL) {
114 struct net_device *m = dat->m->dev->qdisc->dev; 116 struct net_device *m = qdisc_dev(dat_queue->qdisc);
115 if (m) { 117 if (m) {
116 dat->m->slaves = sch; 118 dat->m->slaves = sch;
117 netif_wake_queue(m); 119 netif_wake_queue(m);
118 } 120 }
119 } 121 }
120 sch->q.qlen = dat->q.qlen + dat->m->dev->qdisc->q.qlen; 122 sch->q.qlen = dat->q.qlen + dat_queue->qdisc->q.qlen;
121 return skb; 123 return skb;
122} 124}
123 125
@@ -153,10 +155,16 @@ teql_destroy(struct Qdisc* sch)
153 if (q == master->slaves) { 155 if (q == master->slaves) {
154 master->slaves = NEXT_SLAVE(q); 156 master->slaves = NEXT_SLAVE(q);
155 if (q == master->slaves) { 157 if (q == master->slaves) {
158 struct netdev_queue *txq;
159 spinlock_t *root_lock;
160
161 txq = netdev_get_tx_queue(master->dev, 0);
156 master->slaves = NULL; 162 master->slaves = NULL;
157 spin_lock_bh(&master->dev->queue_lock); 163
158 qdisc_reset(master->dev->qdisc); 164 root_lock = qdisc_root_lock(txq->qdisc);
159 spin_unlock_bh(&master->dev->queue_lock); 165 spin_lock_bh(root_lock);
166 qdisc_reset(txq->qdisc);
167 spin_unlock_bh(root_lock);
160 } 168 }
161 } 169 }
162 skb_queue_purge(&dat->q); 170 skb_queue_purge(&dat->q);
@@ -170,7 +178,7 @@ teql_destroy(struct Qdisc* sch)
170 178
171static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt) 179static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt)
172{ 180{
173 struct net_device *dev = sch->dev; 181 struct net_device *dev = qdisc_dev(sch);
174 struct teql_master *m = (struct teql_master*)sch->ops; 182 struct teql_master *m = (struct teql_master*)sch->ops;
175 struct teql_sched_data *q = qdisc_priv(sch); 183 struct teql_sched_data *q = qdisc_priv(sch);
176 184
@@ -216,7 +224,8 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt)
216static int 224static int
217__teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev) 225__teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev)
218{ 226{
219 struct teql_sched_data *q = qdisc_priv(dev->qdisc); 227 struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, 0);
228 struct teql_sched_data *q = qdisc_priv(dev_queue->qdisc);
220 struct neighbour *mn = skb->dst->neighbour; 229 struct neighbour *mn = skb->dst->neighbour;
221 struct neighbour *n = q->ncache; 230 struct neighbour *n = q->ncache;
222 231
@@ -252,7 +261,8 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *
252static inline int teql_resolve(struct sk_buff *skb, 261static inline int teql_resolve(struct sk_buff *skb,
253 struct sk_buff *skb_res, struct net_device *dev) 262 struct sk_buff *skb_res, struct net_device *dev)
254{ 263{
255 if (dev->qdisc == &noop_qdisc) 264 struct netdev_queue *txq = netdev_get_tx_queue(dev, 0);
265 if (txq->qdisc == &noop_qdisc)
256 return -ENODEV; 266 return -ENODEV;
257 267
258 if (dev->header_ops == NULL || 268 if (dev->header_ops == NULL ||
@@ -268,7 +278,6 @@ static int teql_master_xmit(struct sk_buff *skb, struct net_device *dev)
268 struct Qdisc *start, *q; 278 struct Qdisc *start, *q;
269 int busy; 279 int busy;
270 int nores; 280 int nores;
271 int len = skb->len;
272 int subq = skb_get_queue_mapping(skb); 281 int subq = skb_get_queue_mapping(skb);
273 struct sk_buff *skb_res = NULL; 282 struct sk_buff *skb_res = NULL;
274 283
@@ -282,12 +291,13 @@ restart:
282 goto drop; 291 goto drop;
283 292
284 do { 293 do {
285 struct net_device *slave = q->dev; 294 struct net_device *slave = qdisc_dev(q);
295 struct netdev_queue *slave_txq;
286 296
287 if (slave->qdisc_sleeping != q) 297 slave_txq = netdev_get_tx_queue(slave, 0);
298 if (slave_txq->qdisc_sleeping != q)
288 continue; 299 continue;
289 if (netif_queue_stopped(slave) || 300 if (__netif_subqueue_stopped(slave, subq) ||
290 __netif_subqueue_stopped(slave, subq) ||
291 !netif_running(slave)) { 301 !netif_running(slave)) {
292 busy = 1; 302 busy = 1;
293 continue; 303 continue;
@@ -296,14 +306,14 @@ restart:
296 switch (teql_resolve(skb, skb_res, slave)) { 306 switch (teql_resolve(skb, skb_res, slave)) {
297 case 0: 307 case 0:
298 if (netif_tx_trylock(slave)) { 308 if (netif_tx_trylock(slave)) {
299 if (!netif_queue_stopped(slave) && 309 if (!__netif_subqueue_stopped(slave, subq) &&
300 !__netif_subqueue_stopped(slave, subq) &&
301 slave->hard_start_xmit(skb, slave) == 0) { 310 slave->hard_start_xmit(skb, slave) == 0) {
302 netif_tx_unlock(slave); 311 netif_tx_unlock(slave);
303 master->slaves = NEXT_SLAVE(q); 312 master->slaves = NEXT_SLAVE(q);
304 netif_wake_queue(dev); 313 netif_wake_queue(dev);
305 master->stats.tx_packets++; 314 master->stats.tx_packets++;
306 master->stats.tx_bytes += len; 315 master->stats.tx_bytes +=
316 qdisc_pkt_len(skb);
307 return 0; 317 return 0;
308 } 318 }
309 netif_tx_unlock(slave); 319 netif_tx_unlock(slave);
@@ -352,7 +362,7 @@ static int teql_master_open(struct net_device *dev)
352 362
353 q = m->slaves; 363 q = m->slaves;
354 do { 364 do {
355 struct net_device *slave = q->dev; 365 struct net_device *slave = qdisc_dev(q);
356 366
357 if (slave == NULL) 367 if (slave == NULL)
358 return -EUNATCH; 368 return -EUNATCH;
@@ -403,7 +413,7 @@ static int teql_master_mtu(struct net_device *dev, int new_mtu)
403 q = m->slaves; 413 q = m->slaves;
404 if (q) { 414 if (q) {
405 do { 415 do {
406 if (new_mtu > q->dev->mtu) 416 if (new_mtu > qdisc_dev(q)->mtu)
407 return -EINVAL; 417 return -EINVAL;
408 } while ((q=NEXT_SLAVE(q)) != m->slaves); 418 } while ((q=NEXT_SLAVE(q)) != m->slaves);
409 } 419 }