* [PATCH net 1/2] tun: fix missing dropped counter in tun_xdp_act
@ 2024-01-19 10:22 Yunjian Wang
2024-01-19 15:22 ` Willem de Bruijn
2024-01-22 3:40 ` Jason Wang
0 siblings, 2 replies; 3+ messages in thread
From: Yunjian Wang @ 2024-01-19 10:22 UTC (permalink / raw)
To: willemdebruijn.kernel, jasowang, kuba, davem
Cc: netdev, linux-kernel, xudingke, Yunjian Wang
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(-)
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;
--
2.41.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net 1/2] tun: fix missing dropped counter in tun_xdp_act
2024-01-19 10:22 [PATCH net 1/2] tun: fix missing dropped counter in tun_xdp_act Yunjian Wang
@ 2024-01-19 15:22 ` Willem de Bruijn
2024-01-22 3:40 ` Jason Wang
1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2024-01-19 15:22 UTC (permalink / raw)
To: Yunjian Wang, willemdebruijn.kernel, jasowang, kuba, davem
Cc: netdev, linux-kernel, xudingke, Yunjian Wang
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net 1/2] tun: fix missing dropped counter in tun_xdp_act
2024-01-19 10:22 [PATCH net 1/2] tun: fix missing dropped counter in tun_xdp_act Yunjian Wang
2024-01-19 15:22 ` Willem de Bruijn
@ 2024-01-22 3:40 ` Jason Wang
1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2024-01-22 3:40 UTC (permalink / raw)
To: Yunjian Wang
Cc: willemdebruijn.kernel, kuba, davem, netdev, linux-kernel, xudingke
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-22 3:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 10:22 [PATCH net 1/2] tun: fix missing dropped counter in tun_xdp_act Yunjian Wang
2024-01-19 15:22 ` Willem de Bruijn
2024-01-22 3:40 ` Jason Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®