diff mbox series

[v3,4/7] cryptodev: add PMD device probe finish API

Message ID 20211018144201.2028022-5-gakhil@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers show
Series cryptodev: hide internal structures | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Akhil Goyal Oct. 18, 2021, 2:41 p.m. UTC
Added a rte_cryptodev_pmd_probing_finish API which
need to be called by the PMD after the device is initialized
completely. This will set the fast path function pointers
in the flat array for secondary process. For primary process,
these are set in rte_cryptodev_start.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
 lib/cryptodev/cryptodev_pmd.c | 16 ++++++++++++++++
 lib/cryptodev/cryptodev_pmd.h | 13 +++++++++++++
 lib/cryptodev/version.map     |  1 +
 3 files changed, 30 insertions(+)

Comments

Zhang, Roy Fan Oct. 19, 2021, 4:01 p.m. UTC | #1
> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Sent: Monday, October 18, 2021 3:42 PM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; david.marchand@redhat.com;
> hemant.agrawal@nxp.com; anoobj@marvell.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>;
> Doherty, Declan <declan.doherty@intel.com>; matan@nvidia.com;
> g.singh@nxp.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>;
> jianjay.zhou@huawei.com; asomalap@amd.com; ruifeng.wang@arm.com;
> Ananyev, Konstantin <konstantin.ananyev@intel.com>; Nicolau, Radu
> <radu.nicolau@intel.com>; ajit.khaparde@broadcom.com;
> rnagadheeraj@marvell.com; adwivedi@marvell.com; Power, Ciara
> <ciara.power@intel.com>; Akhil Goyal <gakhil@marvell.com>
> Subject: [PATCH v3 4/7] cryptodev: add PMD device probe finish API
> 
> Added a rte_cryptodev_pmd_probing_finish API which
> need to be called by the PMD after the device is initialized
> completely. This will set the fast path function pointers
> in the flat array for secondary process. For primary process,
> these are set in rte_cryptodev_start.
> 
> Signed-off-by: Akhil Goyal <gakhil@marvell.com>

Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
diff mbox series

Patch

diff --git a/lib/cryptodev/cryptodev_pmd.c b/lib/cryptodev/cryptodev_pmd.c
index fd74543682..739a0b3f34 100644
--- a/lib/cryptodev/cryptodev_pmd.c
+++ b/lib/cryptodev/cryptodev_pmd.c
@@ -161,6 +161,22 @@  rte_cryptodev_pmd_destroy(struct rte_cryptodev *cryptodev)
 	return 0;
 }
 
+void
+rte_cryptodev_pmd_probing_finish(struct rte_cryptodev *cryptodev)
+{
+	if (cryptodev == NULL)
+		return;
+	/*
+	 * for secondary process, at that point we expect device
+	 * to be already 'usable', so shared data and all function
+	 * pointers for fast-path devops have to be setup properly
+	 * inside rte_cryptodev.
+	 */
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+		cryptodev_fp_ops_set(rte_crypto_fp_ops +
+				cryptodev->data->dev_id, cryptodev);
+}
+
 static uint16_t
 dummy_crypto_enqueue_burst(__rte_unused void *qp,
 			   __rte_unused struct rte_crypto_op **ops,
diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index a71edbb991..9bb1e47ae4 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -509,6 +509,19 @@  __rte_internal
 uint8_t rte_cryptodev_allocate_driver(struct cryptodev_driver *crypto_drv,
 		const struct rte_driver *drv);
 
+/**
+ * @internal
+ * This is the last step of device probing. It must be called after a
+ * cryptodev is allocated and initialized successfully.
+ *
+ * @param	dev	Pointer to cryptodev struct
+ *
+ * @return
+ *  void
+ */
+__rte_internal
+void
+rte_cryptodev_pmd_probing_finish(struct rte_cryptodev *dev);
 
 #define RTE_PMD_REGISTER_CRYPTO_DRIVER(crypto_drv, drv, driver_id)\
 RTE_INIT(init_ ##driver_id)\
diff --git a/lib/cryptodev/version.map b/lib/cryptodev/version.map
index ed62ced221..157dac521d 100644
--- a/lib/cryptodev/version.map
+++ b/lib/cryptodev/version.map
@@ -123,5 +123,6 @@  INTERNAL {
 	rte_cryptodev_pmd_get_dev;
 	rte_cryptodev_pmd_get_named_dev;
 	rte_cryptodev_pmd_parse_input_args;
+	rte_cryptodev_pmd_probing_finish;
 	rte_cryptodev_pmd_release_device;
 };