summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorYunsheng Lin <linyunsheng@huawei.com>2021-06-22 14:49:57 +0800
committerDavid S. Miller <davem@davemloft.net>2021-06-23 12:17:35 -0700
commitd3e0f57501bde8a9585aff79afcffd99e6a5d91c (patch)
treeb0ab80b197393e5574f22a5e595a716b8875175e /include/net
parentc4fef01ba4793a85b2d38a472bddd1e3b56d9585 (diff)
net: sched: remove qdisc->empty for lockless qdisc
As MISSED and DRAINING state are used to indicate a non-empty qdisc, qdisc->empty is not longer needed, so remove it. Acked-by: Jakub Kicinski <kuba@kernel.org> Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # flexcan Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/sch_generic.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 177f240d59d4..c99ffe9cc88f 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -117,8 +117,6 @@ struct Qdisc {
spinlock_t busylock ____cacheline_aligned_in_smp;
spinlock_t seqlock;
- /* for NOLOCK qdisc, true if there are no enqueued skbs */
- bool empty;
struct rcu_head rcu;
/* private data */
@@ -165,7 +163,7 @@ static inline bool qdisc_is_percpu_stats(const struct Qdisc *q)
static inline bool qdisc_is_empty(const struct Qdisc *qdisc)
{
if (qdisc_is_percpu_stats(qdisc))
- return READ_ONCE(qdisc->empty);
+ return nolock_qdisc_is_empty(qdisc);
return !READ_ONCE(qdisc->q.qlen);
}
@@ -173,7 +171,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
{
if (qdisc->flags & TCQ_F_NOLOCK) {
if (spin_trylock(&qdisc->seqlock))
- goto nolock_empty;
+ return true;
/* If the MISSED flag is set, it means other thread has
* set the MISSED flag before second spin_trylock(), so
@@ -195,12 +193,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
/* Retry again in case other CPU may not see the new flag
* after it releases the lock at the end of qdisc_run_end().
*/
- if (!spin_trylock(&qdisc->seqlock))
- return false;
-
-nolock_empty:
- WRITE_ONCE(qdisc->empty, false);
- return true;
+ return spin_trylock(&qdisc->seqlock);
} else if (qdisc_is_running(qdisc)) {
return false;
}