DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vdpa/sfc: make MCDI memzone name unique
@ 2022-01-11  5:33 abhimanyu.saini
  2022-01-14  7:06 ` Xia, Chenbo
  2022-01-17 11:29 ` [PATCH v2] " abhimanyu.saini
  0 siblings, 2 replies; 9+ messages in thread
From: abhimanyu.saini @ 2022-01-11  5:33 UTC (permalink / raw)
  To: dev; +Cc: chenbo.xia, maxime.coquelin, andrew.rybchenko, Abhimanyu Saini

From: Abhimanyu Saini <asaini@xilinx.com>

Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
with zone name 'mcdi'. Since multiple MCDI channels are needed to
support multiple VF(s) and rte_memzone_reserve_aligned expects unique
zone names, append PCI address to zone name to make it unique.

Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
---
 drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c b/drivers/vdpa/sfc/sfc_vdpa_hw.c
index fd1fee7..a7018b1 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_hw.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c
@@ -25,21 +25,30 @@
 {
        uint64_t mcdi_iova;
        size_t mcdi_buff_size;
+       char mz_name[RTE_MEMZONE_NAMESIZE];
        const struct rte_memzone *mz = NULL;
        int numa_node = sva->pdev->device.numa_node;
        int ret;

        mcdi_buff_size = RTE_ALIGN_CEIL(len, PAGE_SIZE);
+       ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s",
+                      sva->pdev->name, name);
+       if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {
+               sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",
+                            sva->pdev->name, name);
+               return -EINVAL;
+       }

-       sfc_vdpa_log_init(sva, "name=%s, len=%zu", name, len);
+       sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len);

-       mz = rte_memzone_reserve_aligned(name, mcdi_buff_size,
+       mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size,
                                         numa_node,
                                         RTE_MEMZONE_IOVA_CONTIG,
                                         PAGE_SIZE);
        if (mz == NULL) {
                sfc_vdpa_err(sva, "cannot reserve memory for %s: len=%#x: %s",
-                            name, (unsigned int)len, rte_strerror(rte_errno));
+                            mz_name, (unsigned int)len,
+                            rte_strerror(rte_errno));
                return -ENOMEM;
        }

--
1.8.3.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* RE: [PATCH] vdpa/sfc: make MCDI memzone name unique
  2022-01-11  5:33 [PATCH] vdpa/sfc: make MCDI memzone name unique abhimanyu.saini
@ 2022-01-14  7:06 ` Xia, Chenbo
  2022-01-17 11:29 ` [PATCH v2] " abhimanyu.saini
  1 sibling, 0 replies; 9+ messages in thread
From: Xia, Chenbo @ 2022-01-14  7:06 UTC (permalink / raw)
  To: abhimanyu.saini, dev; +Cc: maxime.coquelin, andrew.rybchenko, Abhimanyu Saini

Hi Abhimanyu,

> -----Original Message-----
> From: abhimanyu.saini@xilinx.com <abhimanyu.saini@xilinx.com>
> Sent: Tuesday, January 11, 2022 1:33 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> andrew.rybchenko@oktetlabs.ru; Abhimanyu Saini <asaini@xilinx.com>
> Subject: [PATCH] vdpa/sfc: make MCDI memzone name unique
> 
> From: Abhimanyu Saini <asaini@xilinx.com>
> 
> Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
> with zone name 'mcdi'. Since multiple MCDI channels are needed to
> support multiple VF(s) and rte_memzone_reserve_aligned expects unique
> zone names, append PCI address to zone name to make it unique.
> 
> Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
> ---

Could you help with the apply issue and checkpatch issue, then send new version?

Thanks,
Chenbo

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

* [PATCH v2] vdpa/sfc: make MCDI memzone name unique
  2022-01-11  5:33 [PATCH] vdpa/sfc: make MCDI memzone name unique abhimanyu.saini
  2022-01-14  7:06 ` Xia, Chenbo
@ 2022-01-17 11:29 ` abhimanyu.saini
  2022-02-01  8:21   ` Maxime Coquelin
  2022-02-14 10:51   ` [PATCH v3] " abhimanyu.saini
  1 sibling, 2 replies; 9+ messages in thread
From: abhimanyu.saini @ 2022-01-17 11:29 UTC (permalink / raw)
  To: dev
  Cc: maxime.coquelin, chenbo.xia, andrew.rybchenko, vsrivast, Abhimanyu Saini

