Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

virtio_vdpa: support the arg sizes of find_vqs()

Virtio vdpa support the new parameter sizes of find_vqs().

Signed-off-by: Bo Liu <liubo03@inspur.com>
Message-Id: <20220810085151.7251-1-liubo03@inspur.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Bo Liu and committed by
Michael S. Tsirkin
99e8927d ebe6a354

+9 -6
+9 -6
drivers/virtio/virtio_vdpa.c
··· 131 131 static struct virtqueue * 132 132 virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index, 133 133 void (*callback)(struct virtqueue *vq), 134 - const char *name, bool ctx) 134 + const char *name, u32 size, bool ctx) 135 135 { 136 136 struct virtio_vdpa_device *vd_dev = to_virtio_vdpa_device(vdev); 137 137 struct vdpa_device *vdpa = vd_get_vdpa(vdev); ··· 168 168 goto error_new_virtqueue; 169 169 } 170 170 171 + if (!size || size > max_num) 172 + size = max_num; 173 + 171 174 if (ops->get_vq_num_min) 172 175 min_num = ops->get_vq_num_min(vdpa); 173 176 174 - may_reduce_num = (max_num == min_num) ? false : true; 177 + may_reduce_num = (size == min_num) ? false : true; 175 178 176 179 /* Create the vring */ 177 180 align = ops->get_vq_align(vdpa); 178 - vq = vring_create_virtqueue(index, max_num, align, vdev, 181 + vq = vring_create_virtqueue(index, size, align, vdev, 179 182 true, may_reduce_num, ctx, 180 183 virtio_vdpa_notify, callback, name); 181 184 if (!vq) { ··· 288 285 continue; 289 286 } 290 287 291 - vqs[i] = virtio_vdpa_setup_vq(vdev, queue_idx++, 292 - callbacks[i], names[i], ctx ? 293 - ctx[i] : false); 288 + vqs[i] = virtio_vdpa_setup_vq(vdev, queue_idx++, callbacks[i], 289 + names[i], sizes ? sizes[i] : 0, 290 + ctx ? ctx[i] : false); 294 291 if (IS_ERR(vqs[i])) { 295 292 err = PTR_ERR(vqs[i]); 296 293 goto err_setup_vq;