From: Patrick McHardy <redacted>
Date: Thu, 03 Jul 2008 15:11:26 +0200
David Miller wrote:
quoted
As per comments, this isn't a foolproof implementation. This is being
added so that we can contain and isolate all the explicit ->tx_queue
references in the tree.
+/* Are all TX queues of the device empty? */
+static inline bool qdisc_all_tx_empty(const struct net_device *dev)
+{
+ struct netdev_queue *txq = &dev->tx_queue;
+
+ /* XXX This is not correct but it is good enough for the
+ * XXX one place that wants this, IRDA. If we wanted to
+ * XXX do this right, we'd need to add a qdisc op to
+ * XXX probe for the queue state.
+ */
+ return skb_queue_empty(&txq->qdisc->q);
+}
It this comment referring to the fact that its looking at
qdisc->q itself, while the qdisc might be using internal
queues? If so, just using txq->qdisc->q.qlen should be
fine since qdiscs are required to always update this value,
even if they're not using the queue itself.
Indeed, and this is exactly what the sch_generic.c packet output path
uses as a test too.
Thanks Patrick, I'll fix this up.