Commit 5744ba05 authored by Yunjian Wang's avatar Yunjian Wang Committed by David S. Miller

tun: fix missing dropped counter in tun_xdp_act

The commit 8ae1aff0 ("tuntap: split out XDP logic") includes
dropped counter for XDP_DROP, XDP_ABORTED, and invalid XDP actions.
Unfortunately, that commit missed the dropped counter when error
occurs during XDP_TX and XDP_REDIRECT actions. This patch fixes
this issue.

Fixes: 8ae1aff0 ("tuntap: split out XDP logic")
Signed-off-by: default avatarYunjian Wang <wangyunjian@huawei.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d09486a0
......@@ -1630,13 +1630,17 @@ 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);
if (err)
if (err) {
dev_core_stats_rx_dropped_inc(tun->dev);
return err;
}
break;
case XDP_TX:
err = tun_xdp_tx(tun->dev, xdp);
if (err < 0)
if (err < 0) {
dev_core_stats_rx_dropped_inc(tun->dev);
return err;
}
break;
case XDP_PASS:
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment