Skip to content

net: ethtool: make netdev_rss_key_fill() spread flows over all queues

Eric Dumazet 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 Latest4 patches 1 replyApplied 4/4
  2. v15 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Fix reverse xmas tree in proc_do_rss_key() (Jakub)
- Move netdev_rss_key and netdev_rss_key_fill() to net/ethtool/common.c (Jakub)
- Drop the KUnit test patch (Jakub)
- Add RSS reporting to netdevsim and fold the selftests into a single self-contained tools/testing/selftests/drivers/net/rss_key.py using ethtool netlink flow-hash reporting (Jakub)

Patches in v2 All 4 applied

#Subject and filesSizeRepliesApplied
1/4net: synchronize proc_do_rss_key() with netdev_rss_key_fill()net/core/dev.h net/core/sysctl_net_core.c net/ethtool/ioctl.c+14 -10 repliesApplied
2/4net: ethtool: generate RSS keys that spread flows over all queuesDocumentation/networking/scaling.rst include/linux/netdevice.h net/core/dev.h +2 more+184 -171 replyApplied
3/4netdevsim: support reporting RSS key, indirection table, and flow hash fieldsdrivers/net/netdevsim/ethtool.c drivers/net/netdevsim/netdevsim.h+56 -00 repliesApplied
4/4selftests: drivers: net: check the host and device RSS keystools/testing/selftests/drivers/net/Makefile tools/testing/selftests/drivers/net/rss_key.py+344 -00 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 net-next 0/4] net: ethtool: make netdev_rss_key_fill() spread flows over all queues

netdev_rss_key_fill() hands drivers a uniformly random key. Because the Toeplitz hash is linear over GF(2), a random key is singular for a given header field and queue count with probability 1/2: flows differing only in the low order bits of that field (such as a burst of consecutive ephemeral ports) then cannot reach all RX queues. On one affected 16-queue host, only 4 queues received traffic until the key was replaced.

Patch 1 synchronizes proc_do_rss_key() with netdev_rss_key_fill() using an smp_wmb()/smp_rmb() pair and a boolean flag so readers of /proc/sys/net/core/netdev_rss_key print zero bytes until the key is fully populated.

Patch 2 keeps the key random but constrains 1008 of its 2048 bits so that, at every 16-bit aligned position and for every power-of-two queue count up to 256, consecutive values of a field ending there visit every queue once. Applying the fixup on the 16-bit grid covers standard 2-tuple/4-tuple hashes as well as encapsulated or bitmap-selected layouts (such as PSP inner TCP ports at byte 78) without enumerating them in the core. The fixup is a bijection onto the set of valid keys, and redraws in the ~1 in 5 case where two 32-bit windows a multiple of 8 bits apart alias.

Patch 3 adds RSS key, indirection table, and flow-hash reporting to netdevsim so the selftest can exercise both the host key and ethtool netlink RSS reporting in a virtual machine without hardware.

Patch 4 adds a selftest under tools/testing/selftests/drivers/net/rss_key.py checking /proc/sys/net/core/netdev_rss_key and the live RSS key, indirection table, and flow-hash layouts reported by a device via ethtool netlink.

v2:
- Fix reverse xmas tree in proc_do_rss_key() (Jakub)
- Move netdev_rss_key and netdev_rss_key_fill() to net/ethtool/common.c (Jakub)
- Drop the KUnit test patch (Jakub)
- Add RSS reporting to netdevsim and fold the selftests into a single self-contained tools/testing/selftests/drivers/net/rss_key.py using ethtool netlink flow-hash reporting (Jakub)

Assisted-by LLM

Eric Dumazet (4):
net: synchronize proc_do_rss_key() with netdev_rss_key_fill()
net: ethtool: generate RSS keys that spread flows over all queues
netdevsim: support reporting RSS key, indirection table, and flow hash
fields
selftests: drivers: net: check the host and device RSS keys

 Documentation/networking/scaling.rst          |   9 +
 drivers/net/netdevsim/ethtool.c               |  53 +++
 drivers/net/netdevsim/netdevsim.h             |   3 +
 include/linux/netdevice.h                     |   1 -
 net/core/dev.h                                |   2 +
 net/core/sysctl_net_core.c                    |   7 +-
 net/ethtool/common.c                          | 174 +++++++++
 net/ethtool/ioctl.c                           |   9 -
 tools/testing/selftests/drivers/net/Makefile  |   1 +
 .../testing/selftests/drivers/net/rss_key.py  | 343 ++++++++++++++++++
 10 files changed, 591 insertions(+), 11 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/rss_key.py
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog