Ido Schimmel e7638a027a tc_util: Add support for 64-bit hardware packets counter
The netlink nest that carriers tc action statistics looks as follows:

[TCA_ACT_STATS]
	[TCA_STATS_BASIC]
	[TCA_STATS_BASIC_HW]

Where 'TCA_STATS_BASIC' carries the combined software and hardware
packets (32-bits) and bytes (64-bit) counters and 'TCA_STATS_BASIC_HW'
carries the hardware statistics.

When the number of packets exceeds 0xffffffff, the kernel emits the
'TCA_STATS_PKT64' attribute:

[TCA_ACT_STATS]
	[TCA_STATS_BASIC]
	[TCA_STATS_PKT64]
	[TCA_STATS_BASIC_HW]
	[TCA_STATS_PKT64]

This layout is not ideal as the only way for user space to know what
each 'TCA_STATS_PKT64' attribute carries is to check which attribute
precedes it, which is exactly what some applications are doing [1].

Do the same in iproute2 so that users with existing kernels could read
the 64-bit hardware packets counter of tc actions instead of reading the
truncated 32-bit counter.

Before:

$ 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 47 sec used 23 sec
        Action statistics:
        Sent 368689092544 bytes 5760767071 pkt (dropped 0, overlimits 0 requeues 0)
        Sent software 0 bytes 0 pkt
        Sent hardware 368689092544 bytes 1465799775 pkt
        backlog 0b 0p requeues 0
        used_hw_stats immediate

Where 5760767071 - 1465799775 = 0x100000000

After:

$ 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 71 sec used 47 sec
        Action statistics:
        Sent 368689092544 bytes 5760767071 pkt (dropped 0, overlimits 0 requeues 0)
        Sent software 0 bytes 0 pkt
        Sent hardware 368689092544 bytes 5760767071 pkt
        backlog 0b 0p requeues 0
        used_hw_stats immediate

[1] 006e1c6dbf

Reported-by: Joe Botha <joe@atomic.ac>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
2025-02-07 21:02:08 +00:00
2023-06-28 16:31:33 -07:00
2024-01-25 16:49:10 -08:00
2024-02-08 09:21:39 -08:00
2025-02-04 06:59:30 -08:00
2023-01-14 09:00:34 -08:00
2023-10-30 11:35:32 -07:00
2024-09-12 10:12:21 -07:00
2019-05-15 09:50:42 -07:00
2008-03-08 13:31:03 -08:00
2023-05-13 19:25:04 -07:00
2023-09-29 16:06:42 -07:00

This is a set of utilities for Linux networking.

Information:
    https://wiki.linuxfoundation.org/networking/iproute2

Download:
    http://www.kernel.org/pub/linux/utils/net/iproute2/

Stable version repository:
    git://git.kernel.org/pub/scm/network/iproute2/iproute2.git

Development repository:
    git://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git

Compatibility
-------------
A new release of iproute2 is done with each kernel version, but
there is a wide range of compatibility. Newer versions of iproute2
will still work with older kernels, but there are some limitations.

If an iproute2 command with a new feature is used with an older
kernel, the kernel may report an error or silently ignore the new
attribute. Likewise if older iproute2 is used with an newer kernel,
it is not possible to use or see new features. The range of
compatibility extends back as far as the oldest supported Long Term
Support (LTS) kernel version.

How to compile this.
--------------------
1. libdbm

arpd needs to have the berkeleydb development libraries. For Debian
users this is the package with a name like libdbX.X-dev.
DBM_INCLUDE points to the directory with db_185.h which
is the include file used by arpd to get to the old format Berkeley
database routines.  Often this is in the db-devel package.

2. make

The makefile will automatically build a config.mk file which
contains definitions of libraries that may or may not be available
on the system such as: ATM, ELF, MNL, and SELINUX.

3. include/uapi

This package includes matching sanitized kernel headers because
the build environment may not have up to date versions. See Makefile
if you have special requirements and need to point at different
kernel include files.

Stephen Hemminger
stephen@networkplumber.org

David Ahern
dsahern@gmail.com
Description
No description provided
Readme 8.5 MiB
Languages
C 97.3%
Shell 1.9%
Makefile 0.5%
Yacc 0.2%