[dpdk-dev] [PATCH v4 2/2] ethdev: add traffic management API

Dumitrescu, Cristian cristian.dumitrescu at intel.com
Mon May 22 16:25:45 CEST 2017



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Friday, May 19, 2017 6:34 PM
> To: Dumitrescu, Cristian <cristian.dumitrescu at intel.com>
> Cc: dev at dpdk.org; thomas.monjalon at 6wind.com;
> jerin.jacob at caviumnetworks.com;
> balasubramanian.manoharan at cavium.com; hemant.agrawal at nxp.com;
> shreyansh.jain at 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.dumitrescu at 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?


More information about the dev mailing list