From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 4C5AF108A for ; Mon, 6 Mar 2017 14:57:24 +0100 (CET) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2017 05:57:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,253,1484035200"; d="scan'208";a="64744340" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by orsmga004.jf.intel.com with ESMTP; 06 Mar 2017 05:57:22 -0800 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.142]) by irsmsx110.ger.corp.intel.com ([169.254.15.101]) with mapi id 14.03.0248.002; Mon, 6 Mar 2017 13:57:21 +0000 From: "Mcnamara, John" To: Ravi Kerur , "dev@dpdk.org" CC: "Ananyev, Konstantin" , "Richardson, Bruce" Thread-Topic: [dpdk-dev] [v4 2/3] LPM config file read option. Thread-Index: AQHSlel+CK7CS8/7yEmra1/I1sM0NqGH1EQQ Date: Mon, 6 Mar 2017 13:57:21 +0000 Message-ID: References: <1488743225-25750-1-git-send-email-rkerur@gmail.com> <1488743225-25750-3-git-send-email-rkerur@gmail.com> In-Reply-To: <1488743225-25750-3-git-send-email-rkerur@gmail.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDA5MmQxY2YtZDBjYS00YzJmLTgzODktNWM3OGZjYjhkYTE4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjlDUUc5cE9nK1BLcFowa2FIYmJPWERjUExSdFM2dU10Vko1WW9CQ09raWM9In0= x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [v4 2/3] LPM config file read option. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2017 13:57:24 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Ravi Kerur > Sent: Sunday, March 5, 2017 7:47 PM > To: dev@dpdk.org > Cc: Ananyev, Konstantin ; Richardson, Bruce > ; Ravi Kerur > 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 =3D 0; \ > + val =3D strtoul((in), &end, (base)); \ > + if (errno !=3D 0 || end[0] !=3D (dlm) || val > (lim)) \ > + return -EINVAL; \ > + (fd) =3D (typeof(fd))val; \ > + (in) =3D 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