On Thu, Aug 25, 2022 at 2:36 AM Eugenio Pérez <epere...@redhat.com> wrote:
>
> This allows to simplify the code.
>
> Signed-off-by: Eugenio Pérez <epere...@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