diff options
| author | David S. Miller <davem@davemloft.net> | 2022-10-02 18:07:17 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2022-10-02 18:07:17 +0300 |
| commit | 9d43507319cc256c8383e3e2dcc394b458b7aa37 (patch) | |
| tree | 63a87fa2a51b9e7b6cc77581c865a7f37927f679 /include | |
| parent | bc37b24ee05e3fc4eae3e51c25572ccda9c34c11 (diff) | |
| parent | cc9039a1349425516eca369183c5a8d2f139cb1b (diff) | |
| download | linux-9d43507319cc256c8383e3e2dcc394b458b7aa37.tar.xz | |
Merge branch 'tc-bind_class-hook'
Zhengchao Shao says:
====================
refactor duplicate codes in bind_class hook function
All the bind_class callback duplicate the same logic, so we can refactor
them. First, ensure n arg not empty before call bind_class hook function.
Then, add tc_cls_bind_class() helper. Last, use tc_cls_bind_class() in
filter.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/pkt_cls.h | 12 |
1 files changed, 12 insertions, 0 deletions
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) */ |
