From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0050.outbound.protection.outlook.com [104.47.37.50]) by dpdk.org (Postfix) with ESMTP id DD20A5A72 for ; Fri, 9 Sep 2016 10:45:05 +0200 (CEST) Received: from BN3PR0301CA0063.namprd03.prod.outlook.com (10.160.152.159) by BLUPR0301MB2004.namprd03.prod.outlook.com (10.164.22.18) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9; Fri, 9 Sep 2016 08:45:04 +0000 Received: from BY2FFO11FD031.protection.gbl (2a01:111:f400:7c0c::146) by BN3PR0301CA0063.outlook.office365.com (2a01:111:e400:401e::31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.609.9 via Frontend Transport; Fri, 9 Sep 2016 08:45:04 +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.587.6 via Frontend Transport; Fri, 9 Sep 2016 08:45:04 +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 u898hoZ4018305; Fri, 9 Sep 2016 01:45:01 -0700 From: Shreyansh Jain To: CC: , , Shreyansh Jain Date: Fri, 9 Sep 2016 14:13:54 +0530 Message-ID: <1473410639-10367-11-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> References: <1451682326-5834-1-git-send-email-viktorin@rehivetech.com> <1473410639-10367-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131178843042036500; (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)(106466001)(2950100001)(19580395003)(19580405001)(8676002)(586003)(86362001)(36756003)(189998001)(48376002)(626004)(8936002)(5660300001)(7846002)(5003940100001)(68736007)(77096005)(2351001)(50226002)(229853001)(47776003)(104016004)(305945005)(8666005)(11100500001)(50986999)(76176999)(356003)(105606002)(4326007)(92566002)(87936001)(85426001)(33646002)(50466002)(97736004)(81166006)(110136002)(81156014)(2906002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0301MB2004; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD031; 1:gnCfmWqf4san/cB6l1eeo+t5wGmAOdS/qf1WpxrZtVyo+t0XbibnIrE/hkXmHyDGSGPWHGtaoLgVH5m4jhEWMgPxvVEofJRRlua/HNgIjmzUYeXJKacRBItb1rzsSIa09dHC1aeTHlWyr3XjAYWMcvrTPJ2u42enHaaXViDus9ZtOBv5CsBYNT41sb3dZHIfJ/fx6KWALySnTzAet4B6pL9En6XfpClgwsL7FOPzNTEcNecye5NzvPlw5T1tN1fDh1PS6+aVlklkO+V4/bniSMFBhKYHPMlMFRcXzaETrfPX2QTQ4D0F6CgEM+JhxGmW8nIXcKSYqXFjwT62N6hFhQ6GDZrniKok8bueQvhQWkDg0pL+ZiWu9aUqfQs0CIwzQsQwGTwI/cjgNU18z9Sb4xzqJVe566B1/BK7ZCq6oSK1AnpAhBDfqm8f8nMhO2F0zuInVn3sMqHa5f6Vcq7pz7efkshtDx6sFuxGSi6Ew6n9LaGb8BuTAnw9geXbrBN4Hdhf1tFDREwcvaFUcnPBd4rDtGyhjAmomPaxBIg0hXhm5uUgsNsZ1mTPgJejIszNj5iO/xEosHUD9lH+TuSgI5FB410Fm8agx3Sc/KSuVWksf8AsMyiT3Bz0gP7chQgB74bcuDBgUKbIbKOxKQsbEZk6uhRqLmLNDKnA/AhWll/sTLtOMGYUfjh5zNp9dNxZsyYCcvx+g0uCyQvGdY10GBLUnm/bijbhbpPnfgeF9tI= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f7c7b657-376b-497d-d9b3-08d3d88d9805 X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2004; 2:z99oObM5QeaRVyRcVzpEZl1IyiVXUVjdCBQz7pGgackMx4lhhygjvu7owzNFtnHTm5GbRStlC02gAorwMcJrzksal8Ccm/ZP/qpdx3cyM/c/s6N9iFvhcK3sqmy4HAp4J8d+rsmBxQM807GrXAtT/S4yx9HhYOaR7TDBkPq6O+giGFSxA8Wnmu1HcrAQab+M; 3:eUVuWGXMZQI1E+yddkTO36j/JX7+XuR2vdk0t2X3pCNdqo7uCeKqADAXzfmtLD9FAONf6oorSxTY09Qgh9eUBualJKRDrUIL0jg+wpFpS/PcIGhdk4PsNRqx8aM4r3cWIUlqSRxEhZ5L8DtdKl9Trzfu9MEU734JKvtMckB6vByoNDx4VlgSTZN78e+zTGQgmTk2eOqiAljt2/8gLV4SrlG2y2aQ/+L846oyrvmGjbU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB2004; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2004; 25:U/jiH/G8F+/yPc5R87u0PCIFqwoaqtBNcmwKGuHglnCMyhq7zXgRSla6wvZ7K/1TKHk4qdXUxYrg9++yPmy3+9XEYl4btAypNsOj2AorxR6iqxvK+sslubD69dcqoCKRTiayhcsiLVfozREjKf9ejjOSebpP0wUXShWcdlrLfozFIYaXPJfDRNFVXt5Sru49pyW3v7GhKfg6lO5ptS1BYZbPWrYvt4pYQCFwhYos0wBZ3oobmoP3oQZ0GgolEAq7kFdxBiDu3mtJBPUujaAamw1AyVwGjrx3YMj5q7JzrPTE0JEv9TbGNxznIYvaRMJW3cWOvKgI+PPmjCA+abtKARGHu/4FzJMfdMxUwwCLPmI6IPl+6Nv7FKfsPNLV73uxSvpwFcJicwFngIdrB7lZcZqPM2FveswD2KdMNwG9W+qs5vf6xUjh9pOvlXV+uJ83eCOG5cgx+NGJIz/d8sr0tZFcbWUmyIs8vJA6zGyugh4CBwxP+BQc/uKMwbRNvXLuG5hxqzEdQWCBz482mgzEJbEUsniKYH6v6+ahTCO3eU91RF7LLUT6YRDm+H52z8fLS1XO/JA1Ya8w8gijCBW1/E5WLdDCiSNPTw+Udqm5DNKI79+LX7RU2is96Pn3gHoVu+hZS8Pil9rC4SzyZ9O0B07nnZMhbL7m0+qur8+ih6o95aYq5RUcpmb/9JoVCiVUyTmYj/wvPLRPwZi0ac2RRg==; 31:Cwk9FqPbqBhOGA91p4UhQLwGYE6zF/jXIC+gNrLJInzrlPbfGnne5VEtWQJ+4lzY3orykMgb8Cv4JdcENwTN0MU5EuhOLZqP9KsRyGBz5dik9v6Ox21oC3QPA9dx8JLgGCKukRtB3YV9PTJCb3HSxCjtir8FrVPwOsanBaKvtjNP5hs0ceebwIT1+QaeAJK6fdpPRjcjvwK/CmmdpRDbizGCf3Lrrv6QXfnyFSvk2XE= 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)(13015025)(13017025)(13023025)(13018025)(13024025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BLUPR0301MB2004; BCL:0; PCL:0; RULEID:(400006); SRVR:BLUPR0301MB2004; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2004; 4:OytAe8PAIo9CYwOZckHoUvzVPRUcGhWFPRlfvAlMFg7CCHrIsgf0IUQtvT0qB+RKCQ1iyicASIO3XD5NxNjgtx50pwhdBSz9Mo7F6cOsslvXjGPdy1LWkuoKEYPSJ2FmGE32AoLyAPY2w4jy82C0c04xdMizFZUnPMiTpgrpHLOmBiJfLaeSLJMBrBVotDe1ESbNPztNYqKFtmdsyOABth6hX9ChlXMF6VVKhQjl1NdZ/Vbb/PoQ0llUTEimU7TZFpIMStIe9debiLQZWq3Ep0UXpXqEfL+BjXOsBC/iJ5Ns2Y1G7yvhH/gOHGJBqxwrHr6HwcpMni66bdg21Q8JWOLLUCFpcuaxwEPQ7kh3fsl/6E6jHF1ZHrANUI7R10/yKQC//FHI2w3/JYkaEoaAOoapw4ZDqszcLSSpoo6R9Q4PgJ2ao+fBpehodDjkyTQOxivdu5XvekcTnr+QwJzicvJEwI9UP/yg4kOg86QsQuYv55/DxtYF89pdpBaLvZJO7S81s2jmoaHAz/6jUZb9DQ+Q3gAUstgabq37zi6RaIk= X-Forefront-PRVS: 00603B7EEF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0301MB2004; 23:v7AuHG7aRLAIfCZ1EJfC+g5Me0zfP8AukocFdii?= =?us-ascii?Q?a/d8m9fmtK76ZXHoL0S++MpaVlLKCGE8IBSHyXzV4lKIo0VPVAraODCEkZGu?= =?us-ascii?Q?Pf6T3j74Pg7MPzIAzutq3YD8z8t5lSNugJcNNJnl4ol5BuURFUV7m4U2A57I?= =?us-ascii?Q?Hu2Q0B5444XyAv37q07akkA/olY4UjBd4UBpxVeKgfgDBU/fSwjOEA2b6jmc?= =?us-ascii?Q?HEFqAOuRcNa/iLVVwYqCsoxZL8vcYZLAGL/Y0pJRyCZVDQ4+R5zGdStJdLX9?= =?us-ascii?Q?spma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?us-ascii?Q?Cb6dEI5c4c8juMiU=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0301MB2004; 6:qw06ZTu6AArfmKBiBhIKfhOA3XBRy9hQ8kGOH0ZKmjbSprIQ+XPHeH8NKCwpv7XZ0kUx/2gkWHCrn9QzLWNv7bxo62L0LKNb9vi1gBmwRaq/nEy4zUhFsXc6icLuJwROLThe6c3LPU4B0oP0eSocEjZJ/6dYR7NqGgJm4DWMXHTwDx4m0kKWB76JVqSI/y//Z2VeSavWE/tQVOUNqSg10DNdY6dgxWHYwsfKk6xK3aQncxLtOsJRNqH2K+1xTewzF7ze6ATvGCS94mK8mRW4FsaR+OC1SZs63bO0hVP3V88=; 5:7OHdHurLVK+AukIek6CThLGNANuP2gGGV73wafqb5OXR2TV2/K0jnZxFwzONbhGBU9mUNsC8LRap89ZxDkUUQ82Db/V0U+TMHC1vR4Xlsu8dGbtBNc8Wx2uwvZNIrJHeP1Zi7VBQMzxopuaNBaMCcF7vwkq7Sxe+DkXRvsSc71Y=; 24:km5rFb8XLRflayNXDu+vnXIYJsg2e5og6mogRibZio7LhQOr5QUuuMIlGV+i0LMs+wbGXEf3J/gMuRa7VOHciK6HgbEl2VbI5zN7nsfJGuw=; 7:odX9kps/shOTbygmtc7v879SZybGWf8Ecp/yg3nvXHfkVJ2lHvZ3QEUr+ixOtZKEkLEccF20+SQudGlf0hJ2elElzdJPaWKNdFXHfUrdyy6icumQjGmtMK7/xQl+ibrm3Z2myciBieOISfeIzSV+SOGwUYhNDIamDken9YPpWwRoA+qXCngaLDu/PKVOzMK5SnF3yUMpTKzLxPkNNvVbteLtc6ylvB4btjySNpWaAyw6OTGbO8ST0jPD/7li1VEa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2016 08:45:04.0008 (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: BLUPR0301MB2004 Subject: [dpdk-dev] [PATCH v3 10/15] 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: Fri, 09 Sep 2016 08:45:07 -0000 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 d54ec9e..b10d985 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -242,7 +242,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)); @@ -303,7 +303,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 2a697ec..8320dc4 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1842,7 +1842,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