search for: xdp_do_flush_map

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

2018 Sep 06
1
[PATCH net-next 07/11] tuntap: move XDP flushing out of tun_do_xdp()
...t/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_xdp; > + > + if (act == XDP_REDIRECT) > +...
2018 Apr 13
1
[PATCH net] virtio-net: add missing virtqueue kick when flushing packets
We tends to batch submitting packets during XDP_TX. This requires to kick virtqueue after a batch, we tried to do it through xdp_do_flush_map() which only makes sense for devmap not XDP_TX. So explicitly kick the virtqueue in this case. Reported-by: Kimitoshi Takahashi <ktaka at nii.ac.jp> Tested-by: Kimitoshi Takahashi <ktaka at nii.ac.jp> Cc: Daniel Borkmann <daniel at iogearbox.net> Fixes: 186b3c998c50 ("virtio...
2018 Sep 06
2
[PATCH net-next 06/11] tuntap: split out XDP logic
...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 need goto? why not just return? > + default: > +...
2018 Sep 06
2
[PATCH net-next 06/11] tuntap: split out XDP logic
...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 need goto? why not just return? > + default: > +...
2018 Sep 06
0
[PATCH net-next 07/11] tuntap: move XDP flushing out of tun_do_xdp()
...f --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_xdp; + + if (act == XDP_REDIRECT) + xdp_do_flush_map(); if (act != XDP_PASS) g...
2018 Sep 06
0
[PATCH net-next 06/11] tuntap: split out XDP logic
...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 */ + case XDP_ABORTED: + trace_xdp_exception(tun-...
2018 Sep 07
0
[PATCH net-next 06/11] tuntap: split out XDP logic
...ct 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 need go...
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 May 21
0
[RFC PATCH net-next 12/12] vhost_net: batch submitting XDP buffers to underlayer sockets
...ns(-) diff --git a/drivers/net/tun.c b/drivers/net/tun.c index b586b3f..5d16d18 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1616,7 +1616,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; @@ -1624,7 +1623,6 @@ static u32 tun_do_xdp(struct tun_struct *tun, *err = tun_xdp_tx(tun->dev, xdp); if (*err) break; - tun_xdp_flush(tun->dev); goto out; case XDP_PASS: goto out; @@ -2400,9 +2398,6 @@ static int tun_xdp_one(struct t...
2018 Sep 06
2
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...; @@ -1695,23 +1698,15 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, > > switch (act) { > case XDP_REDIRECT: > - get_page(alloc_frag->page); > - alloc_frag->offset += buflen; > err = xdp_do_redirect(tun->dev, &xdp, xdp_prog); > xdp_do_flush_map(); > if (err) > - goto err_redirect; > - rcu_read_unlock(); > - local_bh_enable(); > - return NULL; > + goto err_xdp; > + goto out; > case XDP_TX: > - get_page(alloc_frag->page); > - alloc_frag->offset += buflen; > if (tun_xdp_tx(t...
2018 Sep 06
2
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...; @@ -1695,23 +1698,15 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, > > switch (act) { > case XDP_REDIRECT: > - get_page(alloc_frag->page); > - alloc_frag->offset += buflen; > err = xdp_do_redirect(tun->dev, &xdp, xdp_prog); > xdp_do_flush_map(); > if (err) > - goto err_redirect; > - rcu_read_unlock(); > - local_bh_enable(); > - return NULL; > + goto err_xdp; > + goto out; > case XDP_TX: > - get_page(alloc_frag->page); > - alloc_frag->offset += buflen; > if (tun_xdp_tx(t...
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
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
2018 May 21
20
[RFC PATCH net-next 00/12] XDP batching for TUN/vhost_net
Hi all: We do not support XDP batching for TUN since it can only receive one packet a time from vhost_net. This series tries to remove this limitation by: - introduce a TUN specific msg_control that can hold a pointer to an array of XDP buffs - try copy and build XDP buff in vhost_net - store XDP buffs in an array and submit them once for every N packets from vhost_net - since TUN can only
2018 Sep 06
0
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...in case the headroom is not enough. @@ -1695,23 +1698,15 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, switch (act) { case XDP_REDIRECT: - get_page(alloc_frag->page); - alloc_frag->offset += buflen; err = xdp_do_redirect(tun->dev, &xdp, xdp_prog); xdp_do_flush_map(); if (err) - goto err_redirect; - rcu_read_unlock(); - local_bh_enable(); - return NULL; + goto err_xdp; + goto out; case XDP_TX: - get_page(alloc_frag->page); - alloc_frag->offset += buflen; if (tun_xdp_tx(tun->dev, &xdp) < 0) - goto err_redirect; -...
2018 Sep 07
0
[PATCH net-next 04/11] tuntap: simplify error handling in tun_build_skb()
...struct sk_buff *tun_build_skb(struct tun_struct *tun, >> >> switch (act) { >> case XDP_REDIRECT: >> - get_page(alloc_frag->page); >> - alloc_frag->offset += buflen; >> err = xdp_do_redirect(tun->dev, &xdp, xdp_prog); >> xdp_do_flush_map(); >> if (err) >> - goto err_redirect; >> - rcu_read_unlock(); >> - local_bh_enable(); >> - return NULL; >> + goto err_xdp; >> + goto out; >> case XDP_TX: >> - get_page(alloc_frag->page); >> - alloc_frag->o...
2018 Sep 06
0
[PATCH net-next 09/11] tuntap: accept an array of XDP buffs through sendmsg()
...ctl->type & 0xF) == TUN_MSG_PTR)) { + int n = ctl->type >> 16; + int flush = 0; + + local_bh_disable(); + rcu_read_lock(); + + for (i = 0; i < n; i++) { + xdp = &((struct xdp_buff *)ctl->ptr)[i]; + tun_xdp_one(tun, tfile, xdp, &flush); + } + + if (flush) + xdp_do_flush_map(); + + rcu_read_unlock(); + local_bh_enable(); + + ret = total_len; + goto out; + } ret = tun_get_user(tun, tfile, ctl ? ctl->ptr : NULL, &m->msg_iter, m->msg_flags & MSG_DONTWAIT, m->msg_flags & MSG_MORE); +out: tun_put(tun); return ret; } -- 2.1...
2018 Sep 06
1
[PATCH net-next 09/11] tuntap: accept an array of XDP buffs through sendmsg()
...t;type >> 16; > + int flush = 0; > + > + local_bh_disable(); > + rcu_read_lock(); > + > + for (i = 0; i < n; i++) { > + xdp = &((struct xdp_buff *)ctl->ptr)[i]; > + tun_xdp_one(tun, tfile, xdp, &flush); > + } > + > + if (flush) > + xdp_do_flush_map(); > + > + rcu_read_unlock(); > + local_bh_enable(); > + > + ret = total_len; > + goto out; > + } > > ret = tun_get_user(tun, tfile, ctl ? ctl->ptr : NULL, &m->msg_iter, > m->msg_flags & MSG_DONTWAIT, > m->msg_flags & MS...
2017 Sep 19
0
[PATCH net-next 3/3] virtio-net: support XDP_REDIRECT
...int received; + bool xdp_xmit = false; virtnet_poll_cleantx(rq); - received = virtnet_receive(rq, budget); + received = virtnet_receive(rq, budget, &xdp_xmit); /* Out of packets? */ if (received < budget) virtqueue_napi_complete(napi, rq->vq, received); + if (xdp_xmit) + xdp_do_flush_map(); + return received; } @@ -2069,6 +2114,8 @@ static const struct net_device_ops virtnet_netdev = { .ndo_poll_controller = virtnet_netpoll, #endif .ndo_xdp = virtnet_xdp, + .ndo_xdp_xmit = virtnet_xdp_xmit, + .ndo_xdp_flush = virtnet_xdp_flush, .ndo_features_check = passthru_features...
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