1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/include
Ido Schimmel 811b8f534f net: sched: Fix truncation of offloaded action statistics
In case of tc offload, when user space queries the kernel for tc action
statistics, tc will query the offloaded statistics from device drivers.
Among other statistics, drivers are expected to pass the number of
packets that hit the action since the last query as a 64-bit number.

Unfortunately, tc treats the number of packets as a 32-bit number,
leading to truncation and incorrect statistics when the number of
packets since the last query exceeds 0xffffffff:

$ tc -s filter show dev swp2 ingress
filter protocol all pref 1 flower chain 0
filter protocol all pref 1 flower chain 0 handle 0x1
  skip_sw
  in_hw in_hw_count 1
        action order 1: mirred (Egress Redirect to device swp1) stolen
        index 1 ref 1 bind 1 installed 58 sec used 0 sec
        Action statistics:
        Sent 1133877034176 bytes 536959475 pkt (dropped 0, overlimits 0 requeues 0)
[...]

According to the above, 2111-byte packets were redirected which is
impossible as only 64-byte packets were transmitted and the MTU was
1500.

Fix by treating packets as a 64-bit number:

$ tc -s filter show dev swp2 ingress
filter protocol all pref 1 flower chain 0
filter protocol all pref 1 flower chain 0 handle 0x1
  skip_sw
  in_hw in_hw_count 1
        action order 1: mirred (Egress Redirect to device swp1) stolen
        index 1 ref 1 bind 1 installed 61 sec used 0 sec
        Action statistics:
        Sent 1370624380864 bytes 21416005951 pkt (dropped 0, overlimits 0 requeues 0)
[...]

Which shows that only 64-byte packets were redirected (1370624380864 /
21416005951 = 64).

Fixes: 3804070235 ("net/sched: Enable netdev drivers to update statistics of offloaded actions")
Reported-by: Joe Botha <joe@atomic.ac>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250204123839.1151804-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-02-05 18:32:06 -08:00
..
acpi LoongArch changes for v6.14 2025-01-28 08:52:01 -08:00
asm-generic The various patchsets are summarized below. Plus of course many 2025-01-26 18:36:23 -08:00
clocksource KVM/arm64 updates for 6.14 2025-01-28 09:01:36 -08:00
crypto crypto: skcipher - document skcipher_walk_done() and rename some vars 2025-01-14 11:38:32 +08:00
cxl cxl/events: Update Memory Module Event Record to CXL spec rev 3.1 2025-01-13 09:33:21 -07:00
drm drm/bridge: fix documentation for the hdmi_audio_prepare() callback 2025-01-15 12:32:47 +02:00
dt-bindings Char/Misc/IIO driver updates for 6.14-rc1 2025-01-27 16:51:51 -08:00
hyperv hyperv: Add new Hyper-V headers in include/hyperv 2025-01-10 00:54:20 +00:00
keys keys: drop shadowing dead prototype 2025-01-21 11:25:23 +02:00
kunit linux_kselftest-kunit-6.14-rc1 2025-01-22 12:32:39 -08:00
kvm Merge branch kvm-arm64/pkvm-memshare-declutter into kvmarm-master/next 2025-01-17 11:05:18 +00:00
linux net: harmonize tstats and dstats 2025-02-03 18:39:59 -08:00
math-emu
media media: cec: include linux/debugfs.h and linux/seq_file.h where needed 2025-01-07 12:21:38 +01:00
memory
misc
net net: sched: Fix truncation of offloaded action statistics 2025-02-05 18:32:06 -08:00
pcmcia
ras
rdma RDMA/core: Support link status events dispatching 2024-12-24 05:22:18 -05:00
rv rv: Reset per-task monitors also for idle tasks 2025-01-23 12:16:04 -05:00
scsi Driver core and debugfs updates 2025-01-28 12:25:12 -08:00
soc soc: driver updates for 6.14 2025-01-24 14:56:59 -08:00
sound sound updates for 6.14-rc1 2025-01-24 07:54:34 -08:00
target
trace rxrpc: Fix the rxrpc_connection attend queue handling 2025-02-04 15:30:28 +01:00
uapi fuse update for 6.14 2025-01-29 09:40:23 -08:00
ufs scsi: Revert "scsi: ufs: core: Probe for EXT_IID support" 2025-01-10 16:38:21 -05:00
vdso vdso: Correct typo in PAGE_SHIFT comment 2025-01-15 11:07:08 +01:00
video
xen