From: Abhimanyu Saini <asaini@xilinx.com>

Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
with zone name 'mcdi'. Since multiple MCDI channels are needed to
support multiple VF(s) and rte_memzone_reserve_aligned expects unique
zone names, append PCI address to zone name to make it unique.

Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
---
v2:
* Formatting changes

 drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c b/drivers/vdpa/sfc/sfc_vdpa_hw.c
index fd1fee7..a7018b1 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_hw.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c
@@ -25,21 +25,30 @@
 {
        uint64_t mcdi_iova;
        size_t mcdi_buff_size;
+       char mz_name[RTE_MEMZONE_NAMESIZE];
        const struct rte_memzone *mz = NULL;
        int numa_node = sva->pdev->device.numa_node;
        int ret;

        mcdi_buff_size = RTE_ALIGN_CEIL(len, PAGE_SIZE);
+       ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s",
+                      sva->pdev->name, name);
+       if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {
+               sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",
+                            sva->pdev->name, name);
+               return -EINVAL;
+       }

-       sfc_vdpa_log_init(sva, "name=%s, len=%zu", name, len);
+       sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len);

-       mz = rte_memzone_reserve_aligned(name, mcdi_buff_size,
+       mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size,
                                         numa_node,
                                         RTE_MEMZONE_IOVA_CONTIG,
                                         PAGE_SIZE);
        if (mz == NULL) {
                sfc_vdpa_err(sva, "cannot reserve memory for %s: len=%#x: %s",
-                            name, (unsigned int)len, rte_strerror(rte_errno));
+                            mz_name, (unsigned int)len,
+                            rte_strerror(rte_errno));
                return -ENOMEM;
        }

--
1.8.3.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* Re: [PATCH v2] vdpa/sfc: make MCDI memzone name unique
  2022-01-17 11:29 ` [PATCH v2] " abhimanyu.saini
@ 2022-02-01  8:21   ` Maxime Coquelin
  2022-02-14 10:51   ` [PATCH v3] " abhimanyu.saini
  1 sibling, 0 replies; 9+ messages in thread
From: Maxime Coquelin @ 2022-02-01  8:21 UTC (permalink / raw)
  To: abhimanyu.saini, dev
  Cc: chenbo.xia, andrew.rybchenko, vsrivast, Abhimanyu Saini

Hi Abhimanyu,

On 1/17/22 12:29, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <asaini@xilinx.com>
> 
> Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
> with zone name 'mcdi'. Since multiple MCDI channels are needed to
> support multiple VF(s) and rte_memzone_reserve_aligned expects unique
> zone names, append PCI address to zone name to make it unique.
> 
> Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
> ---
> v2:
> * Formatting changes
> 
>   drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
> 


The patch itself looks goof to me, but it seems you have issues with its
formatting (I guess you need to configure indents properly in your
editor):

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#153: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:28:
+       char mz_name[RTE_MEMZONE_NAMESIZE];$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#159: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:34:
+       ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s",$

ERROR:CODE_INDENT: code indent should use tabs where possible
#160: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:35:
+                      sva->pdev->name, name);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#160: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:35:
+                      sva->pdev->name, name);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#161: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:36:
+       if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {$

WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional 
statements (7, 15)
#161: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:36:
+       if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {
+               sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",

ERROR:CODE_INDENT: code indent should use tabs where possible
#162: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:37:
+               sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#162: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:37:
+               sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",$

ERROR:CODE_INDENT: code indent should use tabs where possible
#163: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:38:
+                            sva->pdev->name, name);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#163: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:38:
+                            sva->pdev->name, name);$

ERROR:CODE_INDENT: code indent should use tabs where possible
#164: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:39:
+               return -EINVAL;$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#164: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:39:
+               return -EINVAL;$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#165: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:40:
+       }$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#168: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:42:
+       sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len);$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#171: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:44:
+       mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size,$

ERROR:CODE_INDENT: code indent should use tabs where possible
#178: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:50:
+                            mz_name, (unsigned int)len,$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#178: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:50:
+                            mz_name, (unsigned int)len,$

ERROR:CODE_INDENT: code indent should use tabs where possible
#179: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:51:
+                            rte_strerror(rte_errno));$

WARNING:LEADING_SPACE: please, no spaces at the start of a line
#179: FILE: drivers/vdpa/sfc/sfc_vdpa_hw.c:51:
+                            rte_strerror(rte_errno));$

total: 6 errors, 13 warnings, 33 lines checked


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

* [PATCH v3] vdpa/sfc: make MCDI memzone name unique
  2022-01-17 11:29 ` [PATCH v2] " abhimanyu.saini
  2022-02-01  8:21   ` Maxime Coquelin
@ 2022-02-14 10:51   ` abhimanyu.saini
  2022-02-15 10:56     ` Maxime Coquelin
                       ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: abhimanyu.saini @ 2022-02-14 10:51 UTC (permalink / raw)
  To: dev; +Cc: chenbo.xia, maxime.coquelin, andrew.rybchenko, Abhimanyu Saini

From: Abhimanyu Saini <asaini@xilinx.com>

Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
with zone name 'mcdi'. Since multiple MCDI channels are needed to
support multiple VF(s) and rte_memzone_reserve_aligned expects unique
zone names, append PCI address to zone name to make it unique.

Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
---
v2:
  - Formatting changes
v3:
  - Formatting changes

 drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c b/drivers/vdpa/sfc/sfc_vdpa_hw.c
index fd1fee7..a7018b1 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_hw.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c
@@ -25,21 +25,30 @@
 {
 	uint64_t mcdi_iova;
 	size_t mcdi_buff_size;
+	char mz_name[RTE_MEMZONE_NAMESIZE];
 	const struct rte_memzone *mz = NULL;
 	int numa_node = sva->pdev->device.numa_node;
 	int ret;
 
 	mcdi_buff_size = RTE_ALIGN_CEIL(len, PAGE_SIZE);
+	ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s",
+		       sva->pdev->name, name);
+	if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {
+		sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",
+			     sva->pdev->name, name);
+		return -EINVAL;
+	}
 
-	sfc_vdpa_log_init(sva, "name=%s, len=%zu", name, len);
+	sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len);
 
-	mz = rte_memzone_reserve_aligned(name, mcdi_buff_size,
+	mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size,
 					 numa_node,
 					 RTE_MEMZONE_IOVA_CONTIG,
 					 PAGE_SIZE);
 	if (mz == NULL) {
 		sfc_vdpa_err(sva, "cannot reserve memory for %s: len=%#x: %s",
-			     name, (unsigned int)len, rte_strerror(rte_errno));
+			     mz_name, (unsigned int)len,
+			     rte_strerror(rte_errno));
 		return -ENOMEM;
 	}
 
-- 
1.8.3.1


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

* Re: [PATCH v3] vdpa/sfc: make MCDI memzone name unique
  2022-02-14 10:51   ` [PATCH v3] " abhimanyu.saini
