DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] raw/ioat: add secondary process support
@ 2020-11-21  2:09 Kumar Amber
  2021-01-04 13:31 ` [dpdk-dev] [PATCH v2] " Kumar Amber
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Amber @ 2020-11-21  2:09 UTC (permalink / raw)
  To: dev

add the secondart process support in dsa
and ioat for cbdma

Signed-off-by: Kumar Amber <kumar.amber@intel.com>
---
 drivers/raw/ioat/ioat_common.c | 18 +++++++++++++++---
 drivers/raw/ioat/ioat_rawdev.c | 19 +++++++++++++++----
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..e5a0bac8ab 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,11 +215,23 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/*
+	* Check for primary than allocate memory
+	* else return the memory from primary
+	* memzone.
+	*/
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
-			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..0fd9ebc60d 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,15 +165,26 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/*
+	* Check for primary than allocate memory
+	* else return the memory from primary
+	* memzone.
+	*/
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
-			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->device.numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
-
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = &ioat_rawdev_ops;
 	rawdev->device = &dev->device;
-- 
2.17.1


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

* [dpdk-dev] [PATCH v2] raw/ioat: add secondary process support
  2020-11-21  2:09 [dpdk-dev] [PATCH v1] raw/ioat: add secondary process support Kumar Amber
@ 2021-01-04 13:31 ` Kumar Amber
  2021-01-04 16:28   ` [dpdk-dev] [PATCH v3] " Kumar Amber
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Amber @ 2021-01-04 13:31 UTC (permalink / raw)
  To: dev

Adds the check for the process type
primary and secondary. Allocate
memzone only in the primary porcess
space and return the same memzone
in secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>
---
 drivers/raw/ioat/ioat_common.c | 17 ++++++++++++++---
 drivers/raw/ioat/ioat_rawdev.c | 18 ++++++++++++++----
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..baa0e856f6 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,11 +215,22 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* allocate memory for primary process
+	 * else return memory of primary
+	 * memzone for secondary process
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
-			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..76ed48d5a0 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,15 +165,25 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* allocate memory for primary process
+	 * else return memory of primary
+	 * memzone for secondary process
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
-			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->device.numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
-
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = &ioat_rawdev_ops;
 	rawdev->device = &dev->device;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v3] raw/ioat: add secondary process support
  2021-01-04 13:31 ` [dpdk-dev] [PATCH v2] " Kumar Amber
@ 2021-01-04 16:28   ` Kumar Amber
  2021-01-04 16:30     ` [dpdk-dev] [PATCH v4] " Kumar Amber
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Amber @ 2021-01-04 16:28 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>
---
 drivers/raw/ioat/ioat_common.c | 17 ++++++++++++++---
 drivers/raw/ioat/ioat_rawdev.c | 18 ++++++++++++++----
 2 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..baa0e856f6 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,11 +215,22 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* allocate memory for primary process
+	 * else return memory of primary
+	 * memzone for secondary process
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
-			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..76ed48d5a0 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,15 +165,25 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* allocate memory for primary process
+	 * else return memory of primary
+	 * memzone for secondary process
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
-			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->device.numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
-
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = &ioat_rawdev_ops;
 	rawdev->device = &dev->device;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v4] raw/ioat: add secondary process support
  2021-01-04 16:28   ` [dpdk-dev] [PATCH v3] " Kumar Amber
@ 2021-01-04 16:30     ` Kumar Amber
  2021-01-06 14:07       ` Bruce Richardson
  2021-01-07  4:00       ` [dpdk-dev] [PATCH v5] " Kumar Amber
  0 siblings, 2 replies; 15+ messages in thread
