search for: xdp_do_redirect

Displaying 20 results from an estimated 45 matches for "xdp_do_redirect".

2018 Mar 02
2
[PATCH net] virtio-net: re enable XDP_REDIRECT for mergeable buffer
...;rq->mrg_avg_pkt_len, len); - switch (act) { case XDP_PASS: /* recalculate offset to account for any header @@ -770,6 +774,19 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, goto err_xdp; rcu_read_unlock(); goto xdp_xmit; + case XDP_REDIRECT: + err = xdp_do_redirect(dev, &xdp, xdp_prog); + if (err) { + trace_xdp_exception(vi->dev, xdp_prog, act); + if (unlikely(xdp_page != page)) + put_page(xdp_page); + goto err_xdp; + } + *xdp_xmit = true; + if (unlikely(xdp_page != page)) + goto err_xdp; + rcu_read_unlock(); + goto xdp_xmit...
2018 Mar 02
2
[PATCH net] virtio-net: re enable XDP_REDIRECT for mergeable buffer
...;rq->mrg_avg_pkt_len, len); - switch (act) { case XDP_PASS: /* recalculate offset to account for any header @@ -770,6 +774,19 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, goto err_xdp; rcu_read_unlock(); goto xdp_xmit; + case XDP_REDIRECT: + err = xdp_do_redirect(dev, &xdp, xdp_prog); + if (err) { + trace_xdp_exception(vi->dev, xdp_prog, act); + if (unlikely(xdp_page != page)) + put_page(xdp_page); + goto err_xdp; + } + *xdp_xmit = true; + if (unlikely(xdp_page != page)) + goto err_xdp; + rcu_read_unlock(); + goto xdp_xmit...
2023 Apr 03
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...+ return VIRTNET_XDP_RES_DROP; > + } > + > + *xdp_xmit |= VIRTIO_XDP_TX; > + return VIRTNET_XDP_RES_CONSUMED; > + > + case XDP_REDIRECT: > + stats->xdp_redirects++; > + err = xdp_do_redirect(dev, xdp, xdp_prog); > + if (err) > + return VIRTNET_XDP_RES_DROP; > + > + *xdp_xmit |= VIRTIO_XDP_REDIR; > + return VIRTNET_XDP_RES_CONSUMED; > + > + default: > + bpf_warn_invalid_xdp_action...
2017 Sep 22
1
[PATCH net-next] virtio-net: correctly set xdp_xmit for mergeable buffer
We should set xdp_xmit only when xdp_do_redirect() succeed. Cc: John Fastabend <john.fastabend at gmail.com> Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f6c1f13..dd14a45 10...
2017 Sep 22
1
[PATCH net-next] virtio-net: correctly set xdp_xmit for mergeable buffer
We should set xdp_xmit only when xdp_do_redirect() succeed. Cc: John Fastabend <john.fastabend at gmail.com> Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f6c1f13..dd14a45 10...
2018 Sep 06
2
[PATCH net-next 06/11] tuntap: split out XDP logic
...n_do_xdp(struct tun_struct *tun, > + struct tun_file *tfile, > + struct bpf_prog *xdp_prog, > + struct xdp_buff *xdp, > + int *err) > +{ > + u32 act = bpf_prog_run_xdp(xdp_prog, xdp); > + > + switch (act) { > + case XDP_REDIRECT: > + *err = xdp_do_redirect(tun->dev, xdp, xdp_prog); > + xdp_do_flush_map(); > + if (*err) > + break; > + goto out; > + case XDP_TX: > + *err = tun_xdp_tx(tun->dev, xdp); > + if (*err < 0) > + break; > + *err = 0; > + goto out; > + case XDP_PASS: > + goto out; Do we n...
2018 Sep 06
2
[PATCH net-next 06/11] tuntap: split out XDP logic
...n_do_xdp(struct tun_struct *tun, > + struct tun_file *tfile, > + struct bpf_prog *xdp_prog, > + struct xdp_buff *xdp, > + int *err) > +{ > + u32 act = bpf_prog_run_xdp(xdp_prog, xdp); > + > + switch (act) { > + case XDP_REDIRECT: > + *err = xdp_do_redirect(tun->dev, xdp, xdp_prog); > + xdp_do_flush_map(); > + if (*err) > + break; > + goto out; > + case XDP_TX: > + *err = tun_xdp_tx(tun->dev, xdp); > + if (*err < 0) > + break; > + *err = 0; > + goto out; > + case XDP_PASS: > + goto out; Do we n...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...t; > > + *xdp_xmit |= VIRTIO_XDP_TX; > > > > + return VIRTNET_XDP_RES_CONSUMED; > > > > + > > > > + case XDP_REDIRECT: > > > > + stats->xdp_redirects++; > > > > + err = xdp_do_redirect(dev, xdp, xdp_prog); > > > > + if (err) > > > > + return VIRTNET_XDP_RES_DROP; > > > > + > > > > + *xdp_xmit |= VIRTIO_XDP_REDIR; > > > > + return VIRTNET_XDP_RES_CONSUMED; &g...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...*xdp_xmit |= VIRTIO_XDP_TX; > > > > > + return VIRTNET_XDP_RES_CONSUMED; > > > > > + > > > > > + case XDP_REDIRECT: > > > > > + stats->xdp_redirects++; > > > > > + err = xdp_do_redirect(dev, xdp, xdp_prog); > > > > > + if (err) > > > > > + return VIRTNET_XDP_RES_DROP; > > > > > + > > > > > + *xdp_xmit |= VIRTIO_XDP_REDIR; > > > > > + return VIR...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...; > > > + return VIRTNET_XDP_RES_CONSUMED; > > > > > > > + > > > > > > > + case XDP_REDIRECT: > > > > > > > + stats->xdp_redirects++; > > > > > > > + err = xdp_do_redirect(dev, xdp, xdp_prog); > > > > > > > + if (err) > > > > > > > + return VIRTNET_XDP_RES_DROP; > > > > > > > + > > > > > > > + *xdp_xmit |= VIRTIO_XDP_REDIR; > > &...
2017 Sep 20
1
[PATCH net-next 3/3] virtio-net: support XDP_REDIRECT
...kely(!__virtnet_xdp_xmit(vi, &xdp))) > trace_xdp_exception(vi->dev, xdp_prog, act); > + else > + *xdp_xmit = true; > if (unlikely(xdp_page != page)) > goto err_xdp; > rcu_read_unlock(); > goto xdp_xmit; > + case XDP_REDIRECT: > + err = xdp_do_redirect(dev, &xdp, xdp_prog); > + if (err) > + *xdp_xmit = true; Is this a typo? Should above be if (!err) *xdp_xmit = true; this would match the pattern in receive_small and also make more sense. > + rcu_read_unlock(); > + goto xdp_xmit; > default: > bpf_wa...
2018 Mar 02
0
[PATCH net] virtio-net: re enable XDP_REDIRECT for mergeable buffer
On Fri, 2 Mar 2018 14:25:29 +0800 Jason Wang <jasowang at redhat.com> wrote: > @@ -770,6 +774,19 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, > goto err_xdp; > rcu_read_unlock(); > goto xdp_xmit; > + case XDP_REDIRECT: > + err = xdp_do_redirect(dev, &xdp, xdp_prog); > + if (err) { > + trace_xdp_exception(vi->dev, xdp_prog, act); Do not add a trace_xdp_exception here... this is handled inside xdp_do_redirect() invocation. > + if (unlikely(xdp_page != page)) > + put_page(xdp_page); > + goto err_xdp; &g...
2018 Sep 06
1
[PATCH net-next 07/11] tuntap: move XDP flushing out of tun_do_xdp()
...gt; > diff --git a/drivers/net/tun.c b/drivers/net/tun.c > index 21b125020b3b..ff1cbf3ebd50 100644 > --- a/drivers/net/tun.c > +++ b/drivers/net/tun.c > @@ -1646,7 +1646,6 @@ static u32 tun_do_xdp(struct tun_struct *tun, > switch (act) { > case XDP_REDIRECT: > *err = xdp_do_redirect(tun->dev, xdp, xdp_prog); > - xdp_do_flush_map(); > if (*err) > break; > goto out; > @@ -1735,6 +1734,9 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, > act = tun_do_xdp(tun, tfile, xdp_prog, &xdp, &err); > if (err) > goto err...
2017 Sep 20
1
[PATCH net-next 3/3] virtio-net: support XDP_REDIRECT
...kely(!__virtnet_xdp_xmit(vi, &xdp))) > trace_xdp_exception(vi->dev, xdp_prog, act); > + else > + *xdp_xmit = true; > if (unlikely(xdp_page != page)) > goto err_xdp; > rcu_read_unlock(); > goto xdp_xmit; > + case XDP_REDIRECT: > + err = xdp_do_redirect(dev, &xdp, xdp_prog); > + if (err) > + *xdp_xmit = true; Is this a typo? Should above be if (!err) *xdp_xmit = true; this would match the pattern in receive_small and also make more sense. > + rcu_read_unlock(); > + goto xdp_xmit; > default: > bpf_wa...
2018 Sep 06
0
[PATCH net-next 06/11] tuntap: split out XDP logic
...un_file *tfile, return true; } +static u32 tun_do_xdp(struct tun_struct *tun, + struct tun_file *tfile, + struct bpf_prog *xdp_prog, + struct xdp_buff *xdp, + int *err) +{ + u32 act = bpf_prog_run_xdp(xdp_prog, xdp); + + switch (act) { + case XDP_REDIRECT: + *err = xdp_do_redirect(tun->dev, xdp, xdp_prog); + xdp_do_flush_map(); + if (*err) + break; + goto out; + case XDP_TX: + *err = tun_xdp_tx(tun->dev, xdp); + if (*err < 0) + break; + *err = 0; + goto out; + case XDP_PASS: + goto out; + default: + bpf_warn_invalid_xdp_action(act); + /* fall through *...
2018 Sep 07
0
[PATCH net-next 06/11] tuntap: split out XDP logic
...; + struct tun_file *tfile, >> + struct bpf_prog *xdp_prog, >> + struct xdp_buff *xdp, >> + int *err) >> +{ >> + u32 act = bpf_prog_run_xdp(xdp_prog, xdp); >> + >> + switch (act) { >> + case XDP_REDIRECT: >> + *err = xdp_do_redirect(tun->dev, xdp, xdp_prog); >> + xdp_do_flush_map(); >> + if (*err) >> + break; >> + goto out; >> + case XDP_TX: >> + *err = tun_xdp_tx(tun->dev, xdp); >> + if (*err < 0) >> + break; >> + *err = 0; >> + goto out; >>...
2017 Sep 19
6
[PATCH net-next 1/3] virtio-net: remove unnecessary parameter of virtnet_xdp_xmit()
CC: John Fastabend <john.fastabend at gmail.com> Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/net/virtio_net.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 511f833..a0ef4b0 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -373,7 +373,6 @@ static struct sk_buff
2017 Sep 19
6
[PATCH net-next 1/3] virtio-net: remove unnecessary parameter of virtnet_xdp_xmit()
CC: John Fastabend <john.fastabend at gmail.com> Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/net/virtio_net.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 511f833..a0ef4b0 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -373,7 +373,6 @@ static struct sk_buff
2023 Mar 28
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
...e if (unlikely(err < 0)) { trace_xdp_exception(dev, xdp_prog, act); - return VIRTNET_XDP_RES_DROP; + goto drop; } *xdp_xmit |= VIRTIO_XDP_TX; @@ -850,7 +850,7 @@ static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp, stats->xdp_redirects++; err = xdp_do_redirect(dev, xdp, xdp_prog); if (err) - return VIRTNET_XDP_RES_DROP; + goto drop; *xdp_xmit |= VIRTIO_XDP_REDIR; return VIRTNET_XDP_RES_CONSUMED; @@ -862,8 +862,12 @@ static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp, trace_xdp_exception(dev, xdp_prog, act);...
2023 Apr 03
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
...xception(dev, xdp_prog, act); > - return VIRTNET_XDP_RES_DROP; > + goto drop; > } > > *xdp_xmit |= VIRTIO_XDP_TX; > @@ -850,7 +850,7 @@ static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp, > stats->xdp_redirects++; > err = xdp_do_redirect(dev, xdp, xdp_prog); > if (err) > - return VIRTNET_XDP_RES_DROP; > + goto drop; > > *xdp_xmit |= VIRTIO_XDP_REDIR; > return VIRTNET_XDP_RES_CONSUMED; > @@ -862,8 +862,12 @@ static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp, >...