Commit d3e0f575 authored by Yunsheng Lin's avatar Yunsheng Lin Committed by David S. Miller

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: default avatarJakub Kicinski <kuba@kernel.org>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # flexcan
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c4fef01b
...@@ -117,8 +117,6 @@ struct Qdisc { ...@@ -117,8 +117,6 @@ struct Qdisc {
spinlock_t busylock ____cacheline_aligned_in_smp; spinlock_t busylock ____cacheline_aligned_in_smp;
spinlock_t seqlock; spinlock_t seqlock;
/* for NOLOCK qdisc, true if there are no enqueued skbs */
bool empty;
struct rcu_head rcu; struct rcu_head rcu;
/* private data */ /* private data */
...@@ -165,7 +163,7 @@ static inline bool qdisc_is_percpu_stats(const struct Qdisc *q) ...@@ -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) static inline bool qdisc_is_empty(const struct Qdisc *qdisc)
{ {
if (qdisc_is_percpu_stats(qdisc)) if (qdisc_is_percpu_stats(qdisc))
return READ_ONCE(qdisc->empty); return nolock_qdisc_is_empty(qdisc);
return !READ_ONCE(qdisc->q.qlen); return !READ_ONCE(qdisc->q.qlen);
} }
...@@ -173,7 +171,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) ...@@ -173,7 +171,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
{ {
if (qdisc->flags & TCQ_F_NOLOCK) { if (qdisc->flags & TCQ_F_NOLOCK) {
if (spin_trylock(&qdisc->seqlock)) if (spin_trylock(&qdisc->seqlock))
goto nolock_empty; return true;
/* If the MISSED flag is set, it means other thread has /* If the MISSED flag is set, it means other thread has
* set the MISSED flag before second spin_trylock(), so * set the MISSED flag before second spin_trylock(), so
...@@ -195,12 +193,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) ...@@ -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 /* Retry again in case other CPU may not see the new flag
* after it releases the lock at the end of qdisc_run_end(). * after it releases the lock at the end of qdisc_run_end().
*/ */
if (!spin_trylock(&qdisc->seqlock)) return spin_trylock(&qdisc->seqlock);
return false;
nolock_empty:
WRITE_ONCE(qdisc->empty, false);
return true;
} else if (qdisc_is_running(qdisc)) { } else if (qdisc_is_running(qdisc)) {
return false; return false;
} }
......
...@@ -725,8 +725,6 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc) ...@@ -725,8 +725,6 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
need_retry = false; need_retry = false;
goto retry; goto retry;
} else {
WRITE_ONCE(qdisc->empty, true);
} }
return skb; return skb;
...@@ -927,7 +925,6 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, ...@@ -927,7 +925,6 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
sch->enqueue = ops->enqueue; sch->enqueue = ops->enqueue;
sch->dequeue = ops->dequeue; sch->dequeue = ops->dequeue;
sch->dev_queue = dev_queue; sch->dev_queue = dev_queue;
sch->empty = true;
dev_hold(dev); dev_hold(dev);
refcount_set(&sch->refcnt, 1); refcount_set(&sch->refcnt, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment