mbox series

[net-next,0/7] drop_monitor: Convert to use devlink tracepoint

Message ID 20200929081556.1634838-1-idosch@idosch.org
Headers show
Series drop_monitor: Convert to use devlink tracepoint | expand

Message

Ido Schimmel Sept. 29, 2020, 8:15 a.m. UTC
From: Ido Schimmel <idosch@nvidia.com>

Drop monitor is able to monitor both software and hardware originated
drops. Software drops are monitored by having drop monitor register its
probe on the 'kfree_skb' tracepoint. Hardware originated drops are
monitored by having devlink call into drop monitor whenever it receives
a dropped packet from the underlying hardware.

This patch set converts drop monitor to monitor both software and
hardware originated drops in the same way - by registering its probe on
the relevant tracepoint.

In addition to drop monitor being more consistent, it is now also
possible to build drop monitor as module instead of as a builtin and
still monitor hardware originated drops. Initially, CONFIG_NET_DEVLINK
implied CONFIG_NET_DROP_MONITOR, but after commit def2fbffe62c
("kconfig: allow symbols implied by y to become m") we can have
CONFIG_NET_DEVLINK=y and CONFIG_NET_DROP_MONITOR=m and hardware
originated drops will not be monitored.

Patch set overview:

Patch #1 adds a tracepoint in devlink for trap reports.

Patch #2 prepares probe functions in drop monitor for the new
tracepoint.

Patch #3 converts drop monitor to use the new tracepoint.

Patches #4-#6 perform cleanups after the conversion.

Patch #7 adds a test case for drop monitor. Both software originated
drops and hardware originated drops (using netdevsim) are tested.

Tested:

| CONFIG_NET_DEVLINK | CONFIG_NET_DROP_MONITOR | Build | SW drops | HW drops |
| -------------------|-------------------------|-------|----------|----------|
|          y         |            y            |   v   |     v    |     v    |
|          y         |            m            |   v   |     v    |     v    |
|          y         |            n            |   v   |     x    |     x    |
|          n         |            y            |   v   |     v    |     x    |
|          n         |            m            |   v   |     v    |     x    |
|          n         |            n            |   v   |     x    |     x    |

Ido Schimmel (7):
  devlink: Add a tracepoint for trap reports
  drop_monitor: Prepare probe functions for devlink tracepoint
  drop_monitor: Convert to using devlink tracepoint
  drop_monitor: Remove no longer used functions
  drop_monitor: Remove duplicate struct
  drop_monitor: Filter control packets in drop monitor
  selftests: net: Add drop monitor test

 MAINTAINERS                                   |   1 -
 include/net/devlink.h                         |  16 ++
 include/net/drop_monitor.h                    |  36 ---
 include/trace/events/devlink.h                |  37 +++
 net/Kconfig                                   |   1 -
 net/core/devlink.c                            |  37 ++-
 net/core/drop_monitor.c                       | 133 ++++++-----
 tools/testing/selftests/net/Makefile          |   1 +
 tools/testing/selftests/net/config            |   3 +
 .../selftests/net/drop_monitor_tests.sh       | 215 ++++++++++++++++++
 10 files changed, 368 insertions(+), 112 deletions(-)
 delete mode 100644 include/net/drop_monitor.h
 create mode 100755 tools/testing/selftests/net/drop_monitor_tests.sh

Comments

David Miller Oct. 1, 2020, 1:01 a.m. UTC | #1
From: Ido Schimmel <idosch@idosch.org>
Date: Tue, 29 Sep 2020 11:15:49 +0300

> From: Ido Schimmel <idosch@nvidia.com>
> 
> Drop monitor is able to monitor both software and hardware originated
> drops. Software drops are monitored by having drop monitor register its
> probe on the 'kfree_skb' tracepoint. Hardware originated drops are
> monitored by having devlink call into drop monitor whenever it receives
> a dropped packet from the underlying hardware.
> 
> This patch set converts drop monitor to monitor both software and
> hardware originated drops in the same way - by registering its probe on
> the relevant tracepoint.
> 
> In addition to drop monitor being more consistent, it is now also
> possible to build drop monitor as module instead of as a builtin and
> still monitor hardware originated drops. Initially, CONFIG_NET_DEVLINK
> implied CONFIG_NET_DROP_MONITOR, but after commit def2fbffe62c
> ("kconfig: allow symbols implied by y to become m") we can have
> CONFIG_NET_DEVLINK=y and CONFIG_NET_DROP_MONITOR=m and hardware
> originated drops will not be monitored.
 ...

Series applied, thank you.