Displaying 20 results from an estimated 223 matches for "detach_buf".
2017 Mar 29
2
[PATCH 3/6] virtio: allow extra context per descriptor
..., 0, 1, data, ctx, gfp);
+}
+EXPORT_SYMBOL_GPL(virtqueue_add_inbuf_ctx);
+
+/**
* virtqueue_kick_prepare - first half of split virtqueue_kick call.
* @vq: the struct virtqueue
*
@@ -598,7 +627,8 @@ bool virtqueue_kick(struct virtqueue *vq)
}
EXPORT_SYMBOL_GPL(virtqueue_kick);
-static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
+static void detach_buf(struct vring_virtqueue *vq, unsigned int head,
+ void **ctx)
{
unsigned int i, j;
__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
@@ -622,10 +652,15 @@ static void detach_buf(struct vring_v...
2017 Mar 29
2
[PATCH 3/6] virtio: allow extra context per descriptor
..., 0, 1, data, ctx, gfp);
+}
+EXPORT_SYMBOL_GPL(virtqueue_add_inbuf_ctx);
+
+/**
* virtqueue_kick_prepare - first half of split virtqueue_kick call.
* @vq: the struct virtqueue
*
@@ -598,7 +627,8 @@ bool virtqueue_kick(struct virtqueue *vq)
}
EXPORT_SYMBOL_GPL(virtqueue_kick);
-static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
+static void detach_buf(struct vring_virtqueue *vq, unsigned int head,
+ void **ctx)
{
unsigned int i, j;
__virtio16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
@@ -622,10 +652,15 @@ static void detach_buf(struct vring_v...
2014 Aug 27
2
[PATCH 2/3] virtio_ring: Use DMA APIs
...struct virtqueue *_vq,
>
> add_head:
> /* Set token. */
> - vq->data[head] = data;
> + vq->desc_state[head].data = data;
>
> /* Put entry in available array (but don't update avail->idx until they
> * do sync). */
> @@ -470,22 +532,33 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
> unsigned int i;
>
> /* Clear data ptr. */
> - vq->data[head] = NULL;
> + vq->desc_state[head].data = NULL;
>
> /* Put back on free list: find end */
> i = head;
>
> /* Free the indirect table */
> -...
2014 Aug 27
2
[PATCH 2/3] virtio_ring: Use DMA APIs
...struct virtqueue *_vq,
>
> add_head:
> /* Set token. */
> - vq->data[head] = data;
> + vq->desc_state[head].data = data;
>
> /* Put entry in available array (but don't update avail->idx until they
> * do sync). */
> @@ -470,22 +532,33 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
> unsigned int i;
>
> /* Clear data ptr. */
> - vq->data[head] = NULL;
> + vq->desc_state[head].data = NULL;
>
> /* Put back on free list: find end */
> i = head;
>
> /* Free the indirect table */
> -...
2010 May 05
4
[PATCH RFC] virtio: put last seen used index into ring itself
...struct vring_virtqueue
/* Number we've added since last sync. */
unsigned int num_added;
- /* Last used index we've seen. */
- u16 last_used_idx;
-
/* How to notify other side. FIXME: commonalize hcalls! */
void (*notify)(struct virtqueue *vq);
@@ -285,12 +282,13 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
static inline bool more_used(const struct vring_virtqueue *vq)
{
- return vq->last_used_idx != vq->vring.used->idx;
+ return *vq->vring.last_used_idx != vq->vring.used->idx;
}
void *virtqueue_get_buf(struct virtqueue *_vq, uns...
2010 May 05
4
[PATCH RFC] virtio: put last seen used index into ring itself
...struct vring_virtqueue
/* Number we've added since last sync. */
unsigned int num_added;
- /* Last used index we've seen. */
- u16 last_used_idx;
-
/* How to notify other side. FIXME: commonalize hcalls! */
void (*notify)(struct virtqueue *vq);
@@ -285,12 +282,13 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
static inline bool more_used(const struct vring_virtqueue *vq)
{
- return vq->last_used_idx != vq->vring.used->idx;
+ return *vq->vring.last_used_idx != vq->vring.used->idx;
}
void *virtqueue_get_buf(struct virtqueue *_vq, uns...
2014 Aug 26
0
[PATCH 2/3] virtio_ring: Use DMA APIs
...+331,7 @@ static inline int virtqueue_add(struct virtqueue *_vq,
add_head:
/* Set token. */
- vq->data[head] = data;
+ vq->desc_state[head].data = data;
/* Put entry in available array (but don't update avail->idx until they
* do sync). */
@@ -470,22 +532,33 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
unsigned int i;
/* Clear data ptr. */
- vq->data[head] = NULL;
+ vq->desc_state[head].data = NULL;
/* Put back on free list: find end */
i = head;
/* Free the indirect table */
- if (vq->vring.desc[i].flags & VRING_DESC_F_I...
2018 Apr 17
2
[RFC v2] virtio: support packed ring
...gt; > > > On 2018?04?13? 15:15, Tiwei Bie wrote:
> > > > > > On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote:
> > > > > > > On 2018?04?01? 22:12, Tiwei Bie wrote:
> > > > [...]
> > > > > > > > +static int detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> > > > > > > > + void **ctx)
> > > > > > > > +{
> > > > > > > > + struct vring_packed_desc *desc;
> > > > > > > > + unsigned int i, j;
>...
2018 Apr 17
2
[RFC v2] virtio: support packed ring
...gt; > > > On 2018?04?13? 15:15, Tiwei Bie wrote:
> > > > > > On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote:
> > > > > > > On 2018?04?01? 22:12, Tiwei Bie wrote:
> > > > [...]
> > > > > > > > +static int detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> > > > > > > > + void **ctx)
> > > > > > > > +{
> > > > > > > > + struct vring_packed_desc *desc;
> > > > > > > > + unsigned int i, j;
>...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...< total_sg; n++) {
+ if (i == err_idx)
+ break;
+ vring_unmap_one(vq, &desc[i]);
+ i = vq->vring.desc[i].next;
+ }
+
+ vq->vq.num_free += total_sg;
+
+ if (indirect)
+ kfree(desc);
+
+ return -EIO;
}
/**
@@ -423,27 +526,43 @@ EXPORT_SYMBOL_GPL(virtqueue_kick);
static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
{
- unsigned int i;
+ unsigned int i, j;
+ u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
/* Clear data ptr. */
- vq->data[head] = NULL;
+ vq->desc_state[head].data = NULL;
- /* Put back on free list: find end */
+ /* P...
2014 Aug 27
0
[PATCH 2/3] virtio_ring: Use DMA APIs
...add_head:
> > /* Set token. */
> > - vq->data[head] = data;
> > + vq->desc_state[head].data = data;
> >
> > /* Put entry in available array (but don't update avail->idx until they
> > * do sync). */
> > @@ -470,22 +532,33 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
> > unsigned int i;
> >
> > /* Clear data ptr. */
> > - vq->data[head] = NULL;
> > + vq->desc_state[head].data = NULL;
> >
> > /* Put back on free list: find end */
> > i = head;
> >...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...2 +-
>> drivers/virtio/virtio_ring.c | 190 +++++++++++++++++++++++++++++++--------
>> tools/virtio/linux/dma-mapping.h | 17 ++++
>> 3 files changed, 172 insertions(+), 37 deletions(-)
>> create mode 100644 tools/virtio/linux/dma-mapping.h
>
>> static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
>> {
>> - unsigned int i;
>> + unsigned int i, j;
>> + u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>>
>> /* Clear data ptr. */
>> - vq->data[head] = NULL;
>> + vq->desc_sta...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...2 +-
>> drivers/virtio/virtio_ring.c | 190 +++++++++++++++++++++++++++++++--------
>> tools/virtio/linux/dma-mapping.h | 17 ++++
>> 3 files changed, 172 insertions(+), 37 deletions(-)
>> create mode 100644 tools/virtio/linux/dma-mapping.h
>
>> static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
>> {
>> - unsigned int i;
>> + unsigned int i, j;
>> + u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>>
>> /* Clear data ptr. */
>> - vq->data[head] = NULL;
>> + vq->desc_sta...
2016 Feb 03
0
[PATCH v7 5/9] virtio_ring: Support DMA APIs
...< total_sg; n++) {
+ if (i == err_idx)
+ break;
+ vring_unmap_one(vq, &desc[i]);
+ i = vq->vring.desc[i].next;
+ }
+
+ vq->vq.num_free += total_sg;
+
+ if (indirect)
+ kfree(desc);
+
+ return -EIO;
}
/**
@@ -454,27 +569,43 @@ EXPORT_SYMBOL_GPL(virtqueue_kick);
static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
{
- unsigned int i;
+ unsigned int i, j;
+ u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
/* Clear data ptr. */
- vq->data[head] = NULL;
+ vq->desc_state[head].data = NULL;
- /* Put back on free list: find end */
+ /* P...
2014 Oct 22
0
[PATCH RFC 04/11] virtio_ring: implement endian reversal based on VERSION_1 feature.
...gt;flags & VRING_USED_F_NO_NOTIFY);
> + u16 flags;
> +
> + flags = virtio_to_cpu_u16(vq->vq.vdev, vq->vring.used->flags);
> + needs_kick = !(flags & VRING_USED_F_NO_NOTIFY);
> }
> END_USE(vq);
> return needs_kick;
> @@ -486,11 +528,20 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
> i = head;
>
> /* Free the indirect table */
> - if (vq->vring.desc[i].flags & VRING_DESC_F_INDIRECT)
> - kfree(phys_to_virt(vq->vring.desc[i].addr));
> + if (vq->vring.desc[i].flags &
> + cpu_to_virtio...
2016 Feb 03
1
[PATCH v7 5/9] virtio_ring: Support DMA APIs
...q, &desc[i]);
> + i = vq->vring.desc[i].next;
> + }
> +
> + vq->vq.num_free += total_sg;
> +
> + if (indirect)
> + kfree(desc);
> +
> + return -EIO;
> }
>
> /**
> @@ -454,27 +569,43 @@ EXPORT_SYMBOL_GPL(virtqueue_kick);
>
> static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
> {
> - unsigned int i;
> + unsigned int i, j;
> + u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>
> /* Clear data ptr. */
> - vq->data[head] = NULL;
> + vq->desc_state[head].data = NULL;
>
&...
2016 Feb 03
1
[PATCH v7 5/9] virtio_ring: Support DMA APIs
...q, &desc[i]);
> + i = vq->vring.desc[i].next;
> + }
> +
> + vq->vq.num_free += total_sg;
> +
> + if (indirect)
> + kfree(desc);
> +
> + return -EIO;
> }
>
> /**
> @@ -454,27 +569,43 @@ EXPORT_SYMBOL_GPL(virtqueue_kick);
>
> static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
> {
> - unsigned int i;
> + unsigned int i, j;
> + u16 nextflag = cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_NEXT);
>
> /* Clear data ptr. */
> - vq->data[head] = NULL;
> + vq->desc_state[head].data = NULL;
>
&...
2015 Dec 07
6
[PATCH RFC 0/3] Xen on Virtio
...he dma API which
takes care of the additional address conversions. However using the dma
API would increase the complexity of the non-Xen case too. We would also
need to keep track of the physical or virtual address in addition to the
dma address for each vring_desc to be able to free the memory in
detach_buf (see patch #3).
Instead this series adds few obvious checks to perform address
translations in a couple of key places, without changing non-Xen code
paths. You are welcome to suggest improvements or alternative
implementations.
Thanks,
Stefano
Stefano Stabellini (3):
xen: export xen_phys...
2015 Dec 07
6
[PATCH RFC 0/3] Xen on Virtio
...he dma API which
takes care of the additional address conversions. However using the dma
API would increase the complexity of the non-Xen case too. We would also
need to keep track of the physical or virtual address in addition to the
dma address for each vring_desc to be able to free the memory in
detach_buf (see patch #3).
Instead this series adds few obvious checks to perform address
translations in a couple of key places, without changing non-Xen code
paths. You are welcome to suggest improvements or alternative
implementations.
Thanks,
Stefano
Stefano Stabellini (3):
xen: export xen_phys...
2014 Nov 27
0
[PATCH v6 09/46] virtio_ring: switch to new memory access APIs
...ing)),
new, old);
} else {
- needs_kick = !(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY);
+ needs_kick = !(vq->vring.used->flags & cpu_to_virtio16(_vq->vdev, VRING_USED_F_NO_NOTIFY));
}
END_USE(vq);
return needs_kick;
@@ -432,15 +433,15 @@ static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
i = head;
/* Free the indirect table */
- if (vq->vring.desc[i].flags & VRING_DESC_F_INDIRECT)
- kfree(phys_to_virt(vq->vring.desc[i].addr));
+ if (vq->vring.desc[i].flags & cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_INDIRECT)...