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 CB488A0548; Mon, 27 Sep 2021 04:09:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4FF8B40686; Mon, 27 Sep 2021 04:09:19 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id D44904003D for ; Mon, 27 Sep 2021 04:09:17 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10119"; a="211637612" X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="211637612" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2021 19:09:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="475756164" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga007.jf.intel.com with ESMTP; 26 Sep 2021 19:09:16 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sun, 26 Sep 2021 19:09:15 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sun, 26 Sep 2021 19:09:15 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.48) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Sun, 26 Sep 2021 19:09:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GT/utvdx0myy/u6x6oZPrFnUpE2n4jEOTYKFfkmQeEsttxQQsB0KUt43+HiyVsmjzxZl+g1vZDUz/5J74/b2J6xdYWt/IFIYvC61rOtlD8hwEhfbFppiqcaTxLY5ngm0pGAZj0nBssJXOhBG2yGpmgt3uoiroIUYEdGUCDYPEguYf1LTDXtGHiLNvvxgYvOVh3TZ5wgd1F5D5rpgSCXxocSvtydjx2tDaQ62O+yjZNcaTPB4YRM2OHOrsYmgSXfKZ6FiN7YBz6mIcRhCzuu0jjrlF+qFLw2lGxPcdKUVnrkXaCLfgSms+iei5ESJSul/82fGbwUOr4GprJaVrGphTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=npBdIK7f7c0CtKFusrH3ooavyeC4LLzSWc9V8oXYsx0=; b=AJJ43VsHnekQGRcYF5m2LkLl/jT7I6aYfUmVodbZC9m0a7W1tHt55iQOK3gt5L9oLXx1PqZZ241SsHBBasHOaMnXHoOSewcYD1RePUMUBBH+IqwZ4l51sgG9xh59lKjQiJHonYqnjSs0qycVZ6hZCjeqHfQMDs2U2LeBfMPfTvTGmp3x4efALNWge/SCH3vzRSCh30fWR1oxwV/A4PAKuK1NfL3iOJ3e0Qo9PmdQkbNZnJQZMsQB1OTFKtrth5tvhm+vQoCion20fyLxbKw6yq9S818/QVJildjeTW5uhQ4XUuq5xKo/7dVqfyGPpJ2pkEOvTplhiToKm+3743GDMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=npBdIK7f7c0CtKFusrH3ooavyeC4LLzSWc9V8oXYsx0=; b=qMCwy85OVMwWGw5xxcpciRg1fWZRdqM3gcFb+VKeVSIvRnxtzolhcYMRmszUaalw4ErLJTyOyuz42aRg7nFIAL1PBhI5pav49N59cNnXxdjpoLg9rmY9sxkdI8KqsusQhywQ9BXB7PqDcOgysQHiAoRbR+52Np//fsGjL27Cq68= Received: from DM8PR11MB5751.namprd11.prod.outlook.com (2603:10b6:8:12::16) by DM6PR11MB4362.namprd11.prod.outlook.com (2603:10b6:5:1dd::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.18; Mon, 27 Sep 2021 02:09:14 +0000 Received: from DM8PR11MB5751.namprd11.prod.outlook.com ([fe80::7d53:9d3b:b91f:9c09]) by DM8PR11MB5751.namprd11.prod.outlook.com ([fe80::7d53:9d3b:b91f:9c09%7]) with mapi id 15.20.4544.021; Mon, 27 Sep 2021 02:09:14 +0000 From: "Wang, Xiao W" To: jilei chen CC: "dev@dpdk.org" Thread-Topic: [PATCH] Enhance code readability when dma_map in ifc/ifcvp_vdpa Thread-Index: AQHXsvTBqpL3gmEk/E2Ft03nIve1Uqu3Gs4w Date: Mon, 27 Sep 2021 02:09:13 +0000 Message-ID: References: <20210926164518.8982-1-chenjilei@cmss.chinamobile.com> In-Reply-To: <20210926164518.8982-1-chenjilei@cmss.chinamobile.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows authentication-results: cmss.chinamobile.com; dkim=none (message not signed) header.d=none;cmss.chinamobile.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fb6795b2-2573-47a6-44e4-08d9815bcd92 x-ms-traffictypediagnostic: DM6PR11MB4362: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3826; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FS8BbsTSrDWXTv8t5oiWl54yQrYPBOpLWGaK9ahvm6DVI0Gq/wTgxB+Pj6l4bNBN/gCNYP37VmsGCmB5yaTpT4iY6dF1fke3vppJK+zIICzpoMoHzLoadJbJkt9yiQLNsRtVWyiYLcjPfrn93x5N8L6gD/bZ8zYCMiAmPUXAr3DfPIw3GEKMQgez5O2+5j1aZXlX7R7wUUrXlGWZjQqs8tKrxHjkbSlZySUWtPvV1upUixPm2oDm4Fw/ThPuGC+4LNXwLa1Q1l7s1Qd6+b17H69xBRB5AdE9QGgZgGZTWt1bbn99Z6gXCoPp+m3M7n3i5F7KjsPcfLCL6TEYm5CY3h6/8cUn4KkjWX2EceBJrJLUZCjrNNfL13EoQa/CJUvyVH0uTtYTBaVNsn/5ziz7iT4NZxZ3djnhXfpo/in6WBtdPCg/Bw/Os0S+1ZKdvSlp4wDQr0WuLyF+4zcWUPUSKcuscZZUoCtCf3j9ztQb4WtbQcuRa10fvhC5grrO/hg9FmOgjdo1QQHt/t9soTt/KHmIlqwMIOWdAhjnL24mIrL/Kgttu7nqNKacPAL5joawigzSxPuVEpji9i1gzADIltn/F27xaNj9tOKs8K9fUXRceZ2MvxSGZv40ywX8b1/ixOYgyxeMHugBQls/rx2NLWohT90ac7D3Hh28gCf6nR/CZILNjvPTFoaUhP2bpuEh8jamaSv6OHs0ioqP5o3va/8xWQWLFU+2zBNqq1tEHYjCL87pqKY1cyeeS5jzaehm x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR11MB5751.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6916009)(7696005)(38100700002)(5660300002)(316002)(53546011)(66556008)(66946007)(8676002)(55016002)(186003)(86362001)(8936002)(52536014)(6506007)(83380400001)(508600001)(4326008)(66446008)(9686003)(33656002)(76116006)(26005)(71200400001)(66476007)(64756008)(38070700005)(2906002)(122000001)(71600200004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?gGkdjbfqKC3Haff8jwCtn3SZvx03ApoAFnBpLqn5Jt+k6MrZqKqiFRj8?= =?Windows-1252?Q?x29ekvQQFXLU4i2SX0PHZmcLCWYhwoEUAGjl0nFK+Wo7PZdqNn9wez4N?= =?Windows-1252?Q?w4onHhuXiVh4tMsG2FhT7iKjJaFIj1Uu2W1Ib2RteWfEFyW2+qFmSTfv?= =?Windows-1252?Q?eg/ZMBBAQqYLwrglxHBUpzfSuRA79ToVSvFz+x2j7Q3l4l14+iFGukF1?= =?Windows-1252?Q?287Udtm1wNMThMVtTM91K8zzKpV24FDcWbMZraUAHjfjl9qCgpOpYUTL?= =?Windows-1252?Q?OU7TaiQ3AYHilh4W8HTlEzh+xZ5twhh7yvPheq61JXmYagNwC4PqjmRI?= =?Windows-1252?Q?4JQ+l7dKnZOvgu180MvxXU3O8mV+YjK7ketW9eYZ3MCAAi4aoN56QmmC?= =?Windows-1252?Q?s+/wT7zlXU7BS0QhlG/WL6rMQn8qMPV2PWfEFxm1CjTm2OUm9a8BBR6S?= =?Windows-1252?Q?G1JzIRyfz7bjpGvzCDhUdB8YLMHDyDnrUutv9FzBLHEMu/1Q/VHpnrDp?= =?Windows-1252?Q?slackvK4PtBBNXqoJWOh8SGCWsu2AiEMfg3qlGjr93hQ38KuF7CSr80w?= =?Windows-1252?Q?e1od+H+MaR3Ms6QrL7kCxArUrHqdqLO5C1bU1kviS0OsenWGTb2KHbqJ?= =?Windows-1252?Q?6aE30UjtOKOxRXlo3YRbPVe7KiEv2+eg9B1hKiBvknQz8mUj8uuQB5EG?= =?Windows-1252?Q?jHoINe0htJzAVXqB3/nVGxP7mtvp55Lh3x7ZqffuLW1dPwpSKK0Ll3P2?= =?Windows-1252?Q?4+lUoevcshXjKhMfoJXE72qpcRmdVatCx4mEPhKnuk8Di7v2Ooz77uxM?= =?Windows-1252?Q?gPe3Dx++lDaWj5FzVUiZmIPf/CQbRLqcjaAG9OvU4LXYc8bq9S3sC+LY?= =?Windows-1252?Q?NG1b1YclvwvNMvO3GShlQ9PCmfZz3i15kMC0RUgKABfjXfTGT47kP/7f?= =?Windows-1252?Q?/8BsL0B3KtUOfudsP9JIj0Cc9jTpM9QIUURhuY8g2Hn54YYqe262xjEy?= =?Windows-1252?Q?0qJhzUFtsGh1Uo1pxILdc+AGOk0TN7HcG52WiHVuTpCoBs0y/BLUwdJN?= =?Windows-1252?Q?eZZik6Z8khZ7XBG4nWplk1onQxhMhFiXjsmvJCfZiKZE6HHs55vHMijr?= =?Windows-1252?Q?cldQdzN8j+zmKA2Au4tB3tavc5V8YFK6nB/fobd3uV8dCplV0uLpyNqR?= =?Windows-1252?Q?ywgMf4sEBJyIbDSoYYHQb9sSrasUN/TxMlpmauelvvG1EThB1HWPK0xb?= =?Windows-1252?Q?8j0/iWSBrySQOGon83AMMBK0Bom/z65FZHKyU02g55dJv1S1G6DJ6Qoe?= =?Windows-1252?Q?ONyKc+Uh8gfNRjeWTpXXlbbDLvB4L6bV3kmGGTZsIzfFFvSQGC6nTM5j?= =?Windows-1252?Q?mCLYL7lSYg7Rpz+3OdN4GqNo9Rrk1mibKiSc8/YpozTBBZ3pIfHnnoUj?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM8PR11MB5751.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb6795b2-2573-47a6-44e4-08d9815bcd92 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Sep 2021 02:09:13.9223 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ykBqhMeUquxsUFPHnGkg+HBRWvTMF6sORXP+9bV+MfC+IxiBeQBXghCoMUY2oqmVuQ0Gf+b9Nxd0gi+ofQyZ9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4362 X-OriginatorOrg: intel.com Subject: Re: [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" 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(stru= ct 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 > -----Original Message----- > From: jilei chen > Sent: Monday, September 27, 2021 12:45 AM > To: Wang, Xiao W > Cc: dev@dpdk.org > Subject: [PATCH] Enhance code readability when dma_map in > ifc/ifcvp_vdpa >=20 > Signed-off-by: jilei chen > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > 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); >=20 > #define IFCVF_VDPA_MODE "vdpa" > #define IFCVF_SW_FALLBACK_LM "sw-live-migration" > +#define IFCVF_MAP 1 > +#define IFCVF_UNMAP 0 >=20 > #define THREAD_NAME_LEN 16 >=20 > @@ -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 =3D ifcvf_dma_map(internal, 1); > + ret =3D ifcvf_dma_map(internal, IFCVF_MAP); > if (ret) > goto err; >=20 > @@ -568,7 +570,7 @@ update_datapath(struct ifcvf_internal *internal) > if (ret) > goto err; >=20 > - ret =3D ifcvf_dma_map(internal, 0); > + ret =3D ifcvf_dma_map(internal, IFCVF_UNMAP); > if (ret) > goto err; >=20 > @@ -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); >=20 > /* unset DMA map for guest memory */ > - ifcvf_dma_map(internal, 0); > + ifcvf_dma_map(internal, IFCVF_UNMAP); >=20 > internal->sw_fallback_running =3D false; > } else { > -- > 2.12.2 >=20 >=20