On Mon, Jul 05, 2021 at 03:19:09PM +0800, Jason Wang wrote: > Virtio spec allows the device to specify the per virtqueue max queue > size. vDPA needs to adapt to this flexibility. E.g Qemu advertise a > small control virtqueue for virtio-net. > > So this patch adds a index parameter to get_vq_num_max bus operations > for the device to report its per virtqueue max queue size. > > Both VHOST_VDPA_GET_VRING_NUM and VDPA_ATTR_DEV_MAX_VQ_SIZE assume a > global maximum size. So we iterate all the virtqueues to return the > minimal size in this case. Actually, the VHOST_VDPA_GET_VRING_NUM is > not a must for the userspace. Userspace may choose to check the > VHOST_SET_VRING_NUM for proving or validating the maximum virtqueue > size. Anyway, we can invent a per vq version of > VHOST_VDPA_GET_VRING_NUM in the future if it's necessary. > > Signed-off-by: Jason Wang > --- > drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- > drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +- > drivers/vdpa/vdpa.c | 22 +++++++++++++++++++++- > drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +- > drivers/vdpa/virtio_pci/vp_vdpa.c | 2 +- > drivers/vhost/vdpa.c | 9 ++++++--- > drivers/virtio/virtio_vdpa.c | 2 +- > include/linux/vdpa.h | 5 ++++- > 8 files changed, 36 insertions(+), 10 deletions(-) Reviewed-by: Stefan Hajnoczi