On Fri, 19 May 2017 18:12:52 +0100
Cristian Dumitrescu <[email protected]> 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.