[dpdk-dev,v6,06/17] crypto: export init/uninit common wrappers for pci drivers

Message ID 1468303282-2806-7-git-send-email-shreyansh.jain@nxp.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Shreyansh Jain July 12, 2016, 6:01 a.m. UTC
  Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
that can be used by pci drivers that assume a 1 to 1 association between
pci resource and upper interface.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 lib/librte_cryptodev/rte_cryptodev.c           | 16 ++++++++--------
 lib/librte_cryptodev/rte_cryptodev_pmd.h       | 12 ++++++++++++
 lib/librte_cryptodev/rte_cryptodev_version.map |  2 ++
 3 files changed, 22 insertions(+), 8 deletions(-)
  

Comments

Jan Viktorin July 14, 2016, 5:06 p.m. UTC | #1
On Tue, 12 Jul 2016 11:31:11 +0530
Shreyansh Jain <shreyansh.jain@nxp.com> wrote:

> Preparing for getting rid of rte_cryptodev_driver, here are two wrappers
> that can be used by pci drivers that assume a 1 to 1 association between
> pci resource and upper interface.
> 
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
> ---
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
  

Patch

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index c3cc3e9..3a75f2c 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -431,9 +431,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;
@@ -492,8 +492,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;
@@ -541,15 +541,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..7aa7f4e 100644
--- a/lib/librte_cryptodev/rte_cryptodev_version.map
+++ b/lib/librte_cryptodev/rte_cryptodev_version.map
@@ -37,5 +37,7 @@  DPDK_16.07 {
 	global:
 
 	rte_cryptodev_parse_vdev_init_params;
+	rte_cryptodev_pci_probe;
+	rte_cryptodev_pci_remove;
 
 } DPDK_16.04;