From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0077.outbound.protection.outlook.com [104.47.38.77]) by dpdk.org (Postfix) with ESMTP id C15E26CB7 for ; Fri, 28 Oct 2016 14:30:39 +0200 (CEST) Received: from CY1PR03CA0007.namprd03.prod.outlook.com (10.174.128.17) by CY1PR03MB2380.namprd03.prod.outlook.com (10.167.8.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Fri, 28 Oct 2016 12:30:38 +0000 Received: from BN1BFFO11FD029.protection.gbl (2a01:111:f400:7c10::1:164) by CY1PR03CA0007.outlook.office365.com (2603:10b6:600::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12 via Frontend Transport; Fri, 28 Oct 2016 12:30:38 +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 BN1BFFO11FD029.mail.protection.outlook.com (10.58.144.92) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.679.5 via Frontend Transport; Fri, 28 Oct 2016 12:30:37 +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 u9SCPEMH019399; Fri, 28 Oct 2016 05:30:34 -0700 From: Shreyansh Jain To: Date: Fri, 28 Oct 2016 17:56:22 +0530 Message-ID: <1477657598-826-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> References: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> <1477657598-826-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131221314375078078; (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)(199003)(189002)(2351001)(229853001)(11100500001)(4326007)(189998001)(106466001)(5003940100001)(5660300001)(626004)(2906002)(77096005)(47776003)(104016004)(68736007)(50986999)(76176999)(8666005)(356003)(7846002)(8936002)(50226002)(305945005)(36756003)(85426001)(86362001)(19580405001)(110136003)(586003)(50466002)(19580395003)(6916009)(2950100002)(33646002)(105606002)(6666003)(87936001)(48376002)(92566002)(81156014)(81166006)(8676002)(97736004)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2380; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD029; 1:qDE48Y5XOYITLlDgHXlp8GYGDCvouXW7hyd7Z41k3QSm8rBRq+uwdBMFVeDl14RJyjfbdL4FyE4YtHpYgK7abnVruQW0NOfR4CdrI1N2MZYNQ/XF9mAwfUMcJEGrqo5ov5YYWGwm0MdN01a6d2ERM4R7XrnBw6Aq7iztevkMlTobtny+0Fg6OD7IUhfGaN7j12a7ygPAGh7T+fIWA+oJ1RHcsOgPb8GmuJCfk/rNKUpWdNj9N+ECCaIoXEYGuAwqIKkuWe206rPLc0VdW6eWyvspFLR+Hpg5abO+taIY87hKLZXV7Bhgbya2RypwERmMhbwj7sgTbmzL67MdjnCUdWBFeeayxv5p+gpJ2PrAZylKm5bOZleiWq/uNO37sPHqmeA+5q5yV3nPT4Zpp8vHM+QSw3vHpAI7hZsXytHN0ZEjDMtNSAge+iYzbRM30acXmE8sgro3M2BsvAnwKq0fBftF8qdOm7Oby512xX03bBL5ZzP5MU/tQFidK3qvc2mFXl157eIHjHYDaDPow0wspCprf2GXb63FPF5J0sftrBqqkNGol9w54uuLbPiILNGyrxHhVBJzyMr3OKsVKDnnNUsRRPsGXdbWIP5dEvvhYilfCrN3/o7uOjoebYdiorQxiAMXt7WfTmGkH4YNgJEOQcmw8bbybFLTiYxl/yji8cVYWQSoW8Jsj8Q4wiem07MZWoR6dA7/+G7xa5NOopQVuLEajs/OCKGhLqw8xqx5u5U= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 877b2baf-1b03-4bc6-e467-08d3ff2e38aa X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2380; 2:7J9r3BS5PunLApnp+1sve28JJ6j2tcrzi8HVQcsGSjqgbtX5L9GonjEtkMK4SUWQgB9BtybJaoOtRcjS+6Eztu1GpEb2sychX/SZEAp2kkP8Kxa8o3tvXTbD080aWeCVLrtVZTvvsYcm41VMCXpNE2pHFkC+6lCjvhemRVQfBp2f6A5uj/NpxArjMym6PdkI6cpitK/RZCuIVhfwiAITNA==; 3:XQKuE+4YLOHNmC4sxgbRY/QfIzNMLJPMXtY362OlK27t+Ww7CF4HOdAG1bjidS1tVS2RnOsI9c6nAwRulLf55rzTU3/lT1g7paO0MhARBmn8W2/0nAKpjkv6IHVVRpHweireZ18SwfO57klul9YubODoKzgd4b30V3ps/uQf19/fDfaVgqqgryw2yz2lB1lz7YLqr3c/Be3Q6zu/UquZKOdefKpr8dsNg+naeJWYeM1oQVkpHYzzbUX3fh5AHjwo; 25:N2MS5aqob0ZvT6gumrvdxPrLrXRgZR1SMiOtWSPBJUiVYa5oJW1BbY6WjJ3ItflhQyytcfFuA4DLucxiue0Bc0kbG/DbF5Rkz0E/4M0MO23HNcWnpmkS7BZtkxVkPT18UCU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5dnyzbLsEdDvXtunbLU3pXC7DLZKUbfcstav/cQ8oSqtgrblUIDMPxMcOTQ9vISoWOVSccmCM8s4eUFWgxV4xQNgeAVPJ1CBreNbsGj+DBgQEfQgjaIPpuhWXPeGKELCC75EFJ+8CoEjCBwwC5A+lpNb4dta+hgdtNA3f+boQWnjQOqH3Ngb2hqQBNhyWrcAbqzZmo461MM8JSpjGraGQVZanGKxb2vWTdxCaS67Y 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)(13018025)(13024025)(13023025)(13015025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:CY1PR03MB2380; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR03MB2380; X-Forefront-PRVS: 0109D382B0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2380; 23:H18pxEZeJqMDHxBKTKKajRnSlWNbPDnKd7YdHGKLg?= =?us-ascii?Q?eye1xllxN0E4RAcO9b4RV9Hl/cU/NQ1cXSHYXwoJsvw5ejb2uXYKOX0oEIym?= =?us-ascii?Q?TbWlU7zZM9ix0DhgKQrW1rTrMfGnselgaodrJ/s4UEwg0geMT2nQhXzA6qmJ?= =?us-ascii?Q?INOATDg98V26asLHpyq2ykFYz7FhLVx0NTaXAJTy6n0apy2HCTdUMDvVXeQw?= =?us-ascii?Q?I8EpEpMsMEoxloBaGB2/0/mYJO1NlXJyxR1N0z6biu+pX2C/BW69p+Xi7ixc?= =?us-ascii?Q?F6njL89gSNivXdqHEvJUTrkPKVc8I7kzjwsLpuve4lgtUrSbWXFBW4n1wyTe?= =?us-ascii?Q?G1IlUWZdZXQ9uUj1G2gpK/K5jkfzMoIx8PK3gm6s5ijwI8TRg5aJ2RnAYlSj?= =?us-ascii?Q?W2IbPf7sniS0DL/yqx4g43276TeeK3wgC8PgX7YtZLaQKLw+3IIuL/2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tIblEiKbtIMAGVYakwq6PBI/YsxocM6yQJ6Um5SRpBc43eoJ4ZdNVYATDrH7FB+QesL4/u1+vSLOsRwaLdLfCCr2LP29OwAYeaL7kpT5ct4TPRop7PCTBguPRMUPg1CW0f01WpO83vcSB92w+xuCVB5/WYeT7DWnHzp/eZYYutNt13Jdy4OLfDyfiYtOqW0SLRLkguxA/Z+O3Eu156Iinz6vzuilzKnLis4JbI; 5:q43I2gI2rIWfH1U/3w5Vh4sgsIBMkK4sos951ZyTvBxHbJb7kfN/6ezcaORIiwFrUZ/f/nxB3PKbvHMIZrfuUNI0Q9exgTuG4OlkkeXd5pryoAOZekzNaFEbW2U7PdwenRe3NtABxSlMqlWdVJP0HvcvgX7kibtCkEe+fUEGvNUh0tZai60zUPPWCwUoXNfu; 24:kQyrB0y4UFEf98c5D29Kx+SZArxFx/tGFXN04BTuwaKDwQgyf3WKCgKXw9F+ckT50SWyKBhK0F+aIedJQiBVv6oDaHp53j6hicn7/eZVbbA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2380; 7:uDeqFNtYmhHXLX5OEye1cfFmgw0w1KrbMAbuVWYyjOpK+DvMlyeXtWsn+geZEX2eFGi8JL9FpA1i7rCNNn2p4vkW1PyARCnWnxvOYJbhyox4cbi3tq2YWeqqviWS+vRIP89NBh6w3d0/DbrbkRGEzBy8920bbXDvsWzL5q2CILBXkJiwucjMHhjVlPIw8zoUN6JtKLFTtwm3znJmP5rn/YJ4jrFEeJ42Muzkt6SWSI6UABgwt77lvv/tovpbBdo0UIxHGUPaeKd5hhhcfWLkTPkq/QYFE4TPIQsjBlBYWupAk4ICC5hh5kbmGQQvLEQN3eAIsmVi5VuLnWegdofD2KGx4AQB/LmWy1T4eIlF1w4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 12:30:37.1802 (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: CY1PR03MB2380 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v7 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: Fri, 28 Oct 2016 12:30:40 -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