DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] crypto/dpaa2_sec: use bus device name
@ 2025-11-19  8:06 David Marchand
  2025-11-19  9:35 ` Hemant Agrawal
  0 siblings, 1 reply; 2+ messages in thread
From: David Marchand @ 2025-11-19  8:06 UTC (permalink / raw)
  To: dev; +Cc: maxime, Gagandeep Singh, Hemant Agrawal

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.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
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(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 698548e6ea..995e375fb5 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -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;
 
-- 
2.51.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] crypto/dpaa2_sec: use bus device name
  2025-11-19  8:06 [PATCH] crypto/dpaa2_sec: use bus device name David Marchand
@ 2025-11-19  9:35 ` Hemant Agrawal
  0 siblings, 0 replies; 2+ messages in thread
From: Hemant Agrawal @ 2025-11-19  9:35 UTC (permalink / raw)
  To: David Marchand, dev; +Cc: maxime, Gagandeep Singh

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-19  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-19  8:06 [PATCH] crypto/dpaa2_sec: use bus device name David Marchand
2025-11-19  9:35 ` Hemant Agrawal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).