summaryrefslogtreecommitdiff
path: root/drivers/scsi/virtio_scsi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-07-19 11:57:55 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2024-07-19 11:57:55 -0700
commitf4f92db4391285ef3a688cdad25d5c76db200a30 (patch)
treef13b26b236e6a2f124cfec88ee14ca9ca872624c /drivers/scsi/virtio_scsi.c
parentf66b07c56119833b88bffa4ecaf9f983834675de (diff)
parent6c85d6b653caeba2ef982925703cbb4f2b3b3163 (diff)
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio updates from Michael Tsirkin: "Several new features here: - Virtio find vqs API has been reworked (required to fix the scalability issue we have with adminq, which I hope to merge later in the cycle) - vDPA driver for Marvell OCTEON - virtio fs performance improvement - mlx5 migration speedups Fixes, cleanups all over the place" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (56 commits) virtio: rename virtio_find_vqs_info() to virtio_find_vqs() virtio: remove unused virtio_find_vqs() and virtio_find_vqs_ctx() helpers virtio: convert the rest virtio_find_vqs() users to virtio_find_vqs_info() virtio_balloon: convert to use virtio_find_vqs_info() virtiofs: convert to use virtio_find_vqs_info() scsi: virtio_scsi: convert to use virtio_find_vqs_info() virtio_net: convert to use virtio_find_vqs_info() virtio_crypto: convert to use virtio_find_vqs_info() virtio_console: convert to use virtio_find_vqs_info() virtio_blk: convert to use virtio_find_vqs_info() virtio: rename find_vqs_info() op to find_vqs() virtio: remove the original find_vqs() op virtio: call virtio_find_vqs_info() from virtio_find_single_vq() directly virtio: convert find_vqs() op implementations to find_vqs_info() virtio_pci: convert vp_*find_vqs() ops to find_vqs_info() virtio: introduce virtio_queue_info struct and find_vqs_info() config op virtio: make virtio_find_single_vq() call virtio_find_vqs() virtio: make virtio_find_vqs() call virtio_find_vqs_ctx() caif_virtio: use virtio_find_single_vq() for single virtqueue finding vdpa/mlx5: Don't enable non-active VQs in .set_vq_ready() ...
Diffstat (limited to 'drivers/scsi/virtio_scsi.c')
-rw-r--r--drivers/scsi/virtio_scsi.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 89ca26945721..8471f38b730e 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -841,19 +841,16 @@ static int virtscsi_init(struct virtio_device *vdev,
int err;
u32 i;
u32 num_vqs, num_poll_vqs, num_req_vqs;
- vq_callback_t **callbacks;
- const char **names;
+ struct virtqueue_info *vqs_info;
struct virtqueue **vqs;
struct irq_affinity desc = { .pre_vectors = 2 };
num_req_vqs = vscsi->num_queues;
num_vqs = num_req_vqs + VIRTIO_SCSI_VQ_BASE;
vqs = kmalloc_array(num_vqs, sizeof(struct virtqueue *), GFP_KERNEL);
- callbacks = kmalloc_array(num_vqs, sizeof(vq_callback_t *),
- GFP_KERNEL);
- names = kmalloc_array(num_vqs, sizeof(char *), GFP_KERNEL);
+ vqs_info = kcalloc(num_vqs, sizeof(*vqs_info), GFP_KERNEL);
- if (!callbacks || !vqs || !names) {
+ if (!vqs || !vqs_info) {
err = -ENOMEM;
goto out;
}
@@ -869,22 +866,20 @@ static int virtscsi_init(struct virtio_device *vdev,
vscsi->io_queues[HCTX_TYPE_READ],
vscsi->io_queues[HCTX_TYPE_POLL]);
- callbacks[0] = virtscsi_ctrl_done;
- callbacks[1] = virtscsi_event_done;
- names[0] = "control";
- names[1] = "event";
+ vqs_info[0].callback = virtscsi_ctrl_done;
+ vqs_info[0].name = "control";
+ vqs_info[1].callback = virtscsi_event_done;
+ vqs_info[1].name = "event";
for (i = VIRTIO_SCSI_VQ_BASE; i < num_vqs - num_poll_vqs; i++) {
- callbacks[i] = virtscsi_req_done;
- names[i] = "request";
+ vqs_info[i].callback = virtscsi_req_done;
+ vqs_info[i].name = "request";
}
- for (; i < num_vqs; i++) {
- callbacks[i] = NULL;
- names[i] = "request_poll";
- }
+ for (; i < num_vqs; i++)
+ vqs_info[i].name = "request_poll";
/* Discover virtqueues and write information to configuration. */
- err = virtio_find_vqs(vdev, num_vqs, vqs, callbacks, names, &desc);
+ err = virtio_find_vqs(vdev, num_vqs, vqs, vqs_info, &desc);
if (err)
goto out;
@@ -900,8 +895,7 @@ static int virtscsi_init(struct virtio_device *vdev,
err = 0;
out:
- kfree(names);
- kfree(callbacks);
+ kfree(vqs_info);
kfree(vqs);
if (err)
virtscsi_remove_vqs(vdev);