Skip to content

Commit

Permalink
crypto/dpaa_sec: fix secondary process probing
Browse files Browse the repository at this point in the history
[ upstream commit 96ec64f ]

DPAA hardware supports non-i/o performing secondary
applications only. So we do not have to probe crypto
devices in secondary applications.

Fixes: c3e85bd ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform")

Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
Vanshika Shukla authored and steevenlee committed Jun 20, 2022
1 parent faf1c3b commit 4565093
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions drivers/crypto/dpaa_sec/dpaa_sec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3445,23 +3445,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;
Expand Down Expand Up @@ -3501,8 +3502,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);

Expand Down

0 comments on commit 4565093

Please sign in to comment.