From: Jason Wang <jasowang@redhat.com>
To: mst@redhat.com, jasowang@redhat.com,
virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org
Cc: rob.miller@broadcom.com, lingshan.zhu@intel.com,
eperezma@redhat.com, lulu@redhat.com, shahafs@mellanox.com,
hanand@xilinx.com, mhabets@solarflare.com, gdawar@xilinx.com,
saugatm@xilinx.com, vmireyno@marvell.com,
zhangweining@ruijie.com.cn, eli@mellanox.com
Subject: [PATCH RFC 1/5] vhost-vdpa: refine ioctl pre-processing
Date: Thu, 18 Jun 2020 13:56:22 +0800 [thread overview]
Message-ID: <20200618055626.25660-2-jasowang@redhat.com> (raw)
In-Reply-To: <20200618055626.25660-1-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 77a0c9fb6cc3..db4c9cb44c61 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -353,15 +353,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.20.1
next prev parent reply other threads:[~2020-06-18 5:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 5:56 [PATCH RFC 0/5] support batched IOTLB updating in vhost-vdpa Jason Wang
2020-06-18 5:56 ` Jason Wang [this message]
2020-06-18 5:56 ` [PATCH RFC 2/5] vhost: generialize backend features setting/getting Jason Wang
2020-06-18 5:56 ` [PATCH RFC 3/5] vhost-vdpa: support get/set backend features Jason Wang
2020-06-18 5:56 ` [PATCH RFC 4/5] vhost-vdpa: support IOTLB batching hints Jason Wang
2020-06-28 9:58 ` Michael S. Tsirkin
2020-06-29 9:26 ` Jason Wang
2020-06-29 15:49 ` Michael S. Tsirkin
2020-06-30 1:55 ` Jason Wang
2020-06-18 5:56 ` [PATCH RFC 5/5] vdpasim: support batch updating Jason Wang
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=20200618055626.25660-2-jasowang@redhat.com \
--to=jasowang@redhat.com \
--cc=eli@mellanox.com \
--cc=eperezma@redhat.com \
--cc=gdawar@xilinx.com \
--cc=hanand@xilinx.com \
--cc=lingshan.zhu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lulu@redhat.com \
--cc=mhabets@solarflare.com \
--cc=mst@redhat.com \
--cc=rob.miller@broadcom.com \
--cc=saugatm@xilinx.com \
--cc=shahafs@mellanox.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=vmireyno@marvell.com \
--cc=zhangweining@ruijie.com.cn \
/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).