[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221020163954.93618-1-kuniyu@amazon.com>
Date: Thu, 20 Oct 2022 09:39:52 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
CC: Martin KaFai Lau <martin.lau@...nel.org>,
Craig Gallek <kraig@...gle.com>,
Kazuho Oku <kazuhooku@...il.com>,
Kuniyuki Iwashima <kuniyu@...zon.com>,
Kuniyuki Iwashima <kuni1840@...il.com>,
<netdev@...r.kernel.org>
Subject: [PATCH v2 net-next 0/2] soreuseport: Fix issues related to the faster selection algorithm.
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:
v2:
* 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/20221010174351.11024-1-kuniyu@amazon.com/
Kuniyuki Iwashima (2):
soreuseport: Fix socket selection for SO_INCOMING_CPU.
selftest: Add test for SO_INCOMING_CPU.
include/net/sock_reuseport.h | 3 +
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, 337 insertions(+), 6 deletions(-)
create mode 100644 tools/testing/selftests/net/so_incoming_cpu.c
--
2.30.2
Powered by blists - more mailing lists