Message ID | 20220927124855.252023-3-shaozhengchao@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 402963e34a707e4a8f1854ed86437bc375d65766 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | refactor duplicate codes in bind_class hook function | expand |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index d376c995d906..4cabb32a2ad9 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -210,6 +210,18 @@ tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r) __tcf_unbind_filter(q, r); } +static inline void tc_cls_bind_class(u32 classid, unsigned long cl, + void *q, struct tcf_result *res, + unsigned long base) +{ + if (res->classid == classid) { + if (cl) + __tcf_bind_filter(q, res, base); + else + __tcf_unbind_filter(q, res); + } +} + struct tcf_exts { #ifdef CONFIG_NET_CLS_ACT __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
All the bind_class callback duplicate the same logic, this patch introduces tc_cls_bind_class() helper for common usage. Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> --- include/net/pkt_cls.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)