diff options
| author | 2022-09-20 15:54:46 -0700 | |
|---|---|---|
| committer | 2022-09-20 15:54:46 -0700 | |
| commit | adae216f4ebc037e20b4868deaa62fb6a5c2299f (patch) | |
| tree | 5b3df0821033d7821beeade25e025b1add5f4b4b /include | |
| parent | net: broadcom: bcm4908_enet: handle -EPROBE_DEFER when getting MAC (diff) | |
| parent | selftests/tc-testings: add list case for basic filter (diff) | |
Merge branch 'refactor-duplicate-codes-in-the-tc-cls-walk-function'
Zhengchao Shao says:
====================
refactor duplicate codes in the tc cls walk function
The walk implementation of most tc cls 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.
Then use helper function to replace the code of each cls module in
alphabetical order.
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/20220916020251.190097-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/pkt_cls.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index d9d90e6925e1..d376c995d906 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -81,6 +81,19 @@ int tcf_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct tcf_result *res, bool compat_mode); +static inline bool tc_cls_stats_dump(struct tcf_proto *tp, + struct tcf_walker *arg, + void *filter) +{ + if (arg->count >= arg->skip && arg->fn(tp, filter, arg) < 0) { + arg->stop = 1; + return false; + } + + arg->count++; + return true; +} + #else static inline bool tcf_block_shared(struct tcf_block *block) { |
