Displaying 15 results from an estimated 15 matches for "virtnet_xdp_handler".
2023 Apr 03
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
? 2023/3/28 20:04, Xuan Zhuo ??:
> virtnet_build_xdp_buff_mrg() and virtnet_xdp_handler() auto
I think you meant virtnet_xdp_handler() actually?
> release xdp shinfo then the caller no need to careful the xdp shinfo.
>
> Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com>
> ---
> drivers/net/virtio_net.c | 29 +++++++++++++++++------------
> 1 file...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...> > >
> > > > XDP_DROP and error conditions go with this.
> > > >
> > > > > * CUNSUMED: xdp prog used the buffer, we do nothing
> > > >
> > > > XDP_TX/XDP_REDIRECTION goes for this.
> > > >
> > > > So t virtnet_xdp_handler() just maps XDP ACTION plus the error
> > > > conditions to the above three states.
> > > >
> > > > We can simply map error to XDP_DROP like:
> > > >
> > > > case XDP_TX:
> > > > stats->xdp_tx++;
> &g...
2023 Mar 28
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
virtnet_build_xdp_buff_mrg() and virtnet_xdp_handler() auto
release xdp shinfo then the caller no need to careful the xdp shinfo.
Signed-off-by: Xuan Zhuo <xuanzhuo at linux.alibaba.com>
---
drivers/net/virtio_net.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/drivers/net/virtio_net.c b/d...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...SS goes for this.
> >
> > > * DROP: we should release buffer
> >
> > XDP_DROP and error conditions go with this.
> >
> > > * CUNSUMED: xdp prog used the buffer, we do nothing
> >
> > XDP_TX/XDP_REDIRECTION goes for this.
> >
> > So t virtnet_xdp_handler() just maps XDP ACTION plus the error
> > conditions to the above three states.
> >
> > We can simply map error to XDP_DROP like:
> >
> > case XDP_TX:
> > stats->xdp_tx++;
> > xdpf = xdp_convert_buff_to_frame(xdp);
>...
2023 Apr 04
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...;
> > * PASS: goto make skb
>
> XDP_PASS goes for this.
>
> > * DROP: we should release buffer
>
> XDP_DROP and error conditions go with this.
>
> > * CUNSUMED: xdp prog used the buffer, we do nothing
>
> XDP_TX/XDP_REDIRECTION goes for this.
>
> So t virtnet_xdp_handler() just maps XDP ACTION plus the error
> conditions to the above three states.
>
> We can simply map error to XDP_DROP like:
>
> case XDP_TX:
> stats->xdp_tx++;
> xdpf = xdp_convert_buff_to_frame(xdp);
> if (unlikely(!xdpf...
2023 Apr 03
1
[PATCH net-next 3/8] virtio_net: introduce virtnet_xdp_handler() to seprate the logic of run xdp
...; +
> 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,
> + struct virtnet_rq_stats *stats)
> +{
> + struct xdp_frame *xdpf;
> + int...
2023 Mar 15
10
[RFC net-next 0/8] virtio_net: refactor xdp codes
...So this patch set is a RFC.
Please review.
Thanks.
[1]. https://lore.kernel.org/netdev/20230315015223.89137-1-xuanzhuo at linux.alibaba.com/
Xuan Zhuo (8):
virtio_net: mergeable xdp: put old page immediately
virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
virtio_net: introduce virtnet_xdp_handler() to seprate the logic of
run xdp
virtio_net: separate the logic of freeing xdp shinfo
virtio_net: separate the logic of freeing the rest mergeable buf
virtio_net: auto release xdp shinfo
virtio_net: introduce receive_mergeable_xdp()
virtio_net: introduce receive_small_xdp()
drivers...
2023 Mar 22
9
[PATCH net-next 0/8] virtio_net: refactor xdp codes
...ssing of actions, I don't want to
introduce a new similar code. In this way, I can reuse these codes in the
future.
Please review.
Thanks.
Xuan Zhuo (8):
virtio_net: mergeable xdp: put old page immediately
virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
virtio_net: introduce virtnet_xdp_handler() to seprate the logic of
run xdp
virtio_net: separate the logic of freeing xdp shinfo
virtio_net: separate the logic of freeing the rest mergeable buf
virtio_net: auto release xdp shinfo
virtio_net: introduce receive_mergeable_xdp()
virtio_net: introduce receive_small_xdp()
drivers...
2023 Mar 28
8
[PATCH net-next 0/8] virtio_net: refactor xdp codes
...new similar code. In this way, I can reuse these codes in the
future.
Please review.
Thanks.
v1:
1. fix some variables are uninitialized
Xuan Zhuo (8):
virtio_net: mergeable xdp: put old page immediately
virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
virtio_net: introduce virtnet_xdp_handler() to seprate the logic of
run xdp
virtio_net: separate the logic of freeing xdp shinfo
virtio_net: separate the logic of freeing the rest mergeable buf
virtio_net: auto release xdp shinfo
virtio_net: introduce receive_mergeable_xdp()
virtio_net: introduce receive_small_xdp()
drivers...
2023 Mar 30
1
[PATCH net-next 7/8] virtio_net: introduce receive_mergeable_xdp()
...age,
> + offset, &len, hdr);
> + if (!data)
> + goto err_xdp;
> +
> + err = virtnet_build_xdp_buff_mrg(dev, vi, rq, &xdp, data, len, frame_sz,
> + &num_buf, &xdp_frags_truesz, stats);
> + if (unlikely(err))
> + goto err_xdp;
> +
> + act = virtnet_xdp_handler(xdp_prog, &xdp, dev, xdp_xmit, stats);
> +
> + switch (act) {
> + case VIRTNET_XDP_RES_PASS:
> + head_skb = build_skb_from_xdp_buff(dev, vi, &xdp, xdp_frags_truesz);
> + if (unlikely(!head_skb))
> + goto err_xdp;
> + return head_skb;
> +
> + case VIRTNET_XDP_...
2023 Mar 28
1
[PATCH net-next 4/8] virtio_net: separate the logic of freeing xdp shinfo
...t skb_shared_info *shinfo;
+ struct page *xdp_page;
+ int i;
+
+ if (xdp_buff_has_frags(xdp)) {
+ shinfo = xdp_get_shared_info_from_buff(xdp);
+ for (i = 0; i < shinfo->nr_frags; i++) {
+ xdp_page = skb_frag_page(&shinfo->frags[i]);
+ put_page(xdp_page);
+ }
+ }
+}
+
static int virtnet_xdp_handler(struct bpf_prog *xdp_prog, struct xdp_buff *xdp,
struct net_device *dev,
unsigned int *xdp_xmit,
@@ -1312,12 +1327,9 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
xdp_prog = rcu_dereference(rq->xdp_prog);
if (xdp_prog) {
unsigned int xdp_frags_t...
2023 Mar 22
1
[PATCH net-next 0/8] virtio_net: refactor xdp codes
...se to merge this one through the virtio tree?
Then you will have all the pieces in one place and try to target
next linux.
> Xuan Zhuo (8):
> virtio_net: mergeable xdp: put old page immediately
> virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
> virtio_net: introduce virtnet_xdp_handler() to seprate the logic of
> run xdp
> virtio_net: separate the logic of freeing xdp shinfo
> virtio_net: separate the logic of freeing the rest mergeable buf
> virtio_net: auto release xdp shinfo
> virtio_net: introduce receive_mergeable_xdp()
> virtio_net: introduce...
2023 Mar 22
1
[PATCH net-next 0/8] virtio_net: refactor xdp codes
...l the pieces in one place and try to target
> > next linux.
> >
> >
> > > Xuan Zhuo (8):
> > > virtio_net: mergeable xdp: put old page immediately
> > > virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
> > > virtio_net: introduce virtnet_xdp_handler() to seprate the logic of
> > > run xdp
> > > virtio_net: separate the logic of freeing xdp shinfo
> > > virtio_net: separate the logic of freeing the rest mergeable buf
> > > virtio_net: auto release xdp shinfo
> > > virtio_net: introduce re...
2023 Mar 21
1
[RFC net-next 0/8] virtio_net: refactor xdp codes
...https://lore.kernel.org/netdev/20230315015223.89137-1-xuanzhuo at linux.alibaba.com/
> >
> >
> > Xuan Zhuo (8):
> > virtio_net: mergeable xdp: put old page immediately
> > virtio_net: mergeable xdp: introduce mergeable_xdp_prepare
> > virtio_net: introduce virtnet_xdp_handler() to seprate the logic of
> > run xdp
> > virtio_net: separate the logic of freeing xdp shinfo
> > virtio_net: separate the logic of freeing the rest mergeable buf
> > virtio_net: auto release xdp shinfo
> > virtio_net: introduce receive_mergeable_xdp()
>...
2023 Mar 22
1
[PATCH net-next 7/8] virtio_net: introduce receive_mergeable_xdp()
...xdp_prog, ctx, &frame_sz, &num_buf, &page,
+ offset, &len, hdr);
+ if (!data)
+ goto err_xdp;
+
+ err = virtnet_build_xdp_buff_mrg(dev, vi, rq, &xdp, data, len, frame_sz,
+ &num_buf, &xdp_frags_truesz, stats);
+ if (unlikely(err))
+ goto err_xdp;
+
+ act = virtnet_xdp_handler(xdp_prog, &xdp, dev, xdp_xmit, stats);
+
+ switch (act) {
+ case VIRTNET_XDP_RES_PASS:
+ head_skb = build_skb_from_xdp_buff(dev, vi, &xdp, xdp_frags_truesz);
+ if (unlikely(!head_skb))
+ goto err_xdp;
+ return head_skb;
+
+ case VIRTNET_XDP_RES_CONSUMED:
+ return NULL;
+
+ case VIRTNE...