qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.caveayland@nutanix.com>
To: John Levon <john.levon@nutanix.com>, qemu-devel@nongnu.org
Cc: "Thanos Makatos" <thanos.makatos@nutanix.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: Re: [PATCH v3 1/5] vfio-user: simplify vfio_user_process()
Date: Tue, 2 Dec 2025 10:42:31 +0000	[thread overview]
Message-ID: <4d983197-9d34-4e89-a193-b9d55ea2c8b3@nutanix.com> (raw)
In-Reply-To: <20251201095621.2786318-2-john.levon@nutanix.com>

On 01/12/2025 09:56, John Levon wrote:

> It can figure out if it's a reply by itself, rather than passing that
> information in.
> 
> Signed-off-by: John Levon <john.levon@nutanix.com>
> ---
>   hw/vfio-user/proxy.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/vfio-user/proxy.c b/hw/vfio-user/proxy.c
> index bbd7ec243d..75845d7c89 100644
> --- a/hw/vfio-user/proxy.c
> +++ b/hw/vfio-user/proxy.c
> @@ -147,8 +147,7 @@ VFIOUserFDs *vfio_user_getfds(int numfds)
>   /*
>    * Process a received message.
>    */
> -static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
> -                              bool isreply)
> +static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg)
>   {
>   
>       /*
> @@ -157,7 +156,7 @@ static void vfio_user_process(VFIOUserProxy *proxy, VFIOUserMsg *msg,
>        *
>        * Requests get queued for the BH.
>        */
> -    if (isreply) {
> +    if ((msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY) {
>           msg->complete = true;
>           if (msg->type == VFIO_MSG_WAIT) {
>               qemu_cond_signal(&msg->cv);
> @@ -187,7 +186,6 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
>   {
>       VFIOUserMsg *msg = proxy->part_recv;
>       size_t msgleft = proxy->recv_left;
> -    bool isreply;
>       char *data;
>       int ret;
>   
> @@ -214,8 +212,7 @@ static int vfio_user_complete(VFIOUserProxy *proxy, Error **errp)
>        */
>       proxy->part_recv = NULL;
>       proxy->recv_left = 0;
> -    isreply = (msg->hdr->flags & VFIO_USER_TYPE) == VFIO_USER_REPLY;
> -    vfio_user_process(proxy, msg, isreply);
> +    vfio_user_process(proxy, msg);
>   
>       /* return positive value */
>       return 1;
> @@ -381,7 +378,7 @@ static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
>           data += ret;
>       }
>   
> -    vfio_user_process(proxy, msg, isreply);
> +    vfio_user_process(proxy, msg);
>       return 0;
>   
>       /*

Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>


ATB,

Mark.



  reply	other threads:[~2025-12-02 10:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01  9:56 [PATCH v3 0/5] vfio-user coverity fixes John Levon
2025-12-01  9:56 ` [PATCH v3 1/5] vfio-user: simplify vfio_user_process() John Levon
2025-12-02 10:42   ` Mark Cave-Ayland [this message]
2025-12-01  9:56 ` [PATCH v3 2/5] vfio-user: clarify partial message handling John Levon
2025-12-02 10:43   ` Mark Cave-Ayland
2025-12-01  9:56 ` [PATCH v3 3/5] vfio-user: refactor out header handling John Levon
2025-12-02 10:53   ` Mark Cave-Ayland
2025-12-03  7:40     ` Cédric Le Goater
2025-12-01  9:56 ` [PATCH v3 4/5] vfio-user: simplify vfio_user_recv_one() John Levon
2025-12-02 11:11   ` Mark Cave-Ayland
2025-12-01  9:56 ` [PATCH v3 5/5] vfio-user: recycle msg on failure John Levon
2025-12-02 11:14   ` Mark Cave-Ayland

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=4d983197-9d34-4e89-a193-b9d55ea2c8b3@nutanix.com \
    --to=mark.caveayland@nutanix.com \
    --cc=clg@redhat.com \
    --cc=john.levon@nutanix.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thanos.makatos@nutanix.com \
    /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).