diff options
author | David S. Miller <davem@davemloft.net> | 2008-07-17 03:34:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-17 22:21:00 -0400 |
commit | e8a0464cc950972824e2e128028ae3db666ec1ed (patch) | |
tree | 5022b95396c0f3b313531bc39b19543c03551b9a /include/net/sch_generic.h | |
parent | 070825b3840a743e21ebcc44f8279708a4fed977 (diff) |
netdev: Allocate multiple queues for TX.
alloc_netdev_mq() now allocates an array of netdev_queue
structures for TX, based upon the queue_count argument.
Furthermore, all accesses to the TX queues are now vectored
through the netdev_get_tx_queue() and netdev_for_each_tx_queue()
interfaces. This makes it easy to grep the tree for all
things that want to get to a TX queue of a net device.
Problem spots which are not really multiqueue aware yet, and
only work with one queue, can easily be spotted by grepping
for all netdev_get_tx_queue() calls that pass in a zero index.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 5ba66b555578..b47f556c66f8 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -230,32 +230,47 @@ extern void tcf_destroy_chain(struct tcf_proto **fl); | |||
230 | /* Reset all TX qdiscs of a device. */ | 230 | /* Reset all TX qdiscs of a device. */ |
231 | static inline void qdisc_reset_all_tx(struct net_device *dev) | 231 | static inline void qdisc_reset_all_tx(struct net_device *dev) |
232 | { | 232 | { |
233 | qdisc_reset(dev->tx_queue.qdisc); | 233 | unsigned int i; |
234 | for (i = 0; i < dev->num_tx_queues; i++) | ||
235 | qdisc_reset(netdev_get_tx_queue(dev, i)->qdisc); | ||
234 | } | 236 | } |
235 | 237 | ||
236 | /* Are all TX queues of the device empty? */ | 238 | /* Are all TX queues of the device empty? */ |
237 | static inline bool qdisc_all_tx_empty(const struct net_device *dev) | 239 | static inline bool qdisc_all_tx_empty(const struct net_device *dev) |
238 | { | 240 | { |
239 | const struct netdev_queue *txq = &dev->tx_queue; | 241 | unsigned int i; |
240 | const struct Qdisc *q = txq->qdisc; | 242 | for (i = 0; i < dev->num_tx_queues; i++) { |
243 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); | ||
244 | const struct Qdisc *q = txq->qdisc; | ||
241 | 245 | ||
242 | return (q->q.qlen == 0); | 246 | if (q->q.qlen) |
247 | return false; | ||
248 | } | ||
249 | return true; | ||
243 | } | 250 | } |
244 | 251 | ||
245 | /* Are any of the TX qdiscs changing? */ | 252 | /* Are any of the TX qdiscs changing? */ |
246 | static inline bool qdisc_tx_changing(struct net_device *dev) | 253 | static inline bool qdisc_tx_changing(struct net_device *dev) |
247 | { | 254 | { |
248 | struct netdev_queue *txq = &dev->tx_queue; | 255 | unsigned int i; |
249 | 256 | for (i = 0; i < dev->num_tx_queues; i++) { | |
250 | return (txq->qdisc != txq->qdisc_sleeping); | 257 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); |
258 | if (txq->qdisc != txq->qdisc_sleeping) | ||
259 | return true; | ||
260 | } | ||
261 | return false; | ||
251 | } | 262 | } |
252 | 263 | ||
253 | /* Is the device using the noop qdisc? */ | 264 | /* Is the device using the noop qdisc on all queues? */ |
254 | static inline bool qdisc_tx_is_noop(const struct net_device *dev) | 265 | static inline bool qdisc_tx_is_noop(const struct net_device *dev) |
255 | { | 266 | { |
256 | const struct netdev_queue *txq = &dev->tx_queue; | 267 | unsigned int i; |
257 | 268 | for (i = 0; i < dev->num_tx_queues; i++) { | |
258 | return (txq->qdisc == &noop_qdisc); | 269 | struct netdev_queue *txq = netdev_get_tx_queue(dev, i); |
270 | if (txq->qdisc != &noop_qdisc) | ||
271 | return false; | ||
272 | } | ||
273 | return true; | ||
259 | } | 274 | } |
260 | 275 | ||
261 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, | 276 | static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch, |