summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-09-22 17:34:18 -0700
committerJakub Kicinski <kuba@kernel.org>2022-09-22 17:34:19 -0700
commit3f5b606dd9b955e7dae0ff0830c77bb1b3d3668d (patch)
tree63f168687b577a636f2148f15ec2a156ce3e8158 /include
parenta2c2a4ddc27db1715be8c03280c6cb7b808dd8b7 (diff)
parentd3f832547bb2981a96f498e007c100703398de53 (diff)
Merge branch 'refactor-duplicate-codes-in-the-qdisc-class-walk-function'
Zhengchao Shao says: ==================== refactor duplicate codes in the qdisc class walk function The walk implementation of most qdisc class modules is basically the same. That is, the values of count and skip are checked first. If count is greater than or equal to skip, the registered fn function is executed. Otherwise, increase the value of count. So the code can be refactored. The walk function is invoked during dump. Therefore, test cases related to the tdc filter need to be added. ==================== Link: https://lore.kernel.org/r/20220921024040.385296-1-shaozhengchao@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/pkt_sched.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 29f65632ebc5..2ff80cd04c5c 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -222,4 +222,17 @@ static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb)
return cb;
}
+static inline bool tc_qdisc_stats_dump(struct Qdisc *sch,
+ unsigned long cl,
+ struct qdisc_walker *arg)
+{
+ if (arg->count >= arg->skip && arg->fn(sch, cl, arg) < 0) {
+ arg->stop = 1;
+ return false;
+ }
+
+ arg->count++;
+ return true;
+}
+
#endif