From: Kumar Amber @ 2021-01-04 16:30 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>
---
 drivers/raw/ioat/ioat_common.c | 16 +++++++++++++---
 drivers/raw/ioat/ioat_rawdev.c | 17 +++++++++++++----
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..c174e4bb28 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,11 +215,21 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
-			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..0d3e904c8d 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,15 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
-			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->device.numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
+		IOAT_PMD_ERR("Unable to reserve memzone\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
-
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = &ioat_rawdev_ops;
 	rawdev->device = &dev->device;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v4] raw/ioat: add secondary process support
  2021-01-04 16:30     ` [dpdk-dev] [PATCH v4] " Kumar Amber
@ 2021-01-06 14:07       ` Bruce Richardson
  2021-01-07  4:00       ` [dpdk-dev] [PATCH v5] " Kumar Amber
  1 sibling, 0 replies; 15+ messages in thread
From: Bruce Richardson @ 2021-01-06 14:07 UTC (permalink / raw)
  To: Kumar Amber; +Cc: dev

On Mon, Jan 04, 2021 at 10:00:49PM +0530, Kumar Amber wrote:
> Add support for secondary processes in ioat devices. The update
> allocates a memzone for a primary process or returns it in a
> secondary process.
> 
> Signed-off-by: Kumar Amber <kumar.amber@intel.com>
> ---

Thanks for the patch. Some comments below.
Also, with each version can you include below the cutline [i.e. here] what
has changed since the previous version, to make reviewing easier.

Thanks,
/Bruce

>  drivers/raw/ioat/ioat_common.c | 16 +++++++++++++---
>  drivers/raw/ioat/ioat_rawdev.c | 17 +++++++++++++----
>  2 files changed, 26 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
> index 142e171bc9..c174e4bb28 100644
> --- a/drivers/raw/ioat/ioat_common.c
> +++ b/drivers/raw/ioat/ioat_common.c
> @@ -215,11 +215,21 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
>  		goto cleanup;
>  	}
>  
> +	/* Allocate memory for the primary process or else return the memory
> +	 * of primary memzone for the secondary process.
> +	 */
>  	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
> -	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
> -			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
> +	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> +		mz = rte_memzone_lookup(mz_name);
> +		rawdev->dev_private = mz->addr;

I think we should have some error checking here in case the lookup fails.
The particular device in question could be unused by the primary.

> +		return 0;
> +	}
> +	mz = rte_memzone_reserve(mz_name,
> +			sizeof(struct rte_ioat_rawdev),
> +			dev->numa_node,
> +			RTE_MEMZONE_IOVA_CONTIG);
>  	if (mz == NULL) {
> -		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
> +		IOAT_PMD_ERR("Unable to reserve memzone\n");

Is there a need to change the error message here?

>  		ret = -ENOMEM;
>  		goto cleanup;
>  	}
> diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
> index 2c88b4369f..0d3e904c8d 100644
> --- a/drivers/raw/ioat/ioat_rawdev.c
> +++ b/drivers/raw/ioat/ioat_rawdev.c
> @@ -165,15 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
>  		goto cleanup;
>  	}
>  
> +	/* Allocate memory for the primary process or else return the memory
> +	 * of primary memzone for the secondary process.
> +	 */
>  	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
> -	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
> -			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
> +	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> +		mz = rte_memzone_lookup(mz_name);
> +		rawdev->dev_private = mz->addr;
> +		return 0;
> +	}
> +	mz = rte_memzone_reserve(mz_name,
> +			sizeof(struct rte_ioat_rawdev),
> +			dev->device.numa_node,
> +			RTE_MEMZONE_IOVA_CONTIG);
>  	if (mz == NULL) {
> -		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
> +		IOAT_PMD_ERR("Unable to reserve memzone\n");
>  		ret = -ENOMEM;
>  		goto cleanup;
>  	}
> -

Same comments for this file as for previous. Also note the extra line
removal here, which probably should not be part of this patch too.

>  	rawdev->dev_private = mz->addr;
>  	rawdev->dev_ops = &ioat_rawdev_ops;
>  	rawdev->device = &dev->device;
> -- 
> 2.25.1
> 

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

* [dpdk-dev] [PATCH v5] raw/ioat: add secondary process support
  2021-01-04 16:30     ` [dpdk-dev] [PATCH v4] " Kumar Amber
  2021-01-06 14:07       ` Bruce Richardson
@ 2021-01-07  4:00       ` Kumar Amber
  2021-01-07  5:05         ` [dpdk-dev] [PATCH v6] " Kumar Amber
  1 sibling, 1 reply; 15+ messages in thread
From: Kumar Amber @ 2021-01-07  4:00 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>

---
v5
* add error check for memzone lookup
---
 drivers/raw/ioat/ioat_common.c | 21 +++++++++++++++++++--
 drivers/raw/ioat/ioat_rawdev.c | 19 +++++++++++++++++--
 2 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..91f0d5122c 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,14 +215,31 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
-			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+	}
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
+
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = ops;
 	rawdev->device = dev;
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..a9846e75f2 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,9 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
-			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->device.numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v6] raw/ioat: add secondary process support
  2021-01-07  4:00       ` [dpdk-dev] [PATCH v5] " Kumar Amber
