mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
virtio_pci: pass vq info as an argument to vp_setup_vq()
Instead vp_setup_vq() storing vq info directly to vp_dev->vqs, let the caller provide a pointer to store the info to. This prepares vp_setup_vq() to be able to store admin queue info as well. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Message-Id: <20240716113552.80599-9-jiri@resnulli.us> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
7e5d9f556e
commit
89a1c435ae
|
|
@ -197,7 +197,8 @@ static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned int in
|
||||||
void (*callback)(struct virtqueue *vq),
|
void (*callback)(struct virtqueue *vq),
|
||||||
const char *name,
|
const char *name,
|
||||||
bool ctx,
|
bool ctx,
|
||||||
u16 msix_vec)
|
u16 msix_vec,
|
||||||
|
struct virtio_pci_vq_info **p_info)
|
||||||
{
|
{
|
||||||
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
||||||
struct virtio_pci_vq_info *info = kmalloc(sizeof *info, GFP_KERNEL);
|
struct virtio_pci_vq_info *info = kmalloc(sizeof *info, GFP_KERNEL);
|
||||||
|
|
@ -225,7 +226,7 @@ static struct virtqueue *vp_setup_vq(struct virtio_device *vdev, unsigned int in
|
||||||
INIT_LIST_HEAD(&info->node);
|
INIT_LIST_HEAD(&info->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
vp_dev->vqs[index] = info;
|
*p_info = info;
|
||||||
return vq;
|
return vq;
|
||||||
|
|
||||||
out_info:
|
out_info:
|
||||||
|
|
@ -320,7 +321,8 @@ static struct virtqueue *
|
||||||
vp_find_one_vq_msix(struct virtio_device *vdev, int queue_idx,
|
vp_find_one_vq_msix(struct virtio_device *vdev, int queue_idx,
|
||||||
vq_callback_t *callback, const char *name, bool ctx,
|
vq_callback_t *callback, const char *name, bool ctx,
|
||||||
bool slow_path, int *allocated_vectors,
|
bool slow_path, int *allocated_vectors,
|
||||||
enum vp_vq_vector_policy vector_policy)
|
enum vp_vq_vector_policy vector_policy,
|
||||||
|
struct virtio_pci_vq_info **p_info)
|
||||||
{
|
{
|
||||||
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
|
||||||
struct virtqueue *vq;
|
struct virtqueue *vq;
|
||||||
|
|
@ -338,7 +340,8 @@ vp_find_one_vq_msix(struct virtio_device *vdev, int queue_idx,
|
||||||
msix_vec = VP_MSIX_CONFIG_VECTOR;
|
msix_vec = VP_MSIX_CONFIG_VECTOR;
|
||||||
else
|
else
|
||||||
msix_vec = VP_MSIX_VQ_VECTOR;
|
msix_vec = VP_MSIX_VQ_VECTOR;
|
||||||
vq = vp_setup_vq(vdev, queue_idx, callback, name, ctx, msix_vec);
|
vq = vp_setup_vq(vdev, queue_idx, callback, name, ctx, msix_vec,
|
||||||
|
p_info);
|
||||||
if (IS_ERR(vq))
|
if (IS_ERR(vq))
|
||||||
return vq;
|
return vq;
|
||||||
|
|
||||||
|
|
@ -405,7 +408,8 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned int nvqs,
|
||||||
}
|
}
|
||||||
vqs[i] = vp_find_one_vq_msix(vdev, queue_idx++, vqi->callback,
|
vqs[i] = vp_find_one_vq_msix(vdev, queue_idx++, vqi->callback,
|
||||||
vqi->name, vqi->ctx, false,
|
vqi->name, vqi->ctx, false,
|
||||||
&allocated_vectors, vector_policy);
|
&allocated_vectors, vector_policy,
|
||||||
|
&vp_dev->vqs[i]);
|
||||||
if (IS_ERR(vqs[i])) {
|
if (IS_ERR(vqs[i])) {
|
||||||
err = PTR_ERR(vqs[i]);
|
err = PTR_ERR(vqs[i]);
|
||||||
goto error_find;
|
goto error_find;
|
||||||
|
|
@ -445,7 +449,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev, unsigned int nvqs,
|
||||||
}
|
}
|
||||||
vqs[i] = vp_setup_vq(vdev, queue_idx++, vqi->callback,
|
vqs[i] = vp_setup_vq(vdev, queue_idx++, vqi->callback,
|
||||||
vqi->name, vqi->ctx,
|
vqi->name, vqi->ctx,
|
||||||
VIRTIO_MSI_NO_VECTOR);
|
VIRTIO_MSI_NO_VECTOR, &vp_dev->vqs[i]);
|
||||||
if (IS_ERR(vqs[i])) {
|
if (IS_ERR(vqs[i])) {
|
||||||
err = PTR_ERR(vqs[i]);
|
err = PTR_ERR(vqs[i]);
|
||||||
goto out_del_vqs;
|
goto out_del_vqs;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user