Message ID | 1705659755-39828-1-git-send-email-wangyunjian@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 5744ba05e7c4bff8fec133dd0f9e51ddffba92f5 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | fixes for tun | expand |
Yunjian Wang wrote: > The commit 8ae1aff0b331 ("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: 8ae1aff0b331 ("tuntap: split out XDP logic") > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Reviewed-by: Willem de Bruijn <willemb@google.com>
On Fri, Jan 19, 2024 at 6:22 PM Yunjian Wang <wangyunjian@huawei.com> wrote: > > The commit 8ae1aff0b331 ("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: 8ae1aff0b331 ("tuntap: split out XDP logic") > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> Acked-by: Jason Wang <jasowang@redhat.com> Thanks
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index afa5497f7c35..237fef557ba5 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -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;
The commit 8ae1aff0b331 ("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: 8ae1aff0b331 ("tuntap: split out XDP logic") Signed-off-by: Yunjian Wang <wangyunjian@huawei.com> --- drivers/net/tun.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)