@ 2021-01-07  5:05         ` Kumar Amber
  2021-01-07 12:23           ` [dpdk-dev] [PATCH v7] " Kumar Amber
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Amber @ 2021-01-07  5:05 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>

---
v5
* add error check for memzone lookup
v6
* fix compilation
---
 drivers/raw/ioat/ioat_common.c | 20 ++++++++++++++++++--
 drivers/raw/ioat/ioat_rawdev.c | 19 +++++++++++++++++--
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..ada691c11d 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,14 +215,30 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
-			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
+
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = ops;
 	rawdev->device = dev;
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..a9846e75f2 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,9 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
-			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->device.numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
-- 
2.25.1


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

* [dpdk-dev] [PATCH v7] raw/ioat: add secondary process support
  2021-01-07  5:05         ` [dpdk-dev] [PATCH v6] " Kumar Amber
@ 2021-01-07 12:23           ` Kumar Amber
  2021-01-07 12:37             ` Bruce Richardson
  2021-01-08 13:44             ` [dpdk-dev] [PATCH v8] " Kumar Amber
  0 siblings, 2 replies; 15+ messages in thread
From: Kumar Amber @ 2021-01-07 12:23 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>

---
v5
* add error check for memzone lookup
v6
* fix compilation
v7
* include dev ops for secondary
---
 drivers/raw/ioat/ioat_common.c | 22 ++++++++++++++++++++--
 drivers/raw/ioat/ioat_rawdev.c | 21 +++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..2428c8a5b6 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,14 +215,32 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
-			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = ops;
+		rawdev->device = dev;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
+
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = ops;
 	rawdev->device = dev;
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..e152004219 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,9 +165,26 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
-	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
-			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = &ioat_rawdev_ops;
+		rawdev->device = &dev->device;
+		return 0;
+	}
+	mz = rte_memzone_reserve(mz_name,
+			sizeof(struct rte_ioat_rawdev),
+			dev->device.numa_node,
+			RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v7] raw/ioat: add secondary process support
  2021-01-07 12:23           ` [dpdk-dev] [PATCH v7] " Kumar Amber
@ 2021-01-07 12:37             ` Bruce Richardson
  2021-01-08 13:44             ` [dpdk-dev] [PATCH v8] " Kumar Amber
  1 sibling, 0 replies; 15+ messages in thread
From: Bruce Richardson @ 2021-01-07 12:37 UTC (permalink / raw)
  To: Kumar Amber; +Cc: dev

On Thu, Jan 07, 2021 at 05:53:12PM +0530, Kumar Amber wrote:
> Add support for secondary processes in ioat devices. The update
> allocates a memzone for a primary process or returns it in a
> secondary process.
> 
> Signed-off-by: Kumar Amber <kumar.amber@intel.com>
> 
> ---
> v5
> * add error check for memzone lookup
> v6
> * fix compilation
> v7
> * include dev ops for secondary
> ---

Two comments below. With those fixed, you can add my ack to v8.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

>  drivers/raw/ioat/ioat_common.c | 22 ++++++++++++++++++++--
>  drivers/raw/ioat/ioat_rawdev.c | 21 +++++++++++++++++++--
>  2 files changed, 39 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
> index 142e171bc9..2428c8a5b6 100644
> --- a/drivers/raw/ioat/ioat_common.c
> +++ b/drivers/raw/ioat/ioat_common.c
> @@ -215,14 +215,32 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
>  		goto cleanup;
>  	}
>  
> +	/* Allocate memory for the primary process or else return the memory
> +	 * of primary memzone for the secondary process.
> +	 */
>  	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
> -	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
> -			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);

This line actually doesn't need to be changed, and in doing so, it's
actually introduced a bug. The sizeof() call here, has "idxd_rawdev" while
the replacement below is a copy-paste error using "ioat_rawdev".

> +	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> +		mz = rte_memzone_lookup(mz_name);
> +		if (mz == NULL) {
> +			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
> +			ret = -ENOMEM;
> +			goto cleanup;
> +		}
> +		rawdev->dev_private = mz->addr;
> +		rawdev->dev_ops = ops;
> +		rawdev->device = dev;
> +		return 0;
> +	}
> +	mz = rte_memzone_reserve(mz_name,
> +			sizeof(struct rte_ioat_rawdev),
> +			dev->numa_node,
> +			RTE_MEMZONE_IOVA_CONTIG);
>  	if (mz == NULL) {
>  		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
>  		ret = -ENOMEM;
>  		goto cleanup;
>  	}
> +
>  	rawdev->dev_private = mz->addr;
>  	rawdev->dev_ops = ops;
>  	rawdev->device = dev;
> diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
> index 2c88b4369f..e152004219 100644
> --- a/drivers/raw/ioat/ioat_rawdev.c
> +++ b/drivers/raw/ioat/ioat_rawdev.c
> @@ -165,9 +165,26 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
>  		goto cleanup;
>  	}
>  
> +	/* Allocate memory for the primary process or else return the memory
> +	 * of primary memzone for the secondary process.
> +	 */
>  	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
> -	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
> -			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);

No bug introduced here, but again I think changing this line is
unnecessary.

> +	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> +		mz = rte_memzone_lookup(mz_name);
> +		if (mz == NULL) {
> +			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
> +			ret = -ENOMEM;
> +			goto cleanup;
> +		}
> +		rawdev->dev_private = mz->addr;
> +		rawdev->dev_ops = &ioat_rawdev_ops;
> +		rawdev->device = &dev->device;
> +		return 0;
> +	}
> +	mz = rte_memzone_reserve(mz_name,
> +			sizeof(struct rte_ioat_rawdev),
> +			dev->device.numa_node,
> +			RTE_MEMZONE_IOVA_CONTIG);
>  	if (mz == NULL) {
>  		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
>  		ret = -ENOMEM;
> -- 
> 2.25.1
> 

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

* [dpdk-dev] [PATCH v8] raw/ioat: add secondary process support
  2021-01-07 12:23           ` [dpdk-dev] [PATCH v7] " Kumar Amber
  2021-01-07 12:37             ` Bruce Richardson
@ 2021-01-08 13:44             ` Kumar Amber
  2021-01-08 14:03               ` Bruce Richardson
  2021-01-08 16:08               ` [dpdk-dev] [PATCH v9] " Kumar Amber
  1 sibling, 2 replies; 15+ messages in thread
