mbox series

[net-next,v3,0/3] netdevsim: Support for L3 HW stats

Message ID cover.1647265833.git.petrm@nvidia.com (mailing list archive)
Headers show
Series netdevsim: Support for L3 HW stats | expand

Message

Petr Machata March 14, 2022, 2:01 p.m. UTC
"L3 stats" is a suite of interface statistics aimed at reflecting traffic
taking place in a HW device, on an object corresponding to some software
netdevice. Support for this stats suite has been added recently, in commit
ca0a53dcec94 ("Merge branch 'net-hw-counters-for-soft-devices'").

In this patch set:

- Patch #1 adds support for L3 stats to netdevsim.

  Real devices can have various conditions for when an L3 counter is
  available. To simulate this, netdevsim maintains a list of devices
  suitable for HW stats collection. Only when l3_stats is enabled on both a
  netdevice itself, and in netdevsim, will netdevsim contribute values to
  L3 stats.

  This enablement and disablement is done via debugfs:

    # echo $ifindex > /sys/kernel/debug/netdevsim/$DEV/hwstats/l3/enable_ifindex
    # echo $ifindex > /sys/kernel/debug/netdevsim/$DEV/hwstats/l3/disable_ifindex

  Besides this, there is a third toggle to mark a device for future failure:

    # echo $ifindex > /sys/kernel/debug/netdevsim/$DEV/hwstats/l3/fail_next_enable

- This allows HW-independent testing of stats reporting and in-kernel APIs,
  as well as a test for enablement rollback, which is difficult to do
  otherwise. This netdevsim-specific selftest is added in patch #2.

- Patch #3 adds another driver-specific selftest, namely a test aimed at
  checking mlxsw-induced stats monitoring events.

v3:
- Patch #1:
    - Rewrite the fops definitions as macros. clang didn't like the
      previous approach to reducing redundancy.

v2:
- Patch #1:
    - Embed fops into a structure that carries the necessary metadata
      together with the fops. Extract the data in the generic write
      handler to determine what debugfs file the op pertains to. This
      obviates the need to have a per-debugfs file helper wrapper.

Petr Machata (3):
  netdevsim: Introduce support for L3 offload xstats
  selftests: netdevsim: hw_stats_l3: Add a new test
  selftests: mlxsw: hw_stats_l3: Add a new test

 drivers/net/netdevsim/Makefile                |   2 +-
 drivers/net/netdevsim/dev.c                   |  17 +-
 drivers/net/netdevsim/hwstats.c               | 486 ++++++++++++++++++
 drivers/net/netdevsim/netdevsim.h             |  23 +
 .../drivers/net/mlxsw/hw_stats_l3.sh          |  31 ++
 .../drivers/net/netdevsim/hw_stats_l3.sh      | 421 +++++++++++++++
 tools/testing/selftests/net/forwarding/lib.sh |  60 +++
 7 files changed, 1037 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/netdevsim/hwstats.c
 create mode 100755 tools/testing/selftests/drivers/net/mlxsw/hw_stats_l3.sh
 create mode 100755 tools/testing/selftests/drivers/net/netdevsim/hw_stats_l3.sh

Comments

patchwork-bot+netdevbpf@kernel.org March 15, 2022, 2:50 p.m. UTC | #1
Hello:

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

On Mon, 14 Mar 2022 15:01:14 +0100 you wrote:
> "L3 stats" is a suite of interface statistics aimed at reflecting traffic
> taking place in a HW device, on an object corresponding to some software
> netdevice. Support for this stats suite has been added recently, in commit
> ca0a53dcec94 ("Merge branch 'net-hw-counters-for-soft-devices'").
> 
> In this patch set:
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/3] netdevsim: Introduce support for L3 offload xstats
    https://git.kernel.org/netdev/net-next/c/1a6d7ae7d63c
  - [net-next,v3,2/3] selftests: netdevsim: hw_stats_l3: Add a new test
    https://git.kernel.org/netdev/net-next/c/9b18942e9993
  - [net-next,v3,3/3] selftests: mlxsw: hw_stats_l3: Add a new test
    https://git.kernel.org/netdev/net-next/c/ed2ae69c4053

You are awesome, thank you!