From: Tim Menninger <tmenninger@everpuredata.com>
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 <tmenninger@everpuredata.com>
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 [thread overview]
Message-ID: <20261203234720.2428689-4-tmenninger@everpuredata.com> (raw)
In-Reply-To: <20261203234720.2428689-1-tmenninger@everpuredata.com>
From: Shiva Lingappa <slingappa@everpuredata.com>
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 <rpatil@everpuredata.com>
Signed-off-by: Shiva Lingappa <slingappa@everpuredata.com>
Co-developed-by: Tim Menninger <tmenninger@everpuredata.com>
Signed-off-by: Tim Menninger <tmenninger@everpuredata.com>
---
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
prev parent reply other threads:[~2026-12-03 23:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 23:47 [PATCH v2 0/3] Spread rdma_cm connections across ECMP paths Tim Menninger
2026-12-03 23:47 ` [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection Tim Menninger
2026-12-03 23:47 ` [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address Tim Menninger
2026-12-03 23:47 ` Tim Menninger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203234720.2428689-4-tmenninger@everpuredata.com \
--to=tmenninger@everpuredata.com \
--cc=bharat@chelsio.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rpatil@everpuredata.com \
--cc=shuah@kernel.org \
--cc=slingappa@everpuredata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®