Skip to content

Support for nexthop group statistics

Petr Machata netdev 4 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. v4 Latest7 patches 3 repliesApplied 7/7
  2. v37 patches 3 repliesSuperseded
  3. v27 patches 15 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v17 patches14 repliesSuperseded

Changes in v4 from the cover letter

- Patch #2:
- s/nla_get_bitfield32/nla_get_u32/ in __nh_valid_dump_req().

Patches in v4 All 7 applied

#Subject and filesSizeRepliesApplied
1/7net: nexthop: Adjust netlink policy parsing for a new attributenet/ipv4/nexthop.c+28 -302 repliesApplied
2/7net: nexthop: Add NHA_OP_FLAGSinclude/uapi/linux/nexthop.h net/ipv4/nexthop.c+23 -41 replyApplied
3/7net: nexthop: Add nexthop group entry statsinclude/net/nexthop.h net/ipv4/nexthop.c+37 -40 repliesApplied
4/7net: nexthop: Expose nexthop group stats to user spaceinclude/uapi/linux/nexthop.h net/ipv4/nexthop.c+117 -80 repliesApplied
5/7net: nexthop: Add hardware statistics notificationsinclude/net/nexthop.h net/ipv4/nexthop.c+5 -00 repliesApplied
6/7net: nexthop: Add ability to enable / disable hardware statisticsinclude/net/nexthop.h include/uapi/linux/nexthop.h net/ipv4/nexthop.c+19 -10 repliesApplied
7/7net: nexthop: Expose nexthop group HW stats to user spaceinclude/net/nexthop.h include/uapi/linux/nexthop.h net/ipv4/nexthop.c+149 -80 repliesApplied

Reviews trailers per patch

5 of 7 patches have a Reviewed-by or Acked-by.

PatchDavid AhernIdo SchimmelKees Cook
1/7R-b R-b
2/7R-b R-b
3/7
4/7
5/7R-b
6/7R-b
7/7R-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 v4 thread

Cover letter [PATCH net-next v4 0/7] Support for nexthop group statistics

ECMP is a fundamental component in L3 designs. However, it's fragile. Many factors influence whether an ECMP group will operate as intended: hash policy (i.e. the set of fields that contribute to ECMP hash calculation), neighbor validity, hash seed (which might lead to polarization) or the type of ECMP group used (hash-threshold or resilient).

At the same time, collection of statistics that would help an operator determine that the group performs as desired, is difficult.

A solution that we present in this patchset is to add counters to next hop group entries. For SW-datapath deployments, this will on its own allow collection and evaluation of relevant statistics. For HW-datapath deployments, we further add a way to request that HW counters be installed for a given group, in-kernel interfaces to collect the HW statistics, and netlink interfaces to query them.

For example:

    # ip nexthop replace id 4000 group 4001/4002 hw_stats on
    # ip -s -d nexthop show id 4000
    id 4000 group 4001/4002 scope global proto unspec offload hw_stats on used on
      stats:
        id 4001 packets 5002 packets_hw 5000
        id 4002 packets 4999 packets_hw 4999

The point of the patchset is visibility of ECMP balance, and that is influenced by packet headers, not their payload. Correspondingly, we only include packet counters in the statistics, not byte counters.

We also decided to model HW statistics as a nexthop group attribute, not an arbitrary nexthop one. The latter would count any traffic going through a given nexthop, regardless of which ECMP group it is in, or any at all. The reason is again hat the point of the patchset is ECMP balance visibility, not arbitrary inspection of how busy a particular nexthop is. Implementation of individual-nexthop statistics is certainly possible, and could well follow the general approach we are taking in this patchset. For resilient groups, per-bucket statistics could be done in a similar manner as well.

This patchset contains the core code. mlxsw support will be sent in a follow-up patch set.

This patchset progresses as follows:

- Patches #1 and #2 add support for a new next-hop object attribute, NHA_OP_FLAGS. That is meant to carry various op-specific signaling, in particular whether SW- and HW-collected nexthop stats should be part of the get or dump response. The idea is to avoid wasting message space, and time for collection of HW statistics, when the values are not needed.

- Patches #3 and #4 add SW-datapath stats and corresponding UAPI.

- Patches #5, #6 and #7 add support fro HW-datapath stats and UAPI. Individual drivers still need to contribute the appropriate HW-specific support code.

v4:
- Patch #2:
- s/nla_get_bitfield32/nla_get_u32/ in __nh_valid_dump_req().

v3:
- Patch #3:
- Convert to u64_stats_t
- Patch #4:
- Give a symbolic name to the set of all valid dump flags for the NHA_OP_FLAGS attribute.
- Convert to u64_stats_t
- Patch #6:
- Use a named constant for the NHA_HW_STATS_ENABLE policy.

v2:
- Patch #2:
- Change OP_FLAGS to u32, enforce through NLA_POLICY_MASK
- Patch #3:
- Set err on nexthop_create_group() error path
- Patch #4:
- Use uint to encode NHA_GROUP_STATS_ENTRY_PACKETS
- Rename jump target in nla_put_nh_group_stats() to avoid having to rename further in the patchset.
- Patch #7:
- Use uint to encode NHA_GROUP_STATS_ENTRY_PACKETS_HW
- Do not cancel outside of nesting in nla_put_nh_group_stats()

Ido Schimmel (5):
net: nexthop: Add nexthop group entry stats
net: nexthop: Expose nexthop group stats to user space
net: nexthop: Add hardware statistics notifications
net: nexthop: Add ability to enable / disable hardware statistics
net: nexthop: Expose nexthop group HW stats to user space

Petr Machata (2):
net: nexthop: Adjust netlink policy parsing for a new attribute
net: nexthop: Add NHA_OP_FLAGS

 include/net/nexthop.h        |  29 +++
 include/uapi/linux/nexthop.h |  45 +++++
 net/ipv4/nexthop.c           | 329 ++++++++++++++++++++++++++++++-----
 3 files changed, 363 insertions(+), 40 deletions(-)
Signature · 1 line
2.43.0