search for: xdp_xmit

Displaying 20 results from an estimated 60 matches for "xdp_xmit".

2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...> > > > case XDP_TX: > > stats->xdp_tx++; > > xdpf = xdp_convert_buff_to_frame(xdp); > > if (unlikely(!xdpf)) > > return XDP_DROP; > > > > A good side effect is to avoid the xdp_xmit pointer to be passed to > > the function. > > > So, I guess you mean this: > > switch (act) { > case XDP_PASS: > /* handle pass */ > return skb; > > case XDP_TX: > *xdp_xmit |= VIRTIO_XDP_...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...stats->xdp_tx++; > > > > xdpf = xdp_convert_buff_to_frame(xdp); > > > > if (unlikely(!xdpf)) > > > > return XDP_DROP; > > > > > > > > A good side effect is to avoid the xdp_xmit pointer to be passed to > > > > the function. > > > > > > > > > So, I guess you mean this: > > > > > > switch (act) { > > > case XDP_PASS: > > > /* handle pass */ > > >...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...e can simply map error to XDP_DROP like: > > case XDP_TX: > stats->xdp_tx++; > xdpf = xdp_convert_buff_to_frame(xdp); > if (unlikely(!xdpf)) > return XDP_DROP; > > A good side effect is to avoid the xdp_xmit pointer to be passed to > the function. So, I guess you mean this: switch (act) { case XDP_PASS: /* handle pass */ return skb; case XDP_TX: *xdp_xmit |= VIRTIO_XDP_TX; goto xmit; case XDP_REDIRECT: *xdp_xmit |= VIRTIO_XDP_REDIR; goto xmit; case XDP_DROP: default: goto e...
2017 Sep 19
0
[PATCH net-next 3/3] virtio-net: support XDP_REDIRECT
...h> #include <linux/cpu.h> #include <linux/average.h> +#include <linux/filter.h> #include <net/route.h> static int napi_weight = NAPI_POLL_WEIGHT; @@ -372,8 +373,20 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, return skb; } -static bool virtnet_xdp_xmit(struct virtnet_info *vi, - struct xdp_buff *xdp) +static void virtnet_xdp_flush(struct net_device *dev) +{ + struct virtnet_info *vi = netdev_priv(dev); + struct send_queue *sq; + unsigned int qp; + + qp = vi->curr_queue_pairs - vi->xdp_queue_pairs + smp_processor_id(); + sq = &vi-...
2023 Apr 03
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...on is extended. (And we've already had: VIRTIO_XDP_REDIR and VIRTIO_XDP_TX ...) > + > static void virtnet_rq_free_unused_buf(struct virtqueue *vq, void *buf); > static void virtnet_sq_free_unused_buf(struct virtqueue *vq, void *buf); > > @@ -789,6 +798,59 @@ static int virtnet_xdp_xmit(struct net_device *dev, > return ret; > } > > +static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp, > + struct net_device *dev, > + unsigned int *xdp_xmit, > +...
2017 Sep 19
6
[PATCH net-next 1/3] virtio-net: remove unnecessary parameter of virtnet_xdp_xmit()
...ed, 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 *page_to_skb(struct virtnet_info *vi, } static bool virtnet_xdp_xmit(struct virtnet_info *vi, - struct receive_queue *rq, struct xdp_buff *xdp) { struct virtio_net_hdr_mrg_rxbuf *hdr; @@ -542,7 +541,7 @@ static struct sk_buff *receive_small(struct net_device *dev, delta = orig_data - xdp.data; break; case XDP_TX: - if (unlikely(!virtn...
2017 Sep 19
6
[PATCH net-next 1/3] virtio-net: remove unnecessary parameter of virtnet_xdp_xmit()
...ed, 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 *page_to_skb(struct virtnet_info *vi, } static bool virtnet_xdp_xmit(struct virtnet_info *vi, - struct receive_queue *rq, struct xdp_buff *xdp) { struct virtio_net_hdr_mrg_rxbuf *hdr; @@ -542,7 +541,7 @@ static struct sk_buff *receive_small(struct net_device *dev, delta = orig_data - xdp.data; break; case XDP_TX: - if (unlikely(!virtn...
2017 Sep 20
1
[PATCH net-next 3/3] virtio-net: support XDP_REDIRECT
...ohn Fastabend <john.fastabend at gmail.com> > Signed-off-by: Jason Wang <jasowang at redhat.com> > --- [...] > @@ -678,12 +711,20 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, > } > break; > case XDP_TX: > - if (unlikely(!virtnet_xdp_xmit(vi, &xdp))) > + if (unlikely(!__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; > +...
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...
2017 Sep 20
1
[PATCH net-next 3/3] virtio-net: support XDP_REDIRECT
...ohn Fastabend <john.fastabend at gmail.com> > Signed-off-by: Jason Wang <jasowang at redhat.com> > --- [...] > @@ -678,12 +711,20 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, > } > break; > case XDP_TX: > - if (unlikely(!virtnet_xdp_xmit(vi, &xdp))) > + if (unlikely(!__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; > +...
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...
2023 Mar 28
8
[PATCH net-next 0/8] virtio_net: refactor xdp codes
Due to historical reasons, the implementation of XDP in virtio-net is relatively chaotic. For example, the processing of XDP actions has two copies of similar code. Such as page, xdp_page processing, etc. The purpose of this patch set is to refactor these code. Reduce the difficulty of subsequent maintenance. Subsequent developers will not introduce new bugs because of some complex logical
2023 Mar 22
9
[PATCH net-next 0/8] virtio_net: refactor xdp codes
Due to historical reasons, the implementation of XDP in virtio-net is relatively chaotic. For example, the processing of XDP actions has two copies of similar code. Such as page, xdp_page processing, etc. The purpose of this patch set is to refactor these code. Reduce the difficulty of subsequent maintenance. Subsequent developers will not introduce new bugs because of some complex logical
2023 Mar 15
10
[RFC net-next 0/8] virtio_net: refactor xdp codes
Due to historical reasons, the implementation of XDP in virtio-net is relatively chaotic. For example, the processing of XDP actions has two copies of similar code. Such as page, xdp_page processing, etc. The purpose of this patch set is to refactor these code. Reduce the difficulty of subsequent maintenance. Subsequent developers will not introduce new bugs because of some complex logical
2018 Jul 31
0
[PATCH net-next 2/2] virtio-net: get rid of unnecessary container of rq stats
...q_stats, m) static const struct virtnet_stat_desc virtnet_sq_stats_desc[] = { { "packets", VIRTNET_SQ_STAT(packets) }, @@ -617,7 +609,7 @@ static struct sk_buff *receive_small(struct net_device *dev, void *buf, void *ctx, unsigned int len, unsigned int *xdp_xmit, - struct virtnet_rx_stats *stats) + struct virtnet_rq_stats *stats) { struct sk_buff *skb; struct bpf_prog *xdp_prog; @@ -632,7 +624,7 @@ static struct sk_buff *receive_small(struct net_device *dev, int err; len -= vi->hdr_len; - stats->rx.bytes += len; + stats-&gt...
2023 Mar 28
1
[PATCH net-next 1/8] virtio_net: mergeable xdp: put old page immediately
...ev, if (unlikely(!head_skb)) goto err_xdp_frags; - if (unlikely(xdp_page != page)) - put_page(page); rcu_read_unlock(); return head_skb; case XDP_TX: @@ -1297,8 +1301,6 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, goto err_xdp_frags; } *xdp_xmit |= VIRTIO_XDP_TX; - if (unlikely(xdp_page != page)) - put_page(page); rcu_read_unlock(); goto xdp_xmit; case XDP_REDIRECT: @@ -1307,8 +1309,6 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, if (err) goto err_xdp_frags; *xdp_xmit |= VIRTIO_XDP_REDIR;...
2023 Mar 28
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
...rtio_net.c +++ b/drivers/net/virtio_net.c @@ -833,14 +833,14 @@ static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp, stats->xdp_tx++; xdpf = xdp_convert_buff_to_frame(xdp); if (unlikely(!xdpf)) - return VIRTNET_XDP_RES_DROP; + goto drop; err = virtnet_xdp_xmit(dev, 1, &xdpf, 0); if (unlikely(!err)) { xdp_return_frame_rx_napi(xdpf); } else 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_han...
2023 Mar 31
1
[PATCH net-next 1/8] virtio_net: mergeable xdp: put old page immediately
...unlock(); > return head_skb; > case XDP_TX: > @@ -1297,8 +1301,6 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, > goto err_xdp_frags; > } > *xdp_xmit |= VIRTIO_XDP_TX; > - if (unlikely(xdp_page != page)) > - put_page(page); > rcu_read_unlock(); > goto xdp_xmit; > case XDP_REDIRECT: > @@ -1307,8 +1309,6 @@ static s...
2023 Apr 03
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
...; @@ -833,14 +833,14 @@ static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp, > stats->xdp_tx++; > xdpf = xdp_convert_buff_to_frame(xdp); > if (unlikely(!xdpf)) > - return VIRTNET_XDP_RES_DROP; > + goto drop; > > err = virtnet_xdp_xmit(dev, 1, &xdpf, 0); > if (unlikely(!err)) { > xdp_return_frame_rx_napi(xdpf); > } else if (unlikely(err < 0)) { > trace_xdp_exception(dev, xdp_prog, act); > - return VIRTNET_XDP_RES_DROP; > + goto drop; > } > > *xdp_xmit |= VIRTIO_XD...
2018 Jul 31
8
[PATCH net-next 1/2] virtio-net: correctly update XDP_TX counters
...ats in virtnet_receive(). This will cause several issues: - virtnet_xdp_sq() was called without checking whether or not XDP is set. This may cause out of bound access when there's no enough txq for XDP. - Stats were updated even if there's no XDP/XDP_TX. Fixing this by reusing virtnet_xdp_xmit() for XDP_TX which can counts TX XDP counter itself and remove the unnecessary tx stats embedded in rx stats. Reported-by: syzbot+604f8271211546f5b3c7 at syzkaller.appspotmail.com Fixes: 5b8f3c8d30a6 ("virtio_net: Add XDP related stats") Cc: Toshiaki Makita <makita.toshiaki at lab.ntt...