From: "Eugenio Pérez" <eperezma@redhat.com>
To: qemu-devel@nongnu.org
Cc: Cindy Lu <lulu@redhat.com>,
Harpreet Singh Anand <hanand@xilinx.com>,
Zhu Lingshan <lingshan.zhu@intel.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Gautam Dawar <gdawar@xilinx.com>, Eli Cohen <eli@mellanox.com>,
Parav Pandit <parav@mellanox.com>,
Jason Wang <jasowang@redhat.com>,
Si-Wei Liu <si-wei.liu@oracle.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Liuxiangdong <liuxiangdong5@huawei.com>,
Laurent Vivier <lvivier@redhat.com>
Subject: [PATCH v2 3/3] vhost_vdpa: move VIRTIO_NET_F_STATUS handling to vhost_net
Date: Fri, 28 Oct 2022 17:19:17 +0200 [thread overview]
Message-ID: <20221028151917.260038-4-eperezma@redhat.com> (raw)
In-Reply-To: <20221028151917.260038-1-eperezma@redhat.com>
Since it is emulated on all vhost backends it makes sense to move it.
Although this feature can be emulated by qemu it benefits from
information from the device. Ack it as long as the guest ack it.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/net/vhost_net.c | 13 +++++++++++++
net/vhost-vdpa.c | 1 -
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index d28f8b974b..b533744211 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -127,8 +127,21 @@ int vhost_net_set_config(struct vhost_net *net, const uint8_t *data,
void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
{
+ static const int status_feature_bit[] = {
+ VIRTIO_NET_F_STATUS,
+ VHOST_INVALID_FEATURE_BIT,
+ };
+
net->dev.acked_features = net->dev.backend_features;
vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
+ if (net->dev.features & BIT_ULL(VIRTIO_NET_F_STATUS)) {
+ /*
+ * If device support _F_STATUS qemu should ack it so it reports link
+ * status changes. If not supported qemu emulates it reporting an
+ * always up link.
+ */
+ vhost_ack_features(&net->dev, status_feature_bit, features);
+ }
}
uint64_t vhost_net_get_max_queues(VHostNetState *net)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 6d64000202..854b27186c 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -72,7 +72,6 @@ const int vdpa_feature_bits[] = {
VIRTIO_NET_F_RSS,
VIRTIO_NET_F_HASH_REPORT,
VIRTIO_NET_F_GUEST_ANNOUNCE,
- VIRTIO_NET_F_STATUS,
VHOST_INVALID_FEATURE_BIT
};
--
2.31.1
next prev parent reply other threads:[~2022-10-28 15:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 15:19 [PATCH v2 0/3] Emulate status feature in vhost-vdpa net Eugenio Pérez
2022-10-28 15:19 ` [PATCH v2 1/3] virtio_net: Modify virtio_net_get_config to early return Eugenio Pérez
2022-10-28 15:19 ` [PATCH v2 2/3] virtio_net: Handle _F_STATUS emulation in virtio_net_get_config Eugenio Pérez
2022-10-28 15:19 ` Eugenio Pérez [this message]
2022-10-29 8:24 ` [PATCH v2 3/3] vhost_vdpa: move VIRTIO_NET_F_STATUS handling to vhost_net 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=20221028151917.260038-4-eperezma@redhat.com \
--to=eperezma@redhat.com \
--cc=eli@mellanox.com \
--cc=gdawar@xilinx.com \
--cc=hanand@xilinx.com \
--cc=jasowang@redhat.com \
--cc=lingshan.zhu@intel.com \
--cc=liuxiangdong5@huawei.com \
--cc=lulu@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=parav@mellanox.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=si-wei.liu@oracle.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: 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).