search for: indir_desc

Displaying 20 results from an estimated 131 matches for "indir_desc".

2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...= cpu_to_virtio16(vq->vq.vdev, vq->free_head); >> vq->free_head = head; >> + >> /* Plus final descriptor */ >> vq->vq.num_free++; >> + >> + /* Free the indirect table, if any, now that it's unmapped. */ >> + if (vq->desc_state[head].indir_desc) { >> + struct vring_desc *indir_desc = vq->desc_state[head].indir_desc; >> + u32 len = vq->vring.desc[head].len; > > This one needs to be virtio32_to_cpu(...) as well. Yes, just did the exact same change diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...= cpu_to_virtio16(vq->vq.vdev, vq->free_head); >> vq->free_head = head; >> + >> /* Plus final descriptor */ >> vq->vq.num_free++; >> + >> + /* Free the indirect table, if any, now that it's unmapped. */ >> + if (vq->desc_state[head].indir_desc) { >> + struct vring_desc *indir_desc = vq->desc_state[head].indir_desc; >> + u32 len = vq->vring.desc[head].len; > > This one needs to be virtio32_to_cpu(...) as well. Yes, just did the exact same change diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_...
2023 Mar 22
1
[PATCH vhost v4 04/11] virtio_ring: split: support premapped
...-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index c8ed4aef9462..a2a77a0dafe6 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -70,6 +70,7 @@ struct vring_desc_state_split { void *data; /* Data for callback. */ struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ + bool dma_map_internal; /* Do dma map internally. */ }; struct vring_desc_state_packed { @@ -448,7 +449,7 @@ static void vring_unmap_one_split_indirect(const struct vring_virtqueue *vq, } static unsigned int vring_unmap_one_split(const struct vring_virt...
2023 Mar 21
1
[PATCH vhost v3 04/11] virtio_ring: split: support premapped
...tio_ring.c b/drivers/virtio/virtio_ring.c > index c8ed4aef9462..be2ff96964c3 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -70,6 +70,7 @@ > struct vring_desc_state_split { > void *data; /* Data for callback. */ > struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > + bool map_inter; /* Do dma map internally. */ I prefer a full name. E.g. "dma_map_internal". Eschew abbreviation. > }; > > struct vring_desc_state_packed { > @@ -448,7 +449,7 @@ static void vring_unmap_one_split_indirect(const...
2023 Mar 07
2
[PATCH vhost v1 03/12] virtio_ring: split: introduce virtqueue_add_split_premapped()
...rtio_ring.c > index 17520f0d7649..5b186ce73d35 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -70,6 +70,7 @@ > struct vring_desc_state_split { > void *data; /* Data for callback. */ > struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > + bool dma_map; /* Addr is mapped by virtio core or not. */ This will stress the cache, can we pack the boolean into indir_desc? > }; > > struct vring_desc_state_packed { > @@ -440,7 +441,7 @@ static void vring_unmap_...
2023 Mar 07
1
[PATCH vhost v1 03/12] virtio_ring: split: introduce virtqueue_add_split_premapped()
...d7649..5b186ce73d35 100644 > > --- a/drivers/virtio/virtio_ring.c > > +++ b/drivers/virtio/virtio_ring.c > > @@ -70,6 +70,7 @@ > > struct vring_desc_state_split { > > void *data; /* Data for callback. */ > > struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > > + bool dma_map; /* Addr is mapped by virtio core or not. */ > > This will stress the cache, can we pack the boolean into indir_desc? Rethink about this, I think we cannot pack this into indir_desc. Because we may save ct...
2023 Jun 22
1
[PATCH vhost v10 05/10] virtio_ring: split-detach: support return dma info to driver
...cursor->done = true; > + rc = 0; > + } > + > + *addr = extra->addr; > + *len = extra->len; > + *dir = (extra->flags & VRING_DESC_F_WRITE) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; > + > + vq->vq.num_free++; > + > + } else { > + struct vring_desc *indir_desc, *desc; > + u16 flags; > + > + indir_desc = vq->split.desc_state[cursor->head].indir_desc; > + desc = &indir_desc[cursor->pos]; > + > + flags = virtio16_to_cpu(vq->vq.vdev, desc->flags); > + *addr = virtio64_to_cpu(vq->vq.vdev, desc->addr); > +...
2015 Oct 30
1
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...ak.h> +#include <linux/dma-mapping.h> #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ @@ -54,7 +55,14 @@ #define END_USE(vq) #endif -struct vring_virtqueue { +struct vring_desc_state +{ + void *data; /* Data for callback. */ + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ +}; + +struct vring_virtqueue +{ struct virtqueue vq; /* Actual memory layout for this queue */ @@ -92,12 +100,71 @@ struct vring_virtqueue { ktime_t last_add_time; #endif - /* Tokens for callbacks. */ - void *data[]; + /* Per-descriptor state. */ + st...
2017 Mar 29
2
[PATCH 3/6] virtio: allow extra context per descriptor
...*_vq, START_USE(vq); BUG_ON(data == NULL); + BUG_ON(ctx && vq->indirect); if (unlikely(vq->broken)) { END_USE(vq); @@ -389,6 +391,8 @@ static inline int virtqueue_add(struct virtqueue *_vq, vq->desc_state[head].data = data; if (indirect) vq->desc_state[head].indir_desc = desc; + if (ctx) + vq->desc_state[head].indir_desc = ctx; /* Put entry in available array (but don't update avail->idx until they * do sync). */ @@ -461,7 +465,8 @@ int virtqueue_add_sgs(struct virtqueue *_vq, for (sg = sgs[i]; sg; sg = sg_next(sg)) total_sg++; } - retu...
2017 Mar 29
2
[PATCH 3/6] virtio: allow extra context per descriptor
...*_vq, START_USE(vq); BUG_ON(data == NULL); + BUG_ON(ctx && vq->indirect); if (unlikely(vq->broken)) { END_USE(vq); @@ -389,6 +391,8 @@ static inline int virtqueue_add(struct virtqueue *_vq, vq->desc_state[head].data = data; if (indirect) vq->desc_state[head].indir_desc = desc; + if (ctx) + vq->desc_state[head].indir_desc = ctx; /* Put entry in available array (but don't update avail->idx until they * do sync). */ @@ -461,7 +465,8 @@ int virtqueue_add_sgs(struct virtqueue *_vq, for (sg = sgs[i]; sg; sg = sg_next(sg)) total_sg++; } - retu...
2015 Oct 30
0
[PATCH v4 2/6] virtio_ring: Support DMA APIs
...vq->vring.desc[i].next = cpu_to_virtio16(vq->vq.vdev, vq->free_head); > vq->free_head = head; > + > /* Plus final descriptor */ > vq->vq.num_free++; > + > + /* Free the indirect table, if any, now that it's unmapped. */ > + if (vq->desc_state[head].indir_desc) { > + struct vring_desc *indir_desc = vq->desc_state[head].indir_desc; > + u32 len = vq->vring.desc[head].len; This one needs to be virtio32_to_cpu(...) as well. > + > + BUG_ON(!(vq->vring.desc[head].flags & > + cpu_to_virtio16(vq->vq.vdev, VRING_DESC_F_INDIR...
2023 Feb 20
1
[PATCH vhost 04/10] virtio_ring: split: introduce virtqueue_add_split_premapped()
...52f9f..a31155abe101 100644 > > --- a/drivers/virtio/virtio_ring.c > > +++ b/drivers/virtio/virtio_ring.c > > @@ -70,6 +70,7 @@ > > struct vring_desc_state_split { > > void *data; /* Data for callback. */ > > struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ > > + bool premapped; > > Better with a comment. > > Not native speaker, but "dma_addr" might be better? > > > }; > > > > struct vring_desc_state_packed { > > @@ -440,7 +441,7 @@ static void vring_un...
2023 May 17
12
[PATCH vhost v9 00/12] virtio core prepares for AF_XDP
...parameter 'vq' description in 'virtqueue_dma_dev' v3: 1. add map_inter to struct desc state to reocrd whether virtio core do dma map v2: 1. based on sgs[0]->dma_address to judgment is premapped 2. based on extra.addr to judgment to do unmap for no-indirect desc 3. based on indir_desc to judgment to do unmap for indirect desc 4. rename virtqueue_get_dma_dev to virtqueue_dma_dev v1: 1. expose dma device. NO introduce the api for dma and sync 2. split some commit for review. Xuan Zhuo (12): virtio_ring: put mapping error check in vring_map_one_sg virtio_ring: simplify t...
2018 May 29
2
[RFC v5 3/5] virtio_ring: add packed ring support
...5ef5f42a7cf..eb9fd5207a68 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -62,6 +62,12 @@ struct vring_desc_state { > }; > > struct vring_desc_state_packed { > + void *data; /* Data for callback. */ > + struct vring_packed_desc *indir_desc; /* Indirect descriptor, if any. */ > + int num; /* Descriptor list length. */ > + dma_addr_t addr; /* Buffer DMA addr. */ > + u32 len; /* Buffer length. */ > + u16 flags; /* Descriptor flags. */ > int next; /* The next desc state. */ > }; > > @@ -758,6 +764...
2018 May 29
2
[RFC v5 3/5] virtio_ring: add packed ring support
...5ef5f42a7cf..eb9fd5207a68 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -62,6 +62,12 @@ struct vring_desc_state { > }; > > struct vring_desc_state_packed { > + void *data; /* Data for callback. */ > + struct vring_packed_desc *indir_desc; /* Indirect descriptor, if any. */ > + int num; /* Descriptor list length. */ > + dma_addr_t addr; /* Buffer DMA addr. */ > + u32 len; /* Buffer length. */ > + u16 flags; /* Descriptor flags. */ > int next; /* The next desc state. */ > }; > > @@ -758,6 +764...
2016 Feb 03
0
[PATCH v7 5/9] virtio_ring: Support DMA APIs
...#include <linux/kmemleak.h> +#include <linux/dma-mapping.h> #ifdef DEBUG /* For development, we want to crash whenever the ring is screwed. */ @@ -54,6 +55,11 @@ #define END_USE(vq) #endif +struct vring_desc_state { + void *data; /* Data for callback. */ + struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ +}; + struct vring_virtqueue { struct virtqueue vq; @@ -98,8 +104,8 @@ struct vring_virtqueue { ktime_t last_add_time; #endif - /* Tokens for callbacks. */ - void *data[]; + /* Per-descriptor state. */ + struct vring_desc_state desc_state[]; }; #def...
2018 May 22
0
[RFC v5 2/5] virtio_ring: support creating packed ring
...les changed, 546 insertions(+), 263 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 71458f493cf8..f5ef5f42a7cf 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -61,11 +61,15 @@ struct vring_desc_state { struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ }; +struct vring_desc_state_packed { + int next; /* The next desc state. */ +}; + struct vring_virtqueue { struct virtqueue vq; - /* Actual memory layout for this queue */ - struct vring vring; + /* Is this a packed ring? */ + bool packed; /* Can we...
2018 Jul 11
0
[PATCH net-next v2 2/5] virtio_ring: support creating packed ring
...les changed, 546 insertions(+), 263 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 814b395007b2..c4f8abc7445a 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -60,11 +60,15 @@ struct vring_desc_state { struct vring_desc *indir_desc; /* Indirect descriptor, if any. */ }; +struct vring_desc_state_packed { + int next; /* The next desc state. */ +}; + struct vring_virtqueue { struct virtqueue vq; - /* Actual memory layout for this queue */ - struct vring vring; + /* Is this a packed ring? */ + bool packed; /* Can we...
2018 May 22
9
[RFC v5 0/5] virtio: support packed ring
Hello everyone, This RFC implements packed ring support in virtio driver. Some simple functional tests have been done with Jason's packed ring implementation in vhost (RFC v4): https://lkml.org/lkml/2018/5/16/501 Both of ping and netperf worked as expected w/ EVENT_IDX disabled. Ping worked as expected w/ EVENT_IDX enabled, but netperf didn't (A hack has been added in the driver to
2018 May 22
9
[RFC v5 0/5] virtio: support packed ring
Hello everyone, This RFC implements packed ring support in virtio driver. Some simple functional tests have been done with Jason's packed ring implementation in vhost (RFC v4): https://lkml.org/lkml/2018/5/16/501 Both of ping and netperf worked as expected w/ EVENT_IDX disabled. Ping worked as expected w/ EVENT_IDX enabled, but netperf didn't (A hack has been added in the driver to