From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0089.outbound.protection.outlook.com [104.47.34.89]) by dpdk.org (Postfix) with ESMTP id 5A2296CB3 for ; Fri, 28 Oct 2016 14:31:12 +0200 (CEST) Received: from BN6PR03CA0018.namprd03.prod.outlook.com (10.168.230.156) by CY1PR0301MB1626.namprd03.prod.outlook.com (10.162.166.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Fri, 28 Oct 2016 12:31:11 +0000 Received: from BN1AFFO11FD053.protection.gbl (2a01:111:f400:7c10::152) by BN6PR03CA0018.outlook.office365.com (2603:10b6:404:23::28) 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; Fri, 28 Oct 2016 12:31:10 +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 BN1AFFO11FD053.mail.protection.outlook.com (10.58.53.68) 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:31:10 +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 u9SCPEMT019399; Fri, 28 Oct 2016 05:31:07 -0700 From: Shreyansh Jain To: Date: Fri, 28 Oct 2016 17:56:34 +0530 Message-ID: <1477657598-826-18-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: 131221314702643770; (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)(189002)(199003)(8676002)(4326007)(7846002)(50466002)(229853001)(33646002)(48376002)(2351001)(11100500001)(305945005)(81166006)(586003)(68736007)(5660300001)(356003)(2906002)(104016004)(626004)(8936002)(81156014)(105606002)(106466001)(50226002)(8666005)(76176999)(50986999)(6666003)(85426001)(19580405001)(19580395003)(92566002)(87936001)(97736004)(189998001)(47776003)(77096005)(2950100002)(110136003)(5003940100001)(6916009)(36756003)(86362001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1626; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD053; 1:Fmuj0xEFCc6O0MEKFAGUFan5nDlx0TgP3MZ8kl369erv9spZ0h1QiwvdpUEieqvGKwd3sOUE1a0HpC9U+UDNxbEUaX4svXsLUyp7NQTnVuC97KnDH4naKm7WUytQZpFVGcbhAkgLi6DNoF1izMibTcfhgJvx1gPUBMjVQFDXKFX810j68/xnUNRWCQJun6k1YrxAmfVc+bbhdhGW8/utSogi+LeU/PRUWxdmtXfp9wE2Qfwlz3v3QYuiGV9cXhXEaidBhohRSenst1cQJCVTbNOqfXbUM1g1NKd7QUbC9lWVoR48jkt8lYBRgVXgeWDQjVMRucWq0YhQXKVjOOovaXkMmos+X37vUFwTchD4uHrHWGsdR3VtU4Nz3SE1GgjvGrSKQMlmd3TJ8zb0ovPWQBPY3RLY9gCt/p1QN44w8IjJ2yoMPFbksRgFPrFczU838Uka8frLCilSIF0qb1Sqgo7QO8aJICVjC4kNUZTxURdw1LFNt033TMfT+5tqQa/GcgOgSpNpc+334NsUfcStRl8neBJG+TY7Z+BNwAGd+Xf37wzOeLjD7vDWAzBXM/Y7VeAfK/Qxd7mLtZPOzEpPn0CPVYnWBpXftHIXbguGBIDBhRICDE5wj7LZmQ32DAAb304oqmOs1Il38XEX12vUcnOrHuB/ZtIcJ9/E0zVJTq2cxoqzi6g0TjeMy7cSs+Yx91AM/yYJKMWauyIkO9hMH8SpPUzTSx8NI3FkP6yPi44= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 76ac7f04-7828-4110-30dd-08d3ff2e4c44 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 2:55J5N1dkN9mfp42vKbF4RTrrdpVREnEn/31sHXKFVqURAje6b1BRoMJ9QwSkrtHmtIUOESJagE67fKUgwucJtRMcf1vdS+3px+ry/95qdxu5dT1r7OF8C5lqwtz4UWZWbcAXdGueyd6VQnpPfuKRI44bpMdFJStpUxgX3mrdqeBERDcUNaoax/NTTYHGUUMMz2z1uB7V9ST5wZhweBzpvw==; 3:/tuF58wDFGy98MeBtC/K5S+CKbuGtkBJdzH4N227ICb5Zr/4BIr325sGLggykhJ2ASTAbnd5Oldf3sTCHsQptsTKYLk+CJw4y+0CMUPxAvBVBAYcgk8zHx4lhOa+lFZOf5UFpNodmhVkbjqhSDzAyvcawsBlqLXVyCgCJHI0PrUrbHunrzSqhwN8vm/zTq02w3y9IHoIAqX/Z1X2IPbI9w19/Yr1mgUqu1t7EP+NruItgEzHGjAuTMpKszqw53wM X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1626; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 25:b7vJS+RXrAEXZpQhBtrQaF9R6VsfuE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vCV/Q==; 4:jEBJEi64OncJjKICtggilwzoudt9xWKtsLZAb1HEQR/YkiHVM2QwiKRKGDAFb6Q1tEu8310ZC6smUrU2aK1KN0nKfBVlYHe77/NwKvy6NYuXmY5Z+SUMkdPDPu+sA8doUb6Hx6pgcg+o6vDjnjXH27+/m6t24uQYeimtgexTn2FULf3ol3mxBlXfu6Vv6LU+0fTd7q/A/s+hTBDwnuRFwO4Y7HvOqgHCQ7kj3Nw0Qqt6nQkqKQb0U8GHEStPu7A/UcGGCs9Xs3SxAlSkvataTSr8/QXBFcCLL/GbNgaOb+ZNZP9KxKgmjRBT4ovcmhK+VqWMpJp9K2ixqP2HvZUYtlqFGBt1nih37MZFi4h8zQzzjLkYoXaALZZk0X5KDk0Nk7bDkoX8MQMlkgCwTltGlADAqocOPbQVkxFWQkOH934sS6i1/y6LRqjg+/TVQrs5QRGwHFlpHs+trXDOrCOHNsiw4E2hFHEGVx68K5YQ/+lcAK6kF8JZjtk4xGGip0BJwYTG50/poqyxu3TwM6LV+1rkkK+ayyCRE/QTg219wRsemJGkgU1u0YPPaT1c7P47 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)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB1626; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB1626; X-Forefront-PRVS: 0109D382B0 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1626; 23:V67CsVnTsFBk/EzJmYjM4qfsQtX/HfEPxGWtwhO?= =?us-ascii?Q?f2ZyZNLUVUdlUvTVc81Tf6Yb+YdaaJuyFlEuTaJ/MiyAItw+44w/X0CVAnwY?= =?us-ascii?Q?cOAFE4pqJ8UAy+UhwH3wGx2UEcma2gxpzPDLJAqG0y8kzfMc+8L+pEm1g/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4K0IFzEgmSKLKtmxBMcXHL5AP/NsyjC?= =?us-ascii?Q?u2HpI22O0HqwaDQQKAMvqipquvT5WrTsmFE6YinTsq0xVj0hUULccYFSiALB?= =?us-ascii?Q?yZt9cCnN4JqYZ7X4CUIwptkBA0Nu+pG6uHhSweZJ0finU4jVxvcOAjG8u19m?= =?us-ascii?Q?WLl43n7dpXUqVo/7N1skCCc8pBCCIhj0S98eI?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 6:TazSw951N3CBwGl/qE2BJag5/taWpoifcQ9IoeECSRyi8PIyfyVUnDZHWIhu7+/AVnluB6ugG4PNgswwdQXVIehG8WfcXqPKW/dUAXNpOXmAJ18UnsqlPj732iDmH/HV1ePZYA1TGkWizUx5Kl0xC7+5gHJBmH7ykkBO0TbDVmWlfNq2IGSoQxB7GoFdMrBvSCipQBfk/qjeUh12p3QfmLC0++MN6p0t3hp2smcErdgDBATmbnpcS0u35ko9GrXL2lj6QLWUn43oYI3gUJ6rQa79HVh5bwKXtDXqImBA+RZ3p4cy3OGz70/OCXIpWFA+; 5:+PBfnRPXET4LCu8YZA66TLDdeJY9NJ5jjZYTLK2cX/l+UM1uM3vFJwMDONNkA6iGcZs3bO+QKs3m0sBmFoNajJlyFMKQFd4IhlxxbGWn1RyMR7kpE/Gn1GPJLi2WtGXiry1t5bwZ8FpAhA8fGKixFyVN4xynnOyyCLDaNE03Lx2xHqzW+3lLLFnMipdldcYN; 24:8zt2MMpr5FS9kJRxSTwjVAFfIpYDKhEPWxQ+Uyw1/px3nrAQzhJZvowlxwV4ks1hfnyj0ZeOMmmAhx/plauYe3xj5EqY/UdYtJVPCq5Nr8A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1626; 7:tRlk/piwjkC4w7VBuQI/YOyVwQRUPdh/aAAtEq8r+z+gYyQR4yiqbzR6Nx6XQSqpAkEUSp55ytkn+eSTj7QJIbV2H8ZOlui/q4erqf34d8TOyiWXNt9C8AV2+2XfC3fVoYy+yVICgO+0R8kGrD3T2gyu97ncHsAJjytzlP5CqAmgtUTKDEMpsTfpj7RTsBCgKV850jBYLl9X9pq9fpUQ0tSrSuIxQOW8gf8QpC2DdzH2s1drC7ul3gDlrP3n5YcDiBmfGh4uF/dX1gJxIU+S12n0OXct05OFYhjTzyGwLmUeOMVEIDRBtLAf9KeRU2PawH2x4v0Qt97RZmpTmsT6G0KoBkcVDTFerDYFnQfYIsQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2016 12:31:10.0615 (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: CY1PR0301MB1626 Cc: Shreyansh Jain , thomas.monjalon@6wind.com, viktorin@rehivetech.com Subject: [dpdk-dev] [PATCH v7 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: Fri, 28 Oct 2016 12:31:13 -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