diff mbox series

[v2] vdpa/sfc: make MCDI memzone name unique

Message ID 20220117112906.23823-1-asaini@xilinx.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers show
Series [v2] vdpa/sfc: make MCDI memzone name unique | expand

Checks

Context Check Description
ci/iol-testing warning apply patch failure
ci/Intel-compilation warning apply issues
ci/checkpatch warning coding style issues

Commit Message

abhimanyu.saini@xilinx.com Jan. 17, 2022, 11:29 a.m. UTC
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(-)

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

Comments

Maxime Coquelin Feb. 1, 2022, 8:21 a.m. UTC | #1
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
diff mbox series

Patch

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;
        }