From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0071.outbound.protection.outlook.com [104.47.40.71]) by dpdk.org (Postfix) with ESMTP id 3C3887DEC for ; Mon, 24 Oct 2016 13:59:56 +0200 (CEST) Received: from BN6PR03CA0068.namprd03.prod.outlook.com (10.173.137.30) by SN2PR03MB2384.namprd03.prod.outlook.com (10.166.210.151) 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:53 +0000 Received: from BL2FFO11FD056.protection.gbl (2a01:111:f400:7c09::166) by BN6PR03CA0068.outlook.office365.com (2603:10b6:404:4c::30) 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:53 +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 BL2FFO11FD056.mail.protection.outlook.com (10.173.161.184) 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:53 +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 u9OBwEMb008267; Mon, 24 Oct 2016 04:59:50 -0700 From: Shreyansh Jain To: CC: , , , Shreyansh Jain , Hemant Agrawal Date: Mon, 24 Oct 2016 17:29:36 +0530 Message-ID: <1477310380-17944-18-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: 131217839936151310; (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)(87936001)(189998001)(6916009)(48376002)(2950100002)(50466002)(36756003)(50986999)(106466001)(6666003)(11100500001)(76176999)(81166006)(2351001)(229853001)(8676002)(81156014)(97736004)(7846002)(305945005)(356003)(8666005)(19580395003)(92566002)(19580405001)(104016004)(50226002)(68736007)(8936002)(110136003)(626004)(5660300001)(2906002)(77096005)(586003)(85426001)(86362001)(5003940100001)(33646002)(4326007)(47776003)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2384; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD056; 1:yg9jwehmMywXZu+wVQ1CywxN6jqiOawyj5lWbYzPCQd4olj0EeGJ6fRgtFxU5R4VXTCpday+EuhQWFwAOpErrPUENELUiKJBYtES/t6G3OJ65tTNYDLS0I8dMZKSnX/kPp56GCUkHjfNxsM+od87MmC8wt8nLCqBRGkESK4x4byRCHoSW1Qn74coEyia5HxcdU9oPP6ijB35hLcwK5CGBptqdDQ9G8FoSnRNfAMjGZKGJwHJid7Z0kH7t5uE2fGqha9gOrXq1izbM1GzGvcwFSCyNNHS2InnHk8F8fH5vIT22LCKdbpdJTst0kLU+kNVpQC6piwnN3lRmwh47XdRxoZ6d2gJaBe+l8WJYsdG7LE0DVMgPWhzwjOD7lOVPPwP7XEHSpRDrJHjengBKsZD4FVladen74DaWV9xHAk7ur9TIzowjHpylEN4LPu+Gm30xVWOjozttoJAhOABRmj9ua/kSlcDFwmI8IpDkTifSuqWpg6wxaij8bhompVhzYuaRB13SuFxkbe9KCSVN8vWZQq5w6OTyePh1b/bednCdLMb87ulKjKZavFcX5rVZ//YInhowNDj4AIT33pNvHi0mVcJZlOjTmYRCT4IgxsOIq/OeRcWu+0xDle/4SeKzb8jtU3r7yh0LRvvYdJszCiRrbNIIICslub6T3r2/6JfadGqE40l3LF49M3F4PtxzF5gKfZKQ7tHaOUXIIAFO98fy3WB47qxQGALe1bIsV6KMig= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 0eaf0c11-f644-4540-3daf-08d3fc05440b X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2384; 2:Q1+/u+IEMdyO6rJwZxCyDHhb01nmK1bwg4Gvg1EuS4uGW9ExJb9ilLnIs74K9b32SMqhqKRVhxAm2PyJ1TUCV/gYrFzu/og7LSQ1N19gIt3erMMP8h568kGoDsNYb4hUUz+t2xkAz3SrjPOLNIil7pyJxD9gYX0rJ+g0yD3pe9acepk4lsujedp5RWhqk0XjpaBkEif+KuFpxHnJRjUWxw==; 3:QEOXlEyDVB2yhKWWYcy1nG8/cKVX69qusDNO2KTCefmj/eny10KWc2Xs9fT9fFxCeEnB5CLX+JmNRrbP0x0Td8yFbyQkvkPUEGu7U6ahLwR1+KRFCixbvsdnNjlXXzXfspzj54fXUtgJdESn3VOY7stBamLwqz2PsbneMCgW0IUX+yAB+z+U+sEbq7Q5vQRdA7BThQcyYdUovg7ztATZNKl3mpEA4VjSbQ+VcGnk7yBCkk6KKwb3f583Rw8V3CaF X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB2384; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2384; 25:Y6Lbe5Q3SGdzN8/BsLwhUPj23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2I/AdzVvA64cUU9gkpy2P+1IniPtgGhXF1/Vj444rBTiTDXSLqR; 4:4fHdx26ilb3RKsvfcRqOA4ymO6aSaD+HiGvfPTx7U98hOxZHUgRpYUMxONMSBz7HgJm/j6dwL5WBa3nd+eNkdrfDAWZ2YyrkiIApWL17CcUBr4Dejbx4+xq6rleQK0E1SjDfSdI4564oF1UM56ESZzKcAFNTIYAn3E0XqtJSnN87vWkPvhfzyk9ym7vaDRB3zQ6/MVAwjf1AqvnrqB7lubsQOZodK67vjfoVoJRlPjuQ0DZWbNudzCo7BcOJZuoI4Rgjfz8Bi14MoRkws/GkvWNCGb7OQBhKk93aCYPl+icwZ5ahEVKbQZQRRzMtXzlibSba//DN7mn6Rz27DK/s5rmlWx5CdLRy6RLZI9ASapjMHA2ybXIYphzCGpCqKEymi6QDydf44FyidrTDBobJCc0vxImAFnA6PK8Y95L/VY2qzTm6VvYGI/dDMsRcjQerlITjjqyXDVW5xVZ3eZP8UcB8xNNI6EHmobKwECs+/MDtiCgs5mv41mFJIU8loyK50/wGASSFsX5BOzGYlQwD5lNwhfTqvcS+E1W4eJ1QUkE9cksY2fABx9VCkbxA1Su3 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:SN2PR03MB2384; BCL:0; PCL:0; RULEID:(400006); SRVR:SN2PR03MB2384; X-Forefront-PRVS: 0105DAA385 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2384; 23:bbXt16FxjIClngkSod7T4zNAndJzyurRoZKF7szfP?= =?us-ascii?Q?3BHdaRocTc+osf7DtrxPn3/mbq7sOOBOuwgZRYiOtY0PeGFCVqD4sKXn9ZMs?= =?us-ascii?Q?U6Zpm3+D3C7V074Y13z/+8BzsObWYoz2sC+G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zosImy6MmdL7pX/s5YIdKHiWNkPPq2ZsiffbSNlyoCbXmTni/BSFcj?= =?us-ascii?Q?dpZcC8oTtcg8Q8n8yzkzqAmBg5IOVylZm42hy5v/E5i/t6tmfoOINWiQ1T1s?= =?us-ascii?Q?G6fthtj2HrHPUf2QxBlo2ZGK0eZdWy3V4GbfSZ8hO10Kv0we1MLIgr/pLHZ3?= =?us-ascii?Q?TMC1G10r+1t0TM=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2384; 6:1stWfNeyY73tKSMMM7zOX7onXWMY4FNTu5n0W8lciV4du+K1BBlX5LCXXDokc01WkFTEwmmPn4Nrtz6e5fJmthP9yjgT6009c4AL6quct00sU+RbgZs7bTw/CfrLoGTvX+N4jvS2EJdD8GXZx9mnJGRqC35zM5L18r2xuvn0Q5Kea+KARRjr8copMn8cGxdbFDPXvXWMqKTrMTTjQ6/KE2VKirMsWoWxUX3KOMWKzj6wwBuAmpc0g8q7AkKo7x+elMIdi5y+bhmkxKY2vjnWlioItp7CLTNuC2RdSFpGsswCLDChmX91AXaUjHh7XoUC; 5:Jh6yDwDgMNJi9nnO26ezpshAGm3TpMj9ml6+oE1JhsFEr2A1EWnUFcVrwqKAxqauxQD4xe1H9iChP4H82mFacJyWUTKRSJNl+ln/rtxOkYhso4taAl7iAXQREyCmxPkwNCjux5uP9hPgj/fX6gjrn7/Vw7LkUuIPcTaPbo4ULC3kbHd8ecWa5jQsdPT6Zza9; 24:seyNN6PyRiS3Vn/KTFWugQKmne+ti9oWrv2csJRJQXtyjRNcU3YUW9w/bD/nn7Ui9dZq8kGzz7vpR2vu7ZTJBFxa0mNM2ZSFQew/7vaJcSc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2384; 7:78TmZhYCM9V3TOhCGmaiqCL7pcXjxsw8kXaLTvz8D5Zm4qjdOAXSorY62KAExW5nRBoIhLVryu5oXcHWQnL7Ulmhx64qjFwOoo03uP+S1lL89yeaAsOjPHAO7GZLSwo06xvAxUQKli9fw2zt1g1Jv8XHwBGsyEo+QEeJrVmHrap639VJA1Jlm7Ob/XagxdLoI1XiZCDaRxV0r2qFXRrMPshZbMZiYLuQinr06IqI1fdGyNbph2I0KxJmIkHJV9OiUm0SfZ+eoKxKMQqKjRASg0ZJgj5J9tjPZDUoG3yrobFMdwnL/j/AfBigJlBwsnGZzfObcszpAnbXZ9+HOO+qEb+tKGpS/l1z1lrKjgjNpD8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2016 11:59:53.4279 (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: SN2PR03MB2384 Subject: [dpdk-dev] [PATCH v5 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: Mon, 24 Oct 2016 11:59:56 -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 0d9d9c1..9aea048 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