Lines Matching refs:vring
31 desc = vq->vring.desc; in virtqueue_add()
83 avail = vq->avail_idx_shadow & (vq->vring.num - 1); in virtqueue_add()
84 vq->vring.avail->ring[avail] = cpu_to_virtio16(vq->vdev, head); in virtqueue_add()
92 vq->vring.avail->idx = cpu_to_virtio16(vq->vdev, vq->avail_idx_shadow); in virtqueue_add()
122 vring_avail_event(&vq->vring)), new, old); in virtqueue_kick_prepare()
124 needs_kick = !(vq->vring.used->flags & cpu_to_virtio16(vq->vdev, in virtqueue_kick_prepare()
145 while (vq->vring.desc[i].flags & nextflag) { in detach_buf()
146 i = virtio16_to_cpu(vq->vdev, vq->vring.desc[i].next); in detach_buf()
150 vq->vring.desc[i].next = cpu_to_virtio16(vq->vdev, vq->free_head); in detach_buf()
160 vq->vring.used->idx); in more_used()
177 last_used = (vq->last_used_idx & (vq->vring.num - 1)); in virtqueue_get_buf()
178 i = virtio32_to_cpu(vq->vdev, vq->vring.used->ring[last_used].id); in virtqueue_get_buf()
181 vq->vring.used->ring[last_used].len); in virtqueue_get_buf()
186 if (unlikely(i >= vq->vring.num)) { in virtqueue_get_buf()
200 virtio_store_mb(&vring_used_event(&vq->vring), in virtqueue_get_buf()
204 vq->vring.desc[i].addr); in virtqueue_get_buf()
208 struct vring vring, in __vring_new_virtqueue() argument
222 vq->num_free = vring.num; in __vring_new_virtqueue()
223 vq->vring = vring; in __vring_new_virtqueue()
235 vq->vring.avail->flags = cpu_to_virtio16(vdev, in __vring_new_virtqueue()
240 for (i = 0; i < vring.num - 1; i++) in __vring_new_virtqueue()
241 vq->vring.desc[i].next = cpu_to_virtio16(vdev, i + 1); in __vring_new_virtqueue()
252 struct vring vring; in vring_create_virtqueue() local
278 vring_init(&vring, num, queue, vring_align); in vring_create_virtqueue()
280 vq = __vring_new_virtqueue(index, vring, udev); in vring_create_virtqueue()
293 free(vq->vring.desc); in vring_del_virtqueue()
300 return vq->vring.num; in virtqueue_get_vring_size()
305 return (ulong)vq->vring.desc; in virtqueue_get_desc_addr()
310 return (ulong)vq->vring.desc + in virtqueue_get_avail_addr()
311 ((char *)vq->vring.avail - (char *)vq->vring.desc); in virtqueue_get_avail_addr()
316 return (ulong)vq->vring.desc + in virtqueue_get_used_addr()
317 ((char *)vq->vring.used - (char *)vq->vring.desc); in virtqueue_get_used_addr()
324 return last_used_idx != virtio16_to_cpu(vq->vdev, vq->vring.used->idx); in virtqueue_poll()
333 vq->index, vq->vring.desc, vq->vring.num); in virtqueue_dump()
340 for (i = 0; i < vq->vring.num; i++) { in virtqueue_dump()
342 i, vq->vring.desc[i].addr, vq->vring.desc[i].len, in virtqueue_dump()
343 vq->vring.desc[i].flags, vq->vring.desc[i].next); in virtqueue_dump()
348 vq->vring.avail->flags, vq->vring.avail->idx); in virtqueue_dump()
349 for (i = 0; i < vq->vring.num; i++) { in virtqueue_dump()
351 i, vq->vring.avail->ring[i]); in virtqueue_dump()
356 vq->vring.used->flags, vq->vring.used->idx); in virtqueue_dump()
357 for (i = 0; i < vq->vring.num; i++) { in virtqueue_dump()
359 vq->vring.used->ring[i].id, vq->vring.used->ring[i].len); in virtqueue_dump()