search for: virtqueue_add_split

Displaying 20 results from an estimated 68 matches for "virtqueue_add_split".

2023 Mar 02
1
[PATCH vhost v1 01/12] virtio_ring: split: refactor virtqueue_add_split() for premapped
This commit splits virtqueue_add_split() to two functions. The purpose of such splitting is to separate DMA operations. The first function includes all codes that may fail before the DMA operation. The subsequent part is used as the second function. In this way, we can perform DMA operations in the middle of the two functions. If the...
2023 Feb 20
2
[PATCH vhost 01/10] virtio_ring: split: refactor virtqueue_add_split() for premapped
On Tue, Feb 14, 2023 at 3:27 PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote: > > DMA-related logic is separated from the virtqueue_add_split to prepare > for subsequent support for premapped. The patch seems to do more than what is described here. To simplify reviewers, I'd suggest to split this patch into three: 1) virtqueue_add_split_prepare() (could we have a better name?) 2) virtqueue_map_sgs() 3) virtqueue_add_split_vring...
2023 Mar 07
2
[PATCH vhost v1 03/12] virtio_ring: split: introduce virtqueue_add_split_premapped()
On Thu, Mar 2, 2023 at 7:59?PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote: > > virtqueue_add_split() only supports virtual addresses, dma is completed > in virtqueue_add_split(). > > In some scenarios (such as the AF_XDP scenario), the memory is allocated > and DMA is completed in advance, so it is necessary for us to support > passing the DMA address to virtio core. > > Sig...
2023 Mar 21
1
[PATCH vhost v3 01/11] virtio_ring: split: separate dma codes
DMA-related logic is separated from the virtqueue_add_split() to one new function. DMA address will be saved as sg->dma_address if use_dma_api is true, then virtqueue_add_split() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped by drivers. Signed-off-by: Xuan Zh...
2023 Mar 07
1
[PATCH vhost v1 03/12] virtio_ring: split: introduce virtqueue_add_split_premapped()
On Tue, 7 Mar 2023 14:43:42 +0800, Jason Wang <jasowang at redhat.com> wrote: > On Thu, Mar 2, 2023 at 7:59?PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote: > > > > virtqueue_add_split() only supports virtual addresses, dma is completed > > in virtqueue_add_split(). > > > > In some scenarios (such as the AF_XDP scenario), the memory is allocated > > and DMA is completed in advance, so it is necessary for us to support > > passing the DMA address to v...
2023 Feb 20
1
[PATCH vhost 04/10] virtio_ring: split: introduce virtqueue_add_split_premapped()
On Mon, 20 Feb 2023 13:38:13 +0800, Jason Wang <jasowang at redhat.com> wrote: > On Tue, Feb 14, 2023 at 3:27 PM Xuan Zhuo <xuanzhuo at linux.alibaba.com> wrote: > > > > virtqueue_add_split() only supports virtual addresses, dma is completed > > in virtqueue_add_split(). > > > > In some scenarios (such as the AF_XDP scenario), the memory is allocated > > and DMA is completed in advance, so it is necessary for us to support > > passing the DMA address to v...
2023 Mar 22
1
[PATCH vhost v4 04/11] virtio_ring: split: support premapped
...split(const struct vring_virtqueue *vq, (flags & VRING_DESC_F_WRITE) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); } else { + if (!dma_map_internal) + goto out; + dma_unmap_page(vring_dma_dev(vq), extra[i].addr, extra[i].len, @@ -615,7 +619,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, struct scatterlist *sg; struct vring_desc *desc; unsigned int i, n, avail, descs_used, prev; - bool indirect; + bool indirect, dma_map_internal; int head; START_USE(vq); @@ -668,7 +672,8 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, return -EN...
2023 Mar 21
1
[PATCH vhost v3 04/11] virtio_ring: split: support premapped
...; (flags & VRING_DESC_F_WRITE) ? > DMA_FROM_DEVICE : DMA_TO_DEVICE); > } else { > + if (!map_inter) > + goto out; > + > dma_unmap_page(vring_dma_dev(vq), > extra[i].addr, > extra[i].len, > @@ -615,7 +619,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, > struct scatterlist *sg; > struct vring_desc *desc; > unsigned int i, n, avail, descs_used, prev; > - bool indirect; > + bool indirect, map_inter; > int head; > > START_USE(vq); > @@ -668,7 +672,8 @@ static inline int virtqueue_add_spli...
2023 Mar 22
1
[PATCH vhost v4 01/11] virtio_ring: split: separate dma codes
DMA-related logic is separated from the virtqueue_add_split() to one new function. DMA address will be saved as sg->dma_address if use_dma_api is true, then virtqueue_add_split() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped by drivers. Signed-off-by: Xuan Zh...
2023 Apr 25
1
[PATCH vhost v7 01/11] virtio_ring: split: separate dma codes
DMA-related logic is separated from the virtqueue_add_split() to one new function. DMA address will be saved as sg->dma_address if use_dma_api is true, then virtqueue_add_split() will use it directly. Unmap operation will be simpler. The purpose of this is to facilitate subsequent support to receive dma address mapped by drivers. Signed-off-by: Xuan Zh...
2023 Mar 02
12
[PATCH vhost v1 00/12] virtio core prepares for AF_XDP
...these features: 1. virtio core support premapped 2. virtio core support reset per-queue 3. introduce DMA APIs to virtio core Please review. Thanks. v1: 1. expose dma device. NO introduce the api for dma and sync 2. split some commit for review. Xuan Zhuo (12): virtio_ring: split: refactor virtqueue_add_split() for premapped virtio_ring: split: separate DMA codes virtio_ring: split: introduce virtqueue_add_split_premapped() virtio_ring: packed: separate prepare code from virtuque_add_indirect_packed() virtio_ring: packed: refactor virtqueue_add_packed() for premapped virtio_ring: packed: s...
2023 Mar 02
1
[PATCH vhost v1 02/12] virtio_ring: split: separate DMA codes
...if (i == err_idx) - break; - if (indirect) { - vring_unmap_one_split_indirect(vq, &desc[i]); - i = virtio16_to_cpu(_vq->vdev, desc[i].next); - } else - i = vring_unmap_one_split(vq, i); - } - - if (indirect) - kfree(desc); - - END_USE(vq); - return -ENOMEM; } static inline int virtqueue_add_split(struct virtqueue *_vq, @@ -729,6 +767,10 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, goto end; } + err = virtqueue_map_sgs(vq, sgs, total_sg, out_sgs, in_sgs); + if (err) + goto err; + head = vq->free_head; err = virtqueue_add_vring_split(vq, sgs, total_sg, out_sg...
2023 May 17
12
[PATCH vhost v9 00/12] virtio core prepares for AF_XDP
...iew. Xuan Zhuo (12): virtio_ring: put mapping error check in vring_map_one_sg virtio_ring: simplify the reference of desc state inside detach_buf_split() virtio_ring: check use_dma_api before unmap desc for indirect virtio_ring: virtqueue_add() support premapped virtio_ring: split: virtqueue_add_split() support premapped virtio_ring: packed: virtqueue_add_packed() support premapped virtio_ring: introduce virtqueue_add_outbuf_premapped() virtio_ring: introduce virtqueue_add_inbuf_premapped() virtio_ring: introduce virtqueue_dma_dev() virtio_ring: correct the expression of the descriptio...
2018 Dec 07
2
[RFC 3/3] virtio_ring: use new vring flags
On Fri, Dec 07, 2018 at 04:48:42PM +0800, Tiwei Bie wrote: > Switch to using the _SPLIT_ and _PACKED_ variants of vring flags > in split ring and packed ring respectively. > > Signed-off-by: Tiwei Bie <tiwei.bie at intel.com> > --- > @@ -502,7 +505,8 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, > } > } > /* Last one doesn't continue. */ > - desc[prev].flags &= cpu_to_virtio16(_vq->vdev, ~VRING_DESC_F_NEXT); > + desc[prev].flags &= cpu_to_virtio16(_vq->vdev, > + (u16)~BIT(VRING_SPLIT_DESC_F_NEXT)); > > if (indir...
2018 Dec 07
2
[RFC 3/3] virtio_ring: use new vring flags
On Fri, Dec 07, 2018 at 04:48:42PM +0800, Tiwei Bie wrote: > Switch to using the _SPLIT_ and _PACKED_ variants of vring flags > in split ring and packed ring respectively. > > Signed-off-by: Tiwei Bie <tiwei.bie at intel.com> > --- > @@ -502,7 +505,8 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, > } > } > /* Last one doesn't continue. */ > - desc[prev].flags &= cpu_to_virtio16(_vq->vdev, ~VRING_DESC_F_NEXT); > + desc[prev].flags &= cpu_to_virtio16(_vq->vdev, > + (u16)~BIT(VRING_SPLIT_DESC_F_NEXT)); > > if (indir...
2023 May 26
1
[PATCH] virtio_ring: validate used buffer length
...ing_desc_state_packed *desc_state; struct vring_desc_extra *desc_extra; + /* Maximum in buffer length, NULL means no used validation */ + u32 *buflen; + /* DMA address and size information */ dma_addr_t ring_dma_addr; dma_addr_t driver_event_dma_addr; @@ -552,6 +561,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, unsigned int i, n, avail, descs_used, prev, err_idx; int head; bool indirect; + u32 buflen = 0; START_USE(vq); @@ -635,6 +645,7 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, VRING_DESC_F_NEXT | VRING_DESC_F_WRITE,...
2023 May 17
2
[PATCH vhost v9 01/12] virtio_ring: put mapping error check in vring_map_one_sg
...a_map_page(vring_dma_dev(vq), sg_page(sg), sg->offset, sg->length, direction); + + if (dma_mapping_error(vring_dma_dev(vq), *addr)) + return -ENOMEM; + + return 0; } static dma_addr_t vring_map_single(const struct vring_virtqueue *vq, @@ -588,8 +593,9 @@ static inline int virtqueue_add_split(struct virtqueue *_vq, for (n = 0; n < out_sgs; n++) { for (sg = sgs[n]; sg; sg = sg_next(sg)) { - dma_addr_t addr = vring_map_one_sg(vq, sg, DMA_TO_DEVICE); - if (vring_mapping_error(vq, addr)) + dma_addr_t addr; + + if (vring_map_one_sg(vq, sg, DMA_TO_DEVICE, &addr)) go...
2023 Mar 21
11
[PATCH vhost v3 00/11] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero copy feature of xsk (XDP socket) needs to be supported by the driver. The performance of zero copy is very good. ENV: Qemu with vhost. vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS -----------------------------|---------------|------------------|------------ xmit by sockperf: 90% | 100%
2023 Feb 14
11
[PATCH vhost 00/10] virtio core prepares for AF_XDP
...| 771670 Before achieving the function of Virtio-Net, we also have to let virtio core support these features: 1. virtio core support premapped 2. virtio core support reset per-queue 3. introduce DMA APIs to virtio core Please review. Thanks. Xuan Zhuo (10): virtio_ring: split: refactor virtqueue_add_split() for premapped virtio_ring: packed: separate prepare code from virtuque_add_indirect_packed() virtio_ring: packed: refactor virtqueue_add_packed() for premapped virtio_ring: split: introduce virtqueue_add_split_premapped() virtio_ring: packed: introduce virtqueue_add_packed_premapped()...
2023 Mar 22
11
[PATCH vhost v4 00/11] virtio core prepares for AF_XDP
XDP socket(AF_XDP) is an excellent bypass kernel network framework. The zero copy feature of xsk (XDP socket) needs to be supported by the driver. The performance of zero copy is very good. ENV: Qemu with vhost. vhost cpu | Guest APP CPU |Guest Softirq CPU | PPS -----------------------------|---------------|------------------|------------ xmit by sockperf: 90% | 100%