Skip to content

soreuseport: Fix broken SO_INCOMING_CPU.

Kuniyuki Iwashima netdev 5 versions – Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/22 patches 0 repliesApplied 2/2
  2. v2 posting 2/22 patches 1 replySuperseded
  3. v3 posting 1/21 patch 0 repliesApplied 1/1
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/21 patch6 repliesSuperseded
v13 patches6 repliesSuperseded

Changes in v3 from the cover letter

* Rebase and resolve conflicts

Patches in v3 posting 2/2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2soreuseport: Fix socket selection for SO_INCOMING_CPU.include/net/sock_reuseport.h net/core/sock.c net/core/sock_reuseport.c+92 -60 repliesApplied
2/2selftest: Add test for SO_INCOMING_CPU.tools/testing/selftests/net/.gitignore tools/testing/selftests/net/Makefile tools/testing/selftests/net/so_incoming_cpu.c+244 -00 repliesApplied

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 net-next 0/2] soreuseport: Fix broken SO_INCOMING_CPU.

setsockopt(SO_INCOMING_CPU) for UDP/TCP is broken since 4.5/4.6 due to these commits:

* e32ea7e74727 ("soreuseport: fast reuseport UDP socket selection")
* c125e80b8868 ("soreuseport: fast reuseport TCP socket selection")

These commits introduced the O(1) socket selection algorithm and removed O(n) iteration over the list, but it ignores the score calculated by compute_score(). As a result, it caused two misbehaviours:

* Unconnected sockets receive packets sent to connected sockets
* SO_INCOMING_CPU does not work

The former is fixed by commit acdcecc61285 ("udp: correct reuseport selection with connected sockets"). This series fixes the latter and adds some tests for SO_INCOMING_CPU.

Changes:
v3:
* Rebase and resolve conflicts

v2: https://lore.kernel.org/netdev/[email protected]/
* patch 1
* Rename helper functions
* Remove unnecessary arg sk from '__' helpers
* Fix reuseport_update_incoming_cpu() logic
* patch 2
* Add test cases
* Change when to set SO_INCOMING_CPU
* Add/Remove non-SO_INCOMING_CPU socket

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

Kuniyuki Iwashima (2):
soreuseport: Fix socket selection for SO_INCOMING_CPU.
selftest: Add test for SO_INCOMING_CPU.

 include/net/sock_reuseport.h                  |   2 +
 net/core/sock.c                               |   2 +-
 net/core/sock_reuseport.c                     |  94 ++++++-
 tools/testing/selftests/net/.gitignore        |   1 +
 tools/testing/selftests/net/Makefile          |   1 +
 tools/testing/selftests/net/so_incoming_cpu.c | 242 ++++++++++++++++++
 6 files changed, 336 insertions(+), 6 deletions(-)
 create mode 100644 tools/testing/selftests/net/so_incoming_cpu.c
Signature · 1 line
2.30.2