summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2018-09-12 11:17:05 +0800
committerDavid S. Miller <davem@davemloft.net>2018-09-13 09:25:40 -0700
commit1a097910adda6b3328fc235575bba0e9ee408492 (patch)
tree84e788fa7cb7552910719b2d0bab3b89ab903646 /drivers
parent8ae1aff0b331ab154c39910f2e0ed239bf942d56 (diff)
tuntap: move XDP flushing out of tun_do_xdp()
This will allow adding batch flushing on top. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/tun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 14fe94098180..3ae539374f6b 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1660,7 +1660,6 @@ static int tun_xdp_act(struct tun_struct *tun, struct bpf_prog *xdp_prog,
switch (act) {
case XDP_REDIRECT:
err = xdp_do_redirect(tun->dev, xdp, xdp_prog);
- xdp_do_flush_map();
if (err)
return err;
break;
@@ -1749,6 +1748,8 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
err = tun_xdp_act(tun, xdp_prog, &xdp, act);
if (err < 0)
goto err_xdp;
+ if (err == XDP_REDIRECT)
+ xdp_do_flush_map();
if (err != XDP_PASS)
goto out;