net: sched: prefer qdisc_is_empty() over direct qlen access
authorPaolo Abeni <pabeni@redhat.com>
Wed, 10 Apr 2019 12:32:38 +0000 (14:32 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Apr 2019 19:20:46 +0000 (12:20 -0700)
When checking for root qdisc queue length, do not access directly q.qlen.
In the following patches we will move back qlen accounting to per CPU
values for NOLOCK qdiscs.

Instead, prefer the qdisc_is_empty() helper usage.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sch_generic.h

index 0aea0e262452282c70f7086526f9ed8bab2ba8db..7ecb6127e980f8c97b019e8c5b523d298cfa7994 100644 (file)
@@ -747,7 +747,7 @@ static inline bool qdisc_all_tx_empty(const struct net_device *dev)
                struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
                const struct Qdisc *q = rcu_dereference(txq->qdisc);
 
-               if (q->q.qlen) {
+               if (!qdisc_is_empty(q)) {
                        rcu_read_unlock();
                        return false;
                }