lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20220927124855.252023-3-shaozhengchao@huawei.com> Date: Tue, 27 Sep 2022 20:48:54 +0800 From: Zhengchao Shao <shaozhengchao@...wei.com> To: <netdev@...r.kernel.org>, <bpf@...r.kernel.org>, <jhs@...atatu.com>, <xiyou.wangcong@...il.com>, <jiri@...nulli.us>, <edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com> CC: <ast@...nel.org>, <daniel@...earbox.net>, <andrii@...nel.org>, <martin.lau@...ux.dev>, <song@...nel.org>, <yhs@...com>, <john.fastabend@...il.com>, <kpsingh@...nel.org>, <sdf@...gle.com>, <haoluo@...gle.com>, <jolsa@...nel.org>, <weiyongjun1@...wei.com>, <yuehaibing@...wei.com>, <shaozhengchao@...wei.com> Subject: [PATCH net-next 2/3] net: sched: cls_api: introduce tc_cls_bind_class() helper 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@...wei.com> --- include/net/pkt_cls.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) */ -- 2.17.1
Powered by blists - more mailing lists