qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/6] vdpa: Make VhostVDPAState cvq_cmd_out_buffer control


From: Jason Wang
Subject: Re: [PATCH v2 1/6] vdpa: Make VhostVDPAState cvq_cmd_out_buffer control ack type
Date: Thu, 25 Aug 2022 11:07:30 +0800

On Thu, Aug 25, 2022 at 2:36 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> This allows to simplify the code.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>  net/vhost-vdpa.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 6ce68fcd3f..468e460ac2 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -35,7 +35,9 @@ typedef struct VhostVDPAState {
>      VHostNetState *vhost_net;
>
>      /* Control commands shadow buffers */
> -    void *cvq_cmd_out_buffer, *cvq_cmd_in_buffer;
> +    void *cvq_cmd_out_buffer;
> +    virtio_net_ctrl_ack *cvq_cmd_in_buffer;

Nit, let's simply rename this to 'status'.

Thanks

> +
>      bool started;
>  } VhostVDPAState;
>
> @@ -396,7 +398,7 @@ static int vhost_vdpa_net_load(NetClientState *nc)
>              return dev_written;
>          }
>
> -        return *((virtio_net_ctrl_ack *)s->cvq_cmd_in_buffer) != 
> VIRTIO_NET_OK;
> +        return *s->cvq_cmd_in_buffer != VIRTIO_NET_OK;
>      }
>
>      return 0;
> @@ -491,8 +493,7 @@ static int 
> vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq,
>          goto out;
>      }
>
> -    memcpy(&status, s->cvq_cmd_in_buffer, sizeof(status));
> -    if (status != VIRTIO_NET_OK) {
> +    if (*s->cvq_cmd_in_buffer != VIRTIO_NET_OK) {
>          return VIRTIO_NET_ERR;
>      }
>
> --
> 2.31.1
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]