diff options
author | Laurent Vivier <lvivier@redhat.com> | 2025-07-09 10:24:22 +0200 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2025-07-14 13:27:09 +0800 |
commit | 33b78a30a3e8e1cf16ef423bf2e78caf3d560985 (patch) | |
tree | 79d9f8d1b33215fe0e64dab503814d39227cd9b8 /include | |
parent | 1652f1b335fb5bec921c64ff7f378e6732510ca4 (diff) | |
download | qemu-33b78a30a3e8e1cf16ef423bf2e78caf3d560985.zip qemu-33b78a30a3e8e1cf16ef423bf2e78caf3d560985.tar.gz qemu-33b78a30a3e8e1cf16ef423bf2e78caf3d560985.tar.bz2 |
net: Allow network backends to advertise max TX queue size
This commit refactors how the maximum transmit queue size for
virtio-net devices is determined, making the mechanism more generic
and extensible.
Previously, virtio_net_max_tx_queue_size() contained hardcoded
checks for specific network backend types (vhost-user and
vhost-vdpa) to determine their supported maximum queue size. This
created direct dependencies and would require modifications for
every new backend that supports variable queue sizes.
To improve flexibility, a new max_tx_queue_size field is added
to the vhost_net structure. This allows each network backend
to advertise its supported maximum transmit queue size directly.
The virtio_net_max_tx_queue_size() function now retrieves the max
TX queue size from the vhost_net struct, if available and set.
Otherwise, it defaults to VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/virtio/vhost.h | 1 | ||||
-rw-r--r-- | include/net/vhost_net.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index b0830ba..a62992c 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -145,6 +145,7 @@ struct vhost_net { struct vhost_virtqueue vqs[2]; int backend; const int *feature_bits; + int max_tx_queue_size; SaveAcketFeatures *save_acked_features; NetClientState *nc; }; diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index eb26ed9..8f4fddf 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -16,6 +16,7 @@ typedef struct VhostNetOptions { uint32_t busyloop_timeout; unsigned int nvqs; const int *feature_bits; + int max_tx_queue_size; GetAckedFeatures *get_acked_features; SaveAcketFeatures *save_acked_features; void *opaque; |