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>
This commit is contained in:
@ -230,32 +230,47 @@ extern void tcf_destroy_chain(struct tcf_proto **fl);
|
||||
/* Reset all TX qdiscs of a device. */
|
||||
static inline void qdisc_reset_all_tx(struct net_device *dev)
|
||||
{
|
||||
qdisc_reset(dev->tx_queue.qdisc);
|
||||
unsigned int i;
|
||||
for (i = 0; i < dev->num_tx_queues; i++)
|
||||
qdisc_reset(netdev_get_tx_queue(dev, i)->qdisc);
|
||||
}
|
||||
|
||||
/* Are all TX queues of the device empty? */
|
||||
static inline bool qdisc_all_tx_empty(const struct net_device *dev)
|
||||
{
|
||||
const struct netdev_queue *txq = &dev->tx_queue;
|
||||
const struct Qdisc *q = txq->qdisc;
|
||||
unsigned int i;
|
||||
for (i = 0; i < dev->num_tx_queues; i++) {
|
||||
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
||||
const struct Qdisc *q = txq->qdisc;
|
||||
|
||||
return (q->q.qlen == 0);
|
||||
if (q->q.qlen)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Are any of the TX qdiscs changing? */
|
||||
static inline bool qdisc_tx_changing(struct net_device *dev)
|
||||
{
|
||||
struct netdev_queue *txq = &dev->tx_queue;
|
||||
|
||||
return (txq->qdisc != txq->qdisc_sleeping);
|
||||
unsigned int i;
|
||||
for (i = 0; i < dev->num_tx_queues; i++) {
|
||||
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
||||
if (txq->qdisc != txq->qdisc_sleeping)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Is the device using the noop qdisc? */
|
||||
/* Is the device using the noop qdisc on all queues? */
|
||||
static inline bool qdisc_tx_is_noop(const struct net_device *dev)
|
||||
{
|
||||
const struct netdev_queue *txq = &dev->tx_queue;
|
||||
|
||||
return (txq->qdisc == &noop_qdisc);
|
||||
unsigned int i;
|
||||
for (i = 0; i < dev->num_tx_queues; i++) {
|
||||
struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
|
||||
if (txq->qdisc != &noop_qdisc)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
|
||||
|
Reference in New Issue
Block a user