mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Eli Cohen <eli@mellanox.com>,
	mst@redhat.com, virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Cc: shahafs@mellanox.com, saeedm@mellanox.com, parav@mellanox.com
Subject: Re: [PATCH V4 linux-next 08/12] vdpa: Modify get_vq_state() to return error code
Date: Wed, 5 Aug 2020 16:10:46 +0800	[thread overview]
Message-ID: <972bc164-0d9d-a7fa-6929-daee843f04d7@redhat.com> (raw)
In-Reply-To: <20200804162048.22587-9-eli@mellanox.com>


On 2020/8/5 上午12:20, Eli Cohen wrote:
> Modify get_vq_state() so it returns an error code. In case of hardware
> acceleration, the available index may be retrieved from the device, an
> operation that can possibly fail.
>
> Reviewed-by: Parav Pandit <parav@mellanox.com>
> Signed-off-by: Eli Cohen <eli@mellanox.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   drivers/vdpa/ifcvf/ifcvf_main.c  | 5 +++--
>   drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 +++--
>   drivers/vhost/vdpa.c             | 5 ++++-
>   include/linux/vdpa.h             | 4 ++--
>   4 files changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index dc311e972b9e..076d7ac5e723 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -237,12 +237,13 @@ static u16 ifcvf_vdpa_get_vq_num_max(struct vdpa_device *vdpa_dev)
>   	return IFCVF_QUEUE_MAX;
>   }
>   
> -static void ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid,
> -				    struct vdpa_vq_state *state)
> +static int ifcvf_vdpa_get_vq_state(struct vdpa_device *vdpa_dev, u16 qid,
> +				   struct vdpa_vq_state *state)
>   {
>   	struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
>   
>   	state->avail_index = ifcvf_get_vq_state(vf, qid);
> +	return 0;
>   }
>   
>   static int ifcvf_vdpa_set_vq_state(struct vdpa_device *vdpa_dev, u16 qid,
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index f1c351d5959b..c68741363643 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -464,14 +464,15 @@ static int vdpasim_set_vq_state(struct vdpa_device *vdpa, u16 idx,
>   	return 0;
>   }
>   
> -static void vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx,
> -				 struct vdpa_vq_state *state)
> +static int vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx,
> +				struct vdpa_vq_state *state)
>   {
>   	struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
>   	struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
>   	struct vringh *vrh = &vq->vring;
>   
>   	state->avail_index = vrh->last_avail_idx;
> +	return 0;
>   }
>   
>   static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa)
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index c2e1e2d55084..a0b7c91948e1 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -392,7 +392,10 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
>   		ops->set_vq_ready(vdpa, idx, s.num);
>   		return 0;
>   	case VHOST_GET_VRING_BASE:
> -		ops->get_vq_state(v->vdpa, idx, &vq_state);
> +		r = ops->get_vq_state(v->vdpa, idx, &vq_state);
> +		if (r)
> +			return r;
> +
>   		vq->last_avail_idx = vq_state.avail_index;
>   		break;
>   	case VHOST_GET_BACKEND_FEATURES:
> diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
> index 8f412620071d..fd6e560d70f9 100644
> --- a/include/linux/vdpa.h
> +++ b/include/linux/vdpa.h
> @@ -192,8 +192,8 @@ struct vdpa_config_ops {
>   	bool (*get_vq_ready)(struct vdpa_device *vdev, u16 idx);
>   	int (*set_vq_state)(struct vdpa_device *vdev, u16 idx,
>   			    const struct vdpa_vq_state *state);
> -	void (*get_vq_state)(struct vdpa_device *vdev, u16 idx,
> -			     struct vdpa_vq_state *state);
> +	int (*get_vq_state)(struct vdpa_device *vdev, u16 idx,
> +			    struct vdpa_vq_state *state);
>   	struct vdpa_notification_area
>   	(*get_vq_notification)(struct vdpa_device *vdev, u16 idx);
>   	int (*get_vq_irq)(struct vdpa_device *vdv, u16 idx);


  reply	other threads:[~2020-08-05  8:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 16:20 [PATCH V4 linux-next 00/12] VDPA support for Mellanox ConnectX devices Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 01/12] vhost-vdpa: refine ioctl pre-processing Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 02/12] vhost: generialize backend features setting/getting Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 03/12] vhost-vdpa: support get/set backend features Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 04/12] vhost-vdpa: support IOTLB batching hints Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 05/12] vdpasim: support batch updating Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 06/12] vdpa: remove hard coded virtq num Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 07/12] net/vdpa: Use struct for set/get vq state Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 08/12] vdpa: Modify get_vq_state() to return error code Eli Cohen
2020-08-05  8:10   ` Jason Wang [this message]
2020-08-04 16:20 ` [PATCH V4 linux-next 09/12] vdpa/mlx5: Add hardware descriptive header file Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 10/12] vdpa/mlx5: Add support library for mlx5 VDPA implementation Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 11/12] vdpa/mlx5: Add shared memory registration code Eli Cohen
2020-08-04 16:20 ` [PATCH V4 linux-next 12/12] vdpa/mlx5: Add VDPA driver for supported mlx5 devices Eli Cohen
2020-08-05  8:09   ` Jason Wang
2020-08-04 21:29 ` [PATCH V4 linux-next 00/12] VDPA support for Mellanox ConnectX devices Michael S. Tsirkin
2020-08-05  5:01   ` Eli Cohen
2020-08-05  8:12     ` Jason Wang
2020-08-05  8:18       ` Eli Cohen
2020-08-05  8:11 ` Jason Wang
2020-08-05 12:00 ` Michael S. Tsirkin
2020-08-05 12:40   ` Eli Cohen
2020-08-05 12:48     ` Michael S. Tsirkin
2020-08-05 13:01       ` Eli Cohen
2020-08-05 13:12         ` Michael S. Tsirkin
2020-08-05 19:01           ` Saeed Mahameed
2020-08-05 19:46             ` Jason Gunthorpe
2020-08-05 22:31               ` Michael S. Tsirkin

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=972bc164-0d9d-a7fa-6929-daee843f04d7@redhat.com \
    --to=jasowang@redhat.com \
    --cc=eli@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=parav@mellanox.com \
    --cc=saeedm@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=virtualization@lists.linux-foundation.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

all inboxes | Powered by JetHome®