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=1796341739; b=hGvmmXErZ7MyDsTxvScOQIiV/DgU7ckQ13Ow3StmgGv1OhdQPj+e0bz8str1gONbUGx1 HTkGLwmh7M0idZrpceTD9OQpVqCQGKQLiF3Ynce+ieCVZLaXoQes8sPehm+I+dSvX6i/y VIXU+rNq8ck2CilVZjwPONtPZPyl6RdnXqSVn8lb72lvh2gvc/hHmgJRdwkmJAVUqPueV x9oy9k08WJLZDGmo+8kJi07jdDTIahLmrRwxbOmlI1nzX7dO1nyFDQumhHSOlPa7+YIjJ LnooZrXog3bw6CdjgAr/7jnJ5ZAWP3RmBpoDB9vv6XEZrTatWQVIWHHor0y1hKS7xQA== 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=42XS8ZKV4/XuldYvlGy1CwcqUbbruweKARdz29s3zTyAqCE2/5xcLgztpJCylVGsNb7D jXX75QO2qLH62uA0zoEl48dYM4AXJdSPMvimqIHyYI/yoealsaqv0dR1ygecdAzNFVlTy WRqf1g3BGExJDIZmxQpIMklVf3l7u9gGVm3ExDNtUCNgFTn6whs+556rxRnhgnwCf2oTD axA+daioGeCwutPuLqFfY3eJw6QVmw5xA4Rt1OnL6U3AtBGgR9MrVQRfosXqeZ8AObo6R 8XN+9ae4J2SvPxeosdO/pK1IVzwOoTBU6s7n4y3WXubK95FF6SXVjKN6iwG62Qx03pA== 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 DF19B606A692 for ; Thu, 3 Dec 2026 23:48:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DF19B606A692 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-4b79502c27aso2659645e9.1 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=QU90RGnBpQCJLb/i3AObj9FtfVTKdvXqE80IfSOhIlcRIqwceXgv6qr9yS/ADZNpda L+I9y6y2ul55jzvrlAsnmb/ML40EsWP53FJz2gO35qs2nE2BVv3MhTHqAZWCeIgWa6nd yrCm+/pveulvor2KPkQJmn6lPDWYyxhfXBBwokmx4lMX9GnelzMDKJkBLCjunhb2uBgn 3Og3R0ufXpz9+yettgTNv41Gg68n0kSsRwpkDA/Cmug8f3Xd0Ra4X6JAp5Yn/0/2zpUS t4QWk8nEe0dHF7tkFJzmWzxfD5Wf+IWF6nivPjIm6IhkqOx6NH9edy6n8TSbvhA+vcqM DEwQ== X-Forwarded-Encrypted: i=1; AL+hErGA6hjIEOZDc23293+yEvHuFoxX4QVlP7jhytDmp2A93FmeKqd2RI7aU0whykfZZgfEM8yzNlIGIgbPeyWUluw=@vger.kernel.org X-Gm-Message-State: APuU4Z8moo6HGuanlH+I6N0QQ2+Znmz2VmdhJDuCa34fPgi9u1OQC9Wz Tovbw7tDsU+0k18Xv6Wwpkt0lwpEpD80GVbeUSOKkDeSTDXQUrRzRRmWxZDG46VE6cCaK/6/oAa 9aOTyUgrDooqSeYwSpykG9538sQVNe4TJQ5YT X-Gm-Gg: AZFdTZcI1Uo5zBwYL7nUaOV/4xIc3RwG5Wgo+mfK5BjJcj9I12K3c9Q0Bf/r+Dbdhce muPwZgaWwYXIfuLidfddX3LZVD7fNQgaQHSlU8UpDfmhT568O3wS7poNdqCFr45JLpVUU4TEscX CbI69eSdP9/2APsgMeVxain4ce3QAvQjpPolFcBl4UMC6EH+y5SAYirbBYjlo100W7Hk92kLUlY krNjslNxEumYhIJYF1fF5ZzMwfH8wTpY+ze4PTF0yIK6abHkSpJspjJBzLxAaCSAIKZ8n3OQAsl xbibEsLyYAwIQLS6rG8lL/UB6120nXx9NZpnlp01xEht5d1Hrrc9noWBbCfltZLH6WaJQkgc5ju 0tS63P3e2HyOr49c6hMEJKN21I74MfQVqm3L0CMI= 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-kselftest@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