Enhance code readability when dma_map in ifc/ifcvp_vdpa
Checks
Commit Message
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(-)
@@ -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 {