Skip to contentSkip to conversation

crypto/dpaa2_sec: use bus device name

PATCH Applied David Marchand 3 participants 3 messages Nov 19, 2025 – Feb 10 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/dpaa2_sec: use bus device name

dpaa2_sec_dev_init() sets the crypto device name again after it has been set by rte_cryptodev_pmd_create/allocate(). Overwritting its value could end up as a bug if the cryptodev library changes the way it calls cryptodev objects.

Besides, there is no need to generate a name for the crypto device different than the bus device, as there is a 1:1 relation between those objects.

Reuse the bus device name directly, iow: dpseci.XXX instead of dpsec-XXX.

---
Note: this is a followup cleanup following Maxime comment, no pressure on getting this merged for this release.

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +2 -12
index 698548e6ea..995e375fb5 100644
@@ -4456,8 +4456,6 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
 			     retcode);
 		goto init_error;
 	}
-	snprintf(cryptodev->data->name, sizeof(cryptodev->data->name),
-			"dpsec-%u", hw_id);
 
 	internals->max_nb_queue_pairs = attr.num_tx_queues;
 	cryptodev->data->nb_queue_pairs = internals->max_nb_queue_pairs;
@@ -4482,7 +4480,6 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 			  struct rte_dpaa2_device *dpaa2_dev)
 {
 	struct rte_cryptodev *cryptodev;
-	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	int retval;
 	struct rte_cryptodev_pmd_init_params init_params = {
 		.name = "",
@@ -4493,10 +4490,7 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 			/* setting default, will be updated in init. */
 	};
 
-	snprintf(cryptodev_name, sizeof(cryptodev_name), "dpsec-%d",
-			dpaa2_dev->object_id);
-
-	cryptodev = rte_cryptodev_pmd_create(cryptodev_name, &dpaa2_dev->device,
+	cryptodev = rte_cryptodev_pmd_create(dpaa2_dev->device.name, &dpaa2_dev->device,
 			&init_params);
 	if (cryptodev == NULL) {
 		DPAA2_SEC_ERR("failed to create cryptodev vdev");
@@ -4524,14 +4518,10 @@ cryptodev_dpaa2_sec_probe(struct rte_dpaa2_driver *dpaa2_drv __rte_unused,
 static int
 cryptodev_dpaa2_sec_remove(struct rte_dpaa2_device *dpaa2_dev)
 {
-	char cryptodev_name[RTE_CRYPTODEV_NAME_MAX_LEN];
 	struct rte_cryptodev *cryptodev;
 	int ret;
 
-	snprintf(cryptodev_name, sizeof(cryptodev_name), "dpsec-%d",
-			dpaa2_dev->object_id);
-
-	cryptodev = rte_cryptodev_pmd_get_named_dev(cryptodev_name);
+	cryptodev = rte_cryptodev_pmd_get_named_dev(dpaa2_dev->device.name);
 	if (cryptodev == NULL)
 		return -ENODEV;
 
Signature · 1 line
2.51.1
Applied
#2 lore raw
In reply to David Marchand
Quoted 5 lines

dpaa2_sec_dev_init() sets the crypto device name again after it has been set by rte_cryptodev_pmd_create/allocate(). Overwritting its value could end up as a bug if the cryptodev library changes the way it calls cryptodev objects.

Quoted 7 lines

Besides, there is no need to generate a name for the crypto device different than the bus device, as there is a 1:1 relation between those objects.

Reuse the bus device name directly, iow: dpseci.XXX instead of dpsec-XXX.

Applied to dpdk-next-crypto
Thanks.