cryptodev: add device probing finish function
authorAkhil Goyal <gakhil@marvell.com>
Wed, 20 Oct 2021 11:27:51 +0000 (16:57 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Wed, 20 Oct 2021 13:33:16 +0000 (15:33 +0200)
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: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
lib/cryptodev/cryptodev_pmd.c
lib/cryptodev/cryptodev_pmd.h
lib/cryptodev/version.map

index fd74543..739a0b3 100644 (file)
@@ -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,
index a71edbb..9bb1e47 100644 (file)
@@ -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)\
index 0e409e7..fd5edf1 100644 (file)
@@ -121,5 +121,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;
 };