raw/ioat: add secondary process support
PATCH 1/1 raw/ioat: add secondary process support
add the secondart process support in dsa
and ioat for cbdma
--- drivers/raw/ioat/ioat_common.c | 18 +++++++++++++++--- drivers/raw/ioat/ioat_rawdev.c | 19 +++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-)
drivers/raw/ioat/ioat_common.c +15 -3
@@ -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; }
drivers/raw/ioat/ioat_rawdev.c +15 -4
@@ -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;
Signature · 1 line
2.17.1
PATCH v2 1/1 raw/ioat: add secondary process support
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.
--- drivers/raw/ioat/ioat_common.c | 17 ++++++++++++++--- drivers/raw/ioat/ioat_rawdev.c | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-)
drivers/raw/ioat/ioat_common.c +14 -3
@@ -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; }
drivers/raw/ioat/ioat_rawdev.c +14 -4
@@ -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;
Signature · 1 line
2.25.1
PATCH v3 1/1 raw/ioat: add secondary process support
Add support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
--- drivers/raw/ioat/ioat_common.c | 17 ++++++++++++++--- drivers/raw/ioat/ioat_rawdev.c | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-)
drivers/raw/ioat/ioat_common.c +14 -3
@@ -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; }
drivers/raw/ioat/ioat_rawdev.c +14 -4
@@ -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;
Signature · 1 line
2.25.1
PATCH v4 1/1 raw/ioat: add secondary process support
Add support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
--- drivers/raw/ioat/ioat_common.c | 16 +++++++++++++--- drivers/raw/ioat/ioat_rawdev.c | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-)
drivers/raw/ioat/ioat_common.c +13 -3
@@ -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; }
drivers/raw/ioat/ioat_rawdev.c +13 -4
@@ -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;
Signature · 1 line
2.25.1
Quoted 6 lines · Kumar Amber
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 <[email protected]>---
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
Quoted 11 lines
drivers/raw/ioat/ioat_common.c | 16 +++++++++++++--- drivers/raw/ioat/ioat_rawdev.c | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-)drivers/raw/ioat/ioat_common.c +0
-0@@ -215,11 +215,21 @@ idxd_rawdev_create(const char *name, struct rte_device *dev, goto cleanup; }
drivers/raw/ioat/ioat_common.c idxd_rawdev_create(const char *name, struct rte_device *dev, · line 224
Quoted 10 lines
drivers/raw/ioat/ioat_common.c +6
-2+/* 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.
drivers/raw/ioat/ioat_common.c idxd_rawdev_create(const char *name, struct rte_device *dev, · line 232
Quoted 9 lines
drivers/raw/ioat/ioat_common.c +7
-1+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?
Quoted 23 lines
drivers/raw/ioat/ioat_common.c +0
-0ret = -ENOMEM ; goto cleanup; }drivers/raw/ioat/ioat_rawdev.c +9
-2@@ -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,
drivers/raw/ioat/ioat_rawdev.c ioat_rawdev_create(const char *name, struct rte_pci_device *dev) · line 176
Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c +4
-2+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.
Quoted 6 lines
drivers/raw/ioat/ioat_rawdev.c +0
-0rawdev->dev_private = mz->addr; rawdev->dev_ops = &ioat_rawdev_ops; rawdev->device = &dev->device;Signature · 1 line
2.25.1
PATCH v5 1/1 raw/ioat: add secondary process support
In reply to Kumar AmberAdd support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
---
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(-)
drivers/raw/ioat/ioat_common.c +19 -2
@@ -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;
drivers/raw/ioat/ioat_rawdev.c +17 -2
@@ -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 ;
Signature · 1 line
2.25.1
PATCH v6 1/1 raw/ioat: add secondary process support
Add support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
---
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(-)
drivers/raw/ioat/ioat_common.c +18 -2
@@ -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;
drivers/raw/ioat/ioat_rawdev.c +17 -2
@@ -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 ;
Signature · 1 line
2.25.1
PATCH v7 1/1 raw/ioat: add secondary process support
Add support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
---
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(-)
drivers/raw/ioat/ioat_common.c +20 -2
@@ -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;
drivers/raw/ioat/ioat_rawdev.c +19 -2
@@ -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 ;
Signature · 1 line
2.25.1
Quoted 6 lines · Kumar Amber
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 <[email protected]>
Quoted 8 lines
---
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.
Quoted 9 lines
drivers/raw/ioat/ioat_common.c | 22 ++++++++++++++++++++-- drivers/raw/ioat/ioat_rawdev.c | 21 +++++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-)drivers/raw/ioat/ioat_common.c +0
-0
drivers/raw/ioat/ioat_common.c idxd_rawdev_create(const char *name, struct rte_device *dev, · line 220
Quoted 9 lines
drivers/raw/ioat/ioat_common.c +3
-2@@ -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".
Quoted 30 lines
drivers/raw/ioat/ioat_common.c +17
-0+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;drivers/raw/ioat/ioat_rawdev.c +0
-0
drivers/raw/ioat/ioat_rawdev.c ioat_rawdev_create(const char *name, struct rte_pci_device *dev) · line 170
Quoted 9 lines
drivers/raw/ioat/ioat_rawdev.c +3
-2@@ -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.
Quoted 22 lines
drivers/raw/ioat/ioat_rawdev.c +16
-0+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 ;Signature · 1 line
2.25.1
PATCH v8 1/1 raw/ioat: add secondary process support
In reply to Kumar AmberAdd support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
---
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(+)
drivers/raw/ioat/ioat_common.c +16 -0
@@ -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;
drivers/raw/ioat/ioat_rawdev.c +15 -0
@@ -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 ;
Signature · 1 line
2.25.1
Quoted 36 lines · Kumar Amber
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 <[email protected]>---
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(+)drivers/raw/ioat/ioat_common.c +5
-0@@ -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);
drivers/raw/ioat/ioat_common.c idxd_rawdev_create(const char *name, struct rte_device *dev, · line 235
Quoted 10 lines
drivers/raw/ioat/ioat_common.c +10
-0+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.
drivers/raw/ioat/ioat_common.c idxd_rawdev_create(const char *name, struct rte_device *dev, · line 241
Quoted 6 lines
drivers/raw/ioat/ioat_common.c +1
-0if (mz ==NULL ) {IOAT_PMD_ERR ("Unable to reserve memzone for private data\n" ); ret = -ENOMEM ; goto cleanup; } +
You don't need this newline addition.
Quoted 19 lines
drivers/raw/ioat/ioat_common.c +0
-0rawdev->dev_private = mz->addr; rawdev->dev_ops = ops; rawdev->device = dev;drivers/raw/ioat/ioat_rawdev.c +5
-0@@ -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);
drivers/raw/ioat/ioat_rawdev.c ioat_rawdev_create(const char *name, struct rte_pci_device *dev) · line 185
Quoted 10 lines
drivers/raw/ioat/ioat_rawdev.c +10
-0+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.
Quoted 6 lines
drivers/raw/ioat/ioat_rawdev.c +0
-0if (mz ==NULL ) {IOAT_PMD_ERR ("Unable to reserve memzone for private data\n" ); ret = -ENOMEM ;Signature · 1 line
2.25.1
PATCH v9 1/1 raw/ioat: add secondary process support
In reply to Kumar AmberAdd support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
---
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(+)
drivers/raw/ioat/ioat_common.c +15 -0
@@ -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 );
drivers/raw/ioat/ioat_rawdev.c +15 -0
@@ -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 );
Signature · 1 line
2.25.1
PATCH v9 1/1 raw/ioat: add secondary process support
Add support for secondary processes in ioat devices. The update allocates a memzone for a primary process or returns it in a secondary process.
---
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(+)
drivers/raw/ioat/ioat_common.c +15 -0
@@ -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 ) {
drivers/raw/ioat/ioat_rawdev.c +15 -0
@@ -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 ) {
Signature · 1 line
2.25.1
Quoted 6 lines · Kumar Amber
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 <[email protected]>
Thomas Monjalon
Applied08/01/2021 18:05, Bruce Richardson:
Quoted 8 lines · Kumar Amber
Quoted 6 lines
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 <[email protected]>Acked-by Bruce Richardson <[email protected]>
Applied, thanks