Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: Use the CM source port in IP route lookups
@ 2026-11-30 19:36 Tim Menninger
  2026-11-30 19:44 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Menninger @ 2026-11-30 19:36 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, netdev, David Ahern, Ido Schimmel, Shiva Lingappa,
	Rohit Patil

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 address resolution was checked by resolving 64 rdma_cm IDs to one
destination over a two-way IPv6 ECMP route with hash policy 1. Device
selection changed from 64/0 IDs before this change to 31/33 after.

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>
---
NOTE: Rohit's report was internal, so no public report URL is available.

 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] RDMA/core: Use the CM source port in IP route lookups
  2026-11-30 19:36 [PATCH] RDMA/core: Use the CM source port in IP route lookups Tim Menninger
@ 2026-11-30 19:44 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-30 19:44 UTC (permalink / raw)
  To: Tim Menninger; +Cc: linux-rdma

> 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
> [ ... ]
> 
> 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>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130193648.3170657-1-tmenninger@everpuredata.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-30 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 19:36 [PATCH] RDMA/core: Use the CM source port in IP route lookups Tim Menninger
2026-11-30 19:44 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox