search for: vring_split

Displaying 20 results from an estimated 43 matches for "vring_split".

2023 May 26
1
[PATCH] virtio_ring: validate used buffer length
..., "used len %d is larger than max in buffer len %u\n", + *len, vq->split.buflen[i]); + return NULL; + } /* detach_buf_split clears data, so grab it now. */ ret = vq->split.desc_state[i].data; @@ -1085,10 +1105,25 @@ static void vring_free_split(struct vring_virtqueue_split *vring_split, vring_split->queue_dma_addr, dma_dev); + kfree(vring_split->buflen); kfree(vring_split->desc_state); kfree(vring_split->desc_extra); } +static bool vring_needs_used_validation(const struct virtio_device *vdev) +{ + /* + * Several legacy devices are known to produce...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...gt; > > > > > > > > /* detach_buf_split clears data, so grab it now. */ > > > > > > > ret = vq->split.desc_state[i].data; > > > > > > > @@ -1085,10 +1105,25 @@ static void vring_free_split(struct vring_virtqueue_split *vring_split, > > > > > > > vring_split->queue_dma_addr, > > > > > > > dma_dev); > > > > > > > > > > > > > > + kfree(vring_split->buflen); > > > > > > &gt...
2023 May 31
1
[PATCH] virtio_ring: validate used buffer length
...gt; > > > > > > /* detach_buf_split clears data, so grab it now. */ > > > > > > > > ret = vq->split.desc_state[i].data; > > > > > > > > @@ -1085,10 +1105,25 @@ static void vring_free_split(struct vring_virtqueue_split *vring_split, > > > > > > > > vring_split->queue_dma_addr, > > > > > > > > dma_dev); > > > > > > > > > > > > > > > > + kfree(vring_split->buflen); > > &gt...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...gt; > > > > > > /* detach_buf_split clears data, so grab it now. */ > > > > > > > > ret = vq->split.desc_state[i].data; > > > > > > > > @@ -1085,10 +1105,25 @@ static void vring_free_split(struct vring_virtqueue_split *vring_split, > > > > > > > > vring_split->queue_dma_addr, > > > > > > > > dma_dev); > > > > > > > > > > > > > > > > + kfree(vring_split->buflen); > > &gt...
2023 Jun 01
1
[PATCH] virtio_ring: validate used buffer length
...gt; > > > > /* detach_buf_split clears data, so grab it now. */ > > > > > > > > > ret = vq->split.desc_state[i].data; > > > > > > > > > @@ -1085,10 +1105,25 @@ static void vring_free_split(struct vring_virtqueue_split *vring_split, > > > > > > > > > vring_split->queue_dma_addr, > > > > > > > > > dma_dev); > > > > > > > > > > > > > > > > > > + kfree(vring_split->bu...
2018 Sep 12
1
[PATCH net-next v2 2/5] virtio_ring: support creating packed ring
...> > > + bool packed; > > > + > > > + packed = virtio_has_feature(vdev, VIRTIO_F_RING_PACKED); > > > + if (packed) > > > + vring_init_packed(&vring.vring_packed, num, pages, vring_align); > > > + else > > > + vring_init(&vring.vring_split, num, pages, vring_align); > > > > > > vring_init in the UAPI header is more or less a bug. > > I'd just stop using it, keep it around for legacy userspace. > > Got it. I'd like to do that. Thanks. > > > > > > + > > > + return __...
2018 Sep 07
3
[PATCH net-next v2 2/5] virtio_ring: support creating packed ring
...const char *name) > { > - unsigned int i; > struct vring_virtqueue *vq; > + unsigned int num, i; > + size_t size; > > - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), > - GFP_KERNEL); > + num = packed ? vring.vring_packed.num : vring.vring_split.num; > + size = packed ? num * sizeof(struct vring_desc_state_packed) : > + num * sizeof(struct vring_desc_state); > + > + vq = kmalloc(sizeof(*vq) + size, GFP_KERNEL); > if (!vq) > return NULL; > > - vq->vring = vring; > vq->vq.callback = callback; >...
2018 Sep 07
3
[PATCH net-next v2 2/5] virtio_ring: support creating packed ring
...const char *name) > { > - unsigned int i; > struct vring_virtqueue *vq; > + unsigned int num, i; > + size_t size; > > - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), > - GFP_KERNEL); > + num = packed ? vring.vring_packed.num : vring.vring_split.num; > + size = packed ? num * sizeof(struct vring_desc_state_packed) : > + num * sizeof(struct vring_desc_state); > + > + vq = kmalloc(sizeof(*vq) + size, GFP_KERNEL); > if (!vq) > return NULL; > > - vq->vring = vring; > vq->vq.callback = callback; >...
2018 Mar 16
3
[PATCH RFC 2/2] virtio_ring: support packed ring
...; + queue_size_in_bytes = __vring_size(num, vring_align, packed); >>>>>>> + if (packed) >>>>>>> + vring_packed_init(&vring.vring_packed, num, queue, vring_align); >>>>>>> + else >>>>>>> + vring_init(&vring.vring_split, num, queue, vring_align); >>>>>> Let's rename vring_init to vring_init_split() like other helpers? >>>>> The vring_init() is a public API in include/uapi/linux/virtio_ring.h. >>>>> I don't think we can rename it. >>>> I see, then...
2018 Mar 16
3
[PATCH RFC 2/2] virtio_ring: support packed ring
...; + queue_size_in_bytes = __vring_size(num, vring_align, packed); >>>>>>> + if (packed) >>>>>>> + vring_packed_init(&vring.vring_packed, num, queue, vring_align); >>>>>>> + else >>>>>>> + vring_init(&vring.vring_split, num, queue, vring_align); >>>>>> Let's rename vring_init to vring_init_split() like other helpers? >>>>> The vring_init() is a public API in include/uapi/linux/virtio_ring.h. >>>>> I don't think we can rename it. >>>> I see, then...
2018 Mar 16
2
[PATCH RFC 2/2] virtio_ring: support packed ring
...(*callback)(struct virtqueue *), > const char *name) > { > - unsigned int i; > + unsigned int num, i; > struct vring_virtqueue *vq; > > - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), > + num = packed ? vring.vring_packed.num : vring.vring_split.num; > + > + vq = kmalloc(sizeof(*vq) + num * sizeof(struct vring_desc_state), > GFP_KERNEL); > if (!vq) > return NULL; > > - vq->vring = vring; > vq->vq.callback = callback; > vq->vq.vdev = vdev; > vq->vq.name = name; > - vq-...
2018 Mar 16
2
[PATCH RFC 2/2] virtio_ring: support packed ring
...(*callback)(struct virtqueue *), > const char *name) > { > - unsigned int i; > + unsigned int num, i; > struct vring_virtqueue *vq; > > - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), > + num = packed ? vring.vring_packed.num : vring.vring_split.num; > + > + vq = kmalloc(sizeof(*vq) + num * sizeof(struct vring_desc_state), > GFP_KERNEL); > if (!vq) > return NULL; > > - vq->vring = vring; > vq->vq.callback = callback; > vq->vq.vdev = vdev; > vq->vq.name = name; > - vq-...
2018 Mar 16
2
[PATCH RFC 2/2] virtio_ring: support packed ring
...there's no F_LIST_DESC. > Yes. I kept this in this patch just because the > desc chaining is optional in the old spec draft > when sending out this patch set. I'll remove it > in next version. > >>> +#endif >>> + } else { >>> + vq->vring = vring.vring_split; >>> + vq->avail_flags_shadow = 0; >>> + vq->avail_idx_shadow = 0; >>> + >>> + /* Put everything in free lists. */ >>> + vq->free_head = 0; >>> + for (i = 0; i < num-1; i++) >>> + vq->vring.desc[i].next = cpu_to_vi...
2018 Mar 16
2
[PATCH RFC 2/2] virtio_ring: support packed ring
...there's no F_LIST_DESC. > Yes. I kept this in this patch just because the > desc chaining is optional in the old spec draft > when sending out this patch set. I'll remove it > in next version. > >>> +#endif >>> + } else { >>> + vq->vring = vring.vring_split; >>> + vq->avail_flags_shadow = 0; >>> + vq->avail_idx_shadow = 0; >>> + >>> + /* Put everything in free lists. */ >>> + vq->free_head = 0; >>> + for (i = 0; i < num-1; i++) >>> + vq->vring.desc[i].next = cpu_to_vi...
2018 Feb 23
0
[PATCH RFC 2/2] virtio_ring: support packed ring
...new_virtqueue(unsigned int index, void (*callback)(struct virtqueue *), const char *name) { - unsigned int i; + unsigned int num, i; struct vring_virtqueue *vq; - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), + num = packed ? vring.vring_packed.num : vring.vring_split.num; + + vq = kmalloc(sizeof(*vq) + num * sizeof(struct vring_desc_state), GFP_KERNEL); if (!vq) return NULL; - vq->vring = vring; vq->vq.callback = callback; vq->vq.vdev = vdev; vq->vq.name = name; - vq->vq.num_free = vring.num; + vq->vq.num_free = num; vq-...
2018 Feb 23
5
[PATCH RFC 0/2] Packed ring for virtio
Hello everyone, This RFC implements a subset of packed ring which is described at https://github.com/oasis-tcs/virtio-docs/blob/master/virtio-v1.1-packed-wd08.pdf The code was tested with DPDK vhost (testpmd/vhost-PMD) implemented by Jens at http://dpdk.org/ml/archives/dev/2018-January/089417.html Minor changes are needed for the vhost code, e.g. to kick the guest. It's not a complete
2018 May 22
0
[RFC v5 2/5] virtio_ring: support creating packed ring
...void (*callback)(struct virtqueue *), const char *name) { - unsigned int i; struct vring_virtqueue *vq; + unsigned int num, i; + size_t size; - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), - GFP_KERNEL); + num = packed ? vring.vring_packed.num : vring.vring_split.num; + size = packed ? num * sizeof(struct vring_desc_state_packed) : + num * sizeof(struct vring_desc_state); + + vq = kmalloc(sizeof(*vq) + size, GFP_KERNEL); if (!vq) return NULL; - vq->vring = vring; vq->vq.callback = callback; vq->vq.vdev = vdev; vq->vq.name = name;...
2018 Sep 10
0
[PATCH net-next v2 2/5] virtio_ring: support creating packed ring
...gt; > + union vring_union vring; > > + bool packed; > > + > > + packed = virtio_has_feature(vdev, VIRTIO_F_RING_PACKED); > > + if (packed) > > + vring_init_packed(&vring.vring_packed, num, pages, vring_align); > > + else > > + vring_init(&vring.vring_split, num, pages, vring_align); > > > vring_init in the UAPI header is more or less a bug. > I'd just stop using it, keep it around for legacy userspace. Got it. I'd like to do that. Thanks. > > > + > > + return __vring_new_virtqueue(index, vring, packed, vdev, we...
2018 Jul 11
0
[PATCH net-next v2 2/5] virtio_ring: support creating packed ring
...void (*callback)(struct virtqueue *), const char *name) { - unsigned int i; struct vring_virtqueue *vq; + unsigned int num, i; + size_t size; - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), - GFP_KERNEL); + num = packed ? vring.vring_packed.num : vring.vring_split.num; + size = packed ? num * sizeof(struct vring_desc_state_packed) : + num * sizeof(struct vring_desc_state); + + vq = kmalloc(sizeof(*vq) + size, GFP_KERNEL); if (!vq) return NULL; - vq->vring = vring; vq->vq.callback = callback; vq->vq.vdev = vdev; vq->vq.name = name;...
2018 Mar 16
0
[PATCH RFC 2/2] virtio_ring: support packed ring
...ue *), > > const char *name) > > { > > - unsigned int i; > > + unsigned int num, i; > > struct vring_virtqueue *vq; > > - vq = kmalloc(sizeof(*vq) + vring.num * sizeof(struct vring_desc_state), > > + num = packed ? vring.vring_packed.num : vring.vring_split.num; > > + > > + vq = kmalloc(sizeof(*vq) + num * sizeof(struct vring_desc_state), > > GFP_KERNEL); > > if (!vq) > > return NULL; > > - vq->vring = vring; > > vq->vq.callback = callback; > > vq->vq.vdev = vdev; > >...