From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Ricardo Leitner Subject: Re: [PATCH v3 11/11] net: sched: change action API to use array of pointers to actions Date: Mon, 28 May 2018 18:31:48 -0300 Message-ID: <20180528213147.GF3787@localhost.localdomain> References: <20180527175739.GA3337@nanopsycho> <1527455849-22327-1-git-send-email-vladbu@mellanox.com> <1527455849-22327-12-git-send-email-vladbu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: jiri@resnulli.us, netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, davem@davemloft.net, ast@kernel.org, daniel@iogearbox.net, kliteyn@mellanox.com To: Vlad Buslov Return-path: Received: from mail-qt0-f194.google.com ([209.85.216.194]:34196 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933714AbeE1Vbw (ORCPT ); Mon, 28 May 2018 17:31:52 -0400 Received: by mail-qt0-f194.google.com with SMTP id m5-v6so16335383qti.1 for ; Mon, 28 May 2018 14:31:52 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1527455849-22327-12-git-send-email-vladbu@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, May 28, 2018 at 12:17:29AM +0300, Vlad Buslov wrote: ... > -int tcf_action_destroy(struct list_head *actions, int bind) > +int tcf_action_destroy(struct tc_action *actions[], int bind) > { > const struct tc_action_ops *ops; > - struct tc_action *a, *tmp; > - int ret = 0; > + struct tc_action *a; > + int ret = 0, i; > > - list_for_each_entry_safe(a, tmp, actions, list) { > + for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) { ... > @@ -878,10 +881,9 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, > if (TC_ACT_EXT_CMP(a->tcfa_action, TC_ACT_GOTO_CHAIN)) { > err = tcf_action_goto_chain_init(a, tp); > if (err) { > - LIST_HEAD(actions); > + struct tc_action *actions[TCA_ACT_MAX_PRIO] = { a }; Somewhat nit.. Considering tcf_action_destroy will stop at the first NULL, you need only 2 slots here. > > - list_add_tail(&a->list, &actions); > - tcf_action_destroy(&actions, bind); > + tcf_action_destroy(actions, bind); > NL_SET_ERR_MSG(extack, "Failed to init TC action chain"); > return ERR_PTR(err); > }