From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0057.outbound.protection.outlook.com [104.47.40.57]) by dpdk.org (Postfix) with ESMTP id C1AA6BB0E for ; Thu, 27 Oct 2016 17:17:38 +0200 (CEST) Received: from CY1PR03CA0041.namprd03.prod.outlook.com (10.174.128.51) by BLUPR0301MB1620.namprd03.prod.outlook.com (10.162.214.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Thu, 27 Oct 2016 15:17:34 +0000 Received: from BN1AFFO11FD044.protection.gbl (2a01:111:f400:7c10::127) by CY1PR03CA0041.outlook.office365.com (2603:10b6:600::51) 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; Thu, 27 Oct 2016 15:17:34 +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 BN1AFFO11FD044.mail.protection.outlook.com (10.58.52.191) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.679.5 via Frontend Transport; Thu, 27 Oct 2016 15:17:33 +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 u9RFGIfZ027183; Thu, 27 Oct 2016 08:17:31 -0700 From: Shreyansh Jain To: Date: Thu, 27 Oct 2016 20:47:31 +0530 Message-ID: <1477581467-12588-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> References: <1477310380-17944-1-git-send-email-shreyansh.jain@nxp.com> <1477581467-12588-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131220550541946368; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(979002)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(85426001)(77096005)(92566002)(2906002)(33646002)(626004)(8666005)(68736007)(8676002)(105606002)(586003)(189998001)(86362001)(50226002)(356003)(5660300001)(48376002)(305945005)(87936001)(11100500001)(104016004)(4326007)(8936002)(7846002)(50466002)(229853001)(110136003)(76176999)(6916009)(50986999)(2351001)(2950100002)(19580395003)(19580405001)(106466001)(36756003)(81156014)(97736004)(47776003)(81166006)(5003940100001)(7059030)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB1620; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD044; 1:4hJrOdraFRad2dDuaAQkeyq18eyIOgiUcjzN9lWPmq6Jwo9jIMm4KT6fYjrF56ZUrIoZTnYYq+QbbnAAuXLQuIlyHth/QLRNpBp38+AVn4bKR/B7votx/LmtV1pbwhhzbFswd0/JtJAPVD0AJJwX3K8Y4xoNANlDcwqpxNq+6UE8ONm6wRVkf3Xvdn39gmYKyP10vvChiwSC80ANNJHwcn8RtBs5ATj7HrifxcMzCqB+jeiK88gw7aG26lMjY5kU4fFbuVQkpYFuE77gWsRpMpKSFvoA1RQYAukBRXTpUghNjcG58qk0HqIa8xokMu6emc0JvovTZqjefcKAv5cGTC6NPQ2qdZEBg5H0ZDW7GJYZwrB5PBbOVGTbCLshBDgcrRjf/or17jsY18umdhmooZZvjg47ek743+BClLZ0iroTX2ykUhYd38rgiSxeI1CagA81cXw2ej0jTMx2DV3bKJu29JuPmvj5M6/p0/m04rTyiBW1OxU6hSFQfAauN8LQWsyYQaWJ1ULN7QBvDLUrObPXpmNp88hi3of8TcXHoMTvx1ymQ0O9pWGRR/N0bZrz03XSvrECpOrdTFCViGGxNNiqTTorsSC9abvj01icCF/6Mhn80TnElfAqKYKwc0/VLZWN+6rx16fgeNEYUWI6uZRMIkuSol6F3au0IlqehMrEvvfziJSehi0jO/hSa7h5/92CCdw3O6CkSb616S0vnhzyn4IDgbCqQXivcsQhgDQ= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d12375ca-2847-4c89-4c9e-08d3fe7c60bd X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1620; 2:UEGbl5SfVlpmUUKvdzm5xzNxZwUfZL3LZMLVvGFLoPhk+XnFM33szeKD8u3XClMcON9Qa+i71+Ma7Dvg+9CDOZOAtROvWGAzPthrG+9TLMV/lm6C5PeL+DcsQqDj9FZ/sSGnSt4jzdiLSh7zwLYws3BRbqdw1lqfZaI/CKqWyrIVKruLD3BeYhmwQZ8k+5kH5qioOFsAqxuZGifelpuc1g==; 3:w6s1mEbTWFUyLL1HNZQnpb97EZ4jd8WDmFrHzJvsC8IOQz+xjHuTbihQRvt/Bf8Jx8FpNs3lMp/tBs7WJmx7zRGyYUaoXGZvj5+ViVGwERKcn3rOXz84X+NCTYziHOYdrQpufXZRNuP5v5vcVUQJfxPatUlnmMhR8CPYw9tfLtltumifcFAzPRfrEveIEG4zAJXn61Q72OVstfZ7u5nv6z/XBb67j2Oy9liDCy7gEKvel69FtZ/lwbr/SvKc1m9U X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1620; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1620; 25:8j61+PmSvt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BQrZz9STMcRszFgqxWCH69UnR4u64R+i4bxAjx8=; 4:FpXK+O8/A/L3KkVnzlIQtqb5yganjo24zBq95z9/uAQEO7wDr9MbzYbrpnf9m9iqv0Ett/A2LoYzAQ5vBsvIDTmvYvhLViHhIqXop0k5urYY4M1zhLn5TeTGv8o0cSgEd7h/1THNblkbUa7i6QX9j0m87sTpwV3+N2qxkUIywyLJDwMIRBw7eTt5SMeI5Yx9T6ENsclZwAbHjLQPKLr1JJZGw1h7FVG8Il6U3IiTWoHGKAc7HeeFKznSuMTUHx/H1oTqQ0qQYxzy8/TVK0qiehYRkf3/xnxaJdb17fqcMTfrwHVn5nsR7FgzOpYBfoRRX+o1ww2c9vYe5n2SfOW845V/ow3w+oK4Atm53CwMk4SG0GJrKi3ufHxLEnhNhc/qf7Lhl9hmdk6e8SGZ93EvKzlLNiy3KUana2MDe9TR2aybuiouevyoKstGX/eop9in5IzLVUBh8rpnVr7w9EYQoyLvcFNBP6xrPonoFJaT2Z5VPTB8IYAeoBI4+cCOqLOcg30/UooyhdhTsVRJnFAHW8xYLsmaXDzoIQSo8QlBBLQLnFEbM/LjCLLedsiKZOBC 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)(13024025)(13018025)(13015025)(13017025)(13023025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BLUPR0301MB1620; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR0301MB1620; X-Forefront-PRVS: 0108A997B2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0301MB1620; 23:uT1/QptJW0q0l05Ml0iTM6ttnqWcCazhJ89qp52?= =?us-ascii?Q?57sBnc1dceF3ukgJSEpYpnmXToHtkbBzxA5lYj9Jh+HRxEw3Y6WfKK4R10pv?= =?us-ascii?Q?+yY4GW45PmBFvw8xrhxQYC7d/VrWnYHPqIgKPd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ata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB1620; 7:BAvYXEtS6mD/k4ubkMI6FNzS1dSu/bc/vGHbvh075CX6FaL9NURWMYP6RWZRIpGyPPT86YFKFwkjtc1qpVUH+w5c2Io/4lWCcaDoHXk2q/uuZg18SC8lsaxVEgYYJrTunv/USRjD9wmQqSZJRA6q9yO+4BbKsWgtI1/c7uRANPsPEWFU0LJCqYk34F3aHF7Kze0BdJBjtq+OKwxnqu1xxSzwvtZzNw6dBOovOPfPG+8pB4wh2bUxXqbkPvlDvZFaHLiIuIwYTH0zx0tAAov2C62s4izeMlATxBjT8qBykdNiqzIm7uHZJoGN4tfLK8o5LLunO4yvWqiIUNAFnLPVOPjm+zV0lJYN3M8ODt4Iscs= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2016 15:17:33.9918 (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: BLUPR0301MB1620 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v6 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: Thu, 27 Oct 2016 15:17:39 -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