From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0083.outbound.protection.outlook.com [104.47.40.83]) by dpdk.org (Postfix) with ESMTP id 0F7395A4F for ; Fri, 26 Aug 2016 15:57:46 +0200 (CEST) Received: from BN3PR0301CA0024.namprd03.prod.outlook.com (10.160.180.162) by BY2PR03MB1878.namprd03.prod.outlook.com (10.164.114.18) with Microsoft SMTP Server (TLS) id 15.1.466.19; Fri, 26 Aug 2016 13:57:43 +0000 Received: from BN1BFFO11FD052.protection.gbl (2a01:111:f400:7c10::1:163) by BN3PR0301CA0024.outlook.office365.com (2a01:111:e400:4000::34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.599.9 via Frontend Transport; Fri, 26 Aug 2016 13:57:43 +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 BN1BFFO11FD052.mail.protection.outlook.com (10.58.145.7) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.587.6 via Frontend Transport; Fri, 26 Aug 2016 13:57:44 +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 u7QDvHpi023630; Fri, 26 Aug 2016 06:57:42 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Fri, 26 Aug 2016 19:26:45 +0530 Message-ID: <1472219823-29486-8-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472219823-29486-1-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1472219823-29486-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131166934651252764; (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)(86362001)(5890100001)(87936001)(575784001)(110136002)(85426001)(76176999)(77096005)(81156014)(33646002)(8676002)(8666005)(50986999)(4326007)(97736004)(106466001)(81166006)(48376002)(92566002)(5003940100001)(2906002)(7846002)(189998001)(36756003)(105606002)(104016004)(2950100001)(229853001)(586003)(47776003)(8936002)(50466002)(305945005)(356003)(5660300001)(50226002)(11100500001)(19580395003)(2351001)(626004)(19580405001)(68736007)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB1878; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD052; 1:x3rUnPh6CHvOJkk1J3j8qhvK3962NTXBy2Su/GfkB0SFYR3MtE9EQFstA3G1hlQQ3qkNKkBXaX/iXQ5JXuF2HTWwAWauzHurRhZZrIXnjV8Sep+UNlpldNz6kduAKfSwqfIwOMcoTw83t2esLZ5hssysVY9B3oO2sTqBBRhcR5bDBJ907BpPN/YIJWHMqKOBnpBndeJvO0a2wX7reY7b+6JyAZzfrTWO4y7ahZ5f9ZrsnkwkXIpkF34Yh/Aufk6OUVNnnQFElRT/pHeZ1Dn29I+DD/6Bc3LYYFj7ltpa9J1nPETg+X5c00KPFhghsyQkAdwnOfuDnEp1CI336vaS68Tr+qn2Mio5rpQw5aKtUAEQVg8ZlH06yQ8wPI55rDUKEs0pju1z2E5clg76a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LxsAKtIpK5U4qC7LxXPTTRzzUvVYdoGgPq+bvfdAg5uR72j565eKi9qVp5NyJOR1IpPQ5yATUX7bcjPwVcWhvWLU3pAQKcxmRb/vZPGRu9uhtfAFyXkJnP5W0u1ThG9iTKibV8= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB1878; 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)(13024025)(13018025)(13023025)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BY2PR03MB1878; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB1878; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB1878; 4:BG7oF8pWrXh6jyrQqOXvC5L3AC+pJPlkIL9Qy2dN3Ut8zbUPxSGDdimrCcgV+i1Oz6BY2mAosxB47MwUxDEfEH7lQfWWMdODnniuki7PBzx0uSbLFA8EhJO3/hKb5Cjd6+ZUKxpeKgDe2NWDNC5jWcVlb/PQBi5zhvbG/JbV/I0jiXwgWZCM9Ntv2amNS8Tt1FNAAAX+OotPFlJ86Ma14wbq186TlF0YoqmBT5gomm79bbqU0GuUnf7GJlHk9nPrxsZ/8pbGUVQnHK8TARX1LOWrLK5x0kHIBAmBWYyBXoyO2xuq8Cv3RTU/jjra3mY17nKnTYzRXXLzJEGo76HCM3AoDpkNqXLAAVWR6rs4N2e5vUonMulR5gpNku3kXz7Eu4gOQn3wjHYQZUNiK/mOQdduh2Zud3319pzdKG3nFCuokJGszyCrxg4g3wFL9Fqin0xQ11GzRym8TJD7Xtl4k1S4QL5LvCWtB0s8gwfkMhZiimsOOn6KXdVHaQM8xq8a4Tqw1F86WS70aBdTNBV0fLzAT9+PyAbE+v1eQDM1vZc= X-Forefront-PRVS: 00462943DE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR03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qG35dbbr5oLoEBrY2FI+jghy2aUQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 13:57:44.9380 (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: BY2PR03MB1878 Subject: [dpdk-dev] [PATCH v8 07/25] driver: init/uninit common wrappers for PCI drivers 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, 26 Aug 2016 13:57:46 -0000 crypto and ethdev drivers aligned to PCI probe/remove. Existing handlers for init/uninit can be easily reused for this. Signed-off-by: David Marchand Signed-off-by: Shreyansh Jain --- lib/librte_cryptodev/rte_cryptodev.c | 16 ++++++++-------- lib/librte_cryptodev/rte_cryptodev_pmd.h | 12 ++++++++++++ lib/librte_cryptodev/rte_cryptodev_version.map | 7 +++++++ lib/librte_ether/rte_ethdev.c | 14 +++++++------- lib/librte_ether/rte_ethdev.h | 13 +++++++++++++ lib/librte_ether/rte_ether_version.map | 9 +++++++++ 6 files changed, 56 insertions(+), 15 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 6434894..b1e82b6 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -429,9 +429,9 @@ rte_cryptodev_pmd_virtual_dev_init(const char *name, size_t dev_private_size, return cryptodev; } -static int -rte_cryptodev_init(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev) +int +rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev) { struct rte_cryptodev_driver *cryptodrv; struct rte_cryptodev *cryptodev; @@ -490,8 +490,8 @@ rte_cryptodev_init(struct rte_pci_driver *pci_drv, return -ENXIO; } -static int -rte_cryptodev_uninit(struct rte_pci_device *pci_dev) +int +rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev) { const struct rte_cryptodev_driver *cryptodrv; struct rte_cryptodev *cryptodev; @@ -539,15 +539,15 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv, { /* Call crypto device initialization directly if device is virtual */ if (type == PMD_VDEV) - return rte_cryptodev_init((struct rte_pci_driver *)cryptodrv, + return rte_cryptodev_pci_probe((struct rte_pci_driver *)cryptodrv, NULL); /* * Register PCI driver for physical device intialisation during * PCI probing */ - cryptodrv->pci_drv.devinit = rte_cryptodev_init; - cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit; + cryptodrv->pci_drv.devinit = rte_cryptodev_pci_probe; + cryptodrv->pci_drv.devuninit = rte_cryptodev_pci_remove; rte_eal_pci_register(&cryptodrv->pci_drv); diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index c977c61..3fb7c7c 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -534,6 +534,18 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *crypto_drv, void rte_cryptodev_pmd_callback_process(struct rte_cryptodev *dev, enum rte_cryptodev_event_type event); +/** + * Wrapper for use by pci drivers as a .devinit function to attach to a crypto + * interface. + */ +int rte_cryptodev_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev); + +/** + * Wrapper for use by pci drivers as a .devuninit function to detach a crypto + * interface. + */ +int rte_cryptodev_pci_remove(struct rte_pci_device *pci_dev); #ifdef __cplusplus } diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index a08fd20..1fc0d57 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -39,3 +39,10 @@ DPDK_16.07 { rte_cryptodev_parse_vdev_init_params; } DPDK_16.04; + +DPDK_16.11 { + global: + + rte_cryptodev_pci_probe; + rte_cryptodev_pci_remove; +} DPDK_16.07; diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f62a9ec..8825219 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -245,9 +245,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) return 0; } -static int -rte_eth_dev_init(struct rte_pci_driver *pci_drv, - struct rte_pci_device *pci_dev) +int +rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev) { struct eth_driver *eth_drv; struct rte_eth_dev *eth_dev; @@ -299,8 +299,8 @@ rte_eth_dev_init(struct rte_pci_driver *pci_drv, return diag; } -static int -rte_eth_dev_uninit(struct rte_pci_device *pci_dev) +int +rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev) { const struct eth_driver *eth_drv; struct rte_eth_dev *eth_dev; @@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev) void rte_eth_driver_register(struct eth_driver *eth_drv) { - eth_drv->pci_drv.devinit = rte_eth_dev_init; - eth_drv->pci_drv.devuninit = rte_eth_dev_uninit; + eth_drv->pci_drv.devinit = rte_eth_dev_pci_probe; + eth_drv->pci_drv.devuninit = rte_eth_dev_pci_remove; rte_eal_pci_register(ð_drv->pci_drv); } diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index b0fe033..37d78bf 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -4368,6 +4368,19 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id); int rte_eth_dev_get_name_by_port(uint8_t port_id, char *name); +/** + * Wrapper for use by pci drivers as a .devinit function to attach to a ethdev + * interface. + */ +int rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv, + struct rte_pci_device *pci_dev); + +/** + * Wrapper for use by pci drivers as a .devuninit function to detach a ethdev + * interface. + */ +int rte_eth_dev_pci_remove(struct rte_pci_device *pci_dev); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index 45ddf44..17e7448 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -138,4 +138,13 @@ DPDK_16.07 { rte_eth_dev_get_name_by_port; rte_eth_dev_get_port_by_name; rte_eth_xstats_get_names; + } DPDK_16.04; + +DPDK_16.11 { + global: + + rte_eth_dev_pci_probe; + rte_eth_dev_pci_remove; + +} DPDK_16.07; -- 2.7.4