Re: [dpdk-dev] [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa
From: Wang, Xiao W <hidden>
Date: 2021-09-27 02:09:20
Hi Jilei, Please notice the patch format requirement, the subject of the patch should start with "vdpa/ifc: ". You also need to keep it concise, around ~50 characters. Refer " doc/guides/contributing/patches.rst" for more detail. Back to this patch, it looks we can just change function ifcvf_dma_map(struct ifcvf_internal *internal, int do_map) to ifcvf_dma_map(struct ifcvf_internal *internal, bool do_map), and use "true" or "false" when calling it. This would align with vdpa_enable_vfio_intr(). In your next version patch, you can also change the "1", "0" parameter to "true", "false" when calling vdpa_enable_vfio_intr(). BRs, Xiao
quoted hunk ↗ jump to hunk
-----Original Message----- From: jilei chen <redacted> Sent: Monday, September 27, 2021 12:45 AM To: Wang, Xiao W <redacted> Cc: dev@dpdk.org Subject: [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa Signed-off-by: jilei chen <redacted> --- drivers/vdpa/ifc/ifcvf_vdpa.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 1dc813d0a3..c2bf26f2b7 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c@@ -36,6 +36,8 @@ RTE_LOG_REGISTER(ifcvf_vdpa_logtype,pmd.vdpa.ifcvf, NOTICE); #define IFCVF_VDPA_MODE "vdpa" #define IFCVF_SW_FALLBACK_LM "sw-live-migration" +#define IFCVF_MAP 1 +#define IFCVF_UNMAP 0 #define THREAD_NAME_LEN 16@@ -538,7 +540,7 @@ update_datapath(struct ifcvf_internal *internal) if (!rte_atomic32_read(&internal->running) && (rte_atomic32_read(&internal->started) && rte_atomic32_read(&internal->dev_attached))) { - ret = ifcvf_dma_map(internal, 1); + ret = ifcvf_dma_map(internal, IFCVF_MAP); if (ret) goto err;@@ -568,7 +570,7 @@ update_datapath(struct ifcvf_internal *internal) if (ret) goto err; - ret = ifcvf_dma_map(internal, 0); + ret = ifcvf_dma_map(internal, IFCVF_UNMAP); if (ret) goto err;@@ -875,7 +877,7 @@ ifcvf_sw_fallback_switchover(struct ifcvf_internal*internal) unset_intr: vdpa_disable_vfio_intr(internal); unmap: - ifcvf_dma_map(internal, 0); + ifcvf_dma_map(internal, IFCVF_UNMAP); error: return -1; }@@ -934,7 +936,7 @@ ifcvf_dev_close(int vid) vdpa_disable_vfio_intr(internal); /* unset DMA map for guest memory */ - ifcvf_dma_map(internal, 0); + ifcvf_dma_map(internal, IFCVF_UNMAP); internal->sw_fallback_running = false; } else { --2.12.2