From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0055.outbound.protection.outlook.com [104.47.37.55]) by dpdk.org (Postfix) with ESMTP id 91B30475D for ; Mon, 24 Oct 2016 13:59:22 +0200 (CEST) Received: from BY2PR03CA042.namprd03.prod.outlook.com (10.141.249.15) by BY2PR0301MB1623.namprd03.prod.outlook.com (10.163.28.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.16; Mon, 24 Oct 2016 11:59:21 +0000 Received: from BL2FFO11FD018.protection.gbl (2a01:111:f400:7c09::108) by BY2PR03CA042.outlook.office365.com (2a01:111:e400:2c5d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12 via Frontend Transport; Mon, 24 Oct 2016 11:59:21 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com;nxp.com; dkim=none (message not signed) header.d=none; 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 BL2FFO11FD018.mail.protection.outlook.com (10.173.161.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.669.7 via Frontend Transport; Mon, 24 Oct 2016 11:59:20 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.87]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u9OBwEMP008267; Mon, 24 Oct 2016 04:59:18 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain Date: Mon, 24 Oct 2016 17:29:24 +0530 Message-ID: <1477310380-17944-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> References: <1476539108-13170-1-git-send-email-shreyansh.jain@nxp.com> <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131217839609935051; (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)(1110001)(1109001)(339900001)(189002)(199003)(77096005)(8936002)(356003)(86362001)(8666005)(5003940100001)(305945005)(7846002)(50986999)(76176999)(11100500001)(104016004)(8676002)(81156014)(92566002)(81166006)(229853001)(2351001)(105606002)(106466001)(19580395003)(33646002)(19580405001)(50226002)(47776003)(586003)(85426001)(36756003)(4326007)(6916009)(2950100002)(6666003)(2906002)(189998001)(48376002)(87936001)(626004)(97736004)(68736007)(50466002)(110136003)(5660300001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB1623; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD018; 1:/jzwoefDJq9cjX1fQe7k0zzCrt6iLq4S/0CgVzkDfuT8pnLJmrat8zlM24Z/vvThRHBfamU7MoV8FsjF48WWGMc7s5SIZ/Li2TuMWtFyhuG6MUvCuec/c4HPJnRfw8pmGgLsDseQCHBH1hXe4CnY0+r+oROwIKhAVw3XfL4JrYTGrb9tvUZcRs6S3X2nBMBcGJODHUTv6teFMJhfeLOySCD+P76YY7fR0uPAdO86HUIeKedlzspsyp6P9XOG+VcTo0N/GewBEPkVtn9JvaCu1jZ/Q9PvLgoYDqoTOoRkQ9/akhzgghHOEjJ8L04QPKXvkrJ0wr/BNO2JOU5E4U/nqlzWCPy8f2xWPCK3z2iECqV6yHb+elzBxVPyAwfClo7szLDrySRGn4V2rbztqVZbfvL9R39TNsFdkBR8cEaiDHnkD3s8dHIHWZl4gfjqYrqqERYWRrKCnkMqb1HCiR8ALpgIjFqjpmkpvRy1ATbBLK0yi9TtrkUfyfH3uUwWzWzUASL8xAksHuXQYwI7j63KunP7QiwYLodXgNHwjtpTMnDzK8GeqjvePy1QU05CWS8yQCr3GKP4aSePe0Iz4o5hXgUrNqUVQ/xyNZIa0iqmd+aWFR6qAtHud30uoHVMAJfpnBrv81/X+VNzLtVMl8qqaMKcYvRjTuEOPuF7MGqzoAB+zWZTUI6D7mxbifoFsVd4QWTnjZLyHKR7s6F8Lg2NpR2s79xBkxoNLXq5e19Up2Q= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 85866832-f6d4-434e-936a-08d3fc053099 X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 2:H8IlCcV9k4SQm0bArYzgBxhBwNTI3x51XOI0xKYkCbmintQU/P0yaoL86hVDbi0LrbaQ5qgqzZwfmevry8Wj48ETmfp2hyA0207DSVVIAGJB/EfPnEM2zQKOLDFgIyOaxPl5T9Q0IJf1txOd1Z1fwpx8Cnt1CQdNgXZWZ2HURq1Sx+4RikBxeT1Tz2ABMOFaJN6dPsrwoFErmeSsTCmoCw==; 3:2/AmUOWSi3zoDmd7spaNqvwqCYODL8vavzH+5ccFeRBHKuLvT5CgaxeOGlpXEiIIyi2FAfGNy6arBZ0QVIHKyF7hdn8cCstSsJdLLcWTspy3xjhquFJGewEZ+dEwl6ZeHTQN6HpeiYdxHS+w22TrYUXERO9D3FpkNLWY5tFDY9rd8iXOmx+okXJx6CyY6jaH0kpui/t23uzETkF79/5gNr+KkMHmxgPbdgCQdOnViEFUZLNgNRYUhvDS+O0KlDag; 25:Kv9woI3GyBGTHnda2Zf1HlwFZe1fqcsxkT3cQtICVnpvWp301eujOe91dpf6pBzrAUgsMJOp3dVbfr3RXouXD1c/2QHcIqZ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9l7Is3F9gBU/eI1nZLTChGQYR+VYml8q9AU36YgAGO2CZnKQzHsEE/b+qx8NIGPk+T8OsdQppmjnrc9ozwwhRkUxgydFVg5RyfCWu2Zo8coCMLaXO8BXunN8AzvFpqM26SDD0aXg6NZBk5zHj0sRFhV6PHRS8R0oFO8pVjBFLCDbq+eMXT9yC+k8DmWgJ08tJFMNP1pr3QQnDZVym70lvHNP3AOopYevWJGbXOu8N74n1GZ2zyn/z//S0f4MBPbfosS3hfh57ijzw 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)(13023025)(13018025)(13024025)(13015025)(13017025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BY2PR0301MB1623; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB1623; X-Forefront-PRVS: 0105DAA385 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB1623; 23:DQxeOhbzUsOgu1XUcApIKy2kVbAubv2QRccaj/K?= =?us-ascii?Q?tEoickgKW/+mWPuqiQMsswQb2ajaMx0BpOA8bB0+efxXZcJTRtS7fMu2SqaF?= =?us-ascii?Q?5w3gzXXXjVB8+IwHRe/1y3VZHiXJ2WjlNDDc2WFji/pVYynx34Ui+OjLnGo7?= =?us-ascii?Q?PXn4Qs7qIuGffv2tIgUdDv+iyJAhX581V6vBCe2g8E+p5EYz5VtEPiy5YQUY?= =?us-ascii?Q?dIjF6cFB4QS5RCH7SUnstrzPRpUP5SzF7cBQTfayg9hiaSJ9rQUHRI+ANctm?= =?us-ascii?Q?Pw9XaY3oI7IJ+2EDHmKky8e438QIABZdOnV9awJzamkR2NG+5fDoqREG6Wb2?= =?us-ascii?Q?Zd66442FA7TAw8kGYnzXVEgkqv03Zd+lpTecYwKvA5riD8ap2K25LG8Yp/1l?= =?us-ascii?Q?9mGZisvirrrehyKSBdJlot3FwRcm6D01EgTTIRe81TWg5TOU9m+vbick2npr?= =?us-ascii?Q?LbIQqIpn+Xb45cp44NVWYIXXfj3JHN9nlxrx19BgIBzbJC+MRbDBfhKiW1iU?= =?us-ascii?Q?EJsvq4/lAMD9dvLllMF7zIZOSGJQC1nFE8/81PRSVg4fI6657S062iONscOK?= =?us-ascii?Q?8ddJGPYinegqHXwGySK9/icKgzS5xDa9XqKeAjzYwyr9KhzMEoEAVNBIBlAf?= =?us-ascii?Q?3DKSrn5iOwgLvm8cbKG67wuDH/qSD/7tXgbX2VIz6PYUv/zGmCZDGu1GnBRy?= =?us-ascii?Q?Fu4kY8FgKVFMJ+zr2Xv7YS578i5Gm4MlA4yQhK3QsvoSPuiYhcgakGxB+uDv?= =?us-ascii?Q?bgcOK29txfzcrC07WqIKxh8C51S3vSTdZ1lVeehOLWweNW3Obh2p0sEau531?= =?us-ascii?Q?BOucfZIvN0IRWPOGMGuyzgLyRuknTGMV4dN2yxZ1YzOZT3rc2RlzbcFMIO22?= =?us-ascii?Q?0VqO5aCRzKWxDJG1KD7WwY3AQfSs8/AWdeAv4yarZgjlwRpMuA7dYBWcgJch?= =?us-ascii?Q?wTzJYDQRV8AkIFDOL9rrymw0k4wENolIVUm+rjXPCY6QcOUaJ/8YL4Zes61N?= =?us-ascii?Q?ld225hjHF4bIuz6QUf3Hu1+Osm2EkjCUfHkyOlBkMJqRtRA0dALUr9FgaawC?= =?us-ascii?Q?Bcr4+xsXstTu6a7D3RIok/UCh4RmTyj2lyI7rUrYvndU2VN28HFjDkaiC+tA?= =?us-ascii?Q?V9amm7a7ruGVX6g9wEip7jzD7zaLEBDBZK8iSO/ewDBhv7yC9iBpuL4DdG4L?= =?us-ascii?Q?+D/jWHMd4H28JBBksBbnIDCXGG9b/++ucyPAh?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 6:eU8fw7bXUaPpqr9W76BU+jfEhz51nfwpA+I0S7vBStqeaF4weF0eddiObicbIXHOwoaSUFPAbYmKGUGmJRgujJcuHc1hukvjmBugvhc3iIG9chW5F6xyFRNez4j9COj3Ln2bboPrkrTB1BMcjwk0ZDnpewCNaNAjgfTk/irbWDP6mLuC7vP1qpa4LwZplgqpXfUjfgeXg6FC7LcQWyru2DVxWBXoezkMucxZDlxycyLlyfXtEZ2JNb2lNbCrChEhEIQF1BdPkL5+cGdY/FyqOYVrAAUJlIU6ceRr6+EgJh2l3zVcjTvHlXcGlSgh7z8o; 5:bpt4UZ+F/UK5AfULijcmOmoc5/zKnTf6tvcsi6ghU4ESXmUQbv8T2qru0vW8JT60DXRqqjvjN0c3G09EOLWJX80Slkv7FIMr4vHzs/RRmT2ZWMJXsXi0k223fB52pjaLROrj609qvlwzkjp1FwSM7MgPv+8ZiWb58KRySRtXw2wqAoMjVgcTlaxdNtQS0hY/; 24:H35imTEjdlKP/R9v5OM6KlNsrk3pLx25bbwb9n1m9nPWhML/SPsHQzqjwd+ULyjXcD3OqETEu80y/7wERpKwqffuAQI4Oqn1jPNnSKJ2aU4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB1623; 7:yIslBr9QyXqY0gmfLtRpCnCon8ZBHaQ6t5gwP4pa9XoGuqAtsKjmv9njIcIytxBmt6+9KZJwrY4Sa0AOiFBSD25FJ6euSWzvbZVF9ZAAQrwzOKUSwCrc859AHxzNx66ovtfKr5xD0qpnIrB3gSMnX8ziLHJXRwFDUvE/TgTumKthHjEJk9hmHk0laEjItDkFobxcAaHezLxC5SHSpwCPRjrGOEaBjEt4OYrNh3bCCvAjBANUWtHEBSEiE0kmDfq53bJ1QXXRBGh73TIn7W/enSOFJESjJwT2/ulUZ4rcauDqSWRftLqp/rCglfXYwy2pqbllNDP8y5vUelcyYvUwc4MT7w67vmwTIVx/H66QEqI= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2016 11:59:20.8219 (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: BY2PR0301MB1623 Subject: [dpdk-dev] [PATCH v5 05/21] eal: define container macro 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: Mon, 24 Oct 2016 11:59:23 -0000 From: Jan Viktorin Signed-off-by: Jan Viktorin Signed-off-by: Shreyansh Jain --- lib/librte_eal/common/include/rte_common.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h index db5ac91..8152bd9 100644 --- a/lib/librte_eal/common/include/rte_common.h +++ b/lib/librte_eal/common/include/rte_common.h @@ -331,6 +331,24 @@ 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); + */ +#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) -- 2.7.4