@ 2022-02-15 10:56     ` Maxime Coquelin
  2022-02-15 10:59       ` Maxime Coquelin
  2022-02-15 12:21     ` Maxime Coquelin
  2022-02-17  8:54     ` Maxime Coquelin
  2 siblings, 1 reply; 9+ messages in thread
From: Maxime Coquelin @ 2022-02-15 10:56 UTC (permalink / raw)
  To: abhimanyu.saini, dev; +Cc: chenbo.xia, andrew.rybchenko, Abhimanyu Saini



On 2/14/22 11:51, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <asaini@xilinx.com>
> 
> Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
> with zone name 'mcdi'. Since multiple MCDI channels are needed to
> support multiple VF(s) and rte_memzone_reserve_aligned expects unique
> zone names, append PCI address to zone name to make it unique.
> 
> Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
> ---
> v2:
>    - Formatting changes
> v3:
>    - Formatting changes
> 
>   drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c b/drivers/vdpa/sfc/sfc_vdpa_hw.c
> index fd1fee7..a7018b1 100644
> --- a/drivers/vdpa/sfc/sfc_vdpa_hw.c
> +++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c
> @@ -25,21 +25,30 @@
>   {
>   	uint64_t mcdi_iova;
>   	size_t mcdi_buff_size;
> +	char mz_name[RTE_MEMZONE_NAMESIZE];
>   	const struct rte_memzone *mz = NULL;
>   	int numa_node = sva->pdev->device.numa_node;
>   	int ret;
>   
>   	mcdi_buff_size = RTE_ALIGN_CEIL(len, PAGE_SIZE);
> +	ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s",
> +		       sva->pdev->name, name);
> +	if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {

 From the man page:
"
The functions snprintf() and vsnprintf() do not write more than size 
bytes (including the terminating null byte ('\0')).
"

you might want to pass RTE_MEMZONE_NAMESIZE - 1 as size arg to snprintf,
so you can just check ret >= 0?

> +		sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",
> +			     sva->pdev->name, name);
> +		return -EINVAL;
> +	}
>   
> -	sfc_vdpa_log_init(sva, "name=%s, len=%zu", name, len);
> +	sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len);
>   
> -	mz = rte_memzone_reserve_aligned(name, mcdi_buff_size,
> +	mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size,
>   					 numa_node,
>   					 RTE_MEMZONE_IOVA_CONTIG,
>   					 PAGE_SIZE);
>   	if (mz == NULL) {
>   		sfc_vdpa_err(sva, "cannot reserve memory for %s: len=%#x: %s",
> -			     name, (unsigned int)len, rte_strerror(rte_errno));
> +			     mz_name, (unsigned int)len,
> +			     rte_strerror(rte_errno));
>   		return -ENOMEM;
>   	}
>   


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

