* [PATCH 13/39]: pkt_sched: Add qdisc_all_tx_empty()
@ 2008-07-03 7:03 David Miller
[not found] ` <20080703.000343.16709755.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2008-07-03 7:03 UTC (permalink / raw)
To: netdev; +Cc: vinay, krkumar2, mchan, Matheos.Worku, linux-wireless
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.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/irda/irda_device.h | 2 +-
include/net/sch_generic.h | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 16fbf67..3025ae1 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -223,7 +223,7 @@ int irda_device_is_receiving(struct net_device *dev);
/* Interface for internal use */
static inline int irda_device_txqueue_empty(const struct net_device *dev)
{
- return skb_queue_empty(&dev->tx_queue.qdisc->q);
+ return qdisc_all_tx_empty(dev);
}
int irda_device_set_raw_mode(struct net_device* self, int status);
struct net_device *alloc_irdadev(int sizeof_priv);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index a71994b..f83e860 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -191,6 +191,19 @@ static inline void qdisc_reset_all_tx(struct net_device *dev)
qdisc_reset(dev->tx_queue.qdisc);
}
+/* 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);
+}
+
static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
struct sk_buff_head *list)
{
--
1.5.6
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <20080703.000343.16709755.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>]
* Re: [PATCH 13/39]: pkt_sched: Add qdisc_all_tx_empty() [not found] ` <20080703.000343.16709755.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org> @ 2008-07-03 13:11 ` Patrick McHardy [not found] ` <486CCFFE.7060009-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Patrick McHardy @ 2008-07-03 13:11 UTC (permalink / raw) To: David Miller Cc: netdev-u79uwXL29TY76Z2rM5mHXA, vinay-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, krkumar2-xthvdsQ13ZrQT0dZR+AlfA, mchan-dY08KVG/lbpWk0Htik3J/w, Matheos.Worku-UdXhSnd/wVw, linux-wireless-u79uwXL29TY76Z2rM5mHXA David Miller wrote: > 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. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <486CCFFE.7060009-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org>]
* Re: [PATCH 13/39]: pkt_sched: Add qdisc_all_tx_empty() [not found] ` <486CCFFE.7060009-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org> @ 2008-07-03 20:46 ` David Miller 0 siblings, 0 replies; 3+ messages in thread From: David Miller @ 2008-07-03 20:46 UTC (permalink / raw) To: kaber-dcUjhNyLwpNeoWH0uzbU5w Cc: netdev-u79uwXL29TY76Z2rM5mHXA, vinay-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, krkumar2-xthvdsQ13ZrQT0dZR+AlfA, mchan-dY08KVG/lbpWk0Htik3J/w, Matheos.Worku-UdXhSnd/wVw, linux-wireless-u79uwXL29TY76Z2rM5mHXA From: Patrick McHardy <kaber-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org> Date: Thu, 03 Jul 2008 15:11:26 +0200 > David Miller wrote: > > 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. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-03 20:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 7:03 [PATCH 13/39]: pkt_sched: Add qdisc_all_tx_empty() David Miller
[not found] ` <20080703.000343.16709755.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-07-03 13:11 ` Patrick McHardy
[not found] ` <486CCFFE.7060009-dcUjhNyLwpNeoWH0uzbU5w@public.gmane.org>
2008-07-03 20:46 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).