From: Kumar Amber @ 2021-01-08 13:44 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>

---
v5
* add error check for memzone lookup
v6
* fix compilation
v7
* include dev ops for secondary
v8
* fix wrong memzone alloaction
---
 drivers/raw/ioat/ioat_common.c | 16 ++++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c | 15 +++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..da464181a5 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,14 +215,30 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
 	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
 			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = ops;
+		rawdev->device = dev;
+		return 0;
+	}
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
 		goto cleanup;
 	}
+
 	rawdev->dev_private = mz->addr;
 	rawdev->dev_ops = ops;
 	rawdev->device = dev;
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..922fa20e32 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,9 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
 	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
 			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = &ioat_rawdev_ops;
+		rawdev->device = &dev->device;
+		return 0;
+	}
 	if (mz == NULL) {
 		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
 		ret = -ENOMEM;
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v8] raw/ioat: add secondary process support
  2021-01-08 13:44             ` [dpdk-dev] [PATCH v8] " Kumar Amber
@ 2021-01-08 14:03               ` Bruce Richardson
  2021-01-08 16:08               ` [dpdk-dev] [PATCH v9] " Kumar Amber
  1 sibling, 0 replies; 15+ messages in thread
From: Bruce Richardson @ 2021-01-08 14:03 UTC (permalink / raw)
  To: Kumar Amber; +Cc: dev

On Fri, Jan 08, 2021 at 07:14:56PM +0530, Kumar Amber wrote:
> Add support for secondary processes in ioat devices. The update
> allocates a memzone for a primary process or returns it in a
> secondary process.
> 
> Signed-off-by: Kumar Amber <kumar.amber@intel.com>
> 
> ---
> v5
> * add error check for memzone lookup
> v6
> * fix compilation
> v7
> * include dev ops for secondary
> v8
> * fix wrong memzone alloaction
> ---
>  drivers/raw/ioat/ioat_common.c | 16 ++++++++++++++++
>  drivers/raw/ioat/ioat_rawdev.c | 15 +++++++++++++++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
> index 142e171bc9..da464181a5 100644
> --- a/drivers/raw/ioat/ioat_common.c
> +++ b/drivers/raw/ioat/ioat_common.c
> @@ -215,14 +215,30 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
>  		goto cleanup;
>  	}
>  
> +	/* Allocate memory for the primary process or else return the memory
> +	 * of primary memzone for the secondary process.
> +	 */
>  	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
>  	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
>  			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
> +	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> +		mz = rte_memzone_lookup(mz_name);
> +		if (mz == NULL) {
> +			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
> +			ret = -ENOMEM;
> +			goto cleanup;
> +		}
> +		rawdev->dev_private = mz->addr;
> +		rawdev->dev_ops = ops;
> +		rawdev->device = dev;
> +		return 0;
> +	}

This block you inserted still needs to go two lines further up.

>  	if (mz == NULL) {
>  		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
>  		ret = -ENOMEM;
>  		goto cleanup;
>  	}
> +

You don't need this newline addition.

>  	rawdev->dev_private = mz->addr;
>  	rawdev->dev_ops = ops;
>  	rawdev->device = dev;
> diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
> index 2c88b4369f..922fa20e32 100644
> --- a/drivers/raw/ioat/ioat_rawdev.c
> +++ b/drivers/raw/ioat/ioat_rawdev.c
> @@ -165,9 +165,24 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
>  		goto cleanup;
>  	}
>  
> +	/* Allocate memory for the primary process or else return the memory
> +	 * of primary memzone for the secondary process.
> +	 */
>  	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
>  	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
>  			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
> +	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
> +		mz = rte_memzone_lookup(mz_name);
> +		if (mz == NULL) {
> +			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
> +			ret = -ENOMEM;
> +			goto cleanup;
> +		}
> +		rawdev->dev_private = mz->addr;
> +		rawdev->dev_ops = &ioat_rawdev_ops;
> +		rawdev->device = &dev->device;
> +		return 0;
> +	}

As above, these new lines need to be inserted where they were in the
previous version.

>  	if (mz == NULL) {
>  		IOAT_PMD_ERR("Unable to reserve memzone for private data\n");
>  		ret = -ENOMEM;
> -- 
> 2.25.1
> 

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

* [dpdk-dev] [PATCH v9] raw/ioat: add secondary process support
  2021-01-08 13:44             ` [dpdk-dev] [PATCH v8] " Kumar Amber
  2021-01-08 14:03               ` Bruce Richardson
@ 2021-01-08 16:08               ` Kumar Amber
  2021-01-08 16:52                 ` Kumar Amber
  1 sibling, 1 reply; 15+ messages in thread
From: Kumar Amber @ 2021-01-08 16:08 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>

---
v5
* add error check for memzone lookup
v6
* fix compilation
v7
* include dev ops for secondary
v8
* fix wrong memzone alloaction
v9
* fix comments
---
 drivers/raw/ioat/ioat_common.c | 15 +++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..a80d304214 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,6 +215,21 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = ops;
+		rawdev->device = dev;
+		return 0;
+	}
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
 	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
 			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..21b71b45ed 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,6 +165,21 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = &ioat_rawdev_ops;
+		rawdev->device = &dev->device;
+		return 0;
+	}
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
 	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
 			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
-- 
2.25.1


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

* [dpdk-dev] [PATCH v9] raw/ioat: add secondary process support
  2021-01-08 16:08               ` [dpdk-dev] [PATCH v9] " Kumar Amber
