[dpdk-dev] [PATCH v4 2/2] ethdev: add traffic management API
    Stephen Hemminger 
    stephen at networkplumber.org
       
    Fri May 19 19:34:27 CEST 2017
    
    
  
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.
    
    
More information about the dev
mailing list