[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_n
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail |
Date: |
Wed, 19 Oct 2022 14:52:08 +0200 |
Since this capability is emulated by qemu shadowed CVQ cannot forward it
to the device. Process all that command within qemu.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
net/vhost-vdpa.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 3374c21b4d..5fda405a66 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -488,9 +488,18 @@ static int
vhost_vdpa_net_handle_ctrl_avail(VhostShadowVirtqueue *svq,
out.iov_len = iov_to_buf(elem->out_sg, elem->out_num, 0,
s->cvq_cmd_out_buffer,
vhost_vdpa_net_cvq_cmd_len());
- dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status));
- if (unlikely(dev_written < 0)) {
- goto out;
+ if (*(uint8_t *)s->cvq_cmd_out_buffer == VIRTIO_NET_CTRL_ANNOUNCE) {
+ /*
+ * Guest announce capability is emulated by qemu, so dont forward to
+ * the device.
+ */
+ dev_written = sizeof(status);
+ *s->status = VIRTIO_NET_OK;
+ } else {
+ dev_written = vhost_vdpa_net_cvq_add(s, out.iov_len, sizeof(status));
+ if (unlikely(dev_written < 0)) {
+ goto out;
+ }
}
if (unlikely(dev_written < sizeof(status))) {
--
2.31.1
- [RFC PATCH v2 3/8] vhost_net: Emulate link state up if backend doesn't expose it, (continued)
- [RFC PATCH v2 3/8] vhost_net: Emulate link state up if backend doesn't expose it, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 1/8] vdpa: Delete duplicated vdpa_feature_bits entry, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 5/8] vdpa: Remove shadow CVQ command check, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 7/8] vhost_net: return VIRTIO_NET_S_ANNOUNCE is device model has it set, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 8/8] vdpa: Offer VIRTIO_NET_F_GUEST_ANNOUNCE feature if SVQ is enabled, Eugenio Pérez, 2022/10/19
- [RFC PATCH v2 6/8] vdpa: handle VIRTIO_NET_CTRL_ANNOUNCE in vhost_vdpa_net_handle_ctrl_avail,
Eugenio Pérez <=
[RFC PATCH v2 4/8] vdpa: Expose VIRTIO_NET_F_STATUS unconditionally, Eugenio Pérez, 2022/10/19
Re: [RFC PATCH v2 0/8] Guest announce feature emulation using Shadow VirtQueue, Jason Wang, 2022/10/20