From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dumitrescu, Cristian" Subject: Re: [PATCH v4 2/2] ethdev: add traffic management API Date: Mon, 22 May 2017 14:25:45 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891265279F0A6@IRSMSX108.ger.corp.intel.com> References: <1488589820-206947-2-git-send-email-cristian.dumitrescu@intel.com> <1495213972-109148-1-git-send-email-cristian.dumitrescu@intel.com> <1495213972-109148-3-git-send-email-cristian.dumitrescu@intel.com> <20170519103427.4b083a11@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , "thomas.monjalon@6wind.com" , "jerin.jacob@caviumnetworks.com" , "balasubramanian.manoharan@cavium.com" , "hemant.agrawal@nxp.com" , "shreyansh.jain@nxp.com" To: Stephen Hemminger Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 6AEBD2B88 for ; Mon, 22 May 2017 16:25:48 +0200 (CEST) In-Reply-To: <20170519103427.4b083a11@xeon-e3> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, May 19, 2017 6:34 PM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; thomas.monjalon@6wind.com; > jerin.jacob@caviumnetworks.com; > balasubramanian.manoharan@cavium.com; hemant.agrawal@nxp.com; > shreyansh.jain@nxp.com > Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: add traffic management API >=20 > On Fri, 19 May 2017 18:12:52 +0100 > Cristian Dumitrescu wrote: >=20 > > + > > +#define RTE_TM_FUNC(port_id, func) \ > > +({ \ > > + const struct rte_tm_ops *ops =3D \ > > + rte_tm_ops_get(port_id, error); \ > > + if (ops =3D=3D NULL) \ > > + return -rte_errno; \ > > + \ > > + if (ops->func =3D=3D NULL) \ > > + return -rte_tm_error_set(error, \ > > + ENOSYS, \ > > + RTE_TM_ERROR_TYPE_UNSPECIFIED, \ > > + NULL, \ > > + rte_strerror(ENOSYS)); \ > > + \ > > + ops->func; \ > > +}) >=20 > If you are going to use a templating macro why not go all the way > and generate the whole function. Examples are in Linux kernel > macros are often used to generate show and set functions. After thinking long and hard, this is the best I was able to come up with. = It would be good if you could pick any of the functions in this file and pr= ovide an example for your idea?