From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0062.outbound.protection.outlook.com [104.47.34.62]) by dpdk.org (Postfix) with ESMTP id 030CE2BD4 for ; Tue, 30 Aug 2016 06:31:38 +0200 (CEST) Received: from BN6PR03CA0025.namprd03.prod.outlook.com (10.175.124.11) by DM5PR03MB2443.namprd03.prod.outlook.com (10.168.233.13) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Tue, 30 Aug 2016 04:31:35 +0000 Received: from BL2FFO11OLC003.protection.gbl (2a01:111:f400:7c09::112) by BN6PR03CA0025.outlook.office365.com (2603:10b6:404:10c::11) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Tue, 30 Aug 2016 04:31:35 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11OLC003.mail.protection.outlook.com (10.173.161.187) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Tue, 30 Aug 2016 04:31:35 +0000 Received: from [10.232.14.87] ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u7U4VWss011013; Mon, 29 Aug 2016 21:31:32 -0700 To: Ferruh Yigit , References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1472219823-29486-1-git-send-email-shreyansh.jain@nxp.com> <1472219823-29486-2-git-send-email-shreyansh.jain@nxp.com> <57C46637.3060707@intel.com> CC: , , , From: Shreyansh Jain Message-ID: <1b33a319-2d82-117f-2b7c-447e3c05b9f0@nxp.com> Date: Tue, 30 Aug 2016 10:01:32 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <57C46637.3060707@intel.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131170050956615208; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(3190300001)(339900001)(189002)(377454003)(199003)(24454002)(65956001)(626004)(19580395003)(64126003)(11100500001)(76176999)(19580405001)(86362001)(50986999)(97736004)(104016004)(106466001)(54356999)(47776003)(50466002)(4001350100001)(65826007)(5660300001)(5001770100001)(65806001)(31696002)(83506001)(105606002)(93886004)(36756003)(2906002)(356003)(230700001)(23746002)(68736007)(81166006)(92566002)(33646002)(4326007)(189998001)(81156014)(8676002)(85426001)(8936002)(586003)(87936001)(77096005)(305945005)(8666005)(7846002)(2950100001)(31686004)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2443; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC003; 1:r25X3ZVZJ7IJl5gZMbufj1rVeuwOJjuUbVXFYLbiM1YqDPxB8mrnJAzD16TwYc1vfzOKW5RQSkqWBWmRWtwP0SHaMfwmpnIb8yYCxNrOexoSmSCidMq660oy7XQ1zclmPkwAM3qkJqZzUFDAwV8uchNPmEG4Dh3ro9k7wiXV/IxotmJAFvJu8WERZBpiIoZXZ1zI2OOO0MBBe7eAfhTlL6hPd/PSjSrXzmntN4sdXC3t7FPJfY+BP698eukD4DczppY5BX91sEhOz4kCSOczCQVcxwB6EZ/vmcdaOpcrBGdsFkjXne06nPbbK1imonifHENuiNZYWjs1zf41yJdmWs+zLW2WTwYpcGQylE9HhXQeRe5rVUlwIzlNHG3pp+LDGeBvrTYqFmrFi3vf95LTupZ+11dyg7WC5Aqku39XbVWK9DK+MNGl68UfzUP/gGeIs+I0ubw3PsvxSizJUaO1dzmBd2G2XnSOujct3RvrVQqzD+bJ11YlEIb6oDXHkAY/yBtZ+lr9/cMAEyXHGfdKhtJXLBgINNXwHa5qcd/47u6/zNfqLhUj0SD+oaMthRCoFgGpaN+HTbDomftgjXgs3DaKv3ZUAMHtTzEcPPNRun4iaReE2t/RorEOVPrp9UEZ8txykJccRkHb8NLJkFe7hQ== X-MS-Office365-Filtering-Correlation-Id: dcbf4b37-5870-4a1b-fcc9-08d3d08e86e4 X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2443; 2:LYfFokq2VgldNqk6NX6oG+2lWGQ2At5KLLcFa7bUOKpTxMo6e6HVxkUTZgjrbZFn6DLODvRxGdJvs5JUlklxOg5Jnx8m5wci8ScN5Lq6eQWWNq5QxfBuVcBzqEZbANVMGhMH7vlSklyDjK5lmL98ADFh9w35AY9shpXWcZtpaerwnIId9yK0CQQTWcRLyT+h; 3:trRFpay61dMGMjhiYcci7dUmXr+eMtcloYA799s9RShHycU4bpKqkYuyUbLfbLFYAewjpW5qH1jXQp1CDx0bwPv8DicOr848wbIcvbnUArn4NFXZGcNheTx5koVGoWDw2Rdd4YhO/475BHbShaB14ukWLHq3bsinQrCvuQZbTabxeUZ+s+NLDdMzRmF1jfEVCJEGpnpaS4rDPWkcKQ2hijx/0+YjBxVK8wp6+hjC9z4=; 25:9BNxYu+VglMIZUjbfLQ/vHp+bpaZAdMgG7H5n8oTOjIrpmkTeazRHmKpnArKlbqPnOWlLnbdWIoEdniYstqQbpfaWH5ERoMmwbUi4luEeSJcBUsY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zEZxMXI6I+fWYoKrrxuWlrEBHNfK6r5nhLuQ/BqCHUrgjzOpGlxMD/ZertjYI0HW1phkr7E15KSiGn7cJUD1rQZnAbHsV/0D+eI1jbjoJ/UdcKlQBAS0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(13015025)(13017025)(13023025)(13024025)(13018025)(3002001)(10201501046)(6055026); SRVR:DM5PR03MB2443; BCL:0; PCL:0; RULEID:(400006); SRVR:DM5PR03MB2443; X-Forefront-PRVS: 0050CEFE70 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; DM5PR03MB2443; 23:aD2JsOxhl/fTEl+bQMC/mMBFvGL+A3NSCF7xC?= =?Windows-1252?Q?Qcj5ksTxnhJ0lzXGJUSkpymCUd+tqcgg2z5kC+84VGMRe9PO/cHeXrTu?= =?Windows-1252?Q?qnUBZosLzsks4vFCrO3Y+XGOqNPQUT21U3P6pwSEo+ZoUQohp7E4u7eK?= =?Windows-1252?Q?25xb47syZ1JV4px9S1NFg6AZrQyDm3HZfFdd36cCNMIVsHRHL9Nk8ne1?= =?Windows-1252?Q?rGkqqpFT7Va7TtDAvqPxvHQBSreZAeTtPxiuBhSZ1RdNmu4qXb7VblJ4?= =?Windows-1252?Q?Zd0sNWOQpTD+s/oKEizKAeQLQC+xl14BNx2gvazcmKtnlZ7skiyaqV4U?= =?Windows-1252?Q?lxoaRHqond3OL3uT3eeR/s2gu8nU6mLTbMPAfK/Bf5VE9k201XKbMqk6?= =?Windows-1252?Q?0AKyDqzPgze/vKrRqug7F+k/IuPEZUwv4AU4gHBfiQM8N90VE5zvh3NF?= =?Windows-1252?Q?ItY0uzPfH0vFw4qMK10v5yKB0UJMR7z++sEin0rHY8sEzAUAmYF4MchY?= =?Windows-1252?Q?p0IBt+MyrgjpWGtBOw/FQyhqWwi0QNyqHTdtN/fJKz6yPz6Fh0YT0dKA?= =?Windows-1252?Q?aG5309TLapJtmcJmuagcQq9VbkUrlab+4mWQpB4pWqTnJpRkEoZmPnfC?= =?Windows-1252?Q?J0n+t3eKlTi8VggjGK0dhI1H9ujy0/dVBr/bLc4OEzDHYpUznzyUdnyy?= =?Windows-1252?Q?SvjZWBG65IZrosEvB8Upjwa/SGDekuuxaI1F03ZWRGr5Juaz4PPURBKY?= =?Windows-1252?Q?ldtx+IzCP4T3j0JEgsaGluNLpxsm+YKaliLp46vchrm/51y0GmZZVLoe?= =?Windows-1252?Q?6CPyyXTwz1lGEsotDrk0WWkf7DaafoD2gD+hXIhWiYcMJLYKJAsWgEr7?= =?Windows-1252?Q?ZjMactoTskkqGCbIQHSwARn28qTFyHPZtr5mp+cctrsHgO2QhjPtpVSw?= =?Windows-1252?Q?WndsK2S6I+V7aXt1wVTRwju+18qbHMMoDYnwhBYaxxibwDKtTiGRU9pT?= =?Windows-1252?Q?QVD7eE183AnkUY6mHy5zKPDCq9NTbW/cocWbTlDtALpd4XtjTmWj+HAj?= =?Windows-1252?Q?+qlthgd09+An98h7ZjbYQKQcLLj2BClsqUw1oeMAWEy+aLnWNMa29t7d?= =?Windows-1252?Q?g4a7FIIdV46GLh1JrIK3pIPu//+2912aDwn2NFr42Vv0V1HUS6MMDw6B?= =?Windows-1252?Q?JuR9CRl7m0QDR0KTlLA8DjePw5+yKhnHAI4WTY/wPcw2NK2bK4NidFGY?= =?Windows-1252?Q?5CMZCcwf+URhkqjYOSTLK47G3xplTwqzA1nKnPVJAVnLMOlSTK5yGz6x?= =?Windows-1252?Q?L3g1hOC7DzrRhLx5NS2VLByFY38wp312Sot1F5D+uN79pTz4JcOsDApU?= =?Windows-1252?Q?6zwxmRjjAhbtoEr42UDlk0tkb2BCZ6CcqXgMaF7xdTjAjb2voV4gseTK?= =?Windows-1252?Q?D7/FWlBLO+0D3eooHYIKx/yr1D9dRAhkyJW+x9Zj6gDp8f+TkmfFJtr9?= =?Windows-1252?Q?bR1oAwVYBZC5zVeZxmpiCwVkcG/fQwP3W+nJEE5Yla2yI/7ig=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2443; 6:nkb2hj4DES2FhquJRksTU5SASNC3TNBxnY4tPZpswPTrfxbbNrXUyTT+fx+tAL6EZxdqyphNMC6vl3bGUEAxI+6iDQWNRumePGTgGmRxQOdTsSAaPRA+ysRxYV/I7joYnJiJUeHNsEG+rJezb8bf6tlZXOvd4+3mJoUXJTAQSDmx5JmNF5GknBW/2c/wD09wvOJ4kZ13RPKzvbzuuZgYfxTyitXLSkVrXe2OhdqFDPxYhwGlo3x1tjO5PIualdBiM/wLPi4DMEDUuTgcAs3RiWQ6TfZqbaol/x0GPxNjE38=; 5:LG6OBPJFqokRPlL1aRmiLOUuFmzQZk+33UjHFHCAUTq2hLKr0PHm0zk6VMF59Tmzt/TK0Re9sRC3Z7cIHdH+8rmgDlQYxQ8vZKa1c/Ci1/mDrYAXSoJAycA/KIGfDhw62k7jKakDUvgHXOG0BWOT/yy+op9FiZQ/InNSldLTgzY=; 24:GF+cw7ITSVLMGSRED6nfFr+qzbnF7/0aNy+sjqPJUv94aiK6KDQ8sci7OXz51eVSdLc6TmqQOROA58Usk3QNAwr40tT2hmggJ8Roa7J/y0o=; 7:VO01dWqy2wjaMD9jNSHYsy8GPvJYahWFvzQMWpLXsTukNEoNVGpbBwXxhBuH0xSOf3qL/kZBi6eir7BzELPbQktqpslxrB/ZpICe5KhCLQtbQIggnNG9pnfOPjGsSiOLp/5XZMd1KHTk7pzv/HxOojooS79XbFFZx0OrG8/HoXpURNAixRjJTYjZVEF6MDF6ZzHVaYwyEH1M03SaE6yridraq6waD5E2I4Kr1Bq13ttQb99hLUYlOjheTDvn8lVm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2016 04:31:35.4743 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2443 Subject: Re: [dpdk-dev] [PATCH v8 01/25] eal: define macro container_of X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2016 04:31:40 -0000 Hi Ferruh, Forgot to add a comment in previous reply to this email: On Monday 29 August 2016 10:13 PM, Ferruh Yigit wrote: > On 8/26/2016 2:56 PM, Shreyansh Jain wrote: >> Signed-off-by: Jan Viktorin >> Signed-off-by: Shreyansh Jain >> --- >> lib/librte_eal/common/include/rte_common.h | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h >> index 332f2a4..a9b6792 100644 >> --- a/lib/librte_eal/common/include/rte_common.h >> +++ b/lib/librte_eal/common/include/rte_common.h >> @@ -322,6 +322,22 @@ rte_bsf32(uint32_t v) >> #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) >> #endif >> >> +/** >> + * Return pointer to the wrapping struct instance. >> + * Example: >> + * >> + * struct wrapper { >> + * ... >> + * struct child c; >> + * ... >> + * }; >> + * >> + * struct child *x = obtain(...); >> + * struct wrapper *w = container_of(x, struct wrapper, c); >> + */ >> +#define container_of(p, type, member) \ >> + ((type *) (((char *) (p)) - offsetof(type, member))) >> + >> #define _RTE_STR(x) #x >> /** Take a macro value and get a string version of it */ >> #define RTE_STR(x) _RTE_STR(x) >> > > This gives compilation error for mlx5, because the libraries mlx depends > defines same macro: > ..../rte_common.h:338:9: error: 'container_of' macro redefined > /usr/include/infiniband/verbs.h:77:9: note: previous definition is here > > Does it make sense to protect macro with > #ifndef container_of > .... > #endif Sounds good - probably would prevent double definition in future if someone includes any linux header having similar definition. Generally the container_of definitions are consistent - that is, they would invariably use the offsetof from member. In which case, creating a new dpdk_* would only duplicate. Thus, I prefer the #ifndef. > > OR > > add a dpdk prefix? > > > Regards, > ferruh > - Shreyansh