DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] crypto/ccp:  bug fixes for ccp device probe flow
@ 2022-11-24 13:56 Sunil Uttarwar
  2023-02-27 18:29 ` [EXT] " Akhil Goyal
  2023-03-06 12:58 ` [PATCH v2] " Sunil Uttarwar
  0 siblings, 2 replies; 6+ messages in thread
From: Sunil Uttarwar @ 2022-11-24 13:56 UTC (permalink / raw)
  To: dev; +Cc: selwin.sebastian, Sunil Uttarwar

- Fixed flow for probe and initialization of requested ccp devices
- Removed unnecessary code enumerating for all the PCI devices
  available in the system.
- Removed ccp_pmd_init_done flag controlling probe and initialization
  of only one CCP device even if other CCP devices available

Signed-off-by: Sunil Uttarwar <sunilprakashrao.uttarwar@amd.com>
---
 drivers/crypto/ccp/ccp_dev.c     | 28 ++++++++++------------------
 drivers/crypto/ccp/rte_ccp_pmd.c |  7 -------
 2 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/drivers/crypto/ccp/ccp_dev.c b/drivers/crypto/ccp/ccp_dev.c
index 424ead82c3..9e3c2d6a63 100644
--- a/drivers/crypto/ccp/ccp_dev.c
+++ b/drivers/crypto/ccp/ccp_dev.c
@@ -683,13 +683,11 @@ ccp_probe_devices(struct rte_pci_device *pci_dev,
 {
 	int dev_cnt = 0;
 	int ccp_type = 0;
-	struct dirent *d;
 	DIR *dir;
 	int ret = 0;
 	int module_idx = 0;
-	uint16_t domain;
-	uint8_t bus, devid, function;
 	char dirname[PATH_MAX];
+	char name[RTE_CRYPTODEV_NAME_MAX_LEN];
 
 	module_idx = ccp_check_pci_uio_module();
 	if (module_idx < 0)
@@ -700,21 +698,15 @@ ccp_probe_devices(struct rte_pci_device *pci_dev,
 	dir = opendir(SYSFS_PCI_DEVICES);
 	if (dir == NULL)
 		return -1;
-	while ((d = readdir(dir)) != NULL) {
-		if (d->d_name[0] == '.')
-			continue;
-		if (ccp_parse_pci_addr_format(d->d_name, sizeof(d->d_name),
-					&domain, &bus, &devid, &function) != 0)
-			continue;
-		snprintf(dirname, sizeof(dirname), "%s/%s",
-			     SYSFS_PCI_DEVICES, d->d_name);
-		if (is_ccp_device(dirname, ccp_id, &ccp_type)) {
-			printf("CCP : Detected CCP device with ID = 0x%x\n",
-			       ccp_id[ccp_type].device_id);
-			ret = ccp_probe_device(ccp_type, pci_dev);
-			if (ret == 0)
-				dev_cnt++;
-		}
+	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
+	snprintf(dirname, sizeof(dirname), "%s/%s",
+		     SYSFS_PCI_DEVICES, name);
+	if (is_ccp_device(dirname, ccp_id, &ccp_type)) {
+		printf("CCP : Detected CCP device with ID = 0x%x\n",
+		       ccp_id[ccp_type].device_id);
+		ret = ccp_probe_device(ccp_type, pci_dev);
+		if (ret == 0)
+			dev_cnt++;
 	}
 	closedir(dir);
 	return dev_cnt;
diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index 221a0a5235..ea77d79efc 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -19,7 +19,6 @@
 /**
  * Global static parameter used to find if CCP device is already initialized.
  */
-static unsigned int ccp_pmd_init_done;
 uint8_t ccp_cryptodev_driver_id;
 uint8_t cryptodev_cnt;
 extern void *sha_ctx;
@@ -199,7 +198,6 @@ cryptodev_ccp_remove(struct rte_pci_device *pci_dev)
 	if (dev == NULL)
 		return -ENODEV;
 
-	ccp_pmd_init_done = 0;
 	rte_free(sha_ctx);
 
 	RTE_LOG(INFO, PMD, "Closing ccp device %s on numa socket %u\n",
@@ -288,10 +286,6 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	};
 
 	sha_ctx = (void *)rte_malloc(NULL, SHA512_DIGEST_SIZE, 64);
-	if (ccp_pmd_init_done) {
-		RTE_LOG(INFO, PMD, "CCP PMD already initialized\n");
-		return -EFAULT;
-	}
 	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
 	if (name[0] == '\0')
 		return -EINVAL;
@@ -310,7 +304,6 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	rc = cryptodev_ccp_create(name, pci_dev, &init_params, pci_drv);
 	if (rc)
 		return rc;
-	ccp_pmd_init_done = 1;
 	return 0;
 }
 
-- 
2.25.1


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

* RE: [EXT] [PATCH v1] crypto/ccp: bug fixes for ccp device probe flow
  2022-11-24 13:56 [PATCH v1] crypto/ccp: bug fixes for ccp device probe flow Sunil Uttarwar
@ 2023-02-27 18:29 ` Akhil Goyal
  2023-03-02 11:53   ` David Marchand
  2023-03-06 12:58 ` [PATCH v2] " Sunil Uttarwar
  1 sibling, 1 reply; 6+ messages in thread
From: Akhil Goyal @ 2023-02-27 18:29 UTC (permalink / raw)
  To: Sunil Uttarwar, dev; +Cc: selwin.sebastian, David Marchand

> - Fixed flow for probe and initialization of requested ccp devices
> - Removed unnecessary code enumerating for all the PCI devices
>   available in the system.
> - Removed ccp_pmd_init_done flag controlling probe and initialization
>   of only one CCP device even if other CCP devices available
> 
> Signed-off-by: Sunil Uttarwar <sunilprakashrao.uttarwar@amd.com>
Hi Sunil,

Kindly work with David for the patch that was not merged and rebase this patch as needed.

Marking this patch as changes requested.

Regards,
Akhil

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

* Re: [EXT] [PATCH v1] crypto/ccp: bug fixes for ccp device probe flow
  2023-02-27 18:29 ` [EXT] " Akhil Goyal
@ 2023-03-02 11:53   ` David Marchand
  0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2023-03-02 11:53 UTC (permalink / raw)
  To: Akhil Goyal; +Cc: Sunil Uttarwar, dev, selwin.sebastian

On Mon, Feb 27, 2023 at 7:29 PM Akhil Goyal <gakhil@marvell.com> wrote:
>
> > - Fixed flow for probe and initialization of requested ccp devices
> > - Removed unnecessary code enumerating for all the PCI devices
> >   available in the system.
> > - Removed ccp_pmd_init_done flag controlling probe and initialization
> >   of only one CCP device even if other CCP devices available
> >
> > Signed-off-by: Sunil Uttarwar <sunilprakashrao.uttarwar@amd.com>
> Hi Sunil,
>
> Kindly work with David for the patch that was not merged and rebase this patch as needed.
>
> Marking this patch as changes requested.

Sorry, I kept on postponing work on this patch of mine... thanks for
keeping on pinging me Akhil :-).
I sent a v3 which should address Sunil comment.


-- 
David Marchand


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

* [PATCH v2] crypto/ccp: bug fixes for ccp device probe flow
  2022-11-24 13:56 [PATCH v1] crypto/ccp: bug fixes for ccp device probe flow Sunil Uttarwar
  2023-02-27 18:29 ` [EXT] " Akhil Goyal
@ 2023-03-06 12:58 ` Sunil Uttarwar
  2023-03-11 18:47   ` [EXT] " Akhil Goyal
  1 sibling, 1 reply; 6+ messages in thread
From: Sunil Uttarwar @ 2023-03-06 12:58 UTC (permalink / raw)
  To: gakhil, david.marchand
  Cc: ferruh.yigit, selwin.sebastian, dev, Sunil Uttarwar

- Rebasing patch([v1] crypto/ccp: bug fixes for ccp device probe flow)

Signed-off-by: Sunil Uttarwar <sunilprakashrao.uttarwar@amd.com>
---
 drivers/crypto/ccp/rte_ccp_pmd.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c b/drivers/crypto/ccp/rte_ccp_pmd.c
index a5271d7227..5d1a4445de 100644
--- a/drivers/crypto/ccp/rte_ccp_pmd.c
+++ b/drivers/crypto/ccp/rte_ccp_pmd.c
@@ -19,7 +19,6 @@
 /**
  * Global static parameter used to find if CCP device is already initialized.
  */
-static unsigned int ccp_pmd_init_done;
 uint8_t ccp_cryptodev_driver_id;
 uint8_t cryptodev_cnt;
 
@@ -192,8 +191,6 @@ cryptodev_ccp_remove(struct rte_pci_device *pci_dev)
 	if (dev == NULL)
 		return -ENODEV;
 
-	ccp_pmd_init_done = 0;
-
 	RTE_LOG(INFO, PMD, "Closing ccp device %s on numa socket %u\n",
 			name, rte_socket_id());
 
@@ -278,10 +275,6 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv __rte_unused,
 		.auth_opt = CCP_PMD_AUTH_OPT_CCP,
 	};
 
-	if (ccp_pmd_init_done) {
-		RTE_LOG(INFO, PMD, "CCP PMD already initialized\n");
-		return -EFAULT;
-	}
 	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
 	if (name[0] == '\0')
 		return -EINVAL;
@@ -300,7 +293,6 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	rc = cryptodev_ccp_create(name, pci_dev, &init_params, pci_drv);
 	if (rc)
 		return rc;
-	ccp_pmd_init_done = 1;
 	return 0;
 }
 
-- 
2.25.1


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

* RE: [EXT] [PATCH v2] crypto/ccp: bug fixes for ccp device probe flow
  2023-03-06 12:58 ` [PATCH v2] " Sunil Uttarwar
@ 2023-03-11 18:47   ` Akhil Goyal
  2023-03-14 10:49     ` Akhil Goyal
  0 siblings, 1 reply; 6+ messages in thread
From: Akhil Goyal @ 2023-03-11 18:47 UTC (permalink / raw)
  To: Sunil Uttarwar, david.marchand; +Cc: ferruh.yigit, selwin.sebastian, dev

> Subject: [EXT] [PATCH v2] crypto/ccp: bug fixes for ccp device probe flow
> - Rebasing patch([v1] crypto/ccp: bug fixes for ccp device probe flow)

Please write a meaningful patch title and description
Also add fixes tag.
Add Cc stable@dpdk.org so that fix can be backported.

> 
> Signed-off-by: Sunil Uttarwar <sunilprakashrao.uttarwar@amd.com>
> ---
>  drivers/crypto/ccp/rte_ccp_pmd.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/rte_ccp_pmd.c
> b/drivers/crypto/ccp/rte_ccp_pmd.c
> index a5271d7227..5d1a4445de 100644
> --- a/drivers/crypto/ccp/rte_ccp_pmd.c
> +++ b/drivers/crypto/ccp/rte_ccp_pmd.c
> @@ -19,7 +19,6 @@
>  /**
>   * Global static parameter used to find if CCP device is already initialized.
>   */
> -static unsigned int ccp_pmd_init_done;
>  uint8_t ccp_cryptodev_driver_id;
>  uint8_t cryptodev_cnt;
> 
> @@ -192,8 +191,6 @@ cryptodev_ccp_remove(struct rte_pci_device *pci_dev)
>  	if (dev == NULL)
>  		return -ENODEV;
> 
> -	ccp_pmd_init_done = 0;
> -
>  	RTE_LOG(INFO, PMD, "Closing ccp device %s on numa socket %u\n",
>  			name, rte_socket_id());
> 
> @@ -278,10 +275,6 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
>  		.auth_opt = CCP_PMD_AUTH_OPT_CCP,
>  	};
> 
> -	if (ccp_pmd_init_done) {
> -		RTE_LOG(INFO, PMD, "CCP PMD already initialized\n");
> -		return -EFAULT;
> -	}
>  	rte_pci_device_name(&pci_dev->addr, name, sizeof(name));
>  	if (name[0] == '\0')
>  		return -EINVAL;
> @@ -300,7 +293,6 @@ cryptodev_ccp_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
>  	rc = cryptodev_ccp_create(name, pci_dev, &init_params, pci_drv);
>  	if (rc)
>  		return rc;
> -	ccp_pmd_init_done = 1;
>  	return 0;
>  }
> 
> --
> 2.25.1


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

* RE: [EXT] [PATCH v2] crypto/ccp: bug fixes for ccp device probe flow
  2023-03-11 18:47   ` [EXT] " Akhil Goyal
@ 2023-03-14 10:49     ` Akhil Goyal
  0 siblings, 0 replies; 6+ messages in thread
From: Akhil Goyal @ 2023-03-14 10:49 UTC (permalink / raw)
  To: Akhil Goyal, Sunil Uttarwar, david.marchand
  Cc: ferruh.yigit, selwin.sebastian, dev

> Subject: RE: [EXT] [PATCH v2] crypto/ccp: bug fixes for ccp device probe flow
> 
> > Subject: [EXT] [PATCH v2] crypto/ccp: bug fixes for ccp device probe flow
> > - Rebasing patch([v1] crypto/ccp: bug fixes for ccp device probe flow)
> 
> Please write a meaningful patch title and description
> Also add fixes tag.
> Add Cc stable@dpdk.org so that fix can be backported.

Can you send the next version, need to close tree for RC3

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

end of thread, other threads:[~2023-03-14 10:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 13:56 [PATCH v1] crypto/ccp: bug fixes for ccp device probe flow Sunil Uttarwar
2023-02-27 18:29 ` [EXT] " Akhil Goyal
2023-03-02 11:53   ` David Marchand
2023-03-06 12:58 ` [PATCH v2] " Sunil Uttarwar
2023-03-11 18:47   ` [EXT] " Akhil Goyal
2023-03-14 10:49     ` Akhil Goyal

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).