diff mbox series

[net-next] net: count drops due to missing qdisc as dev->tx_drops

Message ID 20240529162527.3688979-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit 4fdb6b6063f07d959a1c52a2ee580afc4da34e2d
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: count drops due to missing qdisc as dev->tx_drops | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 910 this patch: 910
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 906 this patch: 906
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 914 this patch: 914
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-30--06-00 (tests: 1042)

Commit Message

Jakub Kicinski May 29, 2024, 4:25 p.m. UTC
Catching and debugging missing qdiscs is pretty tricky. When qdisc
is deleted we replace it with a noop qdisc, which silently drops
all the packets. Since the noop qdisc has a single static instance
we can't count drops at the qdisc level. Count them as dev->tx_drops.

  ip netns add red
  ip link add type veth peer netns red
  ip            link set dev veth0 up
  ip -netns red link set dev veth0 up
  ip            a a dev veth0 10.0.0.1/24
  ip -netns red a a dev veth0 10.0.0.2/24
  ping -c 2 10.0.0.2
  #  2 packets transmitted, 2 received, 0% packet loss, time 1031ms
  ip -s link show dev veth0
  #  TX:  bytes packets errors dropped carrier collsns
  #        1314      17      0       0       0       0

  tc qdisc replace dev veth0 root handle 1234: mq
  tc qdisc replace dev veth0 parent 1234:1 pfifo
  tc qdisc del dev veth0 parent 1234:1
  ping -c 2 10.0.0.2
  #  2 packets transmitted, 0 received, 100% packet loss, time 1034ms
  ip -s link show dev veth0
  #  TX:  bytes packets errors dropped carrier collsns
  #        1314      17      0       3       0       0

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: jhs@mojatatu.com
CC: xiyou.wangcong@gmail.com
CC: jiri@resnulli.us
---
 net/sched/sch_generic.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+netdevbpf@kernel.org June 4, 2024, 9 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 29 May 2024 09:25:27 -0700 you wrote:
> Catching and debugging missing qdiscs is pretty tricky. When qdisc
> is deleted we replace it with a noop qdisc, which silently drops
> all the packets. Since the noop qdisc has a single static instance
> we can't count drops at the qdisc level. Count them as dev->tx_drops.
> 
>   ip netns add red
>   ip link add type veth peer netns red
>   ip            link set dev veth0 up
>   ip -netns red link set dev veth0 up
>   ip            a a dev veth0 10.0.0.1/24
>   ip -netns red a a dev veth0 10.0.0.2/24
>   ping -c 2 10.0.0.2
>   #  2 packets transmitted, 2 received, 0% packet loss, time 1031ms
>   ip -s link show dev veth0
>   #  TX:  bytes packets errors dropped carrier collsns
>   #        1314      17      0       0       0       0
> 
> [...]

Here is the summary with links:
  - [net-next] net: count drops due to missing qdisc as dev->tx_drops
    https://git.kernel.org/netdev/net-next/c/4fdb6b6063f0

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 2a637a17061b..1417f1991452 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -633,6 +633,7 @@  EXPORT_SYMBOL_GPL(netif_carrier_event);
 static int noop_enqueue(struct sk_buff *skb, struct Qdisc *qdisc,
 			struct sk_buff **to_free)
 {
+	dev_core_stats_tx_dropped_inc(skb->dev);
 	__qdisc_drop(skb, to_free);
 	return NET_XMIT_CN;
 }