> -----Original Message----- > From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Friday, May 19, 2017 6:34 PM > To: Dumitrescu, Cristian <cristian.dumitre...@intel.com> > Cc: dev@dpdk.org; thomas.monja...@6wind.com; > jerin.ja...@caviumnetworks.com; > balasubramanian.manoha...@cavium.com; hemant.agra...@nxp.com; > shreyansh.j...@nxp.com > Subject: Re: [dpdk-dev] [PATCH v4 2/2] ethdev: add traffic management API > > On Fri, 19 May 2017 18:12:52 +0100 > Cristian Dumitrescu <cristian.dumitre...@intel.com> wrote: > > > + > > +#define RTE_TM_FUNC(port_id, func) \ > > +({ \ > > + const struct rte_tm_ops *ops = \ > > + rte_tm_ops_get(port_id, error); \ > > + if (ops == NULL) \ > > + return -rte_errno; \ > > + \ > > + if (ops->func == NULL) \ > > + return -rte_tm_error_set(error, \ > > + ENOSYS, \ > > + RTE_TM_ERROR_TYPE_UNSPECIFIED, \ > > + NULL, \ > > + rte_strerror(ENOSYS)); \ > > + \ > > + ops->func; \ > > +}) > > 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 provide an example for your idea?