DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa
@ 2021-09-26 16:45 jilei chen
  2021-09-27  2:09 ` Wang, Xiao W
  2021-09-27  5:17 ` [dpdk-dev] [PATCH] vdpa/ifc: increase readability in function jilei chen
  0 siblings, 2 replies; 7+ messages in thread
From: jilei chen @ 2021-09-26 16:45 UTC (permalink / raw)
  To: xiao.w.wang; +Cc: dev

Signed-off-by: jilei chen <chenjilei@cmss.chinamobile.com>
---
 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




^ permalink raw reply	[flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa
@ 2021-09-26 15:57 jilei chen
  0 siblings, 0 replies; 7+ messages in thread
From: jilei chen @ 2021-09-26 15:57 UTC (permalink / raw)
  To: xiao.w.wang; +Cc: dev, Jilei Chen

From: Jilei Chen <chenjilei@cmss.chinamobile.com>

Signed-off-by: Jilei Chen <chenjilei@cmss.chinamobile.com>
---
 drivers/net/ifc/ifcvf_vdpa.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
index da4667ba54..fe7ec87a8a 100644
--- a/drivers/net/ifc/ifcvf_vdpa.c
+++ b/drivers/net/ifc/ifcvf_vdpa.c
@@ -37,6 +37,8 @@
 
 #define IFCVF_VDPA_MODE		"vdpa"
 #define IFCVF_SW_FALLBACK_LM	"sw-live-migration"
+#define IFCVF_MAP	1
+#define IFCVF_UNMAP	0
 
 static const char * const ifcvf_valid_arguments[] = {
 	IFCVF_VDPA_MODE,
@@ -535,7 +537,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;
 
@@ -565,7 +567,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;
 
@@ -869,7 +871,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;
 }
@@ -926,7 +928,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




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

end of thread, other threads:[~2021-09-30 17:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 16:45 [dpdk-dev] [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa jilei chen
2021-09-27  2:09 ` Wang, Xiao W
2021-09-27  5:17 ` [dpdk-dev] [PATCH] vdpa/ifc: increase readability in function jilei chen
2021-09-27 10:17   ` [dpdk-dev] [PATCH] [v3] " jilei chen
2021-09-28  2:22     ` Wang, Xiao W
2021-09-30 17:24       ` Ferruh Yigit
  -- strict thread matches above, loose matches on Subject: below --
2021-09-26 15:57 [dpdk-dev] [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa jilei chen

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