search for: bpf_prog_put

Displaying 20 results from an estimated 21 matches for "bpf_prog_put".

2018 Sep 06
1
[PATCH net-next 01/11] net: sock: introduce SOCK_XDP
...link_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, prog); > if (old_prog) > bpf_prog_put(old_prog); > > + for (i = 0; i < tun->numqueues; i++) { > + tfile = rtnl_dereference(tun->tfiles[i]); > + if (prog) > + sock_set_flag(&tfile->sk, SOCK_XDP); > + else > + sock_reset_flag(&tfile->sk, SOCK_XDP); > + } > + list_for_each_entry(t...
2018 Feb 28
3
[PATCH net] virtio-net: disable NAPI only when enabled during XDP set
...i->max_queue_pairs; i++) + napi_disable(&vi->rq[i].napi); netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); err = _virtnet_set_queues(vi, curr_qp + xdp_qp); @@ -2205,7 +2206,8 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, } if (old_prog) bpf_prog_put(old_prog); - virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); + if (netif_running(dev)) + virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); } return 0; -- 2.7.4
2018 Feb 28
3
[PATCH net] virtio-net: disable NAPI only when enabled during XDP set
...i->max_queue_pairs; i++) + napi_disable(&vi->rq[i].napi); netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); err = _virtnet_set_queues(vi, curr_qp + xdp_qp); @@ -2205,7 +2206,8 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog, } if (old_prog) bpf_prog_put(old_prog); - virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); + if (netif_running(dev)) + virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); } return 0; -- 2.7.4
2017 Jul 18
2
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...og = rtnl_dereference(vi->rq[i].xdp_prog); > rcu_assign_pointer(vi->rq[i].xdp_prog, prog); > + if (i == 0) { > + if (!old_prog) > + virtnet_clear_guest_offloads(vi); > + if (!prog) > + virtnet_restore_guest_offloads(vi); > + } > if (old_prog) > bpf_prog_put(old_prog); > napi_enable(&vi->rq[i].napi); > @@ -2583,6 +2639,10 @@ static int virtnet_probe(struct virtio_device *vdev) > netif_carrier_on(dev); > } > > + for (i = 0; i < ARRAY_SIZE(guest_offloads); i++) > + if (virtio_has_feature(vi->vdev, guest_offloa...
2017 Jul 18
2
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...og = rtnl_dereference(vi->rq[i].xdp_prog); > rcu_assign_pointer(vi->rq[i].xdp_prog, prog); > + if (i == 0) { > + if (!old_prog) > + virtnet_clear_guest_offloads(vi); > + if (!prog) > + virtnet_restore_guest_offloads(vi); > + } > if (old_prog) > bpf_prog_put(old_prog); > napi_enable(&vi->rq[i].napi); > @@ -2583,6 +2639,10 @@ static int virtnet_probe(struct virtio_device *vdev) > netif_carrier_on(dev); > } > > + for (i = 0; i < ARRAY_SIZE(guest_offloads); i++) > + if (virtio_has_feature(vi->vdev, guest_offloa...
2017 Jul 24
1
[PATCH net-next V2 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...og = rtnl_dereference(vi->rq[i].xdp_prog); > rcu_assign_pointer(vi->rq[i].xdp_prog, prog); > + if (i == 0) { > + if (!old_prog) > + virtnet_clear_guest_offloads(vi); > + if (!prog) > + virtnet_restore_guest_offloads(vi); > + } > if (old_prog) > bpf_prog_put(old_prog); > virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); > @@ -2588,6 +2644,10 @@ static int virtnet_probe(struct virtio_device *vdev) > netif_carrier_on(dev); > } > > + for (i = 0; i < ARRAY_SIZE(guest_offloads); i++) > + if (virtio_has_feature(...
2017 Jul 24
1
[PATCH net-next V2 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...og = rtnl_dereference(vi->rq[i].xdp_prog); > rcu_assign_pointer(vi->rq[i].xdp_prog, prog); > + if (i == 0) { > + if (!old_prog) > + virtnet_clear_guest_offloads(vi); > + if (!prog) > + virtnet_restore_guest_offloads(vi); > + } > if (old_prog) > bpf_prog_put(old_prog); > virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); > @@ -2588,6 +2644,10 @@ static int virtnet_probe(struct virtio_device *vdev) > netif_carrier_on(dev); > } > > + for (i = 0; i < ARRAY_SIZE(guest_offloads); i++) > + if (virtio_has_feature(...
2018 Sep 06
0
[PATCH net-next 01/11] net: sock: introduce SOCK_XDP
...*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, prog); if (old_prog) bpf_prog_put(old_prog); + for (i = 0; i < tun->numqueues; i++) { + tfile = rtnl_dereference(tun->tfiles[i]); + if (prog) + sock_set_flag(&tfile->sk, SOCK_XDP); + else + sock_reset_flag(&tfile->sk, SOCK_XDP); + } + list_for_each_entry(tfile, &tun->disabled, next) { + if (p...
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
2017 Jul 17
0
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...< vi->max_queue_pairs; i++) { old_prog = rtnl_dereference(vi->rq[i].xdp_prog); rcu_assign_pointer(vi->rq[i].xdp_prog, prog); + if (i == 0) { + if (!old_prog) + virtnet_clear_guest_offloads(vi); + if (!prog) + virtnet_restore_guest_offloads(vi); + } if (old_prog) bpf_prog_put(old_prog); napi_enable(&vi->rq[i].napi); @@ -2583,6 +2639,10 @@ static int virtnet_probe(struct virtio_device *vdev) netif_carrier_on(dev); } + for (i = 0; i < ARRAY_SIZE(guest_offloads); i++) + if (virtio_has_feature(vi->vdev, guest_offloads[i])) + set_bit(guest_offloads[...
2017 Jul 19
0
[PATCH net-next V2 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...< vi->max_queue_pairs; i++) { old_prog = rtnl_dereference(vi->rq[i].xdp_prog); rcu_assign_pointer(vi->rq[i].xdp_prog, prog); + if (i == 0) { + if (!old_prog) + virtnet_clear_guest_offloads(vi); + if (!prog) + virtnet_restore_guest_offloads(vi); + } if (old_prog) bpf_prog_put(old_prog); virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); @@ -2588,6 +2644,10 @@ static int virtnet_probe(struct virtio_device *vdev) netif_carrier_on(dev); } + for (i = 0; i < ARRAY_SIZE(guest_offloads); i++) + if (virtio_has_feature(vi->vdev, guest_offloads[i])) +...
2017 Jul 19
0
[PATCH net-next 5/5] virtio-net: switch off offloads on demand if possible on XDP set
...prog); >> rcu_assign_pointer(vi->rq[i].xdp_prog, prog); >> + if (i == 0) { >> + if (!old_prog) >> + virtnet_clear_guest_offloads(vi); >> + if (!prog) >> + virtnet_restore_guest_offloads(vi); >> + } >> if (old_prog) >> bpf_prog_put(old_prog); >> napi_enable(&vi->rq[i].napi); >> @@ -2583,6 +2639,10 @@ static int virtnet_probe(struct virtio_device *vdev) >> netif_carrier_on(dev); >> } >> >> + for (i = 0; i < ARRAY_SIZE(guest_offloads); i++) >> + if (virtio_has_f...
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
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
2017 Jul 18
1
[PATCH net-next 4/5] virtio-net: do not reset during XDP set
...qp + xdp_qp); > + if (err) > + goto err; > + vi->xdp_queue_pairs = xdp_qp; > > for (i = 0; i < vi->max_queue_pairs; i++) { > old_prog = rtnl_dereference(vi->rq[i].xdp_prog); > rcu_assign_pointer(vi->rq[i].xdp_prog, prog); > if (old_prog) > bpf_prog_put(old_prog); > + napi_enable(&vi->rq[i].napi); This seems racy. See comment around virtnet_napi_enable. > } > > return 0; > > -virtio_reset_err: > - /* On reset error do our best to unwind XDP changes inflight and return > - * error up to user space for reso...
2017 Jul 18
1
[PATCH net-next 4/5] virtio-net: do not reset during XDP set
...qp + xdp_qp); > + if (err) > + goto err; > + vi->xdp_queue_pairs = xdp_qp; > > for (i = 0; i < vi->max_queue_pairs; i++) { > old_prog = rtnl_dereference(vi->rq[i].xdp_prog); > rcu_assign_pointer(vi->rq[i].xdp_prog, prog); > if (old_prog) > bpf_prog_put(old_prog); > + napi_enable(&vi->rq[i].napi); This seems racy. See comment around virtnet_napi_enable. > } > > return 0; > > -virtio_reset_err: > - /* On reset error do our best to unwind XDP changes inflight and return > - * error up to user space for reso...
2017 Jul 17
0
[PATCH net-next 4/5] virtio-net: do not reset during XDP set
...dp_qp); + err = _virtnet_set_queues(vi, curr_qp + xdp_qp); + if (err) + goto err; + vi->xdp_queue_pairs = xdp_qp; for (i = 0; i < vi->max_queue_pairs; i++) { old_prog = rtnl_dereference(vi->rq[i].xdp_prog); rcu_assign_pointer(vi->rq[i].xdp_prog, prog); if (old_prog) bpf_prog_put(old_prog); + napi_enable(&vi->rq[i].napi); } return 0; -virtio_reset_err: - /* On reset error do our best to unwind XDP changes inflight and return - * error up to user space for resolution. The underlying reset hung on - * us so not much we can do here. - */ +err: + for (i = 0;...
2018 Sep 06
22
[PATCH net-next 00/11] Vhost_net TX batching
Hi all: This series tries to batch submitting packets to underlayer socket through msg_control during sendmsg(). This is done by: 1) Doing userspace copy inside vhost_net 2) Build XDP buff 3) Batch at most 64 (VHOST_NET_BATCH) XDP buffs and submit them once through msg_control during sendmsg(). 4) Underlayer sockets can use XDP buffs directly when XDP is enalbed, or build skb based on XDP
2018 Sep 12
14
[PATCH net-next V2 00/11] vhost_net TX batching
Hi all: This series tries to batch submitting packets to underlayer socket through msg_control during sendmsg(). This is done by: 1) Doing userspace copy inside vhost_net 2) Build XDP buff 3) Batch at most 64 (VHOST_NET_BATCH) XDP buffs and submit them once through msg_control during sendmsg(). 4) Underlayer sockets can use XDP buffs directly when XDP is enalbed, or build skb based on XDP