From: Hawkins Jiawei <yin31149@gmail.com>
To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com
Cc: qemu-devel@nongnu.org, yin31149@gmail.com
Subject: [PATCH v2 2/6] vdpa: reuse virtio_vdev_has_feature()
Date: Thu, 1 Jun 2023 16:48:16 +0800 [thread overview]
Message-ID: <dc0477a7ce8bd9c1b07c99251908aadecea66c89.1685584543.git.yin31149@gmail.com> (raw)
In-Reply-To: <cover.1685584543.git.yin31149@gmail.com>
We can use virtio_vdev_has_feature() instead of manually
accessing the features.
Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
---
net/vhost-vdpa.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 37cdc84562..e907a3c792 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -643,8 +643,7 @@ static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class,
static int vhost_vdpa_net_load_mac(VhostVDPAState *s, const VirtIONet *n)
{
- uint64_t features = n->parent_obj.guest_features;
- if (features & BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR)) {
+ if (virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
ssize_t dev_written = vhost_vdpa_net_load_cmd(s, VIRTIO_NET_CTRL_MAC,
VIRTIO_NET_CTRL_MAC_ADDR_SET,
n->mac, sizeof(n->mac));
@@ -662,10 +661,9 @@ static int vhost_vdpa_net_load_mq(VhostVDPAState *s,
const VirtIONet *n)
{
struct virtio_net_ctrl_mq mq;
- uint64_t features = n->parent_obj.guest_features;
ssize_t dev_written;
- if (!(features & BIT_ULL(VIRTIO_NET_F_MQ))) {
+ if (!virtio_vdev_has_feature(&n->parent_obj, VIRTIO_NET_F_MQ)) {
return 0;
}
--
2.25.1
next prev parent reply other threads:[~2023-06-01 8:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 8:28 [PATCH v2 0/6] Vhost-vdpa Shadow Virtqueue Offloads support Hawkins Jiawei
2023-06-01 8:48 ` [PATCH v2 1/6] include/hw/virtio: make some VirtIODevice const Hawkins Jiawei
2023-06-01 8:48 ` Hawkins Jiawei [this message]
2023-06-01 8:48 ` [PATCH v2 3/6] hw/net/virtio-net: make some VirtIONet const Hawkins Jiawei
2023-06-01 8:48 ` [PATCH v2 4/6] virtio-net: expose virtio_net_supported_guest_offloads() Hawkins Jiawei
2023-06-01 9:05 ` Hawkins Jiawei
2023-06-01 13:43 ` Eugenio Perez Martin
2023-06-01 13:58 ` Hawkins Jiawei
2023-06-01 14:37 ` Eugenio Perez Martin
2023-06-01 8:48 ` [PATCH v2 5/6] vdpa: Add vhost_vdpa_net_load_offloads() Hawkins Jiawei
2023-06-01 8:48 ` [PATCH v2 6/6] vdpa: Allow VIRTIO_NET_F_CTRL_GUEST_OFFLOADS in SVQ Hawkins Jiawei
2023-06-01 9:56 ` [PATCH v2 0/6] Vhost-vdpa Shadow Virtqueue Offloads support Lei Yang
2023-06-01 13:41 ` Hawkins Jiawei
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=dc0477a7ce8bd9c1b07c99251908aadecea66c89.1685584543.git.yin31149@gmail.com \
--to=yin31149@gmail.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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).