From: Eli Cohen <eli@mellanox.com>
To: mst@redhat.com, jasowang@redhat.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Cc: shahafs@mellanox.com, saeedm@mellanox.com, parav@mellanox.com
Subject: [PATCH V4 linux-next 01/12] vhost-vdpa: refine ioctl pre-processing
Date: Tue, 4 Aug 2020 19:20:37 +0300 [thread overview]
Message-ID: <20200804162048.22587-2-eli@mellanox.com> (raw)
In-Reply-To: <20200804162048.22587-1-eli@mellanox.com>
From: Jason Wang <jasowang@redhat.com>
Switch to use 'switch' to make the codes more easier to be extended.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/vhost/vdpa.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 16e0ffb115be..563ae6204052 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -377,15 +377,16 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
idx = array_index_nospec(idx, v->nvqs);
vq = &v->vqs[idx];
- if (cmd == VHOST_VDPA_SET_VRING_ENABLE) {
+ switch (cmd) {
+ case VHOST_VDPA_SET_VRING_ENABLE:
if (copy_from_user(&s, argp, sizeof(s)))
return -EFAULT;
ops->set_vq_ready(vdpa, idx, s.num);
return 0;
- }
-
- if (cmd == VHOST_GET_VRING_BASE)
+ case VHOST_GET_VRING_BASE:
vq->last_avail_idx = ops->get_vq_state(v->vdpa, idx);
+ break;
+ }
r = vhost_vring_ioctl(&v->vdev, cmd, argp);
if (r)
--
2.26.0
next prev parent reply other threads:[~2020-08-04 16:25 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 ` Eli Cohen [this message]
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
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=20200804162048.22587-2-eli@mellanox.com \
--to=eli@mellanox.com \
--cc=jasowang@redhat.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;
as well as URLs for NNTP newsgroup(s).