Displaying 20 results from an estimated 53 matches for "xdp_linearize_pag".
Did you mean:
xdp_linearize_page
2023 Apr 13
1
[PATCH net] virtio_net: bugfix overflow inside xdp_linearize_page()
...--
drivers/net/virtio_net.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2396c28c0122..ea1bd4bb326d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -814,8 +814,13 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,
int page_off,
unsigned int *len)
{
- struct page *page = alloc_page(GFP_ATOMIC);
+ int tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
+ struct page *page;
+
+ if (page_off + *len + tailroom > PAGE_SIZE)
+ return NULL;
+ page = al...
2023 Apr 14
1
[PATCH net v1] virtio_net: bugfix overflow inside xdp_linearize_page()
...g
drivers/net/virtio_net.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 2396c28c0122..ea1bd4bb326d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -814,8 +814,13 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,
int page_off,
unsigned int *len)
{
- struct page *page = alloc_page(GFP_ATOMIC);
+ int tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
+ struct page *page;
+
+ if (page_off + *len + tailroom > PAGE_SIZE)
+ return NULL;
+ page = all...
2016 Dec 23
0
[PATCH net 3/9] virtio-net: fix page miscount during XDP linearizing
...ions(+), 8 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fe4562d..58ad40e 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -483,7 +483,7 @@ static struct sk_buff *receive_big(struct net_device *dev,
* anymore.
*/
static struct page *xdp_linearize_page(struct receive_queue *rq,
- u16 num_buf,
+ u16 *num_buf,
struct page *p,
int offset,
unsigned int *len)
@@ -497,7 +497,7 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,
memcpy(page_address(page) + page_off, page_address(...
2023 Mar 23
1
[PATCH net-next 1/8] virtio_net: mergeable xdp: put old page immediately
...b/drivers/net/virtio_net.c
> > @@ -1245,6 +1245,9 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
> > if (!xdp_page)
> > goto err_xdp;
> > offset = VIRTIO_XDP_HEADROOM;
> > +
> > + put_page(page);
>
> the error handling of xdp_linearize_page() does not seems self contained.
> Does it not seem better?
> 1. if xdp_linearize_page() succesed, call put_page() for first buffer just
> as put_page() is call for other buffer
> 2. or call virtqueue_get_buf() and put_page() for all the buffer of the packet
> so the error han...
2023 Mar 23
0
[PATCH net-next 1/8] virtio_net: mergeable xdp: put old page immediately
...static struct sk_buff *receive_mergeable(struct net_device *dev,
> >>> if (!xdp_page)
> >>> goto err_xdp;
> >>> offset = VIRTIO_XDP_HEADROOM;
> >>> +
> >>> + put_page(page);
> >>
> >> the error handling of xdp_linearize_page() does not seems self contained.
> >> Does it not seem better?
> >> 1. if xdp_linearize_page() succesed, call put_page() for first buffer just
> >> as put_page() is call for other buffer
> >> 2. or call virtqueue_get_buf() and put_page() for all the buffer of...
2018 Mar 01
0
[PATCH net-next 2/2] virtio-net: simplify XDP handling in small buffer
We used to do data copy through xdp_linearize_page() for the buffer
without sufficient headroom, it brings extra complexity without
helping for the performance. So this patch remove it and switch to use
generic XDP routine to handle this case.
Signed-off-by: Jason Wang <jasowang at redhat.com>
---
drivers/net/virtio_net.c | 93 ++++++------...
2018 Mar 01
7
[PATCH net-next 0/2] virtio-net: re enable XDP_REDIRECT for mergeable buffer
Hi:
This series tries to re-enable XDP_REDIRECT for mergeable buffer which
was removed since commit 7324f5399b06 ("virtio_net: disable
XDP_REDIRECT in receive_mergeable() case"). Main concerns are:
- not enough tailroom was reserved which breaks cpumap
- complex logic like EWMA and linearizing during XDP processing
Fix those by:
- reserve enough tailroom during refill
- disable EWMA
2018 Mar 01
7
[PATCH net-next 0/2] virtio-net: re enable XDP_REDIRECT for mergeable buffer
Hi:
This series tries to re-enable XDP_REDIRECT for mergeable buffer which
was removed since commit 7324f5399b06 ("virtio_net: disable
XDP_REDIRECT in receive_mergeable() case"). Main concerns are:
- not enough tailroom was reserved which breaks cpumap
- complex logic like EWMA and linearizing during XDP processing
Fix those by:
- reserve enough tailroom during refill
- disable EWMA
2017 Jul 18
1
[PATCH net-next 4/5] virtio-net: do not reset during XDP set
...case
> + * we should copy the packet and reserve enough headroom for this.
> + * This would be slow but we at most we can copy times of queue
> + * size, this is acceptable. What's more important, this help to
> + * avoid resetting.
> + */
> +static struct page *xdp_linearize_page(struct receive_queue *rq,
> + u16 *num_buf,
> + struct page *p,
> + int offset,
> + int page_off,
> + unsigned int *len)
> +{
> + struct page *page = alloc_page(GFP_ATOMIC);
> +
> + if (!page)
> + return NULL;
> +...
2017 Jul 18
1
[PATCH net-next 4/5] virtio-net: do not reset during XDP set
...case
> + * we should copy the packet and reserve enough headroom for this.
> + * This would be slow but we at most we can copy times of queue
> + * size, this is acceptable. What's more important, this help to
> + * avoid resetting.
> + */
> +static struct page *xdp_linearize_page(struct receive_queue *rq,
> + u16 *num_buf,
> + struct page *p,
> + int offset,
> + int page_off,
> + unsigned int *len)
> +{
> + struct page *page = alloc_page(GFP_ATOMIC);
> +
> + if (!page)
> + return NULL;
> +...
2018 Mar 01
2
[PATCH net-next 2/2] virtio-net: simplify XDP handling in small buffer
On Thu, 1 Mar 2018 11:19:05 +0800 Jason Wang <jasowang at redhat.com> wrote:
> We used to do data copy through xdp_linearize_page() for the buffer
> without sufficient headroom, it brings extra complexity without
> helping for the performance. So this patch remove it and switch to use
> generic XDP routine to handle this case.
I don't like where this is going. I don't like intermixing the native
XDP and ge...
2018 Mar 01
2
[PATCH net-next 2/2] virtio-net: simplify XDP handling in small buffer
On Thu, 1 Mar 2018 11:19:05 +0800 Jason Wang <jasowang at redhat.com> wrote:
> We used to do data copy through xdp_linearize_page() for the buffer
> without sufficient headroom, it brings extra complexity without
> helping for the performance. So this patch remove it and switch to use
> generic XDP routine to handle this case.
I don't like where this is going. I don't like intermixing the native
XDP and ge...
2017 Jul 17
0
[PATCH net-next 4/5] virtio-net: do not reset during XDP set
...than what XDP required. In this case
+ * we should copy the packet and reserve enough headroom for this.
+ * This would be slow but we at most we can copy times of queue
+ * size, this is acceptable. What's more important, this help to
+ * avoid resetting.
+ */
+static struct page *xdp_linearize_page(struct receive_queue *rq,
+ u16 *num_buf,
+ struct page *p,
+ int offset,
+ int page_off,
+ unsigned int *len)
+{
+ struct page *page = alloc_page(GFP_ATOMIC);
+
+ if (!page)
+ return NULL;
+
+ memcpy(page_address(page) + page_off, page_address(p)...
2023 Mar 28
1
[PATCH net-next 2/8] virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
...ers, but many existing devices do not
+ * support it, and we don't want to bother users who are
+ * using xdp normally.
+ */
+ if (!xdp_prog->aux->xdp_has_frags &&
+ (*num_buf > 1 || headroom < virtnet_get_headroom(vi))) {
+ /* linearize data for XDP */
+ xdp_page = xdp_linearize_page(rq, num_buf,
+ *page, offset,
+ VIRTIO_XDP_HEADROOM,
+ len);
+
+ if (!xdp_page)
+ return NULL;
+ } else if (unlikely(headroom < virtnet_get_headroom(vi))) {
+ xdp_room = SKB_DATA_ALIGN(VIRTIO_XDP_HEADROOM +
+ sizeof(struct skb_shared_info));
+ if (*len +...
2023 Mar 31
1
[PATCH net-next 2/8] virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
...ot
> + * support it, and we don't want to bother users who are
> + * using xdp normally.
> + */
> + if (!xdp_prog->aux->xdp_has_frags &&
> + (*num_buf > 1 || headroom < virtnet_get_headroom(vi))) {
> + /* linearize data for XDP */
> + xdp_page = xdp_linearize_page(rq, num_buf,
> + *page, offset,
> + VIRTIO_XDP_HEADROOM,
> + len);
> +
> + if (!xdp_page)
> + return NULL;
> + } else if (unlikely(headroom < virtnet_get_headroom(vi))) {
> + xdp_room = SKB_DATA_ALIGN(VIRTIO_XDP_HEADROOM +
> + s...
2023 Mar 23
0
[PATCH net-next 2/8] virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
On Thu, 23 Mar 2023 15:24:38 +0800, Yunsheng Lin <linyunsheng at huawei.com> wrote:
> On 2023/3/23 13:40, Jason Wang wrote:
> >>>
> >>>>
> >>>> Also, it seems better to split the xdp_linearize_page() to two functions
> >>>> as pskb_expand_head() and __skb_linearize() do, one to expand the headroom,
> >>>> the other one to do the linearizing.
> >>>
> >>> No skb here.
> >>
> >> I means following the semantics of pskb_expan...
2018 Mar 01
0
[PATCH net-next 2/2] virtio-net: simplify XDP handling in small buffer
On 2018?03?01? 16:02, Jesper Dangaard Brouer wrote:
> On Thu, 1 Mar 2018 11:19:05 +0800 Jason Wang <jasowang at redhat.com> wrote:
>
>> We used to do data copy through xdp_linearize_page() for the buffer
>> without sufficient headroom, it brings extra complexity without
>> helping for the performance. So this patch remove it and switch to use
>> generic XDP routine to handle this case.
> I don't like where this is going. I don't like intermixing the n...
2018 Mar 01
2
[PATCH net-next 0/2] virtio-net: re enable XDP_REDIRECT for mergeable buffer
...cording to the commit
log of 7324f5399b06 ("virtio_net: disable XDP_REDIRECT in
receive_mergeable() case"), you said:
"""
??? The longer explaination is that receive_mergeable() tries to
??? work-around and satisfy these XDP requiresments e.g. by having a
??? function xdp_linearize_page() that allocates and memcpy RX buffers
??? around (in case packet is scattered across multiple rx buffers).? This
??? does currently satisfy XDP_PASS, XDP_DROP and XDP_TX (but only because
??? we have not implemented bpf_xdp_adjust_tail yet).
"""
So I consider the tailroom is a...
2018 Mar 01
2
[PATCH net-next 0/2] virtio-net: re enable XDP_REDIRECT for mergeable buffer
...cording to the commit
log of 7324f5399b06 ("virtio_net: disable XDP_REDIRECT in
receive_mergeable() case"), you said:
"""
??? The longer explaination is that receive_mergeable() tries to
??? work-around and satisfy these XDP requiresments e.g. by having a
??? function xdp_linearize_page() that allocates and memcpy RX buffers
??? around (in case packet is scattered across multiple rx buffers).? This
??? does currently satisfy XDP_PASS, XDP_DROP and XDP_TX (but only because
??? we have not implemented bpf_xdp_adjust_tail yet).
"""
So I consider the tailroom is a...
2018 Mar 02
6
[PATCH net V2] virtio-net: re enable XDP_REDIRECT for mergeable buffer
...4 +++++++++++++++++++++++++++++++++++++-----------
1 file changed, 42 insertions(+), 12 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9bb9e56..426dcf7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -504,6 +504,7 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,
page_off += *len;
while (--*num_buf) {
+ int tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
unsigned int buflen;
void *buf;
int off;
@@ -518,7 +519,7 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,
/* guard against a misc...