* Re: [PATCH v3] vdpa/sfc: make MCDI memzone name unique
  2022-02-15 10:56     ` Maxime Coquelin
@ 2022-02-15 10:59       ` Maxime Coquelin
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Coquelin @ 2022-02-15 10:59 UTC (permalink / raw)
  To: abhimanyu.saini, dev; +Cc: chenbo.xia, andrew.rybchenko, Abhimanyu Saini



On 2/15/22 11:56, Maxime Coquelin wrote:
> 
> 
> On 2/14/22 11:51, abhimanyu.saini@xilinx.com wrote:
>> From: Abhimanyu Saini <asaini@xilinx.com>
>>
>> Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
>> with zone name 'mcdi'. Since multiple MCDI channels are needed to
>> support multiple VF(s) and rte_memzone_reserve_aligned expects unique
>> zone names, append PCI address to zone name to make it unique.
>>
>> Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
>> ---
>> v2:
>>    - Formatting changes
>> v3:
>>    - Formatting changes
>>
>>   drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c 
>> b/drivers/vdpa/sfc/sfc_vdpa_hw.c
>> index fd1fee7..a7018b1 100644
>> --- a/drivers/vdpa/sfc/sfc_vdpa_hw.c
>> +++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c
>> @@ -25,21 +25,30 @@
>>   {
>>       uint64_t mcdi_iova;
>>       size_t mcdi_buff_size;
>> +    char mz_name[RTE_MEMZONE_NAMESIZE];
>>       const struct rte_memzone *mz = NULL;
>>       int numa_node = sva->pdev->device.numa_node;
>>       int ret;
>>       mcdi_buff_size = RTE_ALIGN_CEIL(len, PAGE_SIZE);
>> +    ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s",
>> +               sva->pdev->name, name);
>> +    if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {
> 
>  From the man page:
> "
> The functions snprintf() and vsnprintf() do not write more than size 
> bytes (including the terminating null byte ('\0')).
> "
> 
> you might want to pass RTE_MEMZONE_NAMESIZE - 1 as size arg to snprintf,
> so you can just check ret >= 0?

Sorry, I misread, the return value can indeed be greater than size:
"
If the output  was  truncated  due to this limit, then the return value
is the number of characters (excluding the terminating null byte)
which would have been written to the final string if enough space had
been available.  Thus, a return value of size or more  means
that the output was truncated.
"

>> +        sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",
>> +                 sva->pdev->name, name);
>> +        return -EINVAL;
>> +    }
>> -    sfc_vdpa_log_init(sva, "name=%s, len=%zu", name, len);
>> +    sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len);
>> -    mz = rte_memzone_reserve_aligned(name, mcdi_buff_size,
>> +    mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size,
>>                        numa_node,
>>                        RTE_MEMZONE_IOVA_CONTIG,
>>                        PAGE_SIZE);
>>       if (mz == NULL) {
>>           sfc_vdpa_err(sva, "cannot reserve memory for %s: len=%#x: %s",
>> -                 name, (unsigned int)len, rte_strerror(rte_errno));
>> +                 mz_name, (unsigned int)len,
>> +                 rte_strerror(rte_errno));
>>           return -ENOMEM;
>>       }


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

* Re: [PATCH v3] vdpa/sfc: make MCDI memzone name unique
  2022-02-14 10:51   ` [PATCH v3] " abhimanyu.saini
  2022-02-15 10:56     ` Maxime Coquelin
@ 2022-02-15 12:21     ` Maxime Coquelin
  2022-02-17  8:54     ` Maxime Coquelin
  2 siblings, 0 replies; 9+ messages in thread
From: Maxime Coquelin @ 2022-02-15 12:21 UTC (permalink / raw)
  To: abhimanyu.saini, dev; +Cc: chenbo.xia, andrew.rybchenko, Abhimanyu Saini



