From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0087.outbound.protection.outlook.com [104.47.37.87]) by dpdk.org (Postfix) with ESMTP id B3EADBB70 for ; Thu, 27 Oct 2016 17:18:08 +0200 (CEST) Received: from BN3PR0301CA0055.namprd03.prod.outlook.com (10.160.152.151) by CO2PR03MB2375.namprd03.prod.outlook.com (10.166.93.23) 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:18:08 +0000 Received: from BY2FFO11FD031.protection.gbl (2a01:111:f400:7c0c::167) by BN3PR0301CA0055.outlook.office365.com (2a01:111:e400:401e::23) 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:18:07 +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 BY2FFO11FD031.mail.protection.outlook.com (10.1.14.196) 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:18:06 +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 u9RFGIfl027183; Thu, 27 Oct 2016 08:18:03 -0700 From: Shreyansh Jain To: Date: Thu, 27 Oct 2016 20:47:43 +0530 Message-ID: <1477581467-12588-18-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: 131220550869758932; (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)(339900001)(199003)(189002)(47776003)(104016004)(110136003)(8666005)(36756003)(50226002)(5660300001)(50466002)(85426001)(92566002)(8936002)(2950100002)(229853001)(189998001)(87936001)(106466001)(6916009)(2351001)(86362001)(626004)(68736007)(4326007)(77096005)(81156014)(5003940100001)(356003)(6666003)(76176999)(33646002)(48376002)(8676002)(105606002)(586003)(2906002)(19580405001)(19580395003)(50986999)(97736004)(81166006)(305945005)(7846002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2375; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD031; 1:I6elaoh2XYiy5yO2HVEu4cREKg/6ef0QpdG7m2n7pQENDI4bJNxUSMLLa8qwGj/FmvSr0NBLPxUPdMcHm1nFUydjecM1N4Ir9IYqixXBIIkmRMAdkrksnBxepBQiO96OKhAep7zuVCPX/wnKj5QzCWDa7rJ6+60hrSTr5q2zaOqjpkHoInVsvGs8/b4H1mSNiaQtQW9CoRnq1sckoVy3ipzqERtezuBYNh5btBANLT1Vs2nn6I8vjQ3jT+LaIATDq+7zH3XFJPUh1bIskSRJoQDvCfibgfjidWvizE9ZahqZPmGq4Kk3euQGOqCcGbWZA2S5I/sIObhRSXlDH7sDFq1K/oSTtPl9XHvrVvMfOfResQTsQdaJuSuYEgcXC/f0TxvaUrA7Ordg7DZP8ZMbOIt4Ic607mGkng6HQE0MR270SDwz442ygd7rdltpw92/ZiAcbBLeVCAGrLz1u7XZnhMfZlQ18zdR608jDtkdI8vrQzHQWLgA2I1h4kxICYCXnlRINWmJ6pwv9wR9pLXc2RrnJq+BDQdEyloKQVDX8jAMnys9sRRUOQa7MUsvTNqWx8fTCSuo/tTtckq932iPOhB1ccoBegQgc+sIReJK39AHlNOXyCGntmgsXf46w0IlEHTtWxK47lIgVNDXjQiSSaV6W+Ye8UM047s/XM1c+9IYh/gs/NH27GEAESGbe2IWVgtoDXi33EDf6Gua12olCf+9WNiSA5v7wIoZoyJHIqg= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 657fe6ea-8d42-4855-b3d4-08d3fe7c7449 X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2375; 2:g76zDafG+zJI0PhGKug0YNTf5Ju5dZ5dFgOq/YN2MEJ3y61ZUV4cZ9uBBmjwuxF914r7+Kwy+xNAI0aaITfyeDmHJJQEIPqqMjVRz0qj9hVuto3T6iRc3UYtrMNcfRznh12zcd8mvIKuljkppFe+/8yS1kiioLT5lKvhXO/vW/6dpRf7aT2FPpni59OMaEhlUn0s1jKctcWD7FqkNIwWGg==; 3:0a4lEWj9kJKOwq7euGIFTps7Buv2k+Ac5uqv/QNJNsol3GDldwfVN9b8OLShhlZCFdOwHMwf5+dF26dX/gMvkQwC5XKYuy2DuRDuca5Om/wa8keaa61d6Et/aXKvoCEPj+l+KXy7t45iHGepShEHillhWU7dtFBn4yKERcn6FJlwlOH4NBfTWsOpZRkMfw54PyzTVBTMt6vtYyMTLeczuQKr7fveA18wg/5cvQlKeMcERHW81TddqRYG2VmiV/nF; 25:JioKLEj/DDdlGyMMYnz+hZCfUGvmaaeU5sFp0eRrHUx5rNTS4rAydbgqetWUuBfaRDw/hAHTL+9ylzppWV9l2+lshvoJRmlIbAIkz9yAczgKhgtfwq0LKLkj2AkhrBYdVvD/6inA2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Ib6KGEczoBCdf8wxQI9jnzOM3TWQF7Dqijxme9GODTAJBrwmT7MEMYRV06WqqwWRq/VgDQgsnjxW4GwQTEwk83VMeaeqMYzliFQvM3rS7aPmMbSBfpQvEk2CO9wO89gmZzy/tN/d4hVc+0t1Y0wXrbfIBjqGuvAquj5h5meEt1wobTaicMh1FhyiKLGpPvEQKAgNKJNAeMynyidv 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)(13015025)(13018025)(13023025)(13024025)(13017025)(8121501046)(3002001)(10201501046)(6055026); SRVR:CO2PR03MB2375; BCL:0; PCL:0; RULEID:(400006); SRVR:CO2PR03MB2375; X-Forefront-PRVS: 0108A997B2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2375; 23:e5J5Bz2IP7uNjlJ9o+tgXtXIK7DcGpEqwQfORFsmx?= =?us-ascii?Q?hy7GF/pHBq1lbwiYfo3GHp8hCMF+3LIXVQ353CCnxdewpL3lgeYR1q2k//k+?= =?us-ascii?Q?TnGYyBCa02ga+vtgPrBmFr/tnq2crL4k8YX7TRJnT56GUoWtakoty3J8bsNy?= =?us-ascii?Q?FbXRZ9bkZ6PeO7/zcraycp81BSk2BCatpmB0mWOXghl+nYa3YnIbiM99fCPV?= =?us-ascii?Q?6TGsQbdo4DRumCXjCqaDf24EpyJYkTqiIIQUilV7Bbl/U603No5Hmllp3rOL?= =?us-ascii?Q?SAnI5m2sWosNWFM2InT2aX0o7tMsicQG+IZjgas+6m/GuW+IVnlC1Prx8vZm?= =?us-ascii?Q?KtXyE40UagAk51aSncUny6eJMA3XAUta2u88WXIy+9lI9xVWb01mNQd9lQF5?= =?us-ascii?Q?8xPr3f/oaWZSdQS/fg0ycZnNeL25txO9r3d/5iRJCqoLYe34p6MBa+ZceJxW?= =?us-ascii?Q?hnk9NhNwKvDCWkSQN+mukd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oMEalJVcm208XSD6Hy6ky3m5OLlvgNlO0JQWQZZhRNmIFDlIZpf+KS3dCeOl3RimrxEUcandxe1FIzUYG+Okt9HrOv3+SKS5tJaGB7tTIUV8luUh1uGzlf0D5DRV26Wrel/6XoxklNO9WB8BQprTcqrSbRg/B8; 5:nsHF1FsUlIh5OE1bD4In/gVBv3yxjqa3tv+KZftbR0Mp1Pl3nMLfX26muT8YNU+vLJs3As+8AGvEhormRK21PYEqYLqgjUtYKbfhZw2H+Vsva7WSIHXm510UCRa0MpZGLVEdRWSGObt26BS2FJXGsc0nEviwIaoIEnd0Bovopk22SDLMj6XN9IZr9RUeIA5h; 24:sV86W+CW73NYsAMY/NInhlhrwrMoOa+C6nSttnJskia/HdOZVQ8iT1rnDmA2t0ogdKsCo5x3LoGKhaaJXOOBe5QngOBXIvsvsGYNd4ONZTk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2375; 7:jZxnYxUyOR4IpE00jR8rgizbxMkXrmM602Qn6GPa/MrOcDXjVQM/rwOZyY7fxVBJPBgeKGr7z3vNuwsZ7VPP+V9Yhq+s67skoaw7Z1CcfGDPSMIZbXOSkgM32EwfNypS/0XhU9aafnDle39cKvG5szC4aTLvGKK/vYgkIO7vkPo3RlhsRnxihYVMxvlV22U9EVLdfoHPb31l7KRxU8WXV3Xs2b5QG+L+eVcbJ9mcKvWhq0uRpCLpLOcUPLcsqX6A1ImzmEYH28vATDOF2cr9lgOiMpw+PBkUw/VuGgFG+opQWg30XEKV8PuK/FzInjtLdjwjFIz2i87wc2ldz5XHHykzZpoYULxxIDsaHniXAY4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2016 15:18:06.7886 (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: CO2PR03MB2375 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v6 17/21] ether: utilize container_of for pci_drv 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:18:09 -0000 From: Jan Viktorin It is not necessary to place the rte_pci_driver at the beginning of the rte_eth_dev struct anymore as we use the container_of macro to get the parent pointer. Signed-off-by: Jan Viktorin Signed-off-by: Shreyansh Jain Signed-off-by: Hemant Agrawal --- lib/librte_ether/rte_ethdev.c | 4 ++-- lib/librte_ether/rte_ethdev.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index fde8112..347c230 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -241,7 +241,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, int diag; - eth_drv = (struct eth_driver *)pci_drv; + eth_drv = container_of(pci_drv, struct eth_driver, pci_drv); rte_eal_pci_device_name(&pci_dev->addr, ethdev_name, sizeof(ethdev_name)); @@ -302,7 +302,7 @@ rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) if (eth_dev == NULL) return -ENODEV; - eth_drv = (const struct eth_driver *)pci_dev->driver; + eth_drv = container_of(pci_dev->driver, struct eth_driver, pci_drv); /* Invoke PMD device uninit function */ if (*eth_drv->eth_dev_uninit) { diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 38641e8..f893fe0 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1850,7 +1850,7 @@ typedef int (*eth_dev_uninit_t)(struct rte_eth_dev *eth_dev); * Each Ethernet driver acts as a PCI driver and is represented by a generic * *eth_driver* structure that holds: * - * - An *rte_pci_driver* structure (which must be the first field). + * - An *rte_pci_driver* structure. * * - The *eth_dev_init* function invoked for each matching PCI device. * -- 2.7.4