@ 2021-01-08 16:52                 ` Kumar Amber
  2021-01-08 17:05                   ` Bruce Richardson
  0 siblings, 1 reply; 15+ messages in thread
From: Kumar Amber @ 2021-01-08 16:52 UTC (permalink / raw)
  To: dev

Add support for secondary processes in ioat devices. The update
allocates a memzone for a primary process or returns it in a
secondary process.

Signed-off-by: Kumar Amber <kumar.amber@intel.com>

---
v5
* add error check for memzone lookup
v6
* fix compilation
v7
* include dev ops for secondary
v8
* fix wrong memzone alloaction
v9
* fix comments
---
 drivers/raw/ioat/ioat_common.c | 15 +++++++++++++++
 drivers/raw/ioat/ioat_rawdev.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/raw/ioat/ioat_common.c b/drivers/raw/ioat/ioat_common.c
index 142e171bc9..d055c36a2a 100644
--- a/drivers/raw/ioat/ioat_common.c
+++ b/drivers/raw/ioat/ioat_common.c
@@ -215,7 +215,22 @@ idxd_rawdev_create(const char *name, struct rte_device *dev,
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = ops;
+		rawdev->device = dev;
+		return 0;
+	}
 	mz = rte_memzone_reserve(mz_name, sizeof(struct idxd_rawdev),
 			dev->numa_node, RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index 2c88b4369f..77216f67f5 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -165,7 +165,22 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev)
 		goto cleanup;
 	}
 
