From: "Wang, Xiao W" <xiao.w.wang@intel.com>
To: jilei chen <chenjilei@cmss.chinamobile.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] [v2] vdpa/ifc: increase readability in function
Date: Mon, 27 Sep 2021 08:45:53 +0000 [thread overview]
Message-ID: <DM8PR11MB5751CA3F14B08B467F004620B8A79@DM8PR11MB5751.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210927081146.20596-1-chenjilei@cmss.chinamobile.com>
Hi,
> -----Original Message-----
> From: jilei chen <chenjilei@cmss.chinamobile.com>
> Sent: Monday, September 27, 2021 4:12 PM
> To: Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH] [v2] vdpa/ifc: increase readability in function
>
> Optimize several parameters form order to better readability
To the best of my English knowledge, there's a grammar error here.
How about changing it to:
Use bool type for function's switch parameter, this could avoid passing "1" or "0"
which is not reader friendly.
BRs,
Xiao
>
> Signed-off-by: jilei chen <chenjilei@cmss.chinamobile.com>
> ---
> v2:
> * Concise subject of the patch
> * Optimize function parameters
> ---
> drivers/vdpa/ifc/ifcvf_vdpa.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 1dc813d0a3..365da2a8b9 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -182,7 +182,7 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal)
> }
>
> static int
> -ifcvf_dma_map(struct ifcvf_internal *internal, int do_map)
> +ifcvf_dma_map(struct ifcvf_internal *internal, bool do_map)
> {
> uint32_t i;
> int ret;
> @@ -538,11 +538,11 @@ 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, true);
> if (ret)
> goto err;
>
> - ret = vdpa_enable_vfio_intr(internal, 0);
> + ret = vdpa_enable_vfio_intr(internal, false);
> if (ret)
> goto err;
>
> @@ -568,7 +568,7 @@ update_datapath(struct ifcvf_internal *internal)
> if (ret)
> goto err;
>
> - ret = ifcvf_dma_map(internal, 0);
> + ret = ifcvf_dma_map(internal, false);
> if (ret)
> goto err;
>
> @@ -850,7 +850,7 @@ ifcvf_sw_fallback_switchover(struct ifcvf_internal
> *internal)
> goto error;
>
> /* set up interrupt for interrupt relay */
> - ret = vdpa_enable_vfio_intr(internal, 1);
> + ret = vdpa_enable_vfio_intr(internal, true);
> if (ret)
> goto unmap;
>
> @@ -875,7 +875,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, false);
> error:
> return -1;
> }
> @@ -934,7 +934,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, false);
>
> internal->sw_fallback_running = false;
> } else {
> @@ -1130,7 +1130,7 @@ ifcvf_set_vring_state(int vid, int vring, int state)
> }
>
> if (state && !hw->vring[vring].enable) {
> - ret = vdpa_enable_vfio_intr(internal, 0);
> + ret = vdpa_enable_vfio_intr(internal, false);
> if (ret)
> return ret;
> }
> --
> 2.12.2
>
>
prev parent reply other threads:[~2021-09-27 8:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 8:11 jilei chen
2021-09-27 8:45 ` Wang, Xiao W [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM8PR11MB5751CA3F14B08B467F004620B8A79@DM8PR11MB5751.namprd11.prod.outlook.com \
--to=xiao.w.wang@intel.com \
--cc=chenjilei@cmss.chinamobile.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).