Displaying 20 results from an estimated 20 matches for "mergeable_len_to_ctx".
2017 Jul 18
1
[PATCH net-next 2/5] virtio-net: pack headroom into ctx for mergeable buffer
...ndex 1f8c15c..8fae9a8 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -270,6 +270,23 @@ static void skb_xmit_done(struct virtqueue *vq)
> netif_wake_subqueue(vi->dev, vq2txq(vq));
> }
>
> +#define MRG_CTX_HEADER_SHIFT 22
> +static void *mergeable_len_to_ctx(unsigned int truesize,
> + unsigned int headroom)
> +{
> + return (void *)(unsigned long)((headroom << MRG_CTX_HEADER_SHIFT) | truesize);
> +}
> +
> +static unsigned int mergeable_ctx_to_headroom(void *mrg_ctx)
> +{
> + return (unsigned long)mrg_ctx >> MRG_C...
2017 Jul 18
1
[PATCH net-next 2/5] virtio-net: pack headroom into ctx for mergeable buffer
...ndex 1f8c15c..8fae9a8 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -270,6 +270,23 @@ static void skb_xmit_done(struct virtqueue *vq)
> netif_wake_subqueue(vi->dev, vq2txq(vq));
> }
>
> +#define MRG_CTX_HEADER_SHIFT 22
> +static void *mergeable_len_to_ctx(unsigned int truesize,
> + unsigned int headroom)
> +{
> + return (void *)(unsigned long)((headroom << MRG_CTX_HEADER_SHIFT) | truesize);
> +}
> +
> +static unsigned int mergeable_ctx_to_headroom(void *mrg_ctx)
> +{
> + return (unsigned long)mrg_ctx >> MRG_C...
2017 Jul 17
0
[PATCH net-next 2/5] virtio-net: pack headroom into ctx for mergeable buffer
...irtio_net.c b/drivers/net/virtio_net.c
index 1f8c15c..8fae9a8 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -270,6 +270,23 @@ static void skb_xmit_done(struct virtqueue *vq)
netif_wake_subqueue(vi->dev, vq2txq(vq));
}
+#define MRG_CTX_HEADER_SHIFT 22
+static void *mergeable_len_to_ctx(unsigned int truesize,
+ unsigned int headroom)
+{
+ return (void *)(unsigned long)((headroom << MRG_CTX_HEADER_SHIFT) | truesize);
+}
+
+static unsigned int mergeable_ctx_to_headroom(void *mrg_ctx)
+{
+ return (unsigned long)mrg_ctx >> MRG_CTX_HEADER_SHIFT;
+}
+
+static unsigned i...
2020 May 06
0
[PATCH net-next 2/2] virtio-net: fix the XDP truesize calculation for mergeable buffers
...eaving hole at front of pkt */
get_page(alloc_frag->page);
@@ -1205,11 +1206,12 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi,
* the current buffer.
*/
len += hole;
+ truesize += hole;
alloc_frag->offset += hole;
}
sg_init_one(rq->sg, buf, len);
- ctx = mergeable_len_to_ctx(len, headroom);
+ ctx = mergeable_len_to_ctx(truesize, headroom);
err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp);
if (err < 0)
put_page(virt_to_head_page(buf));
--
2.20.1
2020 May 06
2
[PATCH net-next 2/2] virtio-net: fix the XDP truesize calculation for mergeable buffers
...etect that.
> @@ -1205,11 +1206,12 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi,
> * the current buffer.
> */
> len += hole;
> + truesize += hole;
> alloc_frag->offset += hole;
> }
>
> sg_init_one(rq->sg, buf, len);
> - ctx = mergeable_len_to_ctx(len, headroom);
> + ctx = mergeable_len_to_ctx(truesize, headroom);
> err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp);
> if (err < 0)
> put_page(virt_to_head_page(buf));
> --
> 2.20.1
2020 May 06
2
[PATCH net-next 2/2] virtio-net: fix the XDP truesize calculation for mergeable buffers
...etect that.
> @@ -1205,11 +1206,12 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi,
> * the current buffer.
> */
> len += hole;
> + truesize += hole;
> alloc_frag->offset += hole;
> }
>
> sg_init_one(rq->sg, buf, len);
> - ctx = mergeable_len_to_ctx(len, headroom);
> + ctx = mergeable_len_to_ctx(truesize, headroom);
> err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp);
> if (err < 0)
> put_page(virt_to_head_page(buf));
> --
> 2.20.1
2020 May 06
6
[PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP
We tried to reserve space for vnet header before
xdp.data_hard_start. But this is useless since the packet could be
modified by XDP which may invalidate the information stored in the
header and there's no way for XDP to know the existence of the vnet
header currently.
So let's just not reserve space for vnet header in this case.
Cc: Jesper Dangaard Brouer <brouer at redhat.com>
2020 May 06
6
[PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP
We tried to reserve space for vnet header before
xdp.data_hard_start. But this is useless since the packet could be
modified by XDP which may invalidate the information stored in the
header and there's no way for XDP to know the existence of the vnet
header currently.
So let's just not reserve space for vnet header in this case.
Cc: Jesper Dangaard Brouer <brouer at redhat.com>
2017 Jul 18
1
[PATCH net-next 3/5] virtio-net: switch to use new ctx API for small buffer
...6 +813,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, struct receive_queue *rq,
Let's document that ctx API is used a bit differently here:
/* Unlike mergeable buffers, all buffers are allocated to the same size,
* except for the headroom. For this reason we do not need to use
* mergeable_len_to_ctx here - it is enough to store the headroom as the
* context ignoring the truesize.
*/
as an alternative, reuse the same format as mergeable buffers.
> struct page_frag *alloc_frag = &rq->alloc_frag;
> char *buf;
> unsigned int xdp_headroom = virtnet_get_headroom(vi);
> +...
2017 Jul 18
1
[PATCH net-next 3/5] virtio-net: switch to use new ctx API for small buffer
...6 +813,7 @@ static int add_recvbuf_small(struct virtnet_info *vi, struct receive_queue *rq,
Let's document that ctx API is used a bit differently here:
/* Unlike mergeable buffers, all buffers are allocated to the same size,
* except for the headroom. For this reason we do not need to use
* mergeable_len_to_ctx here - it is enough to store the headroom as the
* context ignoring the truesize.
*/
as an alternative, reuse the same format as mergeable buffers.
> struct page_frag *alloc_frag = &rq->alloc_frag;
> char *buf;
> unsigned int xdp_headroom = virtnet_get_headroom(vi);
> +...
2017 Jul 17
13
[PATCH net-next 0/5] refine virtio-net XDP
Hi:
This series brings two optimizations for virtio-net XDP:
- avoid reset during XDP set
- turn off offloads on demand
Please review.
Thanks
Jason Wang (5):
virtio_ring: allow to store zero as the ctx
virtio-net: pack headroom into ctx for mergeable buffer
virtio-net: switch to use new ctx API for small buffer
virtio-net: do not reset during XDP set
virtio-net: switch off offloads
2017 Jul 17
13
[PATCH net-next 0/5] refine virtio-net XDP
Hi:
This series brings two optimizations for virtio-net XDP:
- avoid reset during XDP set
- turn off offloads on demand
Please review.
Thanks
Jason Wang (5):
virtio_ring: allow to store zero as the ctx
virtio-net: pack headroom into ctx for mergeable buffer
virtio-net: switch to use new ctx API for small buffer
virtio-net: do not reset during XDP set
virtio-net: switch off offloads
2017 Jul 19
9
[PATCH net-next V2 0/5] Refine virtio-net XDP
Hi:
This series brings two optimizations for virtio-net XDP:
- avoid reset during XDP set
- turn off offloads on demand
Changes from V1:
- Various tweaks on commit logs and comments
- Use virtnet_napi_enable() when enabling NAPI on XDP set
- Copy the small buffer packet only if xdp_headroom is smaller than
required
Please review.
Thanks
Jason Wang (5):
virtio_ring: allow to store zero as
2017 Jul 19
9
[PATCH net-next V2 0/5] Refine virtio-net XDP
Hi:
This series brings two optimizations for virtio-net XDP:
- avoid reset during XDP set
- turn off offloads on demand
Changes from V1:
- Various tweaks on commit logs and comments
- Use virtnet_napi_enable() when enabling NAPI on XDP set
- Copy the small buffer packet only if xdp_headroom is smaller than
required
Please review.
Thanks
Jason Wang (5):
virtio_ring: allow to store zero as
2023 Jun 22
1
[PATCH vhost v10 10/10] virtio_net: support dma premapped
...rr = virtnet_add_inbuf(rq, vi->big_packets_num_skbfrags + 2,
> + first, NULL, gfp);
> if (err < 0)
> give_pages(rq, first);
>
> @@ -1645,7 +1750,7 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi,
>
> sg_init_one(rq->sg, buf, len);
> ctx = mergeable_len_to_ctx(len + room, headroom);
> - err = virtqueue_add_inbuf_ctx(rq->vq, rq->sg, 1, buf, ctx, gfp);
> + err = virtnet_add_inbuf(rq, 1, buf, ctx, gfp);
> if (err < 0)
> put_page(virt_to_head_page(buf));
>
> @@ -1768,13 +1873,13 @@ static int virtnet_receive(struct receive_q...
2023 Jul 10
10
[PATCH vhost v11 00/10] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use
2023 Aug 10
12
[PATCH vhost v13 00/12] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use
2023 Aug 10
12
[PATCH vhost v13 00/12] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use
2023 Jun 02
12
[PATCH vhost v10 00/10] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use
2023 Jun 02
12
[PATCH vhost v10 00/10] virtio core prepares for AF_XDP
## About DMA APIs
Now, virtio may can not work with DMA APIs when virtio features do not have
VIRTIO_F_ACCESS_PLATFORM.
1. I tried to let DMA APIs return phy address by virtio-device. But DMA APIs just
work with the "real" devices.
2. I tried to let xsk support callballs to get phy address from virtio-net
driver as the dma address. But the maintainers of xsk may want to use