From: Johannes Berg <johannes@sipsolutions.net> To: qemu-devel@nongnu.org Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Johannes Berg" <johannes.berg@intel.com>, "Tiwei Bie" <tiwei.bie@intel.com>, "Michael S . Tsirkin" <mst@redhat.com> Subject: [Qemu-devel] [PATCH] libvhost-user: introduce and use vu_has_protocol_feature() Date: Wed, 4 Sep 2019 09:50:21 +0300 [thread overview] Message-ID: <20190904065021.1360-1-johannes@sipsolutions.net> (raw) From: Johannes Berg <johannes.berg@intel.com> This simplifies the various has_feature() checks, we already have vu_has_feature() but it checks features, not protocol features. Signed-off-by: Johannes Berg <johannes.berg@intel.com> --- contrib/libvhost-user/libvhost-user.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index fcf4a8a00ed2..fba291c13db4 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -94,6 +94,11 @@ bool vu_has_feature(VuDev *dev, return has_feature(dev->features, fbit); } +static inline bool vu_has_protocol_feature(VuDev *dev, unsigned int fbit) +{ + return has_feature(dev->protocol_features, fbit); +} + static const char * vu_request_to_string(unsigned int req) { @@ -951,8 +956,7 @@ vu_check_queue_inflights(VuDev *dev, VuVirtq *vq) { int i = 0; - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } @@ -1097,8 +1101,7 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd, vmsg.fd_num = fd_num; - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) { return false; } @@ -2199,8 +2202,7 @@ vu_queue_map_desc(VuDev *dev, VuVirtq *vq, unsigned int idx, size_t sz) static int vu_queue_inflight_get(VuDev *dev, VuVirtq *vq, int desc_idx) { - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } @@ -2217,8 +2219,7 @@ vu_queue_inflight_get(VuDev *dev, VuVirtq *vq, int desc_idx) static int vu_queue_inflight_pre_put(VuDev *dev, VuVirtq *vq, int desc_idx) { - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } @@ -2234,8 +2235,7 @@ vu_queue_inflight_pre_put(VuDev *dev, VuVirtq *vq, int desc_idx) static int vu_queue_inflight_post_put(VuDev *dev, VuVirtq *vq, int desc_idx) { - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } -- 2.23.0
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com> To: qemu-devel@nongnu.org Cc: "Peter Maydell" <peter.maydell@linaro.org>, "Zhang Yu" <zhangyu31@baidu.com>, "Johannes Berg" <johannes.berg@intel.com>, "Tiwei Bie" <tiwei.bie@intel.com>, "Gerd Hoffmann" <kraxel@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Xie Yongji" <xieyongji@baidu.com> Subject: [Qemu-devel] [PULL 6/6] libvhost-user: introduce and use vu_has_protocol_feature() Date: Wed, 4 Sep 2019 08:01:14 -0400 [thread overview] Message-ID: <20190904065021.1360-1-johannes@sipsolutions.net> (raw) Message-ID: <20190904120114.IkMyz9P1u9PKjlaS5npEdhyTljt3WVbiW3tEvlDYsuQ@z> (raw) In-Reply-To: <20190904120026.3220-1-mst@redhat.com> From: Johannes Berg <johannes.berg@intel.com> This simplifies the various has_feature() checks, we already have vu_has_feature() but it checks features, not protocol features. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Message-Id: <20190904065021.1360-1-johannes@sipsolutions.net> Reviewed-by: Tiwei Bie <tiwei.bie@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- contrib/libvhost-user/libvhost-user.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index cb5f5770e4..68c27136ae 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -94,6 +94,11 @@ bool vu_has_feature(VuDev *dev, return has_feature(dev->features, fbit); } +static inline bool vu_has_protocol_feature(VuDev *dev, unsigned int fbit) +{ + return has_feature(dev->protocol_features, fbit); +} + static const char * vu_request_to_string(unsigned int req) { @@ -951,8 +956,7 @@ vu_check_queue_inflights(VuDev *dev, VuVirtq *vq) { int i = 0; - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } @@ -1097,8 +1101,7 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd, vmsg.fd_num = fd_num; - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) { return false; } @@ -2191,8 +2194,7 @@ vu_queue_map_desc(VuDev *dev, VuVirtq *vq, unsigned int idx, size_t sz) static int vu_queue_inflight_get(VuDev *dev, VuVirtq *vq, int desc_idx) { - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } @@ -2209,8 +2211,7 @@ vu_queue_inflight_get(VuDev *dev, VuVirtq *vq, int desc_idx) static int vu_queue_inflight_pre_put(VuDev *dev, VuVirtq *vq, int desc_idx) { - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } @@ -2226,8 +2227,7 @@ vu_queue_inflight_pre_put(VuDev *dev, VuVirtq *vq, int desc_idx) static int vu_queue_inflight_post_put(VuDev *dev, VuVirtq *vq, int desc_idx) { - if (!has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { + if (!vu_has_protocol_feature(dev, VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) { return 0; } -- MST
next prev reply other threads:[~2019-09-04 6:51 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-09-04 12:00 [Qemu-devel] [PULL 0/6] virtio,vhost: fixes, features, cleanups Michael S. Tsirkin 2019-08-20 16:30 ` [Qemu-devel] [PATCH v2] virtio-pci: Add Function Level Reset support Julia Suvorova 2019-09-04 12:01 ` [Qemu-devel] [PULL 4/6] " Michael S. Tsirkin 2019-09-03 20:04 ` [Qemu-devel] [PATCH v2] libvhost-user: fix SLAVE_SEND_FD handling Johannes Berg 2019-09-04 2:06 ` Tiwei Bie 2019-09-04 9:01 ` Tiwei Bie 2019-09-04 12:01 ` [Qemu-devel] [PULL 5/6] " Michael S. Tsirkin 2019-09-04 6:50 ` Johannes Berg [this message] 2019-09-04 9:22 ` [Qemu-devel] [PATCH] libvhost-user: introduce and use vu_has_protocol_feature() Tiwei Bie 2019-09-04 12:01 ` [Qemu-devel] [PULL 6/6] " Michael S. Tsirkin 2019-09-04 17:16 ` [Qemu-devel] [PULL 0/6] virtio, vhost: fixes, features, cleanups Peter Maydell -- strict thread matches above, loose matches on Subject: below -- 2019-08-20 16:06 [Qemu-devel] [PATCH v8 0/3] rng-builtin: add an RNG backend that uses qemu_guest_getrandom() Laurent Vivier 2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 1/3] " Laurent Vivier 2019-09-04 12:00 ` [Qemu-devel] [PULL 1/6] " Michael S. Tsirkin 2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 2/3] virtio-rng: Keep the default backend out of VirtIORNGConf Laurent Vivier 2019-09-04 12:00 ` [Qemu-devel] [PULL 2/6] " Michael S. Tsirkin 2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 3/3] virtio-rng: change default backend to rng-builtin Laurent Vivier 2019-09-04 12:00 ` [Qemu-devel] [PULL 3/6] " Michael S. Tsirkin 2019-09-04 10:26 ` [Qemu-devel] [PATCH v8 0/3] rng-builtin: add an RNG backend that uses qemu_guest_getrandom() 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=20190904065021.1360-1-johannes@sipsolutions.net \ --to=johannes@sipsolutions.net \ --cc=johannes.berg@intel.com \ --cc=marcandre.lureau@redhat.com \ --cc=mst@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=tiwei.bie@intel.com \ /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: linkBe 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).