From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.98 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796341739; b=zkkOsPBK1zSsPcfmHkQHreT44r0pcwYIU/eSQO2QBxawGhN69cIpogcpFqSORGBMCX3b kEJGdjAm3LX3RSIY0WIjWUMQ9e8fKOzxsg84PTmFlTfKIsJ3TtFu6X/uBtzVbKH/JEKn6 WO913IJ0B6QuAIIKYW3u4Zy1eHsst3Y+ex+PxhEp7I5nq5TQW+hRzPpGOUxEhnVE3Kp78 S6QT16oljAqLNDNoYzVhdC5ieghTEGkKLXwKWSZO3oh5d52bKoKkeBHtrmRW05rzjqU3V I+LzDzqajA/qgQtszTnSE0qXXTPwju9V5odtcqSxJlg11hQ3lAzWv+p2N0li1oQGjVw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796341739; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: X-Relaying-Domain:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=sBZmXi4STG0UHkk8eGGsdZL2PgheAEOzGnkZQOhQJYI=; b=VRhN+ArehLx4rt2NOIo34Un+BASRAMkAjuh+yyzkjRd1/DbkjHCYZHhW4+QbZttbpvEp YprPD9EP7S+cxa393/YEZqXHTfpY6jwpmnu2+43rno0RH+oPt2NelqtBI7C3m4ht6/Keu /2IIWysW5MjjONM/aKiE/oizd8A0aJ475XmJyfm+fj/U/rgLDzTBM+B9p8UgRPP5914oo PUDB6x4soLSkwV2D0JLuey6bNQg9f1c7gPrVpfTW7HsMoI9oQ2JTOIrKFTbXtpRYWH7x6 AqAvOTd+8PFsqGetKhjPsJAD8WSeK794WLn1pkHQkZEz6gPAqjZ2Sik/1WlgYClS44w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=everpuredata.com; spf=pass smtp.mailfrom=everpuredata.com; dkim=pass header.d=everpuredata.com header.i=@everpuredata.com header.a=rsa-sha256 header.s=google header.b=OQWmOoiI; arc=none smtp.remote-ip=209.85.128.98 Received: from mail-wm1-f98.google.com (mail-wm1-f98.google.com [209.85.128.98]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7D76606A68F for ; Thu, 3 Dec 2026 23:48:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7D76606A68F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=everpuredata.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=everpuredata.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=everpuredata.com header.i=@everpuredata.com header.a=rsa-sha256 header.s=google header.b=OQWmOoiI Received: by mail-wm1-f98.google.com with SMTP id 5b1f17b1804b1-4a35ac4475dso2189775e9.2 for ; Thu, 03 Dec 2026 15:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=everpuredata.com; s=google; t=1796341735; x=1796946535; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sBZmXi4STG0UHkk8eGGsdZL2PgheAEOzGnkZQOhQJYI=; b=OQWmOoiIK3J5RYq4eb6W50Xx4QLYCwHpOkKp/THnEb8zlTaFaZWkeIQ1nI58JW7XCr 2bw00o1k2VR5pERwp1OOjedKr1wA38aSI0LWXSyOtTk5CVvqWjrLW1EbPEi6sizFzfLP MBbk+qnzx4Jl54AqQr7370gi9rTzoEv2tzKsb9WA+SF5itpoMpwQq79mbijWkFVTxoOI 381QNKw4CKDv5yLQS8fJpLVRb3kwXUa7jAlSniaDlM/NUaYTTc4cV2XdE5oSbihrUXla FsQKnRv/XFumbD7MNgUNGPjdpCN4hXFBkOEpobB85bBNVBtcExaCvFvA1IuYImSDxKvw c+3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796341735; x=1796946535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sBZmXi4STG0UHkk8eGGsdZL2PgheAEOzGnkZQOhQJYI=; b=EcAaIACbFNEngaZvZAWCDXzGdeZyGozl2L1ugi+o9bL/9lXx1Phz69Uxt8YOxAvwIf pEoTHBenlJ3abUWZTsEiqtoGvWOK4ydNAuhTm0o0uEr8N0akRTkGKvEmnJf+fDlpXfvS oJEBfg8QsLIMCDUwwEp00JYqNZJFjTqIgDEKfhPAQkqKPjueGVAp6G2xMuG+5LSHbosP day29qeLlaAnVAS/ktBeNBcD+jQPsneHasCx/Hz/HIWfbuY3KTY6l5R8ICt/Dns0PcPf Fdrnw4eODtbNenzGtzm0b6E5QFoywmuaZV06luUq9mf/HH9ekiu4kZJx5PIkGMKWQfS6 EmYA== X-Forwarded-Encrypted: i=1; AL+hErET7PUT1/aH9MVR9oOB79hC0eaXuF0DyLjiQye3Q+iQUZ5vEZ26sr01O+2ZaybH1EcN7ULWREDl4qz17mw=@vger.kernel.org X-Gm-Message-State: APuU4Z955sydnz7m/lgH27RDSGvc7VCezLK2kpdz1rSlN0kRLyfdyUZb H1U30Dc8rCBAIeWe4hCtUrx1xg50b9+3A2ixaT58cPM2DHTOc4c3wIlyccX58dXbA2OC2I/GcUT symUPhgb6g3GOGcsoi88bcrPlB1F94c7PVH+l X-Gm-Gg: AZFdTZfqTVy5yg0VsISw95MbJk0WLIPnxWoRyX70DLEI+/QgafWHFqzXE+KbybXkaJr 6cafZv4uyFNvIMQOYT25wnC7PV1EIyjGitcAR8EmfSxHVLLYp7CDQFaM+Fs+4WU1aysqOHUpDUY Mw7LPe/F28fQEEDwihuEGf1kkxuad+Mxuv2qRR3oTyQ/CRSTW7CLUcqlBGqjkoPD8zQ++P7Ou+C 6LdsdY5Rj3z3QtkSPlEfR3tzit/SNkE1swaemlLImSKOwX4hw9jf9Mi6thxhUGBfXe/elzQ8mMJ XFPyhuE0gmSH/qQH7d7wP2qtP9OhL2KK/5e8kq9FxO5h4sW3gLXE1Ajmy+7F2XWsB8QPfq43tL9 PDDd3Bz9q/OStNloW4bHIb2453QNzZ0V2pVJr5AM= X-Received: by 2002:a05:600c:4f07:b0:4bb:be79:27 with SMTP id 5b1f17b1804b1-4bbeb8ee95bmr4285445e9.29.1796341735451; Thu, 03 Dec 2026 15:48:55 -0800 (PST) Received: from c14-smtp-2023.dev.purestorage.com ([208.88.158.129]) by smtp-relay.gmail.com with ESMTPS id 5b1f17b1804b1-4bbea11babesm1710025e9.7.2026.12.03.15.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 15:48:55 -0800 (PST) X-Relaying-Domain: everpuredata.com Received: from irdv-tmenninger.dev.purestorage.com (irdv-tmenninger.dev.purestorage.com [10.32.149.15]) by c14-smtp-2023.dev.purestorage.com (Postfix) with ESMTPS id 1052834103F; Thu, 3 Dec 2026 15:48:24 -0800 (PST) From: Tim Menninger To: leon@kernel.org Cc: jgg@ziepe.ca, bharat@chelsio.com, dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, shuah@kernel.org, slingappa@everpuredata.com, rpatil@everpuredata.com, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Tim Menninger Subject: [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Date: Thu, 3 Dec 2026 23:47:20 +0000 Message-ID: <20261203234720.2428689-4-tmenninger@everpuredata.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261203234720.2428689-1-tmenninger@everpuredata.com> References: <20261203234720.2428689-1-tmenninger@everpuredata.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Shiva Lingappa addr4_resolve() and addr6_resolve() leave the flow's source port zero. With wildcard source addresses and identical routing constraints, connections to the same destination therefore select the same ECMP nexthop, even when fib_multipath_hash_policy includes L4 ports, leaving the other paths idle. Populate fl4_sport/fl6_sport from the source sockaddr, which already contains the CM-assigned port. This provides per-connection entropy with hash policy 1, or policy 3 with the source-port field selected. The normal RoCE CM route setup retains the selected interface and destination MAC. This is the CM port-space port, not the RoCEv2 UDP source port, so it does not reproduce downstream switch hashing. It also changes matching of source-port FIB rules without an ipproto restriction, independently of the hash policy. Policies excluding the source port retain the same multipath hash. Tested over IPv4 with an NFSv4.1 flexfiles client (nconnect=16), one data server, two-way ECMP over two 400G ConnectX-7 ports, hash policy 1 and default FIB rules. All 16 connections used one device without the change. With the change, connections used both devices on every tested mount. elbencho 1 MiB direct-read throughput increased from 46596 to 92726 MiB/s. IPv6 relies on "ipv6: Use the selected nexthop for source address selection". Without it, IDs hashed to a nexthop group member other than the first fail address resolution. With both changes, address and route resolution of 64 rdma_cm IDs per destination over two-way IPv6 ECMP with hash policy 1 split between the devices on every run. A legacy multipath route went from 64/0 to between 30/34 and 33/31. Four destinations through a nexthop group, three of which failed for every ID before, split between 23/41 and 39/25 with no failures. Reported-by: Rohit Patil Signed-off-by: Shiva Lingappa Co-developed-by: Tim Menninger Signed-off-by: Tim Menninger --- Changes in v2: - Note the dependency on patch 1 for IPv6 - Add the IPv6 nexthop group results v1: https://lore.kernel.org/all/20261130193648.3170657-1-tmenninger@everpuredata.com/ drivers/infiniband/core/addr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index bdaa3eb83bcc..6b80cc2c84c8 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c @@ -382,6 +382,7 @@ static int addr4_resolve(struct sockaddr *src_sock, memset(&fl4, 0, sizeof(fl4)); fl4.daddr = dst_ip; fl4.saddr = src_ip; + fl4.fl4_sport = src_in->sin_port; fl4.flowi4_oif = addr->bound_dev_if; rt = ip_route_output_key(addr->net, &fl4); ret = PTR_ERR_OR_ZERO(rt); @@ -411,6 +412,7 @@ static int addr6_resolve(struct sockaddr *src_sock, memset(&fl6, 0, sizeof fl6); fl6.daddr = dst_in->sin6_addr; fl6.saddr = src_in->sin6_addr; + fl6.fl6_sport = src_in->sin6_port; fl6.flowi6_oif = addr->bound_dev_if; dst = ip6_dst_lookup_flow(addr->net, NULL, &fl6, NULL); -- 2.53.0