From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9646C6FA85 for ; Fri, 2 Sep 2022 11:22:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235672AbiIBLWp (ORCPT ); Fri, 2 Sep 2022 07:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234778AbiIBLWf (ORCPT ); Fri, 2 Sep 2022 07:22:35 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E080AC2E81; Fri, 2 Sep 2022 04:22:33 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJwQd3bSrzkWrn; Fri, 2 Sep 2022 19:18:49 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:30 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 01/22] net: sched: act_api: implement generic walker and search for tc action Date: Fri, 2 Sep 2022 19:24:25 +0800 Message-ID: <20220902112446.29858-2-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Being able to get tc_action_net by using net_id stored in tc_action_ops and execute the generic walk/search function, add __tcf_generic_walker() and __tcf_idr_search() helpers. Signed-off-by: Zhengchao Shao --- include/net/act_api.h | 1 + net/sched/act_api.c | 48 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index 9cf6870b526e..a79d6e58519e 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -113,6 +113,7 @@ struct tc_action_ops { enum tca_id id; /* identifier should match kind */ size_t size; struct module *owner; + unsigned int *net_id; int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); /* called under RCU BH lock*/ int (*dump)(struct sk_buff *, struct tc_action *, int, int); diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 817065aa2833..7063d2004199 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -676,6 +676,25 @@ int tcf_idr_search(struct tc_action_net *tn, struct tc= _action **a, u32 index) } EXPORT_SYMBOL(tcf_idr_search); =20 +static int __tcf_generic_walker(struct net *net, struct sk_buff *skb, + struct netlink_callback *cb, int type, + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) +{ + struct tc_action_net *tn =3D net_generic(net, *ops->net_id); + + return tcf_generic_walker(tn, skb, cb, type, ops, extack); +} + +static int __tcf_idr_search(struct net *net, + const struct tc_action_ops *ops, + struct tc_action **a, u32 index) +{ + struct tc_action_net *tn =3D net_generic(net, *ops->net_id); + + return tcf_idr_search(tn, a, index); +} + static int tcf_idr_delete_index(struct tcf_idrinfo *idrinfo, u32 index) { struct tc_action *p; @@ -926,7 +945,8 @@ int tcf_register_action(struct tc_action_ops *act, struct tc_action_ops *a; int ret; =20 - if (!act->act || !act->dump || !act->init || !act->walk || !act->lookup) + if (!act->act || !act->dump || !act->init || + (!act->net_id && (!act->walk || !act->lookup))) return -EINVAL; =20 /* We have to register pernet ops before making the action ops visible, @@ -1638,9 +1658,16 @@ static struct tc_action *tcf_action_get_1(struct net= *net, struct nlattr *nla, goto err_out; } err =3D -ENOENT; - if (ops->lookup(net, &a, index) =3D=3D 0) { - NL_SET_ERR_MSG(extack, "TC action with specified index not found"); - goto err_mod; + if (ops->lookup) { + if (ops->lookup(net, &a, index) =3D=3D 0) { + NL_SET_ERR_MSG(extack, "TC action with specified index not found"); + goto err_mod; + } + } else { + if (__tcf_idr_search(net, ops, &a, index) =3D=3D 0) { + NL_SET_ERR_MSG(extack, "TC action with specified index not found"); + goto err_mod; + } } =20 module_put(ops->owner); @@ -1703,7 +1730,12 @@ static int tca_action_flush(struct net *net, struct = nlattr *nla, goto out_module_put; } =20 - err =3D ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack); + if (ops->walk) { + err =3D ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack); + } else { + err =3D __tcf_generic_walker(net, skb, &dcb, RTM_DELACTION, ops, extack); + } + if (err <=3D 0) { nla_nest_cancel(skb, nest); goto out_module_put; @@ -2121,7 +2153,11 @@ static int tc_dump_action(struct sk_buff *skb, struc= t netlink_callback *cb) if (nest =3D=3D NULL) goto out_module_put; =20 - ret =3D a_o->walk(net, skb, cb, RTM_GETACTION, a_o, NULL); + if (a_o->walk) + ret =3D a_o->walk(net, skb, cb, RTM_GETACTION, a_o, NULL); + else + ret =3D __tcf_generic_walker(net, skb, cb, RTM_GETACTION, a_o, NULL); + if (ret < 0) goto out_module_put; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FE4BECAAD5 for ; Fri, 2 Sep 2022 11:22:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235842AbiIBLWv (ORCPT ); Fri, 2 Sep 2022 07:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235042AbiIBLWf (ORCPT ); Fri, 2 Sep 2022 07:22:35 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C42DFC6954; Fri, 2 Sep 2022 04:22:34 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwQx0HSJzlWcW; Fri, 2 Sep 2022 19:19:05 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:31 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 02/22] net: sched: act_bpf: get rid of tcf_bpf_walker and tcf_bpf_search Date: Fri, 2 Sep 2022 19:24:26 +0800 Message-ID: <20220902112446.29858-3-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving bpf_net_id when registering act_bpf_ops. And then remove the walk and lookup hook functions in act_bpf. Signed-off-by: Zhengchao Shao --- net/sched/act_bpf.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index fea2d78b9ddc..d7fc5c4157d6 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c @@ -390,33 +390,15 @@ static void tcf_bpf_cleanup(struct tc_action *act) tcf_bpf_cfg_cleanup(&tmp); } =20 -static int tcf_bpf_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, bpf_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn =3D net_generic(net, bpf_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_bpf_ops __read_mostly =3D { .kind =3D "bpf", .id =3D TCA_ID_BPF, + .net_id =3D &bpf_net_id, .owner =3D THIS_MODULE, .act =3D tcf_bpf_act, .dump =3D tcf_bpf_dump, .cleanup =3D tcf_bpf_cleanup, .init =3D tcf_bpf_init, - .walk =3D tcf_bpf_walker, - .lookup =3D tcf_bpf_search, .size =3D sizeof(struct tcf_bpf), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF32EC38145 for ; Fri, 2 Sep 2022 11:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234477AbiIBLWz (ORCPT ); Fri, 2 Sep 2022 07:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235494AbiIBLWg (ORCPT ); Fri, 2 Sep 2022 07:22:36 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB5A6C6E86; Fri, 2 Sep 2022 04:22:35 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwQx6mRjzlWfB; Fri, 2 Sep 2022 19:19:05 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:32 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 03/22] net: sched: act_connmark: get rid of tcf_connmark_walker and tcf_connmark_search Date: Fri, 2 Sep 2022 19:24:27 +0800 Message-ID: <20220902112446.29858-4-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving connmark_net_id when registering act_connmark_ops. And then remove the walk and lookup hook functions in act_connmark. Signed-off-by: Zhengchao Shao --- net/sched/act_connmark.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_connmark.c b/net/sched/act_connmark.c index 09e2aafc8943..e7cc0aba9c4f 100644 --- a/net/sched/act_connmark.c +++ b/net/sched/act_connmark.c @@ -200,32 +200,14 @@ static inline int tcf_connmark_dump(struct sk_buff *s= kb, struct tc_action *a, return -1; } =20 -static int tcf_connmark_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, connmark_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 = index) -{ - struct tc_action_net *tn =3D net_generic(net, connmark_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_connmark_ops =3D { .kind =3D "connmark", .id =3D TCA_ID_CONNMARK, + .net_id =3D &connmark_net_id, .owner =3D THIS_MODULE, .act =3D tcf_connmark_act, .dump =3D tcf_connmark_dump, .init =3D tcf_connmark_init, - .walk =3D tcf_connmark_walker, - .lookup =3D tcf_connmark_search, .size =3D sizeof(struct tcf_connmark_info), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0F3CC6FA85 for ; Fri, 2 Sep 2022 11:23:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235929AbiIBLW6 (ORCPT ); Fri, 2 Sep 2022 07:22:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235593AbiIBLWj (ORCPT ); Fri, 2 Sep 2022 07:22:39 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D214C6E86; Fri, 2 Sep 2022 04:22:36 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MJwSs0JwNzrS3f; Fri, 2 Sep 2022 19:20:45 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:33 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 04/22] net: sched: act_csum: get rid of tcf_csum_walker and tcf_csum_search Date: Fri, 2 Sep 2022 19:24:28 +0800 Message-ID: <20220902112446.29858-5-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving csum_net_id when registering act_csum_ops. And then remove the walk and lookup hook functions in act_csum. Signed-off-by: Zhengchao Shao --- net/sched/act_csum.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c index 22847ee009ef..095132b0f96a 100644 --- a/net/sched/act_csum.c +++ b/net/sched/act_csum.c @@ -673,23 +673,6 @@ static void tcf_csum_cleanup(struct tc_action *a) kfree_rcu(params, rcu); } =20 -static int tcf_csum_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, csum_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_csum_search(struct net *net, struct tc_action **a, u32 inde= x) -{ - struct tc_action_net *tn =3D net_generic(net, csum_net_id); - - return tcf_idr_search(tn, a, index); -} - static size_t tcf_csum_get_fill_size(const struct tc_action *act) { return nla_total_size(sizeof(struct tc_csum)); @@ -717,13 +700,12 @@ static int tcf_csum_offload_act_setup(struct tc_actio= n *act, void *entry_data, static struct tc_action_ops act_csum_ops =3D { .kind =3D "csum", .id =3D TCA_ID_CSUM, + .net_id =3D &csum_net_id, .owner =3D THIS_MODULE, .act =3D tcf_csum_act, .dump =3D tcf_csum_dump, .init =3D tcf_csum_init, .cleanup =3D tcf_csum_cleanup, - .walk =3D tcf_csum_walker, - .lookup =3D tcf_csum_search, .get_fill_size =3D tcf_csum_get_fill_size, .offload_act_setup =3D tcf_csum_offload_act_setup, .size =3D sizeof(struct tcf_csum), --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34D0CC38145 for ; Fri, 2 Sep 2022 11:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235964AbiIBLXI (ORCPT ); Fri, 2 Sep 2022 07:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235606AbiIBLWj (ORCPT ); Fri, 2 Sep 2022 07:22:39 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E136C743C; Fri, 2 Sep 2022 04:22:37 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJwQj1dCHzkWt4; Fri, 2 Sep 2022 19:18:53 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:34 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 05/22] net: sched: act_ct: get rid of tcf_ct_walker and tcf_ct_search Date: Fri, 2 Sep 2022 19:24:29 +0800 Message-ID: <20220902112446.29858-6-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving ct_net_id when registering act_ct_ops. And then remove the walk and lookup hook functions in act_ct. Signed-off-by: Zhengchao Shao --- net/sched/act_ct.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index d55afb8d14be..436517272c9d 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -1558,23 +1558,6 @@ static inline int tcf_ct_dump(struct sk_buff *skb, s= truct tc_action *a, return -1; } =20 -static int tcf_ct_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, ct_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_ct_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn =3D net_generic(net, ct_net_id); - - return tcf_idr_search(tn, a, index); -} - static void tcf_stats_update(struct tc_action *a, u64 bytes, u64 packets, u64 drops, u64 lastuse, bool hw) { @@ -1608,13 +1591,12 @@ static int tcf_ct_offload_act_setup(struct tc_actio= n *act, void *entry_data, static struct tc_action_ops act_ct_ops =3D { .kind =3D "ct", .id =3D TCA_ID_CT, + .net_id =3D &ct_net_id, .owner =3D THIS_MODULE, .act =3D tcf_ct_act, .dump =3D tcf_ct_dump, .init =3D tcf_ct_init, .cleanup =3D tcf_ct_cleanup, - .walk =3D tcf_ct_walker, - .lookup =3D tcf_ct_search, .stats_update =3D tcf_stats_update, .offload_act_setup =3D tcf_ct_offload_act_setup, .size =3D sizeof(struct tcf_ct), --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DBC4ECAAD5 for ; Fri, 2 Sep 2022 11:23:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235548AbiIBLXE (ORCPT ); Fri, 2 Sep 2022 07:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235619AbiIBLWj (ORCPT ); Fri, 2 Sep 2022 07:22:39 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CD7BC0E40; Fri, 2 Sep 2022 04:22:38 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJwQk1NX6zkWsB; Fri, 2 Sep 2022 19:18:54 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:35 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 06/22] net: sched: act_ctinfo: get rid of tcf_ctinfo_walker and tcf_ctinfo_search Date: Fri, 2 Sep 2022 19:24:30 +0800 Message-ID: <20220902112446.29858-7-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving ctinfo_net_id when registering act_ctinfo_ops. And then remove the walk and lookup hook functions in act_ctinfo. Signed-off-by: Zhengchao Shao --- net/sched/act_ctinfo.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_ctinfo.c b/net/sched/act_ctinfo.c index 0281e45987a4..b79c5a5177aa 100644 --- a/net/sched/act_ctinfo.c +++ b/net/sched/act_ctinfo.c @@ -342,23 +342,6 @@ static int tcf_ctinfo_dump(struct sk_buff *skb, struct= tc_action *a, return -1; } =20 -static int tcf_ctinfo_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, ctinfo_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_ctinfo_search(struct net *net, struct tc_action **a, u32 in= dex) -{ - struct tc_action_net *tn =3D net_generic(net, ctinfo_net_id); - - return tcf_idr_search(tn, a, index); -} - static void tcf_ctinfo_cleanup(struct tc_action *a) { struct tcf_ctinfo *ci =3D to_ctinfo(a); @@ -372,13 +355,12 @@ static void tcf_ctinfo_cleanup(struct tc_action *a) static struct tc_action_ops act_ctinfo_ops =3D { .kind =3D "ctinfo", .id =3D TCA_ID_CTINFO, + .net_id =3D &ctinfo_net_id, .owner =3D THIS_MODULE, .act =3D tcf_ctinfo_act, .dump =3D tcf_ctinfo_dump, .init =3D tcf_ctinfo_init, .cleanup=3D tcf_ctinfo_cleanup, - .walk =3D tcf_ctinfo_walker, - .lookup =3D tcf_ctinfo_search, .size =3D sizeof(struct tcf_ctinfo), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2393C6FA83 for ; Fri, 2 Sep 2022 11:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235880AbiIBLXN (ORCPT ); Fri, 2 Sep 2022 07:23:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235640AbiIBLWk (ORCPT ); Fri, 2 Sep 2022 07:22:40 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FB90C7B81; Fri, 2 Sep 2022 04:22:39 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwPv5LZfzWf3l; Fri, 2 Sep 2022 19:18:11 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:36 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 07/22] net: sched: act_gact: get rid of tcf_gact_walker and tcf_gact_search Date: Fri, 2 Sep 2022 19:24:31 +0800 Message-ID: <20220902112446.29858-8-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving gact_net_id when registering act_gact_ops. And then remove the walk and lookup hook functions in act_gact. Signed-off-by: Zhengchao Shao --- net/sched/act_gact.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index ac29d1065232..80c276d2793d 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -222,23 +222,6 @@ static int tcf_gact_dump(struct sk_buff *skb, struct t= c_action *a, return -1; } =20 -static int tcf_gact_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, gact_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_gact_search(struct net *net, struct tc_action **a, u32 inde= x) -{ - struct tc_action_net *tn =3D net_generic(net, gact_net_id); - - return tcf_idr_search(tn, a, index); -} - static size_t tcf_gact_get_fill_size(const struct tc_action *act) { size_t sz =3D nla_total_size(sizeof(struct tc_gact)); /* TCA_GACT_PARMS */ @@ -303,13 +286,12 @@ static int tcf_gact_offload_act_setup(struct tc_actio= n *act, void *entry_data, static struct tc_action_ops act_gact_ops =3D { .kind =3D "gact", .id =3D TCA_ID_GACT, + .net_id =3D &gact_net_id, .owner =3D THIS_MODULE, .act =3D tcf_gact_act, .stats_update =3D tcf_gact_stats_update, .dump =3D tcf_gact_dump, .init =3D tcf_gact_init, - .walk =3D tcf_gact_walker, - .lookup =3D tcf_gact_search, .get_fill_size =3D tcf_gact_get_fill_size, .offload_act_setup =3D tcf_gact_offload_act_setup, .size =3D sizeof(struct tcf_gact), --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0D6BC54EE9 for ; Fri, 2 Sep 2022 11:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236006AbiIBLXR (ORCPT ); Fri, 2 Sep 2022 07:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235657AbiIBLWl (ORCPT ); Fri, 2 Sep 2022 07:22:41 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48671C7B97; Fri, 2 Sep 2022 04:22:40 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MJwSw5d0zzrS3Z; Fri, 2 Sep 2022 19:20:48 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:37 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 08/22] net: sched: act_gate: get rid of tcf_gate_walker and tcf_gate_search Date: Fri, 2 Sep 2022 19:24:32 +0800 Message-ID: <20220902112446.29858-9-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving gate_net_id when registering act_gate_ops. And then remove the walk and lookup hook functions in act_gate. Signed-off-by: Zhengchao Shao --- net/sched/act_gate.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c index fd5155274733..e347e3b42a14 100644 --- a/net/sched/act_gate.c +++ b/net/sched/act_gate.c @@ -565,15 +565,6 @@ static int tcf_gate_dump(struct sk_buff *skb, struct t= c_action *a, return -1; } =20 -static int tcf_gate_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, gate_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} =20 static void tcf_gate_stats_update(struct tc_action *a, u64 bytes, u64 pack= ets, u64 drops, u64 lastuse, bool hw) @@ -585,13 +576,6 @@ static void tcf_gate_stats_update(struct tc_action *a,= u64 bytes, u64 packets, tm->lastuse =3D max_t(u64, tm->lastuse, lastuse); } =20 -static int tcf_gate_search(struct net *net, struct tc_action **a, u32 inde= x) -{ - struct tc_action_net *tn =3D net_generic(net, gate_net_id); - - return tcf_idr_search(tn, a, index); -} - static size_t tcf_gate_get_fill_size(const struct tc_action *act) { return nla_total_size(sizeof(struct tc_gate)); @@ -649,15 +633,14 @@ static int tcf_gate_offload_act_setup(struct tc_actio= n *act, void *entry_data, static struct tc_action_ops act_gate_ops =3D { .kind =3D "gate", .id =3D TCA_ID_GATE, + .net_id =3D &gate_net_id, .owner =3D THIS_MODULE, .act =3D tcf_gate_act, .dump =3D tcf_gate_dump, .init =3D tcf_gate_init, .cleanup =3D tcf_gate_cleanup, - .walk =3D tcf_gate_walker, .stats_update =3D tcf_gate_stats_update, .get_fill_size =3D tcf_gate_get_fill_size, - .lookup =3D tcf_gate_search, .offload_act_setup =3D tcf_gate_offload_act_setup, .size =3D sizeof(struct tcf_gate), }; --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67E52C38145 for ; Fri, 2 Sep 2022 11:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235945AbiIBLXW (ORCPT ); Fri, 2 Sep 2022 07:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235673AbiIBLWm (ORCPT ); Fri, 2 Sep 2022 07:22:42 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DC8CC9E8B; Fri, 2 Sep 2022 04:22:41 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwPx4SfpzWf48; Fri, 2 Sep 2022 19:18:13 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:38 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 09/22] net: sched: act_ife: get rid of tcf_ife_walker and tcf_ife_search Date: Fri, 2 Sep 2022 19:24:33 +0800 Message-ID: <20220902112446.29858-10-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving ife_net_id when registering act_ife_ops. And then remove the walk and lookup hook functions in act_ife. Signed-off-by: Zhengchao Shao --- net/sched/act_ife.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c index 41ba55e60b1b..d473618877e0 100644 --- a/net/sched/act_ife.c +++ b/net/sched/act_ife.c @@ -878,33 +878,15 @@ static int tcf_ife_act(struct sk_buff *skb, const str= uct tc_action *a, return tcf_ife_decode(skb, a, res); } =20 -static int tcf_ife_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, ife_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn =3D net_generic(net, ife_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_ife_ops =3D { .kind =3D "ife", .id =3D TCA_ID_IFE, + .net_id =3D &ife_net_id, .owner =3D THIS_MODULE, .act =3D tcf_ife_act, .dump =3D tcf_ife_dump, .cleanup =3D tcf_ife_cleanup, .init =3D tcf_ife_init, - .walk =3D tcf_ife_walker, - .lookup =3D tcf_ife_search, .size =3D sizeof(struct tcf_ife_info), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0A6CC6FA85 for ; Fri, 2 Sep 2022 11:23:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236071AbiIBLX0 (ORCPT ); Fri, 2 Sep 2022 07:23:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235745AbiIBLWo (ORCPT ); Fri, 2 Sep 2022 07:22:44 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ED6FCE336; Fri, 2 Sep 2022 04:22:42 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJwSC2yHBznV0F; Fri, 2 Sep 2022 19:20:11 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:39 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 10/22] net: sched: act_ipt: get rid of tcf_ipt_walker/tcf_xt_walker and tcf_ipt_search/tcf_xt_search Date: Fri, 2 Sep 2022 19:24:34 +0800 Message-ID: <20220902112446.29858-11-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving ipt_net_id/xt_net_id when registering act_ipt_ops/act_xt_ops. And then remove the walk and lookup hook functions in act_ipt. Signed-off-by: Zhengchao Shao --- net/sched/act_ipt.c | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index 2f3d507c24a1..abacfb134caf 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -316,33 +316,15 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct t= c_action *a, int bind, return -1; } =20 -static int tcf_ipt_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, ipt_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn =3D net_generic(net, ipt_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_ipt_ops =3D { .kind =3D "ipt", .id =3D TCA_ID_IPT, + .net_id =3D &ipt_net_id, .owner =3D THIS_MODULE, .act =3D tcf_ipt_act, .dump =3D tcf_ipt_dump, .cleanup =3D tcf_ipt_release, .init =3D tcf_ipt_init, - .walk =3D tcf_ipt_walker, - .lookup =3D tcf_ipt_search, .size =3D sizeof(struct tcf_ipt), }; =20 @@ -365,33 +347,15 @@ static struct pernet_operations ipt_net_ops =3D { .size =3D sizeof(struct tc_action_net), }; =20 -static int tcf_xt_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, xt_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn =3D net_generic(net, xt_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_xt_ops =3D { .kind =3D "xt", .id =3D TCA_ID_XT, + .net_id =3D &xt_net_id, .owner =3D THIS_MODULE, .act =3D tcf_ipt_act, .dump =3D tcf_ipt_dump, .cleanup =3D tcf_ipt_release, .init =3D tcf_xt_init, - .walk =3D tcf_xt_walker, - .lookup =3D tcf_xt_search, .size =3D sizeof(struct tcf_ipt), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACA3DC38145 for ; Fri, 2 Sep 2022 11:23:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236077AbiIBLXa (ORCPT ); Fri, 2 Sep 2022 07:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235766AbiIBLWo (ORCPT ); Fri, 2 Sep 2022 07:22:44 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6511FC7B8F; Fri, 2 Sep 2022 04:22:43 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwR53MDszlWbv; Fri, 2 Sep 2022 19:19:13 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:40 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 11/22] net: sched: act_mirred: get rid of tcf_mirred_walker and tcf_mirred_search Date: Fri, 2 Sep 2022 19:24:35 +0800 Message-ID: <20220902112446.29858-12-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving mirred_net_id when registering act_mirred_ops. And then remove the walk and lookup hook functions in act_mirred. Signed-off-by: Zhengchao Shao --- net/sched/act_mirred.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index a1d70cf86843..4b266a6cbb3f 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -373,23 +373,6 @@ static int tcf_mirred_dump(struct sk_buff *skb, struct= tc_action *a, int bind, return -1; } =20 -static int tcf_mirred_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, mirred_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_mirred_search(struct net *net, struct tc_action **a, u32 in= dex) -{ - struct tc_action_net *tn =3D net_generic(net, mirred_net_id); - - return tcf_idr_search(tn, a, index); -} - static int mirred_device_event(struct notifier_block *unused, unsigned long event, void *ptr) { @@ -504,14 +487,13 @@ static int tcf_mirred_offload_act_setup(struct tc_act= ion *act, void *entry_data, static struct tc_action_ops act_mirred_ops =3D { .kind =3D "mirred", .id =3D TCA_ID_MIRRED, + .net_id =3D &mirred_net_id, .owner =3D THIS_MODULE, .act =3D tcf_mirred_act, .stats_update =3D tcf_stats_update, .dump =3D tcf_mirred_dump, .cleanup =3D tcf_mirred_release, .init =3D tcf_mirred_init, - .walk =3D tcf_mirred_walker, - .lookup =3D tcf_mirred_search, .get_fill_size =3D tcf_mirred_get_fill_size, .offload_act_setup =3D tcf_mirred_offload_act_setup, .size =3D sizeof(struct tcf_mirred), --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FC97C54EE9 for ; Fri, 2 Sep 2022 11:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236034AbiIBLXl (ORCPT ); Fri, 2 Sep 2022 07:23:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235287AbiIBLWu (ORCPT ); Fri, 2 Sep 2022 07:22:50 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53BCCD25C1; Fri, 2 Sep 2022 04:22:45 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwQ039HNzWf4H; Fri, 2 Sep 2022 19:18:16 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:41 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 12/22] net: sched: act_mpls: get rid of tcf_mpls_walker and tcf_mpls_search Date: Fri, 2 Sep 2022 19:24:36 +0800 Message-ID: <20220902112446.29858-13-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving mpls_net_id when registering act_mpls_ops. And then remove the walk and lookup hook functions in act_mpls. Signed-off-by: Zhengchao Shao --- net/sched/act_mpls.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c index adabeccb63e1..32c5b9586025 100644 --- a/net/sched/act_mpls.c +++ b/net/sched/act_mpls.c @@ -367,23 +367,6 @@ static int tcf_mpls_dump(struct sk_buff *skb, struct t= c_action *a, return -EMSGSIZE; } =20 -static int tcf_mpls_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, mpls_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_mpls_search(struct net *net, struct tc_action **a, u32 inde= x) -{ - struct tc_action_net *tn =3D net_generic(net, mpls_net_id); - - return tcf_idr_search(tn, a, index); -} - static int tcf_mpls_offload_act_setup(struct tc_action *act, void *entry_d= ata, u32 *index_inc, bool bind, struct netlink_ext_ack *extack) @@ -446,13 +429,12 @@ static int tcf_mpls_offload_act_setup(struct tc_actio= n *act, void *entry_data, static struct tc_action_ops act_mpls_ops =3D { .kind =3D "mpls", .id =3D TCA_ID_MPLS, + .net_id =3D &mpls_net_id, .owner =3D THIS_MODULE, .act =3D tcf_mpls_act, .dump =3D tcf_mpls_dump, .init =3D tcf_mpls_init, .cleanup =3D tcf_mpls_cleanup, - .walk =3D tcf_mpls_walker, - .lookup =3D tcf_mpls_search, .offload_act_setup =3D tcf_mpls_offload_act_setup, .size =3D sizeof(struct tcf_mpls), }; --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 299A1C6FA85 for ; Fri, 2 Sep 2022 11:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236121AbiIBLXf (ORCPT ); Fri, 2 Sep 2022 07:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235829AbiIBLWq (ORCPT ); Fri, 2 Sep 2022 07:22:46 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18821D21F5; Fri, 2 Sep 2022 04:22:45 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MJwT13czfzrS3G; Fri, 2 Sep 2022 19:20:53 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:42 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 13/22] net: sched: act_nat: get rid of tcf_nat_walker and tcf_nat_search Date: Fri, 2 Sep 2022 19:24:37 +0800 Message-ID: <20220902112446.29858-14-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving nat_net_id when registering act_nat_ops. And then remove the walk and lookup hook functions in act_nat. Signed-off-by: Zhengchao Shao --- net/sched/act_nat.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c index 2a39b3729e84..c95601bc738c 100644 --- a/net/sched/act_nat.c +++ b/net/sched/act_nat.c @@ -289,32 +289,14 @@ static int tcf_nat_dump(struct sk_buff *skb, struct t= c_action *a, return -1; } =20 -static int tcf_nat_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, nat_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn =3D net_generic(net, nat_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_nat_ops =3D { .kind =3D "nat", .id =3D TCA_ID_NAT, + .net_id =3D &nat_net_id, .owner =3D THIS_MODULE, .act =3D tcf_nat_act, .dump =3D tcf_nat_dump, .init =3D tcf_nat_init, - .walk =3D tcf_nat_walker, - .lookup =3D tcf_nat_search, .size =3D sizeof(struct tcf_nat), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB803C6FA83 for ; Fri, 2 Sep 2022 11:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236152AbiIBLXp (ORCPT ); Fri, 2 Sep 2022 07:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235843AbiIBLWv (ORCPT ); Fri, 2 Sep 2022 07:22:51 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56A5FD274B; Fri, 2 Sep 2022 04:22:46 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJwSH1BCzznTrq; Fri, 2 Sep 2022 19:20:15 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:43 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 14/22] net: sched: act_pedit: get rid of tcf_pedit_walker and tcf_pedit_search Date: Fri, 2 Sep 2022 19:24:38 +0800 Message-ID: <20220902112446.29858-15-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving pedit_net_id when registering act_pedit_ops. And then remove the walk and lookup hook functions in act_pedit. Signed-off-by: Zhengchao Shao --- net/sched/act_pedit.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 823ee643371c..15d1b206e73b 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c @@ -492,23 +492,6 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct = tc_action *a, return -1; } =20 -static int tcf_pedit_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, pedit_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 ind= ex) -{ - struct tc_action_net *tn =3D net_generic(net, pedit_net_id); - - return tcf_idr_search(tn, a, index); -} - static int tcf_pedit_offload_act_setup(struct tc_action *act, void *entry_= data, u32 *index_inc, bool bind, struct netlink_ext_ack *extack) @@ -547,14 +530,13 @@ static int tcf_pedit_offload_act_setup(struct tc_acti= on *act, void *entry_data, static struct tc_action_ops act_pedit_ops =3D { .kind =3D "pedit", .id =3D TCA_ID_PEDIT, + .net_id =3D &pedit_net_id, .owner =3D THIS_MODULE, .act =3D tcf_pedit_act, .stats_update =3D tcf_pedit_stats_update, .dump =3D tcf_pedit_dump, .cleanup =3D tcf_pedit_cleanup, .init =3D tcf_pedit_init, - .walk =3D tcf_pedit_walker, - .lookup =3D tcf_pedit_search, .offload_act_setup =3D tcf_pedit_offload_act_setup, .size =3D sizeof(struct tcf_pedit), }; --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74171ECAAD5 for ; Fri, 2 Sep 2022 11:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236041AbiIBLXu (ORCPT ); Fri, 2 Sep 2022 07:23:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235893AbiIBLWz (ORCPT ); Fri, 2 Sep 2022 07:22:55 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 328A6D290F; Fri, 2 Sep 2022 04:22:47 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwR91gmRzlWhT; Fri, 2 Sep 2022 19:19:17 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:44 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 15/22] net: sched: act_police: get rid of tcf_police_walker and tcf_police_search Date: Fri, 2 Sep 2022 19:24:39 +0800 Message-ID: <20220902112446.29858-16-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving police_net_id when registering act_police_ops. And then remove the walk and lookup hook functions in act_police. Signed-off-by: Zhengchao Shao --- net/sched/act_police.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_police.c b/net/sched/act_police.c index b759628a47c2..a9dd89210bd4 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -25,16 +25,6 @@ static unsigned int police_net_id; static struct tc_action_ops act_police_ops; =20 -static int tcf_police_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, police_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] =3D { [TCA_POLICE_RATE] =3D { .len =3D TC_RTAB_SIZE }, [TCA_POLICE_PEAKRATE] =3D { .len =3D TC_RTAB_SIZE }, @@ -412,13 +402,6 @@ static int tcf_police_dump(struct sk_buff *skb, struct= tc_action *a, return -1; } =20 -static int tcf_police_search(struct net *net, struct tc_action **a, u32 in= dex) -{ - struct tc_action_net *tn =3D net_generic(net, police_net_id); - - return tcf_idr_search(tn, a, index); -} - static int tcf_police_act_to_flow_act(int tc_act, u32 *extval, struct netlink_ext_ack *extack) { @@ -508,13 +491,12 @@ MODULE_LICENSE("GPL"); static struct tc_action_ops act_police_ops =3D { .kind =3D "police", .id =3D TCA_ID_POLICE, + .net_id =3D &police_net_id, .owner =3D THIS_MODULE, .stats_update =3D tcf_police_stats_update, .act =3D tcf_police_act, .dump =3D tcf_police_dump, .init =3D tcf_police_init, - .walk =3D tcf_police_walker, - .lookup =3D tcf_police_search, .cleanup =3D tcf_police_cleanup, .offload_act_setup =3D tcf_police_offload_act_setup, .size =3D sizeof(struct tcf_police), --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6EB0ECAAD5 for ; Fri, 2 Sep 2022 11:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235295AbiIBLYB (ORCPT ); Fri, 2 Sep 2022 07:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235729AbiIBLW5 (ORCPT ); Fri, 2 Sep 2022 07:22:57 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63E6AD292B; Fri, 2 Sep 2022 04:22:48 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwQ41TfZzWf4F; Fri, 2 Sep 2022 19:18:20 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:44 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 16/22] net: sched: act_sample: get rid of tcf_sample_walker and tcf_sample_search Date: Fri, 2 Sep 2022 19:24:40 +0800 Message-ID: <20220902112446.29858-17-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving sample_net_id when registering act_sample_ops. And then remove the walk and lookup hook functions in act_sample. Signed-off-by: Zhengchao Shao --- net/sched/act_sample.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 2f7f5e44d28c..f545f38acbdc 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -241,23 +241,6 @@ static int tcf_sample_dump(struct sk_buff *skb, struct= tc_action *a, return -1; } =20 -static int tcf_sample_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, sample_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_sample_search(struct net *net, struct tc_action **a, u32 in= dex) -{ - struct tc_action_net *tn =3D net_generic(net, sample_net_id); - - return tcf_idr_search(tn, a, index); -} - static void tcf_psample_group_put(void *priv) { struct psample_group *group =3D priv; @@ -315,14 +298,13 @@ static int tcf_sample_offload_act_setup(struct tc_act= ion *act, void *entry_data, static struct tc_action_ops act_sample_ops =3D { .kind =3D "sample", .id =3D TCA_ID_SAMPLE, + .net_id =3D &sample_net_id, .owner =3D THIS_MODULE, .act =3D tcf_sample_act, .stats_update =3D tcf_sample_stats_update, .dump =3D tcf_sample_dump, .init =3D tcf_sample_init, .cleanup =3D tcf_sample_cleanup, - .walk =3D tcf_sample_walker, - .lookup =3D tcf_sample_search, .get_psample_group =3D tcf_sample_get_group, .offload_act_setup =3D tcf_sample_offload_act_setup, .size =3D sizeof(struct tcf_sample), --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DAD5C38145 for ; Fri, 2 Sep 2022 11:24:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235962AbiIBLYG (ORCPT ); Fri, 2 Sep 2022 07:24:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235391AbiIBLXI (ORCPT ); Fri, 2 Sep 2022 07:23:08 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D51D2B10; Fri, 2 Sep 2022 04:22:49 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJwSK73VQznTyk; Fri, 2 Sep 2022 19:20:17 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:45 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 17/22] net: sched: act_simple: get rid of tcf_simp_walker and tcf_simp_search Date: Fri, 2 Sep 2022 19:24:41 +0800 Message-ID: <20220902112446.29858-18-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving simp_net_id when registering act_simp_ops. And then remove the walk and lookup hook functions in act_simple. Signed-off-by: Zhengchao Shao --- net/sched/act_simple.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c index 8c1d60bde93e..0091e6cd707b 100644 --- a/net/sched/act_simple.c +++ b/net/sched/act_simple.c @@ -198,33 +198,15 @@ static int tcf_simp_dump(struct sk_buff *skb, struct = tc_action *a, return -1; } =20 -static int tcf_simp_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, simp_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_simp_search(struct net *net, struct tc_action **a, u32 inde= x) -{ - struct tc_action_net *tn =3D net_generic(net, simp_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_simp_ops =3D { .kind =3D "simple", .id =3D TCA_ID_SIMP, + .net_id =3D &simp_net_id, .owner =3D THIS_MODULE, .act =3D tcf_simp_act, .dump =3D tcf_simp_dump, .cleanup =3D tcf_simp_release, .init =3D tcf_simp_init, - .walk =3D tcf_simp_walker, - .lookup =3D tcf_simp_search, .size =3D sizeof(struct tcf_defact), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB677ECAAD5 for ; Fri, 2 Sep 2022 11:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236172AbiIBLYL (ORCPT ); Fri, 2 Sep 2022 07:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235708AbiIBLXI (ORCPT ); Fri, 2 Sep 2022 07:23:08 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94B5BD2B1A; Fri, 2 Sep 2022 04:22:50 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MJwSL6dLpznV0K; Fri, 2 Sep 2022 19:20:18 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:46 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 18/22] net: sched: act_skbedit: get rid of tcf_skbedit_walker and tcf_skbedit_search Date: Fri, 2 Sep 2022 19:24:42 +0800 Message-ID: <20220902112446.29858-19-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving skbedit_net_id when registering act_skbedit_ops. And then remove the walk and lookup hook functions in act_skbedit. Signed-off-by: Zhengchao Shao --- net/sched/act_skbedit.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c index e3bd11dfe1ca..8dfbfab0b5de 100644 --- a/net/sched/act_skbedit.c +++ b/net/sched/act_skbedit.c @@ -347,23 +347,6 @@ static void tcf_skbedit_cleanup(struct tc_action *a) kfree_rcu(params, rcu); } =20 -static int tcf_skbedit_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, skbedit_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 i= ndex) -{ - struct tc_action_net *tn =3D net_generic(net, skbedit_net_id); - - return tcf_idr_search(tn, a, index); -} - static size_t tcf_skbedit_get_fill_size(const struct tc_action *act) { return nla_total_size(sizeof(struct tc_skbedit)) @@ -422,15 +405,14 @@ static int tcf_skbedit_offload_act_setup(struct tc_ac= tion *act, void *entry_data static struct tc_action_ops act_skbedit_ops =3D { .kind =3D "skbedit", .id =3D TCA_ID_SKBEDIT, + .net_id =3D &skbedit_net_id, .owner =3D THIS_MODULE, .act =3D tcf_skbedit_act, .stats_update =3D tcf_skbedit_stats_update, .dump =3D tcf_skbedit_dump, .init =3D tcf_skbedit_init, .cleanup =3D tcf_skbedit_cleanup, - .walk =3D tcf_skbedit_walker, .get_fill_size =3D tcf_skbedit_get_fill_size, - .lookup =3D tcf_skbedit_search, .offload_act_setup =3D tcf_skbedit_offload_act_setup, .size =3D sizeof(struct tcf_skbedit), }; --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54F1DC54EE9 for ; Fri, 2 Sep 2022 11:24:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236094AbiIBLYS (ORCPT ); Fri, 2 Sep 2022 07:24:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235949AbiIBLXI (ORCPT ); Fri, 2 Sep 2022 07:23:08 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B0DDD2B1C; Fri, 2 Sep 2022 04:22:51 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwQ70Dw6zWf4L; Fri, 2 Sep 2022 19:18:23 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:47 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 19/22] net: sched: act_skbmod: get rid of tcf_skbmod_walker and tcf_skbmod_search Date: Fri, 2 Sep 2022 19:24:43 +0800 Message-ID: <20220902112446.29858-20-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving skbmod_net_id when registering act_skbmod_ops. And then remove the walk and lookup hook functions in act_skbmod. Signed-off-by: Zhengchao Shao --- net/sched/act_skbmod.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c index 2083612d8780..ae52e5f175ed 100644 --- a/net/sched/act_skbmod.c +++ b/net/sched/act_skbmod.c @@ -276,33 +276,15 @@ static int tcf_skbmod_dump(struct sk_buff *skb, struc= t tc_action *a, return -1; } =20 -static int tcf_skbmod_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, skbmod_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 in= dex) -{ - struct tc_action_net *tn =3D net_generic(net, skbmod_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_skbmod_ops =3D { .kind =3D "skbmod", .id =3D TCA_ACT_SKBMOD, + .net_id =3D &skbmod_net_id, .owner =3D THIS_MODULE, .act =3D tcf_skbmod_act, .dump =3D tcf_skbmod_dump, .init =3D tcf_skbmod_init, .cleanup =3D tcf_skbmod_cleanup, - .walk =3D tcf_skbmod_walker, - .lookup =3D tcf_skbmod_search, .size =3D sizeof(struct tcf_skbmod), }; =20 --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A8E4C38145 for ; Fri, 2 Sep 2022 11:24:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236182AbiIBLYW (ORCPT ); Fri, 2 Sep 2022 07:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235977AbiIBLXN (ORCPT ); Fri, 2 Sep 2022 07:23:13 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83BA7D2B2D; Fri, 2 Sep 2022 04:22:52 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwRF651yzlWc6; Fri, 2 Sep 2022 19:19:21 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:48 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 20/22] net: sched: act_tunnel_key: get rid of tunnel_key_walker and tunnel_key_search Date: Fri, 2 Sep 2022 19:24:44 +0800 Message-ID: <20220902112446.29858-21-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving tunnel_key_net_id when registering act_tunnel_key_ops. And then remove the walk and lookup hook functions in act_tunnel_key. Signed-off-by: Zhengchao Shao --- net/sched/act_tunnel_key.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c index 856dc23cef8c..47bc251c82ec 100644 --- a/net/sched/act_tunnel_key.c +++ b/net/sched/act_tunnel_key.c @@ -770,23 +770,6 @@ static int tunnel_key_dump(struct sk_buff *skb, struct= tc_action *a, return -1; } =20 -static int tunnel_key_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, tunnel_key_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - -static int tunnel_key_search(struct net *net, struct tc_action **a, u32 in= dex) -{ - struct tc_action_net *tn =3D net_generic(net, tunnel_key_net_id); - - return tcf_idr_search(tn, a, index); -} - static void tcf_tunnel_encap_put_tunnel(void *priv) { struct ip_tunnel_info *tunnel =3D priv; @@ -845,13 +828,12 @@ static int tcf_tunnel_key_offload_act_setup(struct tc= _action *act, static struct tc_action_ops act_tunnel_key_ops =3D { .kind =3D "tunnel_key", .id =3D TCA_ID_TUNNEL_KEY, + .net_id =3D &tunnel_key_net_id, .owner =3D THIS_MODULE, .act =3D tunnel_key_act, .dump =3D tunnel_key_dump, .init =3D tunnel_key_init, .cleanup =3D tunnel_key_release, - .walk =3D tunnel_key_walker, - .lookup =3D tunnel_key_search, .offload_act_setup =3D tcf_tunnel_key_offload_act_setup, .size =3D sizeof(struct tcf_tunnel_key), }; --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12088C38145 for ; Fri, 2 Sep 2022 11:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235770AbiIBLY0 (ORCPT ); Fri, 2 Sep 2022 07:24:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235988AbiIBLXN (ORCPT ); Fri, 2 Sep 2022 07:23:13 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E03F4D2E81; Fri, 2 Sep 2022 04:22:52 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJwRG5lQ0zlWcW; Fri, 2 Sep 2022 19:19:22 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:49 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 21/22] net: sched: act_vlan: get rid of tcf_vlan_walker and tcf_vlan_search Date: Fri, 2 Sep 2022 19:24:45 +0800 Message-ID: <20220902112446.29858-22-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use __tcf_generic_walker() and __tcf_idr_search() helpers by saving vlan_net_id when registering act_vlan_ops. And then remove the walk and lookup hook functions in act_vlan. Signed-off-by: Zhengchao Shao --- net/sched/act_vlan.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index 68b5e772386a..54543a5fac38 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -333,16 +333,6 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct t= c_action *a, return -1; } =20 -static int tcf_vlan_walker(struct net *net, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) -{ - struct tc_action_net *tn =3D net_generic(net, vlan_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} - static void tcf_vlan_stats_update(struct tc_action *a, u64 bytes, u64 pack= ets, u64 drops, u64 lastuse, bool hw) { @@ -353,13 +343,6 @@ static void tcf_vlan_stats_update(struct tc_action *a,= u64 bytes, u64 packets, tm->lastuse =3D max_t(u64, tm->lastuse, lastuse); } =20 -static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 inde= x) -{ - struct tc_action_net *tn =3D net_generic(net, vlan_net_id); - - return tcf_idr_search(tn, a, index); -} - static size_t tcf_vlan_get_fill_size(const struct tc_action *act) { return nla_total_size(sizeof(struct tc_vlan)) @@ -433,15 +416,14 @@ static int tcf_vlan_offload_act_setup(struct tc_actio= n *act, void *entry_data, static struct tc_action_ops act_vlan_ops =3D { .kind =3D "vlan", .id =3D TCA_ID_VLAN, + .net_id =3D &vlan_net_id, .owner =3D THIS_MODULE, .act =3D tcf_vlan_act, .dump =3D tcf_vlan_dump, .init =3D tcf_vlan_init, .cleanup =3D tcf_vlan_cleanup, - .walk =3D tcf_vlan_walker, .stats_update =3D tcf_vlan_stats_update, .get_fill_size =3D tcf_vlan_get_fill_size, - .lookup =3D tcf_vlan_search, .offload_act_setup =3D tcf_vlan_offload_act_setup, .size =3D sizeof(struct tcf_vlan), }; --=20 2.17.1 From nobody Mon Apr 6 20:15:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 835ADC38145 for ; Fri, 2 Sep 2022 11:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236193AbiIBLYb (ORCPT ); Fri, 2 Sep 2022 07:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232239AbiIBLXN (ORCPT ); Fri, 2 Sep 2022 07:23:13 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15067D2EA0; Fri, 2 Sep 2022 04:22:53 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MJwR13v23z1N7k3; Fri, 2 Sep 2022 19:19:09 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 2 Sep 2022 19:22:50 +0800 From: Zhengchao Shao To: , , , , , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH net-next 22/22] net: sched: act: remove redundant code in act_api Date: Fri, 2 Sep 2022 19:24:46 +0800 Message-ID: <20220902112446.29858-23-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220902112446.29858-1-shaozhengchao@huawei.com> References: <20220902112446.29858-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Based on previous patches of this patchset, the walk and lookup hooks in the tc_action_ops structure are no longer used, and redundant code logic branches should be removed. tcf_generic_walker() and tcf_idr_search() are also used only in the act_api.c, change them to static. Signed-off-by: Zhengchao Shao --- include/net/act_api.h | 10 ---------- net/sched/act_api.c | 42 ++++++++++++------------------------------ 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/include/net/act_api.h b/include/net/act_api.h index a79d6e58519e..ebd84ef06b5b 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h @@ -118,15 +118,10 @@ struct tc_action_ops { struct tcf_result *); /* called under RCU BH lock*/ int (*dump)(struct sk_buff *, struct tc_action *, int, int); void (*cleanup)(struct tc_action *); - int (*lookup)(struct net *net, struct tc_action **a, u32 index); int (*init)(struct net *net, struct nlattr *nla, struct nlattr *est, struct tc_action **act, struct tcf_proto *tp, u32 flags, struct netlink_ext_ack *extack); - int (*walk)(struct net *, struct sk_buff *, - struct netlink_callback *, int, - const struct tc_action_ops *, - struct netlink_ext_ack *); void (*stats_update)(struct tc_action *, u64, u64, u64, u64, bool); size_t (*get_fill_size)(const struct tc_action *act); struct net_device *(*get_dev)(const struct tc_action *a, @@ -178,11 +173,6 @@ static inline void tc_action_net_exit(struct list_head= *net_list, rtnl_unlock(); } =20 -int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack); -int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 ind= ex); int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est, struct tc_action **a, const struct tc_action_ops *ops, int bind, bool cpustats, u32 flags); diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 7063d2004199..2d26aec25e3a 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -636,10 +636,10 @@ static int tcf_del_walker(struct tcf_idrinfo *idrinfo= , struct sk_buff *skb, return ret; } =20 -int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, - struct netlink_callback *cb, int type, - const struct tc_action_ops *ops, - struct netlink_ext_ack *extack) +static int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *sk= b, + struct netlink_callback *cb, int type, + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tcf_idrinfo *idrinfo =3D tn->idrinfo; =20 @@ -653,9 +653,8 @@ int tcf_generic_walker(struct tc_action_net *tn, struct= sk_buff *skb, return -EINVAL; } } -EXPORT_SYMBOL(tcf_generic_walker); =20 -int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 ind= ex) +static int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, = u32 index) { struct tcf_idrinfo *idrinfo =3D tn->idrinfo; struct tc_action *p; @@ -674,7 +673,6 @@ int tcf_idr_search(struct tc_action_net *tn, struct tc_= action **a, u32 index) } return false; } -EXPORT_SYMBOL(tcf_idr_search); =20 static int __tcf_generic_walker(struct net *net, struct sk_buff *skb, struct netlink_callback *cb, int type, @@ -945,8 +943,7 @@ int tcf_register_action(struct tc_action_ops *act, struct tc_action_ops *a; int ret; =20 - if (!act->act || !act->dump || !act->init || - (!act->net_id && (!act->walk || !act->lookup))) + if (!act->act || !act->dump || !act->init || !act->net_id) return -EINVAL; =20 /* We have to register pernet ops before making the action ops visible, @@ -1658,16 +1655,10 @@ static struct tc_action *tcf_action_get_1(struct ne= t *net, struct nlattr *nla, goto err_out; } err =3D -ENOENT; - if (ops->lookup) { - if (ops->lookup(net, &a, index) =3D=3D 0) { - NL_SET_ERR_MSG(extack, "TC action with specified index not found"); - goto err_mod; - } - } else { - if (__tcf_idr_search(net, ops, &a, index) =3D=3D 0) { - NL_SET_ERR_MSG(extack, "TC action with specified index not found"); - goto err_mod; - } + + if (__tcf_idr_search(net, ops, &a, index) =3D=3D 0) { + NL_SET_ERR_MSG(extack, "TC action with specified index not found"); + goto err_mod; } =20 module_put(ops->owner); @@ -1730,12 +1721,7 @@ static int tca_action_flush(struct net *net, struct = nlattr *nla, goto out_module_put; } =20 - if (ops->walk) { - err =3D ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack); - } else { - err =3D __tcf_generic_walker(net, skb, &dcb, RTM_DELACTION, ops, extack); - } - + err =3D __tcf_generic_walker(net, skb, &dcb, RTM_DELACTION, ops, extack); if (err <=3D 0) { nla_nest_cancel(skb, nest); goto out_module_put; @@ -2153,11 +2139,7 @@ static int tc_dump_action(struct sk_buff *skb, struc= t netlink_callback *cb) if (nest =3D=3D NULL) goto out_module_put; =20 - if (a_o->walk) - ret =3D a_o->walk(net, skb, cb, RTM_GETACTION, a_o, NULL); - else - ret =3D __tcf_generic_walker(net, skb, cb, RTM_GETACTION, a_o, NULL); - + ret =3D __tcf_generic_walker(net, skb, cb, RTM_GETACTION, a_o, NULL); if (ret < 0) goto out_module_put; =20 --=20 2.17.1