On 2/14/22 11:51, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <asaini@xilinx.com>
> 
> Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
> with zone name 'mcdi'. Since multiple MCDI channels are needed to
> support multiple VF(s) and rte_memzone_reserve_aligned expects unique
> zone names, append PCI address to zone name to make it unique.
> 
> Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
> ---
> v2:
>    - Formatting changes
> v3:
>    - Formatting changes
> 
>   drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


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

* Re: [PATCH v3] vdpa/sfc: make MCDI memzone name unique
  2022-02-14 10:51   ` [PATCH v3] " abhimanyu.saini
  2022-02-15 10:56     ` Maxime Coquelin
  2022-02-15 12:21     ` Maxime Coquelin
@ 2022-02-17  8:54     ` Maxime Coquelin
  2 siblings, 0 replies; 9+ messages in thread
From: Maxime Coquelin @ 2022-02-17  8:54 UTC (permalink / raw)
  To: abhimanyu.saini, dev; +Cc: chenbo.xia, andrew.rybchenko, Abhimanyu Saini



On 2/14/22 11:51, abhimanyu.saini@xilinx.com wrote:
> From: Abhimanyu Saini <asaini@xilinx.com>
> 
> Buffer for MCDI channel is allocated using rte_memzone_reserve_aligned
> with zone name 'mcdi'. Since multiple MCDI channels are needed to
> support multiple VF(s) and rte_memzone_reserve_aligned expects unique
> zone names, append PCI address to zone name to make it unique.
> 
> Signed-off-by: Abhimanyu Saini <asaini@xilinx.com>
> ---
> v2:
>    - Formatting changes
> v3:
>    - Formatting changes
> 
>   drivers/vdpa/sfc/sfc_vdpa_hw.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/vdpa/sfc/sfc_vdpa_hw.c b/drivers/vdpa/sfc/sfc_vdpa_hw.c
> index fd1fee7..a7018b1 100644
> --- a/drivers/vdpa/sfc/sfc_vdpa_hw.c
> +++ b/drivers/vdpa/sfc/sfc_vdpa_hw.c
> @@ -25,21 +25,30 @@
>   {
>   	uint64_t mcdi_iova;
>   	size_t mcdi_buff_size;
> +	char mz_name[RTE_MEMZONE_NAMESIZE];
>   	const struct rte_memzone *mz = NULL;
>   	int numa_node = sva->pdev->device.numa_node;
>   	int ret;
>   
>   	mcdi_buff_size = RTE_ALIGN_CEIL(len, PAGE_SIZE);
> +	ret = snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "%s_%s",
> +		       sva->pdev->name, name);
> +	if (ret < 0 || ret >= RTE_MEMZONE_NAMESIZE) {
> +		sfc_vdpa_err(sva, "%s_%s too long to fit in mz_name",
> +			     sva->pdev->name, name);
> +		return -EINVAL;
> +	}
>   
> -	sfc_vdpa_log_init(sva, "name=%s, len=%zu", name, len);
> +	sfc_vdpa_log_init(sva, "name=%s, len=%zu", mz_name, len);
>   
> -	mz = rte_memzone_reserve_aligned(name, mcdi_buff_size,
> +	mz = rte_memzone_reserve_aligned(mz_name, mcdi_buff_size,
>   					 numa_node,
>   					 RTE_MEMZONE_IOVA_CONTIG,
>   					 PAGE_SIZE);
>   	if (mz == NULL) {
>   		sfc_vdpa_err(sva, "cannot reserve memory for %s: len=%#x: %s",
> -			     name, (unsigned int)len, rte_strerror(rte_errno));
> +			     mz_name, (unsigned int)len,
> +			     rte_strerror(rte_errno));
>   		return -ENOMEM;
>   	}
>   


Applied to dpdk-next-virtio/main.

Thanks,
Maxime


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

end of thread, other threads:[~2022-02-17  8:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11  5:33 [PATCH] vdpa/sfc: make MCDI memzone name unique abhimanyu.saini
2022-01-14  7:06 ` Xia, Chenbo
2022-01-17 11:29 ` [PATCH v2] " abhimanyu.saini
2022-02-01  8:21   ` Maxime Coquelin
2022-02-14 10:51   ` [PATCH v3] " abhimanyu.saini
2022-02-15 10:56     ` Maxime Coquelin
2022-02-15 10:59       ` Maxime Coquelin
2022-02-15 12:21     ` Maxime Coquelin
2022-02-17  8:54     ` Maxime Coquelin

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