From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.97 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796341740; b=eC8nVgvni5j36AVNhg1NjPlDhykvFqYZPUThUYi2yYgFAx7b0Davd+ZL/LTnJY+25eu1 31ME2Xux+8ou+ZPgsvvqdJAEmCknMngf+40KIr6OB+yHIoPDrQaICy3UyW7c64ZnpsZMg A4wA5JKFuXnhZTiFfk5mGkZgm/Ohi8PW0NqGdlesBmZ6tY9rA5Mn/NxNwfGAqDyYp/miu CgYzZn6fADvK2/G+FUq14D4E0s6kw+DyRTE2yGafNAvGkuUU5LsuJMEPkkVENaq8r+oLP PyWvaFzCU2aWLbMguDoJqdAdQ6Q8Dx+W87cFqLvqw5rxWLKhcUGixzLJ2EsJ6KZ1yWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796341740; 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=T+tojoX9SwlnWl4frFx5HGqEYBSW3dBiQUr/wC3wURr+uXSTFsN6tRZ3sgu/q/qJiz/S F1wi3yDTtwNRxnee+80HkTNP+mEXa1TD+MyeXPAUzOoX6H9hmNLQ+B97aP28b3/cAv3DO Tji3jMdLhsAyy6lIsKG2TFOyVKiK+5t0n2vvpQBb4Y4ESqfJ2qPztmtwm04G5TulLj7p5 8I0kLvAFj4nSx4v5bpKTlcqqej8NA4IK6P0ywTxfe8gNgprMoLI8jLTJmOa/BsLt/q0zU Yie1vFiDMeGMWyJv7H0KrzoXGZXLgGnhr+y8tB97ANiq9Ml3yK+d/GFBSsg5Y4bK3aA== 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.97 Received: from mail-wm1-f97.google.com (mail-wm1-f97.google.com [209.85.128.97]) (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 DDF7C606A691 for ; Thu, 3 Dec 2026 23:48:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DDF7C606A691 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-f97.google.com with SMTP id 5b1f17b1804b1-4a35ac4475dso2189765e9.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=PucZBg41u8wJQWm/BbKzRDirRYlqX94vNQMlxME8lZQzlmASPy5IjyX/la2NlW8bCL WesrgG9JyuCUa+N1w0Sb2WlYWZB4iM/Ew/6XtZoFQyXu5uXPgfx6tAuXZLKX3C4Qxp6K /O4auVKBN4t6Jl46ECi9M/1aGdZ8QRgy+n1TOh+EoUfFV4iOeatGBEYQWaSTJgiS88Dr iNdUUk6mADdAkRxOtBNpMebMBnyA3dFTLMx681KLBZP3OFVzDX558VJzK3/g90mvf0Q2 z4lUQyVwtPA1tBdPh4aJzzHBf0W9mfKoY9d4Yr/nTWOfCLOg1ZsfUvfss3pLgPOv9xGd 4U0Q== X-Forwarded-Encrypted: i=1; AL+hErENpfZKyFe21lSdMz20VbeSxukKRSWBBt3RH6vUwAGP1NPySXFd9gCnRvA8CbGFD4Mx2Uvz7Ss=@vger.kernel.org X-Gm-Message-State: APuU4Z+YnL1ZalwBPuYedHpgphhK0moBhnUnAfChChfuFeN0Z+fRUCTf GH6LjEpt5AYjaDFKou2oDCMV8eTfWw83iSUOUiFkmlV0lX3CCveQbl02tQqzX4pikhyrmDBxjk2 VkCyE29MU23gvRd4b0TDaOMWZMUR6vHIXqK3x X-Gm-Gg: AZFdTZf8Y4INkuvMNHs+yC0lA6ndSB3BLW+ha3mo1fEs5v71mYkTVNOxiiCpUB64Hcz dSblyYj33INqs5gOf26aYOJi/6Ie7d4iQ4RUKD+fDOjKzUwLxtBPu3jm3Evkk/hk9TASMjWTnEs OP7KW4cOSsyblWvGl0Ygd0pE76hwL3ofZHy28rSbu2gd2G1mbjGG1w8AMBf/HoM9VD14wuJ+TvU P2J1K3n0pB+8Hkp2tZdqWOU1Wad0VFBUxynwUCVh7sZrUS02bp+jBARzF8rqKNa//m7fNYHRzBi ThrXVnqt+B/4TbJPP0wEvuHRY/Wg1J7zIksdrkQcmR8sAtyNezgiiO2t7Z9xyPBUUoQE186ak91 f+wsINHht99aiRXLa31g91yOSOOyMqGEAa0wg0Sw= 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: netdev@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