diff options
| author | Eric Dumazet <edumazet@google.com> | 2026-05-10 12:14:51 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-05-12 04:28:07 +0300 |
| commit | 554e96a47a84e19abca8d2b1fea1de81cd2c8657 (patch) | |
| tree | 238b2534783a0bc462af2e44e04b5e58fb6a045f /include | |
| parent | 0e5b05f44d818d1efe5154832d2e3f3c44352c02 (diff) | |
| download | linux-554e96a47a84e19abca8d2b1fea1de81cd2c8657.tar.xz | |
net/sched: add qdisc_qlen_lockless() helper
Used in contexts were qdisc spinlock is not held.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Link: https://patch.msgid.link/20260510091455.4039245-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/sch_generic.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 391ee8530017..0edf05d56862 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -542,6 +542,11 @@ static inline int qdisc_qlen(const struct Qdisc *q) return q->q.qlen; } +static inline int qdisc_qlen_lockless(const struct Qdisc *q) +{ + return READ_ONCE(q->q.qlen); +} + static inline void qdisc_qlen_inc(struct Qdisc *q) { WRITE_ONCE(q->q.qlen, q->q.qlen + 1); @@ -561,7 +566,7 @@ static inline int qdisc_qlen_sum(const struct Qdisc *q) for_each_possible_cpu(i) qlen += READ_ONCE(per_cpu_ptr(q->cpu_qstats, i)->qlen); } else { - qlen += READ_ONCE(q->q.qlen); + qlen += qdisc_qlen_lockless(q); } return qlen; |
