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

Mcnamara, John john.mcnamara at intel.com
Mon Mar 6 15:10:54 CET 2017



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Mcnamara, John
> Sent: Monday, March 6, 2017 1:57 PM
> To: Ravi Kerur <rkerur at gmail.com>; dev at dpdk.org
> Cc: Ananyev, Konstantin <konstantin.ananyev at intel.com>; Richardson, Bruce
> <bruce.richardson at intel.com>
> Subject: Re: [dpdk-dev] [v4 2/3] LPM config file read option.
> 
> 
> 
> > -----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.
> 

Nevermind. I see that this macro was already there and you just moved it.
So, it is not your problem. :-)

John



More information about the dev mailing list