crypto/dpaa_sec: fix secondary process probing
authorVanshika Shukla <vanshika.shukla@nxp.com>
Thu, 28 Apr 2022 11:47:27 +0000 (17:17 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Fri, 29 Apr 2022 09:27:35 +0000 (11:27 +0200)
DPAA hardware supports non-i/o performing secondary
applications only. So we do not have to probe crypto
devices in secondary applications.

Fixes: c3e85bdcc6e6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform")
Cc: stable@dpdk.org
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
drivers/crypto/dpaa_sec/dpaa_sec.c

index 23a94d7..6f2b4ba 100644 (file)
@@ -3766,23 +3766,24 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused,
 
        int retval;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
+
        snprintf(cryptodev_name, sizeof(cryptodev_name), "%s", dpaa_dev->name);
 
        cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id());
        if (cryptodev == NULL)
                return -ENOMEM;
 
-       if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-               cryptodev->data->dev_private = rte_zmalloc_socket(
-                                       "cryptodev private structure",
-                                       sizeof(struct dpaa_sec_dev_private),
-                                       RTE_CACHE_LINE_SIZE,
-                                       rte_socket_id());
+       cryptodev->data->dev_private = rte_zmalloc_socket(
+                               "cryptodev private structure",
+                               sizeof(struct dpaa_sec_dev_private),
+                               RTE_CACHE_LINE_SIZE,
+                               rte_socket_id());
 
-               if (cryptodev->data->dev_private == NULL)
-                       rte_panic("Cannot allocate memzone for private "
-                                       "device data");
-       }
+       if (cryptodev->data->dev_private == NULL)
+               rte_panic("Cannot allocate memzone for private "
+                               "device data");
 
        dpaa_dev->crypto_dev = cryptodev;
        cryptodev->device = &dpaa_dev->device;
@@ -3824,8 +3825,7 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused,
        retval = -ENXIO;
 out:
        /* In case of error, cleanup is done */
-       if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-               rte_free(cryptodev->data->dev_private);
+       rte_free(cryptodev->data->dev_private);
 
        rte_cryptodev_pmd_release_device(cryptodev);