};
static struct virtqueue *__vring_new_virtqueue(unsigned int index,
- struct vring vring,
+ struct vring_virtqueue_split *vring_split,
struct virtio_device *vdev,
bool weak_barriers,
bool context,
void (*callback)(struct virtqueue *),
const char *name)
{
+ struct vring_virtqueue_split vring_split = {};
struct virtqueue *vq;
void *queue = NULL;
dma_addr_t dma_addr;
return NULL;
queue_size_in_bytes = vring_size(num, vring_align);
- vring_init(&vring, num, queue, vring_align);
+ vring_init(&vring_split.vring, num, queue, vring_align);
- vq = __vring_new_virtqueue(index, vring, vdev, weak_barriers, context,
- notify, callback, name);
+ vq = __vring_new_virtqueue(index, &vring_split, vdev, weak_barriers,
+ context, notify, callback, name);
if (!vq) {
vring_free_queue(vdev, queue_size_in_bytes, queue,
dma_addr);
/* Only available for split ring */
static struct virtqueue *__vring_new_virtqueue(unsigned int index,
- struct vring vring,
+ struct vring_virtqueue_split *vring_split,
struct virtio_device *vdev,
bool weak_barriers,
bool context,
vq->split.queue_dma_addr = 0;
vq->split.queue_size_in_bytes = 0;
- vq->split.vring = vring;
+ vq->split.vring = vring_split->vring;
vq->split.avail_flags_shadow = 0;
vq->split.avail_idx_shadow = 0;
vq->split.avail_flags_shadow);
}
- vq->split.desc_state = kmalloc_array(vring.num,
+ vq->split.desc_state = kmalloc_array(vring_split->vring.num,
sizeof(struct vring_desc_state_split), GFP_KERNEL);
if (!vq->split.desc_state)
goto err_state;
- vq->split.desc_extra = vring_alloc_desc_extra(vring.num);
+ vq->split.desc_extra = vring_alloc_desc_extra(vring_split->vring.num);
if (!vq->split.desc_extra)
goto err_extra;
/* Put everything in free lists. */
vq->free_head = 0;
- memset(vq->split.desc_state, 0, vring.num *
+ memset(vq->split.desc_state, 0, vring_split->vring.num *
sizeof(struct vring_desc_state_split));
- virtqueue_init(vq, vring.num);
+ virtqueue_init(vq, vring_split->vring.num);
spin_lock(&vdev->vqs_list_lock);
list_add_tail(&vq->vq.list, &vdev->vqs);
void (*callback)(struct virtqueue *vq),
const char *name)
{
- struct vring vring;
+ struct vring_virtqueue_split vring_split = {};
if (virtio_has_feature(vdev, VIRTIO_F_RING_PACKED))
return NULL;
- vring_init(&vring, num, pages, vring_align);
- return __vring_new_virtqueue(index, vring, vdev, weak_barriers, context,
- notify, callback, name);
+ vring_init(&vring_split.vring, num, pages, vring_align);
+ return __vring_new_virtqueue(index, &vring_split, vdev, weak_barriers,
+ context, notify, callback, name);
}
EXPORT_SYMBOL_GPL(vring_new_virtqueue);