From patchwork Fri Sep 2 11:24:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964051 X-Patchwork-Delegate: kuba@kernel.org 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 B3F13C38145 for ; Fri, 2 Sep 2022 11:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235575AbiIBLWi (ORCPT ); Fri, 2 Sep 2022 07:22:38 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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); +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 = 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 = 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; - 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; /* 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 = -ENOENT; - if (ops->lookup(net, &a, index) == 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) == 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) == 0) { + NL_SET_ERR_MSG(extack, "TC action with specified index not found"); + goto err_mod; + } } module_put(ops->owner); @@ -1703,7 +1730,12 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, goto out_module_put; } - err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack); + if (ops->walk) { + err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack); + } else { + err = __tcf_generic_walker(net, skb, &dcb, RTM_DELACTION, ops, extack); + } + if (err <= 0) { nla_nest_cancel(skb, nest); goto out_module_put; @@ -2121,7 +2153,11 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) if (nest == NULL) goto out_module_put; - ret = a_o->walk(net, skb, cb, RTM_GETACTION, a_o, NULL); + if (a_o->walk) + ret = a_o->walk(net, skb, cb, RTM_GETACTION, a_o, NULL); + else + ret = __tcf_generic_walker(net, skb, cb, RTM_GETACTION, a_o, NULL); + if (ret < 0) goto out_module_put; From patchwork Fri Sep 2 11:24:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964052 X-Patchwork-Delegate: kuba@kernel.org 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 AB94DECAAD5 for ; Fri, 2 Sep 2022 11:22:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235380AbiIBLWk (ORCPT ); Fri, 2 Sep 2022 07:22:40 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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); } -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 = 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 = net_generic(net, bpf_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_bpf_ops __read_mostly = { .kind = "bpf", .id = TCA_ID_BPF, + .net_id = &bpf_net_id, .owner = THIS_MODULE, .act = tcf_bpf_act, .dump = tcf_bpf_dump, .cleanup = tcf_bpf_cleanup, .init = tcf_bpf_init, - .walk = tcf_bpf_walker, - .lookup = tcf_bpf_search, .size = sizeof(struct tcf_bpf), }; From patchwork Fri Sep 2 11:24:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964053 X-Patchwork-Delegate: kuba@kernel.org 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 7E533C6FA83 for ; Fri, 2 Sep 2022 11:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235663AbiIBLWl (ORCPT ); Fri, 2 Sep 2022 07:22:41 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 *skb, struct tc_action *a, return -1; } -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 = 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 = net_generic(net, connmark_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_connmark_ops = { .kind = "connmark", .id = TCA_ID_CONNMARK, + .net_id = &connmark_net_id, .owner = THIS_MODULE, .act = tcf_connmark_act, .dump = tcf_connmark_dump, .init = tcf_connmark_init, - .walk = tcf_connmark_walker, - .lookup = tcf_connmark_search, .size = sizeof(struct tcf_connmark_info), }; From patchwork Fri Sep 2 11:24:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964054 X-Patchwork-Delegate: kuba@kernel.org 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 D4590C38145 for ; Fri, 2 Sep 2022 11:22:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235748AbiIBLWo (ORCPT ); Fri, 2 Sep 2022 07:22:44 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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); } -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 = 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 index) -{ - struct tc_action_net *tn = 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_action *act, void *entry_data, static struct tc_action_ops act_csum_ops = { .kind = "csum", .id = TCA_ID_CSUM, + .net_id = &csum_net_id, .owner = THIS_MODULE, .act = tcf_csum_act, .dump = tcf_csum_dump, .init = tcf_csum_init, .cleanup = tcf_csum_cleanup, - .walk = tcf_csum_walker, - .lookup = tcf_csum_search, .get_fill_size = tcf_csum_get_fill_size, .offload_act_setup = tcf_csum_offload_act_setup, .size = sizeof(struct tcf_csum), From patchwork Fri Sep 2 11:24:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964056 X-Patchwork-Delegate: kuba@kernel.org 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 CF674C38145 for ; Fri, 2 Sep 2022 11:22:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235448AbiIBLWs (ORCPT ); Fri, 2 Sep 2022 07:22:48 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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, struct tc_action *a, return -1; } -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 = 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 = 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_action *act, void *entry_data, static struct tc_action_ops act_ct_ops = { .kind = "ct", .id = TCA_ID_CT, + .net_id = &ct_net_id, .owner = THIS_MODULE, .act = tcf_ct_act, .dump = tcf_ct_dump, .init = tcf_ct_init, .cleanup = tcf_ct_cleanup, - .walk = tcf_ct_walker, - .lookup = tcf_ct_search, .stats_update = tcf_stats_update, .offload_act_setup = tcf_ct_offload_act_setup, .size = sizeof(struct tcf_ct), From patchwork Fri Sep 2 11:24:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964055 X-Patchwork-Delegate: kuba@kernel.org 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 95A66C6FA87 for ; Fri, 2 Sep 2022 11:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235802AbiIBLWq (ORCPT ); Fri, 2 Sep 2022 07:22:46 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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; } -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 = 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 index) -{ - struct tc_action_net *tn = 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 = to_ctinfo(a); @@ -372,13 +355,12 @@ static void tcf_ctinfo_cleanup(struct tc_action *a) static struct tc_action_ops act_ctinfo_ops = { .kind = "ctinfo", .id = TCA_ID_CTINFO, + .net_id = &ctinfo_net_id, .owner = THIS_MODULE, .act = tcf_ctinfo_act, .dump = tcf_ctinfo_dump, .init = tcf_ctinfo_init, .cleanup= tcf_ctinfo_cleanup, - .walk = tcf_ctinfo_walker, - .lookup = tcf_ctinfo_search, .size = sizeof(struct tcf_ctinfo), }; From patchwork Fri Sep 2 11:24:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964057 X-Patchwork-Delegate: kuba@kernel.org 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 CE030C54EE9 for ; Fri, 2 Sep 2022 11:22:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235497AbiIBLWu (ORCPT ); Fri, 2 Sep 2022 07:22:50 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 tc_action *a, return -1; } -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 = 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 index) -{ - struct tc_action_net *tn = 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 = nla_total_size(sizeof(struct tc_gact)); /* TCA_GACT_PARMS */ @@ -303,13 +286,12 @@ static int tcf_gact_offload_act_setup(struct tc_action *act, void *entry_data, static struct tc_action_ops act_gact_ops = { .kind = "gact", .id = TCA_ID_GACT, + .net_id = &gact_net_id, .owner = THIS_MODULE, .act = tcf_gact_act, .stats_update = tcf_gact_stats_update, .dump = tcf_gact_dump, .init = tcf_gact_init, - .walk = tcf_gact_walker, - .lookup = tcf_gact_search, .get_fill_size = tcf_gact_get_fill_size, .offload_act_setup = tcf_gact_offload_act_setup, .size = sizeof(struct tcf_gact), From patchwork Fri Sep 2 11:24:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964058 X-Patchwork-Delegate: kuba@kernel.org 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 054C1C6FA83 for ; Fri, 2 Sep 2022 11:22:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235860AbiIBLWw (ORCPT ); Fri, 2 Sep 2022 07:22:52 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 tc_action *a, return -1; } -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 = net_generic(net, gate_net_id); - - return tcf_generic_walker(tn, skb, cb, type, ops, extack); -} static void tcf_gate_stats_update(struct tc_action *a, u64 bytes, u64 packets, 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 = max_t(u64, tm->lastuse, lastuse); } -static int tcf_gate_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn = 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_action *act, void *entry_data, static struct tc_action_ops act_gate_ops = { .kind = "gate", .id = TCA_ID_GATE, + .net_id = &gate_net_id, .owner = THIS_MODULE, .act = tcf_gate_act, .dump = tcf_gate_dump, .init = tcf_gate_init, .cleanup = tcf_gate_cleanup, - .walk = tcf_gate_walker, .stats_update = tcf_gate_stats_update, .get_fill_size = tcf_gate_get_fill_size, - .lookup = tcf_gate_search, .offload_act_setup = tcf_gate_offload_act_setup, .size = sizeof(struct tcf_gate), }; From patchwork Fri Sep 2 11:24:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964059 X-Patchwork-Delegate: kuba@kernel.org 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 CEFD1C6FA85 for ; Fri, 2 Sep 2022 11:22:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235876AbiIBLWx (ORCPT ); Fri, 2 Sep 2022 07:22:53 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 struct tc_action *a, return tcf_ife_decode(skb, a, res); } -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 = 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 = net_generic(net, ife_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_ife_ops = { .kind = "ife", .id = TCA_ID_IFE, + .net_id = &ife_net_id, .owner = THIS_MODULE, .act = tcf_ife_act, .dump = tcf_ife_dump, .cleanup = tcf_ife_cleanup, .init = tcf_ife_init, - .walk = tcf_ife_walker, - .lookup = tcf_ife_search, .size = sizeof(struct tcf_ife_info), }; From patchwork Fri Sep 2 11:24:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964060 X-Patchwork-Delegate: kuba@kernel.org 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 693DFC54EE9 for ; Fri, 2 Sep 2022 11:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235913AbiIBLW5 (ORCPT ); Fri, 2 Sep 2022 07:22:57 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 tc_action *a, int bind, return -1; } -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 = 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 = net_generic(net, ipt_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_ipt_ops = { .kind = "ipt", .id = TCA_ID_IPT, + .net_id = &ipt_net_id, .owner = THIS_MODULE, .act = tcf_ipt_act, .dump = tcf_ipt_dump, .cleanup = tcf_ipt_release, .init = tcf_ipt_init, - .walk = tcf_ipt_walker, - .lookup = tcf_ipt_search, .size = sizeof(struct tcf_ipt), }; @@ -365,33 +347,15 @@ static struct pernet_operations ipt_net_ops = { .size = sizeof(struct tc_action_net), }; -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 = 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 = net_generic(net, xt_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_xt_ops = { .kind = "xt", .id = TCA_ID_XT, + .net_id = &xt_net_id, .owner = THIS_MODULE, .act = tcf_ipt_act, .dump = tcf_ipt_dump, .cleanup = tcf_ipt_release, .init = tcf_xt_init, - .walk = tcf_xt_walker, - .lookup = tcf_xt_search, .size = sizeof(struct tcf_ipt), }; From patchwork Fri Sep 2 11:24:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964061 X-Patchwork-Delegate: kuba@kernel.org 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 CDD87ECAAD5 for ; Fri, 2 Sep 2022 11:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235931AbiIBLW7 (ORCPT ); Fri, 2 Sep 2022 07:22:59 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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; } -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 = 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 index) -{ - struct tc_action_net *tn = 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_action *act, void *entry_data, static struct tc_action_ops act_mirred_ops = { .kind = "mirred", .id = TCA_ID_MIRRED, + .net_id = &mirred_net_id, .owner = THIS_MODULE, .act = tcf_mirred_act, .stats_update = tcf_stats_update, .dump = tcf_mirred_dump, .cleanup = tcf_mirred_release, .init = tcf_mirred_init, - .walk = tcf_mirred_walker, - .lookup = tcf_mirred_search, .get_fill_size = tcf_mirred_get_fill_size, .offload_act_setup = tcf_mirred_offload_act_setup, .size = sizeof(struct tcf_mirred), From patchwork Fri Sep 2 11:24:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964063 X-Patchwork-Delegate: kuba@kernel.org 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 E7336C38145 for ; Fri, 2 Sep 2022 11:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235472AbiIBLXM (ORCPT ); Fri, 2 Sep 2022 07:23:12 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 tc_action *a, return -EMSGSIZE; } -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 = 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 index) -{ - struct tc_action_net *tn = 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_data, u32 *index_inc, bool bind, struct netlink_ext_ack *extack) @@ -446,13 +429,12 @@ static int tcf_mpls_offload_act_setup(struct tc_action *act, void *entry_data, static struct tc_action_ops act_mpls_ops = { .kind = "mpls", .id = TCA_ID_MPLS, + .net_id = &mpls_net_id, .owner = THIS_MODULE, .act = tcf_mpls_act, .dump = tcf_mpls_dump, .init = tcf_mpls_init, .cleanup = tcf_mpls_cleanup, - .walk = tcf_mpls_walker, - .lookup = tcf_mpls_search, .offload_act_setup = tcf_mpls_offload_act_setup, .size = sizeof(struct tcf_mpls), }; From patchwork Fri Sep 2 11:24:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964062 X-Patchwork-Delegate: kuba@kernel.org 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 DFE0AC6FA83 for ; Fri, 2 Sep 2022 11:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235821AbiIBLXJ (ORCPT ); Fri, 2 Sep 2022 07:23:09 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 tc_action *a, return -1; } -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 = 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 = net_generic(net, nat_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_nat_ops = { .kind = "nat", .id = TCA_ID_NAT, + .net_id = &nat_net_id, .owner = THIS_MODULE, .act = tcf_nat_act, .dump = tcf_nat_dump, .init = tcf_nat_init, - .walk = tcf_nat_walker, - .lookup = tcf_nat_search, .size = sizeof(struct tcf_nat), }; From patchwork Fri Sep 2 11:24:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964064 X-Patchwork-Delegate: kuba@kernel.org 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 B1B11C54EE9 for ; Fri, 2 Sep 2022 11:23:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236000AbiIBLXN (ORCPT ); Fri, 2 Sep 2022 07:23:13 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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; } -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 = 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 index) -{ - struct tc_action_net *tn = 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_action *act, void *entry_data, static struct tc_action_ops act_pedit_ops = { .kind = "pedit", .id = TCA_ID_PEDIT, + .net_id = &pedit_net_id, .owner = THIS_MODULE, .act = tcf_pedit_act, .stats_update = tcf_pedit_stats_update, .dump = tcf_pedit_dump, .cleanup = tcf_pedit_cleanup, .init = tcf_pedit_init, - .walk = tcf_pedit_walker, - .lookup = tcf_pedit_search, .offload_act_setup = tcf_pedit_offload_act_setup, .size = sizeof(struct tcf_pedit), }; From patchwork Fri Sep 2 11:24:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964065 X-Patchwork-Delegate: kuba@kernel.org 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 1C822C38145 for ; Fri, 2 Sep 2022 11:23:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235490AbiIBLXP (ORCPT ); Fri, 2 Sep 2022 07:23:15 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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; -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 = 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] = { [TCA_POLICE_RATE] = { .len = TC_RTAB_SIZE }, [TCA_POLICE_PEAKRATE] = { .len = TC_RTAB_SIZE }, @@ -412,13 +402,6 @@ static int tcf_police_dump(struct sk_buff *skb, struct tc_action *a, return -1; } -static int tcf_police_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn = 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 = { .kind = "police", .id = TCA_ID_POLICE, + .net_id = &police_net_id, .owner = THIS_MODULE, .stats_update = tcf_police_stats_update, .act = tcf_police_act, .dump = tcf_police_dump, .init = tcf_police_init, - .walk = tcf_police_walker, - .lookup = tcf_police_search, .cleanup = tcf_police_cleanup, .offload_act_setup = tcf_police_offload_act_setup, .size = sizeof(struct tcf_police), From patchwork Fri Sep 2 11:24:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964066 X-Patchwork-Delegate: kuba@kernel.org 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 1E8B6ECAAD5 for ; Fri, 2 Sep 2022 11:23:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236044AbiIBLXT (ORCPT ); Fri, 2 Sep 2022 07:23:19 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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; } -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 = 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 index) -{ - struct tc_action_net *tn = 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 = priv; @@ -315,14 +298,13 @@ static int tcf_sample_offload_act_setup(struct tc_action *act, void *entry_data, static struct tc_action_ops act_sample_ops = { .kind = "sample", .id = TCA_ID_SAMPLE, + .net_id = &sample_net_id, .owner = THIS_MODULE, .act = tcf_sample_act, .stats_update = tcf_sample_stats_update, .dump = tcf_sample_dump, .init = tcf_sample_init, .cleanup = tcf_sample_cleanup, - .walk = tcf_sample_walker, - .lookup = tcf_sample_search, .get_psample_group = tcf_sample_get_group, .offload_act_setup = tcf_sample_offload_act_setup, .size = sizeof(struct tcf_sample), From patchwork Fri Sep 2 11:24:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964067 X-Patchwork-Delegate: kuba@kernel.org 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 51AE1C6FA85 for ; Fri, 2 Sep 2022 11:23:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235598AbiIBLXW (ORCPT ); Fri, 2 Sep 2022 07:23:22 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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; } -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 = 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 index) -{ - struct tc_action_net *tn = net_generic(net, simp_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_simp_ops = { .kind = "simple", .id = TCA_ID_SIMP, + .net_id = &simp_net_id, .owner = THIS_MODULE, .act = tcf_simp_act, .dump = tcf_simp_dump, .cleanup = tcf_simp_release, .init = tcf_simp_init, - .walk = tcf_simp_walker, - .lookup = tcf_simp_search, .size = sizeof(struct tcf_defact), }; From patchwork Fri Sep 2 11:24:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964068 X-Patchwork-Delegate: kuba@kernel.org 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 D1658C38145 for ; Fri, 2 Sep 2022 11:23:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236062AbiIBLXY (ORCPT ); Fri, 2 Sep 2022 07:23:24 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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); } -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 = 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 index) -{ - struct tc_action_net *tn = 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_action *act, void *entry_data static struct tc_action_ops act_skbedit_ops = { .kind = "skbedit", .id = TCA_ID_SKBEDIT, + .net_id = &skbedit_net_id, .owner = THIS_MODULE, .act = tcf_skbedit_act, .stats_update = tcf_skbedit_stats_update, .dump = tcf_skbedit_dump, .init = tcf_skbedit_init, .cleanup = tcf_skbedit_cleanup, - .walk = tcf_skbedit_walker, .get_fill_size = tcf_skbedit_get_fill_size, - .lookup = tcf_skbedit_search, .offload_act_setup = tcf_skbedit_offload_act_setup, .size = sizeof(struct tcf_skbedit), }; From patchwork Fri Sep 2 11:24:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964069 X-Patchwork-Delegate: kuba@kernel.org 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 6C5C6C54EE9 for ; Fri, 2 Sep 2022 11:23:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236069AbiIBLX0 (ORCPT ); Fri, 2 Sep 2022 07:23:26 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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, struct tc_action *a, return -1; } -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 = 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 index) -{ - struct tc_action_net *tn = net_generic(net, skbmod_net_id); - - return tcf_idr_search(tn, a, index); -} - static struct tc_action_ops act_skbmod_ops = { .kind = "skbmod", .id = TCA_ACT_SKBMOD, + .net_id = &skbmod_net_id, .owner = THIS_MODULE, .act = tcf_skbmod_act, .dump = tcf_skbmod_dump, .init = tcf_skbmod_init, .cleanup = tcf_skbmod_cleanup, - .walk = tcf_skbmod_walker, - .lookup = tcf_skbmod_search, .size = sizeof(struct tcf_skbmod), }; From patchwork Fri Sep 2 11:24:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964070 X-Patchwork-Delegate: kuba@kernel.org 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 E5EBDC38145 for ; Fri, 2 Sep 2022 11:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236118AbiIBLXe (ORCPT ); Fri, 2 Sep 2022 07:23:34 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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; } -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 = 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 index) -{ - struct tc_action_net *tn = 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 = 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 = { .kind = "tunnel_key", .id = TCA_ID_TUNNEL_KEY, + .net_id = &tunnel_key_net_id, .owner = THIS_MODULE, .act = tunnel_key_act, .dump = tunnel_key_dump, .init = tunnel_key_init, .cleanup = tunnel_key_release, - .walk = tunnel_key_walker, - .lookup = tunnel_key_search, .offload_act_setup = tcf_tunnel_key_offload_act_setup, .size = sizeof(struct tcf_tunnel_key), }; From patchwork Fri Sep 2 11:24:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964071 X-Patchwork-Delegate: kuba@kernel.org 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 41395ECAAD5 for ; Fri, 2 Sep 2022 11:23:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235985AbiIBLXg (ORCPT ); Fri, 2 Sep 2022 07:23:36 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 tc_action *a, return -1; } -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 = 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 packets, 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 = max_t(u64, tm->lastuse, lastuse); } -static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index) -{ - struct tc_action_net *tn = 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_action *act, void *entry_data, static struct tc_action_ops act_vlan_ops = { .kind = "vlan", .id = TCA_ID_VLAN, + .net_id = &vlan_net_id, .owner = THIS_MODULE, .act = tcf_vlan_act, .dump = tcf_vlan_dump, .init = tcf_vlan_init, .cleanup = tcf_vlan_cleanup, - .walk = tcf_vlan_walker, .stats_update = tcf_vlan_stats_update, .get_fill_size = tcf_vlan_get_fill_size, - .lookup = tcf_vlan_search, .offload_act_setup = tcf_vlan_offload_act_setup, .size = sizeof(struct tcf_vlan), }; From patchwork Fri Sep 2 11:24:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12964072 X-Patchwork-Delegate: kuba@kernel.org 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 5D5B6ECAAD5 for ; Fri, 2 Sep 2022 11:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236031AbiIBLXl (ORCPT ); Fri, 2 Sep 2022 07:23:41 -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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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(); } -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 index); 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; } -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 *skb, + struct netlink_callback *cb, int type, + const struct tc_action_ops *ops, + struct netlink_ext_ack *extack) { struct tcf_idrinfo *idrinfo = tn->idrinfo; @@ -653,9 +653,8 @@ int tcf_generic_walker(struct tc_action_net *tn, struct sk_buff *skb, return -EINVAL; } } -EXPORT_SYMBOL(tcf_generic_walker); -int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index) +static int tcf_idr_search(struct tc_action_net *tn, struct tc_action **a, u32 index) { struct tcf_idrinfo *idrinfo = 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); 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; - 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; /* 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 net *net, struct nlattr *nla, goto err_out; } err = -ENOENT; - if (ops->lookup) { - if (ops->lookup(net, &a, index) == 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) == 0) { - NL_SET_ERR_MSG(extack, "TC action with specified index not found"); - goto err_mod; - } + + if (__tcf_idr_search(net, ops, &a, index) == 0) { + NL_SET_ERR_MSG(extack, "TC action with specified index not found"); + goto err_mod; } module_put(ops->owner); @@ -1730,12 +1721,7 @@ static int tca_action_flush(struct net *net, struct nlattr *nla, goto out_module_put; } - if (ops->walk) { - err = ops->walk(net, skb, &dcb, RTM_DELACTION, ops, extack); - } else { - err = __tcf_generic_walker(net, skb, &dcb, RTM_DELACTION, ops, extack); - } - + err = __tcf_generic_walker(net, skb, &dcb, RTM_DELACTION, ops, extack); if (err <= 0) { nla_nest_cancel(skb, nest); goto out_module_put; @@ -2153,11 +2139,7 @@ static int tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) if (nest == NULL) goto out_module_put; - if (a_o->walk) - ret = a_o->walk(net, skb, cb, RTM_GETACTION, a_o, NULL); - else - ret = __tcf_generic_walker(net, skb, cb, RTM_GETACTION, a_o, NULL); - + ret = __tcf_generic_walker(net, skb, cb, RTM_GETACTION, a_o, NULL); if (ret < 0) goto out_module_put;