From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0065.outbound.protection.outlook.com [104.47.37.65]) by dpdk.org (Postfix) with ESMTP id 2291E2B88 for ; Fri, 9 Sep 2016 06:18:56 +0200 (CEST) Received: from DM5PR03CA0009.namprd03.prod.outlook.com (10.175.104.19) by SN1PR0301MB2013.namprd03.prod.outlook.com (10.163.225.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9; Fri, 9 Sep 2016 04:18:54 +0000 Received: from BL2FFO11OLC012.protection.gbl (2a01:111:f400:7c09::128) by DM5PR03CA0009.outlook.office365.com (2603:10b6:3:118::19) 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; Fri, 9 Sep 2016 04:18:54 +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 BL2FFO11OLC012.mail.protection.outlook.com (10.173.160.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Fri, 9 Sep 2016 04:18:54 +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 u894Ip2H009633; Thu, 8 Sep 2016 21:18:52 -0700 To: Ferruh Yigit , References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1473257297-7221-1-git-send-email-shreyansh.jain@nxp.com> <1473257297-7221-2-git-send-email-shreyansh.jain@nxp.com> <37d34b1e-732e-d31e-a24d-84d4839fe0c5@intel.com> CC: , Jan Viktorin From: Shreyansh Jain Message-ID: <858e0541-8f83-ae7c-d529-c06b3029cc54@nxp.com> Date: Fri, 9 Sep 2016 09:49:06 +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: <37d34b1e-732e-d31e-a24d-84d4839fe0c5@intel.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131178683344172947; (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)(199003)(24454002)(189002)(377454003)(47776003)(68736007)(586003)(87936001)(2950100001)(85426001)(305945005)(189998001)(23746002)(77096005)(626004)(11100500001)(2906002)(104016004)(50466002)(81156014)(54356999)(2870700001)(4326007)(92566002)(105606002)(65826007)(33646002)(7846002)(31696002)(65806001)(97736004)(93886004)(356003)(65956001)(8666005)(50986999)(4001350100001)(31686004)(5001770100001)(19580405001)(81166006)(106466001)(76176999)(8936002)(19580395003)(5660300001)(8676002)(64126003)(36756003)(83506001)(86362001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB2013; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC012; 1:gRvEih6tmYFgB/zkqeda+NrFYcSJokc8sWkI7Bvifi4kOVgdbCb9jB9F+U/03Z1EMyIgtXNGDlWAYQf4eLMZc6XAiEE6d82NyUINIZEFT8MuMZMJkj0auNspwCBLipr9Udr2/5D/Ky+gMZMpLkcNCzHYfBdSfFx0bzh+wktixGx5H3hK1iA+rr4NvoJECTk6B2Z6himRkKaSJpQBGjjz+aHpQDyW56+n8j8/A/GAIeGJSSNQ6xi+xkqfHpvxr4/E87No/UQAmVZjPUe+HJAKU8nDBNWL0cjjC4zZBPq7JUzDNmAj3wBxOyHXTbNH2BshwlPcN0hdsXUo5NnNpuKnlchnOo4W0q/qoXMt0SqsUgidykoI7hemzrhamigzDhLZ408fhyiIhm8QEJmmvLwtwhaa6sGbsS6ky7Pwatt3rWoLF2t6bZd92DsiiHXgVA6m+03t9e0xVyNgkHd55a3IFjv/xh1oLQiUBHR26uMiuVQExJ9pte72w/Y8JdMk34btSxK1j/dGOWrBjC3PCbQh78x1r8WR0z3akAz1V6frX4iYy6ZpY0eiv/KFHHLs+f41PVIkahlyGu1DosYj5sEE/0KQmMLR0IQxoKY6CNsrpuZf4aeJKNlF+Sfv55grvvgYWZjVegLbsWXL/o2OimvwJg== X-MS-Office365-Filtering-Correlation-Id: 7ea53011-d86b-41b5-3793-08d3d868694c X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2013; 2:09Gu/e+7g2P6Sl6zddJCD7DOmIEbXuZ/BJC6RiG+uU3+/X0gjDDHSlJY2U3o5NBvME5yP33wMrcQxUQBsQZ8nezofCynH9s3ascl1ozkUNppTrWfCnnDc1+olgwhemBVWOajpVcpH1dqzetmg7pEJU5pRMII22BbjJvUh+tO9++9+/P64SPVMUoZPuMch1yl; 3:tJ/8of4jJbRwCTd1nTFOoxTemNrfwTLj7kRG7fweYcxkRGhQg+0t44P9G0r42Dlyv6JxcVQQGSK0/EFdmOj+Oflk2+RCIqCJieROpdrRkpxwP3ajnwYj5REmA4+zLqLH1efvCSTNTq6t5fdAJljp4q+4oWmCSVvosUQObo+Jrud4+WpKgL/4/c9ZcTQDAgLM8SohsQQBTfN8xoHDBatKAjPOPmoocmhL37YOKYacbko= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB2013; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2013; 25:Dz/NI2G+qSx77r3ZAoL1DCZccgyiPO28HCoCFOXv4bn5DSAAmUN9mjpuSATcwJKTh9Fx7eQjAeRoQdGAcEvhFKRD+S/1As0456DL7HQHL6cpfOxM6WRYfZiS/+8rWu8o1SbtIV16xVunphvHEpH/WHWBJFbeQcT81ecLW7ZhHL4Qr3GcdZJQvUlbIdV1ltJg+Ks/5/7V+IvFgQlmtnuaLAxpPua2hz29KuYlhJZl/wJyNxwCZyUVQTzHm+IK4YgrTdTy03lpDbMKx272LSkvbsEaWvfZdftIdmHHqRRG0LYYUGWfmORripHklz+zzS/9fM3HyFOvCj9F8RVpT94KSswoIVFvyDW4JuJsga26xAQRIMg69YNoPOc/QBcmg6sfmOabi+1cYree8L/7TddZBmJsPEICOb11ukUl3+F1ipeRg9viD58yoZZKqIPCu1PzT7cewrJ8ZhbhELkVQbjFN7ylUSxRbXDbP5Lx4AbKmUSzylV8DvhJpLZw+E53MlJ/ldfmeQ/Cs7zvdQsJ45U1YUAV9kvs46eEMWts1ZTafRP5HrpmFE5Sm7pnUoRtTqlFN4jaVwePtvXrggyu6Gw4AzOC2cZ7dIezs918qXEXlzHBhWNnjb/iWHB7mLOGQtIo+LJYSpfYxVyxuzNOT6IX0VmYTxn3FUz2fz5K2NAwHgi/6r28s+PpQ3nmMeZJkPwVC4DkDGUQgv3Z7Ni0DY8KAQ==; 31:AdmBKwqzS4qY66x7ZFoW7r01E7GARkLFmqEL7rnzYkhZoq/oibt+GNXx1NiuwdVJcIAWyLjd+6zqnDELs1N/M7h3cLXtST8loAuQPvCsAxTigGAJ5O+3odkejuVRaNG1zkEF2Qo6jbQVRcGs5zMa5yIxGHdoOqWTloRUevLmwfDTDcViwGhPP6bNobmO7d/7HTxmMJ9j07nUet2GQFOopqwkGXvTTdvEqwL9F2gE5cA= 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)(13017025)(13024025)(13023025)(13018025)(13015025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:SN1PR0301MB2013; BCL:0; PCL:0; RULEID:(400006); SRVR:SN1PR0301MB2013; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2013; 4:hCl2A4sAur8UdVTsN533saPD/mq4ICxzSkBcz0J3FFcGFgpHRHnH+xfUCASJHQHVkdMeLKZL97hpxpk+KqioUBk9JncCZwtytQawo3u103StYC+I1mz6L6uZk4TXKMBcZYvQD086I736i7Jv0VVSl8Dz+sIbGzRC6spVPQBzIvrjhVoegCICMDyL6W/hAve4M6vldr0fZvGQ6iqwTnen4AGlWse95f7q9q9VgnGz1PJkZ47McQb8IKBgRXskcUmPnSIwqlRWWahNbu9xSPs0d1T5ph8TiwQuMk0LRaD1PgxRl56SZ7RaBJTkCjSe8iWGcIKzKJUDyeBMAxWzdK9bZirDiHwT33wbWKTdeHn8yIxeaOzedgMxLiYn33oq7JC2ZhLxt7ZhcldgVFWEw3c6k7B3n66A+4CILYleq1oJx2PWIRHpT7aSn1frY1hUNRSMJKseJ21rP4xUilBvn986KKsHbiAwRDsaO8oMNeI9UcYY5jUT1/xc/TxDCv/m2IQmbT0GKGtG6bVh4V7Grj6SmtkBFpZlrnLfgusNwMztf2o= X-Forefront-PRVS: 00603B7EEF X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; SN1PR0301MB2013; 23:GeuCV5PcH/NGrPhWwEQleK2PYYXnMi5qnVh?= =?Windows-1252?Q?kPyI61+3ijOhO6cXzE9zHV9Ruh4i1SYLh5ETZ3belant9/+Gk4xZdHgO?= =?Windows-1252?Q?T1AFbqB1wdHngBmIJwekmtBZvDRUxSUKpre4PN2tGbu39W+o/DeQFs4Q?= =?Windows-1252?Q?MuT1vLwPOsOFGbBM+OCZVRn/f7NibOcJfdTKCbJTSE8PU2OXKlTJudxC?= =?Windows-1252?Q?StjltDwfJcudyDP23scEAWBlxCpnPuOabHAczt441oXAooZuzZhOdsyF?= =?Windows-1252?Q?TIBpaBMrd1piWdccrEXPts8yRWOiwsbwSZ1H5pUaUjczDLMX/aIFGiPO?= =?Windows-1252?Q?mO2lik4BsEkqy51eNjwnebUlj8hVD/FSzPr1knxAUGh8P3lMO4O1ie4d?= =?Windows-1252?Q?h5Eg6pBU07NxhN3f+6e4+1qDvNpKtMTWMVshQmb7RdlHTEGIk/pwKPW/?= =?Windows-1252?Q?LH398B+yYCFI4axHwbnUrSldt+S/+EJrhBwoRu21ndf/HmCphcqJ5Maa?= =?Windows-1252?Q?k3rKsfsFJEicv8cu/6uL/I/4wkdO0jhoP2Sfn3rllV3fAJ1C5eCvBLaF?= =?Windows-1252?Q?wTeFlu1Dl2APmCQw7N8pfw66AFVLhjXxitbJPBNm6AzDkBokj69a8GAu?= =?Windows-1252?Q?Y50Ze2j0tfoRnkE0Z+DqjHn41HqSHuNvK5EAn62tKtqGQzanezUwVodc?= =?Windows-1252?Q?NWP340Nw4ZRsbr8xId737Dw0151Va+3+ocZ9h6mHENVa0bE07P/O+8nD?= =?Windows-1252?Q?jQrFAPfA+hdHaFU3/A/PmfvB5Yv2cfKUvKCpWvz+eeR0XsE2cEh1Cqf/?= =?Windows-1252?Q?Ad7sZm/oS/MD216MxmErBz7GmRpwvQONzli3eKC2gyxgd/C12AoVogaK?= =?Windows-1252?Q?1ayzOxLNaznQ90Rmc3xKefJsNS1ceNOELYe9JrkkMEFBDOYOVnEtelRT?= =?Windows-1252?Q?+x5km8y9GkKlIMorK2DgPtLOJdAcvJVJBN52jlmuTwaJKFju/nuHmnPo?= =?Windows-1252?Q?4WNGYhQEHMbQB+JGDBdH2qjKmEdle4/dCzfNCL4LNE8h2F3AlX06j5tf?= =?Windows-1252?Q?c6FvA3/2fe8G8b6L2dpmEnWvO8osf2xzVsYVDz36GOaOsACcR+KU98mO?= =?Windows-1252?Q?Ztonn01OJ8HyVrncx/C8TgdEYpchCZ1J7/ZZD+PAo5cBHSvt6WYUac9l?= =?Windows-1252?Q?UdkoLYRC59N0qMt5vCH3FxR55nIICBUBZ3uBPvMKRpi8+1egrBHFOmxs?= =?Windows-1252?Q?+PK8p6AjSS0gZtfXHV1BhG12hDDknDubWqcEiSNZoC/Nq8cKUA0Nd1gQ?= =?Windows-1252?Q?a8XETF9G2Mm4Z/8qN+0k7f2g5XxE7CgZJ+IpTeYfUUF5rFG2bMF2gcq1?= =?Windows-1252?Q?qWQ9lyp/3aLqp2VPFPGpeTQ+UwLM2aPZcYPlk/P8Sb6bu1qBZc02Nxib?= =?Windows-1252?Q?tTKcepzKIRjYUNXkZTpCr/eqGuGo7dLzJoY783myISwW7iKwctRR6sq4?= =?Windows-1252?Q?xhEpITg7q64J7kr3I+lXq1xiaeurPg+HY2N6IdICbNSMOwxILYw=3D?= =?Windows-1252?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB2013; 6:vOcqf8ZKrT19DL9ojgaXw/rwaPHk7ZQF5FejNb9ekjnYcMyedX2M7sNkiiHTIHBXixzBxPj2vic4M2Zvw9kfw1KBMxVNNrXoYPIa472RsrobVjkxFVoc83BV0tkWP/62b6smIds3ySCy6PErZqyGmK/xypp0WJxds6gkEddhfzcg6dSGTuY+Y0+KUN+D8gTn/O99Sa27+oCsYU7+qR8OOEVckpA61KPeZy7muptLrG8FIfCs0OX13wcQ2jxskSyUP0et4sSXWBYLnz1jrLLN5uuvEf3erMFCRWzGSvQIpag=; 5:PwgSmY0qWofPz0RoV2tJFTODPxmpGmr/OaerHJTt5I9ZVVusc9XWDGFvJIrEyASw9iMbmL3l0ePHsGznKe17xxpPtYbQT2qR/fWvdmJzgF4Ikc3BS39h0idSI22OqWGR+FN79jvyaMe5RnJU4o3p6GH7dsbkklfsjQuoWVV2hNY=; 24:NqJ6lmzJZ+o29gMmF4lVjqd2A6oPlMqEzeeyhQ2NY3NWLvZUMUleBf6xpFNEL4s7xZ1rRWbX/SzzBbHOn2VWM34tKZv1YZO242+8l0FeyY8=; 7:E0N5mmHCxCSo+vLc7nlkaLaVBiVJofmeMYOuK9TX49mgh89Wyh9u0dIjIYwPzFEDnFW0MDO4gz/Khv8mCV2Jh9KFeXfagd3gYvtxleWSM9K3fHcCfOShuEDjtdnSOg7RzhMa2quXUGo8Zl0BbhtAf4yajNBoJ5MMwWNUDZNF5SLyBOwCcMUbcjM94ykZTUyqTx/YOwjj930iPhZDUT7z+Oa6nfvShKLQjrRjZJ59gPoAJceLp9S72y2a2rJICP0d SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2016 04:18:54.2456 (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: SN1PR0301MB2013 Subject: Re: [dpdk-dev] [PATCH v9 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: Fri, 09 Sep 2016 04:18:56 -0000 Hi Ferruh, On Thursday 08 September 2016 07:46 PM, Ferruh Yigit wrote: > On 9/7/2016 3:07 PM, Shreyansh Jain wrote: >> Signed-off-by: Jan Viktorin >> Signed-off-by: Shreyansh Jain >> --- >> lib/librte_eal/common/include/rte_common.h | 21 +++++++++++++++++++++ >> 1 file changed, 21 insertions(+) >> >> diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h >> index 332f2a4..c5d94f3 100644 >> --- a/lib/librte_eal/common/include/rte_common.h >> +++ b/lib/librte_eal/common/include/rte_common.h >> @@ -322,6 +322,27 @@ 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); >> + * >> + * Some implementation already have this defined, thus, conditional >> + * declaration. >> + */ >> +#ifndef container_of >> +#define container_of(p, type, member) \ >> + ((type *) (((char *) (p)) - offsetof(type, member))) >> +#endif >> + >> #define _RTE_STR(x) #x >> /** Take a macro value and get a string version of it */ >> #define RTE_STR(x) _RTE_STR(x) >> > > Some mlx5 files includes dpdk version of container_of first, they > produce following warning: > > In file included from .../dpdk/build/include/rte_mbuf.h:57:0, > from .../dpdk/build/include/rte_ether.h:52, > from .../dpdk/drivers/net/mlx5/mlx5_trigger.c:38: > /usr/include/infiniband/verbs.h: In function ‘verbs_get_device’: > ..../dpdk/build/include/rte_common.h:343:14: warning: cast discards > ‘const’ qualifier from pointer target type [-Wcast-qual] > ((type *) (((char *) (p)) - offsetof(type, member))) > > The verbs.h version of container_of is same with dpdk one, I am not able > to find why one gives warning but other not. Thanks for highlighting. I am setting up my environment and will have a look. > > Regards, > ferruh > > -- Shreyansh