mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
net/vhost-vdpa: enable vqs before DRIVER_OK if no cvq
VDUSE do not forward the enable message to the userland device at the
moment, leaving the dataplane disabled. As there is no functional
difference if the device have no CVQ, enable them before DRIVER_OK in
that case.
For devices with a control vq, keep the enabling of the dataplane after
CVQ so QEMU can restore the device configuration.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Fixes: 6c4825476a ("vdpa: move vhost_vdpa_set_vring_ready to the caller")
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260304173857.2705296-1-eperezma@redhat.com>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
412c48d054
commit
66232095a1
@@ -396,6 +396,7 @@ static int vhost_vdpa_net_data_start(NetClientState *nc)
|
||||
{
|
||||
VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc);
|
||||
struct vhost_vdpa *v = &s->vhost_vdpa;
|
||||
bool has_cvq = v->dev->vq_index_end % 2;
|
||||
|
||||
assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA);
|
||||
|
||||
@@ -405,6 +406,15 @@ static int vhost_vdpa_net_data_start(NetClientState *nc)
|
||||
v->shadow_vqs_enabled = false;
|
||||
}
|
||||
|
||||
if (!has_cvq) {
|
||||
for (int i = 0; i < v->dev->nvqs; ++i) {
|
||||
int ret = vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (v->index == 0) {
|
||||
v->shared->shadow_data = v->shadow_vqs_enabled;
|
||||
vhost_vdpa_net_data_start_first(s);
|
||||
@@ -414,25 +424,6 @@ static int vhost_vdpa_net_data_start(NetClientState *nc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vhost_vdpa_net_data_load(NetClientState *nc)
|
||||
{
|
||||
VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc);
|
||||
struct vhost_vdpa *v = &s->vhost_vdpa;
|
||||
bool has_cvq = v->dev->vq_index_end % 2;
|
||||
|
||||
if (has_cvq) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < v->dev->nvqs; ++i) {
|
||||
int ret = vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vhost_vdpa_net_client_stop(NetClientState *nc)
|
||||
{
|
||||
VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc);
|
||||
@@ -449,7 +440,6 @@ static NetClientInfo net_vhost_vdpa_info = {
|
||||
.size = sizeof(VhostVDPAState),
|
||||
.receive = vhost_vdpa_receive,
|
||||
.start = vhost_vdpa_net_data_start,
|
||||
.load = vhost_vdpa_net_data_load,
|
||||
.stop = vhost_vdpa_net_client_stop,
|
||||
.cleanup = vhost_vdpa_cleanup,
|
||||
.has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
|
||||
|
||||
Reference in New Issue
Block a user