aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_generic.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-16 03:56:32 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-17 22:21:18 -0400
commite2627c8c2241bce45e368e150654d076b58a4595 (patch)
treee3ad7d1867339f254a324ba1acd5d8bdac1aca76 /net/sched/sch_generic.c
parentd3b753db7c4f1f37a98b51974d484fda5d86dab5 (diff)
pkt_sched: Make QDISC_RUNNING a qdisc state.
Currently it is associated with a netdev_queue, but when we have qdisc sharing that no longer makes any sense. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_generic.c')
-rw-r--r--net/sched/sch_generic.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 2bd75befa066..ac208c2b2d10 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -130,8 +130,8 @@ static inline int handle_dev_cpu_collision(struct sk_buff *skb,
130/* 130/*
131 * NOTE: Called under queue->lock with locally disabled BH. 131 * NOTE: Called under queue->lock with locally disabled BH.
132 * 132 *
133 * __QUEUE_STATE_QDISC_RUNNING guarantees only one CPU can process 133 * __QDISC_STATE_RUNNING guarantees only one CPU can process
134 * this queue at a time. queue->lock serializes queue accesses for 134 * this qdisc at a time. queue->lock serializes queue accesses for
135 * this queue AND txq->qdisc pointer itself. 135 * this queue AND txq->qdisc pointer itself.
136 * 136 *
137 * netif_tx_lock serializes accesses to device driver. 137 * netif_tx_lock serializes accesses to device driver.
@@ -146,9 +146,9 @@ static inline int handle_dev_cpu_collision(struct sk_buff *skb,
146 * >0 - queue is not empty. 146 * >0 - queue is not empty.
147 * 147 *
148 */ 148 */
149static inline int qdisc_restart(struct netdev_queue *txq) 149static inline int qdisc_restart(struct netdev_queue *txq,
150 struct Qdisc *q)
150{ 151{
151 struct Qdisc *q = txq->qdisc;
152 int ret = NETDEV_TX_BUSY; 152 int ret = NETDEV_TX_BUSY;
153 struct net_device *dev; 153 struct net_device *dev;
154 struct sk_buff *skb; 154 struct sk_buff *skb;
@@ -168,7 +168,6 @@ static inline int qdisc_restart(struct netdev_queue *txq)
168 HARD_TX_UNLOCK(dev, txq); 168 HARD_TX_UNLOCK(dev, txq);
169 169
170 spin_lock(&txq->lock); 170 spin_lock(&txq->lock);
171 q = txq->qdisc;
172 171
173 switch (ret) { 172 switch (ret) {
174 case NETDEV_TX_OK: 173 case NETDEV_TX_OK:
@@ -197,8 +196,9 @@ static inline int qdisc_restart(struct netdev_queue *txq)
197void __qdisc_run(struct netdev_queue *txq) 196void __qdisc_run(struct netdev_queue *txq)
198{ 197{
199 unsigned long start_time = jiffies; 198 unsigned long start_time = jiffies;
199 struct Qdisc *q = txq->qdisc;
200 200
201 while (qdisc_restart(txq)) { 201 while (qdisc_restart(txq, q)) {
202 if (netif_tx_queue_stopped(txq)) 202 if (netif_tx_queue_stopped(txq))
203 break; 203 break;
204 204
@@ -213,7 +213,7 @@ void __qdisc_run(struct netdev_queue *txq)
213 } 213 }
214 } 214 }
215 215
216 clear_bit(__QUEUE_STATE_QDISC_RUNNING, &txq->state); 216 clear_bit(__QDISC_STATE_RUNNING, &q->state);
217} 217}
218 218
219static void dev_watchdog(unsigned long arg) 219static void dev_watchdog(unsigned long arg)
@@ -666,14 +666,16 @@ static bool some_qdisc_is_running(struct net_device *dev, int lock)
666 666
667 for (i = 0; i < dev->num_tx_queues; i++) { 667 for (i = 0; i < dev->num_tx_queues; i++) {
668 struct netdev_queue *dev_queue; 668 struct netdev_queue *dev_queue;
669 struct Qdisc *q;
669 int val; 670 int val;
670 671
671 dev_queue = netdev_get_tx_queue(dev, i); 672 dev_queue = netdev_get_tx_queue(dev, i);
673 q = dev_queue->qdisc;
672 674
673 if (lock) 675 if (lock)
674 spin_lock_bh(&dev_queue->lock); 676 spin_lock_bh(&dev_queue->lock);
675 677
676 val = test_bit(__QUEUE_STATE_QDISC_RUNNING, &dev_queue->state); 678 val = test_bit(__QDISC_STATE_RUNNING, &q->state);
677 679
678 if (lock) 680 if (lock)
679 spin_unlock_bh(&dev_queue->lock); 681 spin_unlock_bh(&dev_queue->lock);