Skip to content

Report netns cookie in FIB lookup tracepoints

Ido Schimmel netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 5 repliesApplied 3/3
  2. v13 patches 3 repliesSuperseded

Changes in v2 from the cover letter

* Patch #2: Make the network namespace the last argument of the fib:fib_table_lookup tracepoint. I kept the tags since the change is minimal.

Patches in v2 All 3 applied

#Subject and filesSizeRepliesApplied
1/3ipv6: Report netns cookie in fib6_table_lookup tracepointinclude/trace/events/fib6.h+6 -21 replyApplied
2/3ipv4: Pass netns to fib_table_lookup()include/net/ip_fib.h include/trace/events/fib.h net/core/filter.c +5 more+27 -191 replyApplied
3/3ipv4: Report netns cookie in fib_table_lookup tracepointinclude/trace/events/fib.h+6 -21 replyApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchPetr MachataFerenc FejesDavid Ahern
1/3R-b R-b R-b
2/3R-b R-b R-b
3/3R-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH net-next v2 0/3] Report netns cookie in FIB lookup tracepoints

The fib:fib_table_lookup and fib6:fib6_table_lookup tracepoints do not report the network namespace in which the lookup was performed, so lookups performed in different namespaces cannot be told apart. The recorded PID does not help either, as lookups in the receive path are performed in softIRQ context.

This is a problem, for example, for netns-aware tracers [1] and multi-ASIC systems where each ASIC and its ports reside in a separate network namespace.

This patchset reports the network namespace cookie in both tracepoints, as commit 27cb3de7f43a ("net: add net cookie for net device trace events") did for the net device tracepoints. This allows filtering lookups performed in a specific network namespace, for example:

 # perf record -a -e fib:fib_table_lookup --filter 'net_cookie == 12'

The cookie of a given network namespace can be retrieved using "ip netns cookie" [2].

Patch #1 reports the cookie in the IPv6 tracepoint, which is already passed the network namespace.

Patch #2 passes the network namespace to fib_table_lookup() and from there to the IPv4 tracepoint.

Patch #3 reports the cookie in the IPv4 tracepoint.

v2:
* Patch #2: Make the network namespace the last argument of the fib:fib_table_lookup tracepoint. I kept the tags since the change is minimal.

v1:
https://lore.kernel.org/netdev/[email protected]/

[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/

Ido Schimmel (3):
ipv6: Report netns cookie in fib6_table_lookup tracepoint
ipv4: Pass netns to fib_table_lookup()
ipv4: Report netns cookie in fib_table_lookup tracepoint

 include/net/ip_fib.h        | 12 +++++++-----
 include/trace/events/fib.h  | 13 +++++++++----
 include/trace/events/fib6.h |  8 ++++++--
 net/core/filter.c           |  2 +-
 net/ipv4/devinet.c          |  3 ++-
 net/ipv4/fib_frontend.c     |  6 ++++--
 net/ipv4/fib_rules.c        |  2 +-
 net/ipv4/fib_semantics.c    |  2 +-
 net/ipv4/fib_trie.c         | 14 ++++++++------
 9 files changed, 39 insertions(+), 23 deletions(-)
Signature · 1 line
2.55.0