+	/* Allocate memory for the primary process or else return the memory
+	 * of primary memzone for the secondary process.
+	 */
 	snprintf(mz_name, sizeof(mz_name), "rawdev%u_private", rawdev->dev_id);
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
+		mz = rte_memzone_lookup(mz_name);
+		if (mz == NULL) {
+			IOAT_PMD_ERR("Unable lookup memzone for private data\n");
+			ret = -ENOMEM;
+			goto cleanup;
+		}
+		rawdev->dev_private = mz->addr;
+		rawdev->dev_ops = &ioat_rawdev_ops;
+		rawdev->device = &dev->device;
+		return 0;
+	}
 	mz = rte_memzone_reserve(mz_name, sizeof(struct rte_ioat_rawdev),
 			dev->device.numa_node, RTE_MEMZONE_IOVA_CONTIG);
 	if (mz == NULL) {
-- 
2.25.1


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

* Re: [dpdk-dev] [PATCH v9] raw/ioat: add secondary process support
  2021-01-08 16:52                 ` Kumar Amber
@ 2021-01-08 17:05                   ` Bruce Richardson
  2021-01-17 21:53                     ` Thomas Monjalon
  0 siblings, 1 reply; 15+ messages in thread
From: Bruce Richardson @ 2021-01-08 17:05 UTC (permalink / raw)
  To: Kumar Amber; +Cc: dev

On Fri, Jan 08, 2021 at 10:22:16PM +0530, Kumar Amber wrote:
> Add support for secondary processes in ioat devices. The update
> allocates a memzone for a primary process or returns it in a
> secondary process.
> 
> Signed-off-by: Kumar Amber <kumar.amber@intel.com>
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

* Re: [dpdk-dev] [PATCH v9] raw/ioat: add secondary process support
  2021-01-08 17:05                   ` Bruce Richardson
@ 2021-01-17 21:53                     ` Thomas Monjalon
  0 siblings, 0 replies; 15+ messages in thread
From: Thomas Monjalon @ 2021-01-17 21:53 UTC (permalink / raw)
  To: Kumar Amber; +Cc: dev, Bruce Richardson

08/01/2021 18:05, Bruce Richardson:
> On Fri, Jan 08, 2021 at 10:22:16PM +0530, Kumar Amber wrote:
> > Add support for secondary processes in ioat devices. The update
> > allocates a memzone for a primary process or returns it in a
> > secondary process.
> > 
> > Signed-off-by: Kumar Amber <kumar.amber@intel.com>
> > 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks



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

end of thread, other threads:[~2021-01-17 21:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21  2:09 [dpdk-dev] [PATCH v1] raw/ioat: add secondary process support Kumar Amber
2021-01-04 13:31 ` [dpdk-dev] [PATCH v2] " Kumar Amber
2021-01-04 16:28   ` [dpdk-dev] [PATCH v3] " Kumar Amber
2021-01-04 16:30     ` [dpdk-dev] [PATCH v4] " Kumar Amber
2021-01-06 14:07       ` Bruce Richardson
2021-01-07  4:00       ` [dpdk-dev] [PATCH v5] " Kumar Amber
2021-01-07  5:05         ` [dpdk-dev] [PATCH v6] " Kumar Amber
2021-01-07 12:23           ` [dpdk-dev] [PATCH v7] " Kumar Amber
2021-01-07 12:37             ` Bruce Richardson
2021-01-08 13:44             ` [dpdk-dev] [PATCH v8] " Kumar Amber
2021-01-08 14:03               ` Bruce Richardson
2021-01-08 16:08               ` [dpdk-dev] [PATCH v9] " Kumar Amber
2021-01-08 16:52                 ` Kumar Amber
2021-01-08 17:05                   ` Bruce Richardson
2021-01-17 21:53                     ` Thomas Monjalon

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git