[dpdk-dev] [v4 2/3] LPM config file read option.

Mcnamara, John john.mcnamara at intel.com
Mon Mar 6 14:57:21 CET 2017



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Ravi Kerur
> Sent: Sunday, March 5, 2017 7:47 PM
> To: dev at dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev at intel.com>; Richardson, Bruce
> <bruce.richardson at intel.com>; Ravi Kerur <rkerur at gmail.com>
> Subject: [dpdk-dev] [v4 2/3] LPM config file read option.
>
> ...
> +
> +#define	IPV6_ADDR_LEN	16
> +#define	IPV6_ADDR_U16	(IPV6_ADDR_LEN / sizeof(uint16_t))
> +#define	IPV6_ADDR_U32	(IPV6_ADDR_LEN / sizeof(uint32_t))
> +
> +#define GET_CB_FIELD(in, fd, base, lim, dlm)	do {            \
> +	unsigned long val;                                      \
> +	char *end;                                              \
> +	errno = 0;                                              \
> +	val = strtoul((in), &end, (base));                      \
> +	if (errno != 0 || end[0] != (dlm) || val > (lim))       \
> +		return -EINVAL;                               \
> +	(fd) = (typeof(fd))val;                                 \
> +	(in) = end + 1;                                         \
> +} while (0)

Hi,

It is probably worth putting a comment before this macro to
explain what it does. Also, it isn't clear, to me, what CB
stands for. Also, having a return in the middle of the macro
might be problematic if it is used in a function with a
different, or not, return value.

John



More information about the dev mailing list