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; 10+ 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] 10+ messages in thread
* [PATCH] vdpa/sfc: make MCDI memzone name unique
@ 2022-01-04  3:54 abhimanyu.saini
  0 siblings, 0 replies; 10+ messages in thread
From: abhimanyu.saini @ 2022-01-04  3:54 UTC (permalink / raw)
  To: dev; +Cc: maxime.coquelin, chenbo.c, 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] 10+ messages in thread

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

Thread overview: 10+ 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
  -- strict thread matches above, loose matches on Subject: below --
2022-01-04  3:54 [PATCH] " abhimanyu.saini

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