From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 740F0A0547; Sun, 26 Sep 2021 22:47:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 38C8940E78; Sun, 26 Sep 2021 22:47:38 +0200 (CEST) Received: from cmccmta1.chinamobile.com (cmccmta1.chinamobile.com [221.176.66.79]) by mails.dpdk.org (Postfix) with ESMTP id 6215C4003C for ; Sun, 26 Sep 2021 18:36:47 +0200 (CEST) Received: from spf.mail.chinamobile.com (unknown[172.16.121.15]) by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee46150a18baef-d2935; Mon, 27 Sep 2021 00:36:29 +0800 (CST) X-RM-TRANSID: 2ee46150a18baef-d2935 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from chenjilei.localdomain (unknown[223.112.32.184]) by rmsmtp-syy-appsvr08-12008 (RichMail) with SMTP id 2ee86150a1850b2-da1dc; Mon, 27 Sep 2021 00:36:29 +0800 (CST) X-RM-TRANSID: 2ee86150a1850b2-da1dc From: jilei chen To: xiao.w.wang@intel.com Cc: dev@dpdk.org Date: Mon, 27 Sep 2021 00:45:18 +0800 Message-Id: <20210926164518.8982-1-chenjilei@cmss.chinamobile.com> X-Mailer: git-send-email 2.12.2 X-Mailman-Approved-At: Sun, 26 Sep 2021 22:47:36 +0200 Subject: [dpdk-dev] [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: jilei chen --- 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