search for: bpf_prog

Displaying 20 results from an estimated 86 matches for "bpf_prog".

2017 Feb 15
3
[PATCH net-next] virito-net: set queues after reset during xdp_set
...---------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 11e2853..9ff959c 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1775,7 +1775,7 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog) unsigned long int max_sz = PAGE_SIZE - sizeof(struct padded_vnet_hdr); struct virtnet_info *vi = netdev_priv(dev); struct bpf_prog *old_prog; - u16 oxdp_qp, xdp_qp = 0, curr_qp; + u16 xdp_qp = 0, curr_qp; int i, err; if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||...
2017 Feb 15
3
[PATCH net-next] virito-net: set queues after reset during xdp_set
...---------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 11e2853..9ff959c 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1775,7 +1775,7 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog) unsigned long int max_sz = PAGE_SIZE - sizeof(struct padded_vnet_hdr); struct virtnet_info *vi = netdev_priv(dev); struct bpf_prog *old_prog; - u16 oxdp_qp, xdp_qp = 0, curr_qp; + u16 xdp_qp = 0, curr_qp; int i, err; if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||...
2023 Mar 28
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
...++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a3f2bcb3db27..136131a7868a 100644 --- a/drivers/net/virtio_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 (unl...
2023 Apr 03
1
[PATCH net-next 6/8] virtio_net: auto release xdp shinfo
...changed, 17 insertions(+), 12 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index a3f2bcb3db27..136131a7868a 100644 > --- a/drivers/net/virtio_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)) { >...
2017 Jul 18
2
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...t_offloads) > + return 0; > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads |= 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > struct netlink_ext_ack *extack) > { > @@ -1898,10 +1947,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > u16 xdp_qp = 0, curr_qp; > int i, err; > > - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || > -...
2017 Jul 18
2
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...t_offloads) > + return 0; > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads |= 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > struct netlink_ext_ack *extack) > { > @@ -1898,10 +1947,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > u16 xdp_qp = 0, curr_qp; > int i, err; > > - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || > -...
2023 Mar 30
1
[PATCH net-next 7/8] virtio_net: introduce receive_mergeable_xdp()
...geable_xdp_prepare(struct virtnet_info *vi, > return page_address(xdp_page) + VIRTIO_XDP_HEADROOM; > } > > +static struct sk_buff *receive_mergeable_xdp(struct net_device *dev, > + struct virtnet_info *vi, > + struct receive_queue *rq, > + struct bpf_prog *xdp_prog, > + void *buf, > + void *ctx, > + unsigned int len, > + unsigned int *xdp_xmit, > + struct virtnet_rq_stats *stats) > +{ > + struct virtio_net_hdr_mrg_rxbuf *hdr = buf; > + int num_buf = virtio16_to_cpu(vi->vdev, hdr...
2016 Dec 23
1
[RFC PATCH] virtio_net: XDP support for adjust_head
Add support for XDP adjust head by allocating a 256B header region that XDP programs can grow into. This is only enabled when a XDP program is loaded. In order to ensure that we do not have to unwind queue headroom push queue setup below bpf_prog_add. It reads better to do a prog ref unwind vs another queue setup call. TBD merge with Jason Wang's fixes, do a bit more testing, note big_packet support is removed by Jason as well. Signed-off-by: John Fastabend <john.r.fastabend at intel.com> --- drivers/net/virtio_net.c | 53...
2016 Dec 23
1
[RFC PATCH] virtio_net: XDP support for adjust_head
Add support for XDP adjust head by allocating a 256B header region that XDP programs can grow into. This is only enabled when a XDP program is loaded. In order to ensure that we do not have to unwind queue headroom push queue setup below bpf_prog_add. It reads better to do a prog ref unwind vs another queue setup call. TBD merge with Jason Wang's fixes, do a bit more testing, note big_packet support is removed by Jason as well. Signed-off-by: John Fastabend <john.r.fastabend at intel.com> --- drivers/net/virtio_net.c | 53...
2017 Jul 24
1
[PATCH net-next V2 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...t_offloads) > + return 0; > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads |= 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > struct netlink_ext_ack *extack) > { > @@ -1905,10 +1954,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > u16 xdp_qp = 0, curr_qp; > int i, err; > > - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || > -...
2017 Jul 24
1
[PATCH net-next V2 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...t_offloads) > + return 0; > + if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_CSUM)) > + offloads |= 1ULL << VIRTIO_NET_F_GUEST_CSUM; > + > + return virtnet_set_guest_offloads(vi, offloads); > +} > + > static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > struct netlink_ext_ack *extack) > { > @@ -1905,10 +1954,11 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, > u16 xdp_qp = 0, curr_qp; > int i, err; > > - if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) || > -...
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
2018 Sep 06
1
[PATCH net-next 01/11] net: sock: introduce SOCK_XDP
...+ if (rtnl_dereference(tun->xdp_prog)) > + sock_set_flag(&tfile->sk, SOCK_XDP); > + > tun_set_real_num_queues(tun); > > /* device is allowed to go away first, so no need to hold extra > @@ -1241,13 +1244,29 @@ static int tun_xdp_set(struct net_device *dev, struct bpf_prog *prog, > struct netlink_ext_ack *extack) > { > struct tun_struct *tun = netdev_priv(dev); > + struct tun_file *tfile; > struct bpf_prog *old_prog; > + int i; > > old_prog = rtnl_dereference(tun->xdp_prog); > rcu_assign_pointer(tun->xdp_prog, pro...
2018 Feb 28
3
[PATCH net] virtio-net: disable NAPI only when enabled during XDP set
...| 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 9bb9e56..2d54123 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2185,8 +2185,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, } /* Make sure NAPI is not using any XDP TX queues for RX. */ - for (i = 0; i < vi->max_queue_pairs; i++) - napi_disable(&vi->rq[i].napi); + if (netif_running(dev)) + for (i = 0; i < vi->max_queue_pairs; i++) + napi_disable(&vi->rq[i].napi); netif_set_...
2018 Feb 28
3
[PATCH net] virtio-net: disable NAPI only when enabled during XDP set
...| 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 9bb9e56..2d54123 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2185,8 +2185,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, } /* Make sure NAPI is not using any XDP TX queues for RX. */ - for (i = 0; i < vi->max_queue_pairs; i++) - napi_disable(&vi->rq[i].napi); + if (netif_running(dev)) + for (i = 0; i < vi->max_queue_pairs; i++) + napi_disable(&vi->rq[i].napi); netif_set_...
2017 Feb 17
0
[PATCH net-next] virito-net: set queues after reset during xdp_set
...insertions(+), 17 deletions(-) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 11e2853..9ff959c 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -1775,7 +1775,7 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog) > unsigned long int max_sz = PAGE_SIZE - sizeof(struct padded_vnet_hdr); > struct virtnet_info *vi = netdev_priv(dev); > struct bpf_prog *old_prog; > - u16 oxdp_qp, xdp_qp = 0, curr_qp; > + u16 xdp_qp = 0, curr_qp; > int i, err; > > if (virtio_has_feature(...
2017 Mar 29
2
[PATCH] virtio_net: fix mergeable bufs error handling
...7 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -570,7 +570,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, u16 num_buf; struct page *page; int offset; - struct sk_buff *head_skb, *curr_skb; + struct sk_buff *head_skb = NULL, *curr_skb; struct bpf_prog *xdp_prog; unsigned int truesize; -- MST
2017 Mar 29
2
[PATCH] virtio_net: fix mergeable bufs error handling
...7 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -570,7 +570,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, u16 num_buf; struct page *page; int offset; - struct sk_buff *head_skb, *curr_skb; + struct sk_buff *head_skb = NULL, *curr_skb; struct bpf_prog *xdp_prog; unsigned int truesize; -- MST
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