aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHawkins Jiawei <yin31149@gmail.com>2023-06-02 19:52:16 +0800
committerMichael S. Tsirkin <mst@redhat.com>2023-06-26 09:50:00 -0400
commit0b545b1e42fc61f64071c7dd6f3ce1650f328007 (patch)
tree1ef247bb1940e6b87c0cc4c2dac9816ca57849e4
parent705e89cfaafc54491482742a756cf661b48608d2 (diff)
downloadqemu-0b545b1e42fc61f64071c7dd6f3ce1650f328007.zip
qemu-0b545b1e42fc61f64071c7dd6f3ce1650f328007.tar.gz
qemu-0b545b1e42fc61f64071c7dd6f3ce1650f328007.tar.bz2
virtio-net: expose virtio_net_supported_guest_offloads()
To support restoring offloads state in vdpa, it is necessary to expose the function virtio_net_supported_guest_offloads(). According to VirtIO standard, "Upon feature negotiation corresponding offload gets enabled to preserve backward compatibility.". Therefore, QEMU uses this function to get the device supported offloads. This allows QEMU to know the device's defaults and skip the control message sending if these defaults align with the driver's configuration. Note that the device's defaults can mismatch the driver's configuration only at live migration. Signed-off-by: Hawkins Jiawei <yin31149@gmail.com> Message-Id: <43679506f3f039a7aa2bdd5b49785107b5dfd7d4.1685704856.git.yin31149@gmail.com> Tested-by: Lei Yang <leiyang@redhat.com> Reviewed-by: Eugenio Pérez <eperezma@redhat.com> Tested-by: Eugenio Pérez <eperezma@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/net/virtio-net.c2
-rw-r--r--include/hw/virtio/virtio-net.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 7b27dad..7e8897a 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -874,7 +874,7 @@ static uint64_t virtio_net_guest_offloads_by_features(uint32_t features)
return guest_offloads_mask & features;
}
-static inline uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n)
+uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
return virtio_net_guest_offloads_by_features(vdev->guest_features);
diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
index ef234ff..5f5dcb4 100644
--- a/include/hw/virtio/virtio-net.h
+++ b/include/hw/virtio/virtio-net.h
@@ -227,5 +227,6 @@ size_t virtio_net_handle_ctrl_iov(VirtIODevice *vdev,
unsigned out_num);
void virtio_net_set_netclient_name(VirtIONet *n, const char *name,
const char *type);
+uint64_t virtio_net_supported_guest_offloads(const VirtIONet *n);
#endif