From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: [PATCH net-next,v2 04/12] cls_api: add translator to flow_action representation Date: Mon, 19 Nov 2018 14:21:41 +0100 Message-ID: <20181119132141.4n4tz4mwiihwccb2@salvia> References: <20181119001519.12124-1-pablo@netfilter.org> <20181119001519.12124-5-pablo@netfilter.org> <20181119121251.GC2223@nanopsycho.orion> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, davem@davemloft.net, thomas.lendacky@amd.com, f.fainelli@gmail.com, ariel.elior@cavium.com, michael.chan@broadcom.com, santosh@chelsio.com, madalin.bucur@nxp.com, yisen.zhuang@huawei.com, salil.mehta@huawei.com, jeffrey.t.kirsher@intel.com, tariqt@mellanox.com, saeedm@mellanox.com, jiri@mellanox.com, idosch@mellanox.com, jakub.kicinski@netronome.com, peppe.cavallaro@st.com, grygorii.strashko@ti.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, alexandre.torgue@st.com, joabreu@synopsys.com, linux-net-drivers@solarflare.com, ganeshgr@chelsio.com, ogerlitz@mellanox.com To: Jiri Pirko Return-path: Received: from mail.us.es ([193.147.175.20]:53206 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729246AbeKSXpY (ORCPT ); Mon, 19 Nov 2018 18:45:24 -0500 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id B2DBCEAA6B for ; Mon, 19 Nov 2018 14:21:45 +0100 (CET) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id A3587DA738 for ; Mon, 19 Nov 2018 14:21:45 +0100 (CET) Content-Disposition: inline In-Reply-To: <20181119121251.GC2223@nanopsycho.orion> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Nov 19, 2018 at 01:12:51PM +0100, Jiri Pirko wrote: > Mon, Nov 19, 2018 at 01:15:11AM CET, pablo@netfilter.org wrote: > >@@ -2567,6 +2575,111 @@ int tc_setup_cb_call(struct tcf_block *block, struct tcf_exts *exts, > > } > > EXPORT_SYMBOL(tc_setup_cb_call); > > > >+int tc_setup_flow_action(struct flow_action *flow_action, > >+ const struct tcf_exts *exts) > >+{ > >+ const struct tc_action *act; > >+ int num_acts = 0, i, j, k; > >+ > >+ if (!exts) > >+ return 0; > >+ > >+ tcf_exts_for_each_action(i, act, exts) { > >+ if (is_tcf_pedit(act)) > >+ num_acts += tcf_pedit_nkeys(act); > >+ else > >+ num_acts++; > >+ } > >+ if (!num_acts) > >+ return 0; > >+ > >+ if (flow_action_init(flow_action, num_acts) < 0) > > This is actually a "alloc" function. And the counterpart is "free". I can rename it to _alloc() if you prefer. > How about to allocate the container struct which would have the [0] > trick for the array of action? You mean turn *keys into keys[0] stub in struct flow_action? This is embedded into struct tc_cls_flower_offload, I may need to make a second look but I think it won't fly. BTW, side note: I will rename keys to "array" given keys is not semantically appropriate as you mentioned, BTW. Thanks!