* [PATCH v2 0/3] Spread rdma_cm connections across ECMP paths
@ 2026-12-03 23:47 Tim Menninger
2026-12-03 23:47 ` [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection Tim Menninger
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Tim Menninger @ 2026-12-03 23:47 UTC (permalink / raw)
To: leon
Cc: jgg, bharat, dsahern, idosch, davem, edumazet, kuba, pabeni,
horms, shuah, slingappa, rpatil, linux-rdma, netdev,
linux-kselftest, linux-kernel, Tim Menninger
rdma_cm resolves routes with the flow's source port left zero, so every
connection to one destination takes the same ECMP nexthop, even when the
multipath hash includes L4 ports. On a client with two 400G ports and one
NFS data server, that leaves one port idle and halves read throughput.
Patch 3 fills in the CM source port for IPv4 and IPv6, as in v1.
Leon pointed out two problems with v1.
For a multipath nexthop group, IPv6 picks the source address for the
group's first nexthop rather than the path the lookup selected, so RoCE
address resolution can fail with -ENODEV. This already happens without
the series whenever the hash picks another member, and v1 exposed it per
connection. Patch 1 fixes it in IPv6 source address selection, matching
IPv6 legacy multipath and IPv4 nexthop groups, and patch 2 adds a
selftest for it.
Leon also reported that Chelsio iWARP can fail with -EHOSTUNREACH when
its own route lookup picks a different adapter than rdma_cm. That
already happens without this series, and as agreed on the v1 thread it
will be handled separately, since none of us can test on Chelsio
hardware.
Patches 1 and 2 also stand on their own.
Changes in v2:
- Add patches 1 and 2, the IPv6 source address fix and its selftest
(Leon)
- Patch 3 commit message notes the dependency on patch 1 and adds the
IPv6 results
v1: https://lore.kernel.org/all/20261130193648.3170657-1-tmenninger@everpuredata.com/
Shiva Lingappa (1):
RDMA/core: Use the CM source port in IP route lookups
Tim Menninger (2):
ipv6: Use the selected nexthop for source address selection
selftests: fib_nexthops: Check the IPv6 multipath source address
drivers/infiniband/core/addr.c | 2 ++
include/net/ip6_route.h | 9 ++++--
net/ipv6/ip6_output.c | 3 +-
net/ipv6/route.c | 2 +-
tools/testing/selftests/net/fib_nexthops.sh | 35 +++++++++++++++++++++
5 files changed, 47 insertions(+), 4 deletions(-)
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
--
2.53.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection 2026-12-03 23:47 [PATCH v2 0/3] Spread rdma_cm connections across ECMP paths Tim Menninger @ 2026-12-03 23:47 ` Tim Menninger 2026-12-05 0:37 ` netdev-bot+sashiko 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 ` [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Tim Menninger 2 siblings, 1 reply; 7+ messages in thread From: Tim Menninger @ 2026-12-03 23:47 UTC (permalink / raw) To: leon Cc: jgg, bharat, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, shuah, slingappa, rpatil, linux-rdma, netdev, linux-kselftest, linux-kernel, Tim Menninger When a route uses a multipath nexthop group and has no preferred source, ip6_route_get_saddr() selects the source address for fib6_info_nh_dev(), which is the group's first nexthop. The lookup may have selected a different nexthop, so the source address can belong to another interface than the one the packet leaves through: $ ip -6 route get fd00:ecb:eeee::1 ... via fe80::b2cf:eff:feaf:6eb6 dev ens6np0 src fd00:ecb::3 ... where fd00:ecb::3 is assigned to ens3np0. IPv6 legacy multipath routes and IPv4 nexthop groups both select the source address for the chosen path. TCP and UDP can operate with a source address assigned to another interface, but RoCE address resolution requires a matching GID on the selected device, and rdma_cm address resolution fails with -ENODEV whenever the hash selects a nexthop other than the first. Pass the dst to ip6_route_get_saddr() and, for a multipath nexthop group, select the source address for the device of the selected path. A configured preferred source still takes precedence, and routes without a multipath nexthop group are unchanged. Tested on a host with two ConnectX-7 ports, an IPv6 route through a two-member nexthop group and hash policy 1, with rdma_cm resolving the address and route of 64 IDs per destination. Before this change, every ID failed for three destinations whose hash selected the second nexthop. After it, every ID resolved, with the source address on the egress port. A route with a preferred source on another interface kept that source, and local destinations resolved as before. Fixes: f88d8ea67fbd ("ipv6: Plumb support for nexthop object in a fib6_info") Signed-off-by: Tim Menninger <tmenninger@everpuredata.com> --- Changes in v2: - New patch, replacing the addr6_resolve() fix proposed on v1 include/net/ip6_route.h | 9 +++++++-- net/ipv6/ip6_output.c | 3 ++- net/ipv6/route.c | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 95f936be32c6..d5754f6442bb 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -143,6 +143,7 @@ void rt6_age_exceptions(struct fib6_info *f6i, struct fib6_gc_args *gc_args, unsigned long now); static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i, + const struct dst_entry *dst, const struct in6_addr *daddr, unsigned int prefs, int l3mdev_index, struct in6_addr *saddr) @@ -155,8 +156,12 @@ static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i, rcu_read_lock(); l3mdev = dev_get_by_index_rcu(net, l3mdev_index); - if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev) - dev = f6i ? fib6_info_nh_dev(f6i) : NULL; + if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev) { + if (dst && f6i && f6i->nh && nexthop_is_multipath(f6i->nh)) + dev = dst_dev_rcu(dst); + else + dev = f6i ? fib6_info_nh_dev(f6i) : NULL; + } same_vrf = !l3mdev || l3mdev_master_dev_rcu(dev) == l3mdev; if (f6i && f6i->fib6_prefsrc.plen && same_vrf) *saddr = f6i->fib6_prefsrc.addr; diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index cb648c839431..6627dac626e8 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1162,7 +1162,8 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk, rcu_read_lock(); from = rt ? rcu_dereference(rt->from) : NULL; - err = ip6_route_get_saddr(net, from, &fl6->daddr, + err = ip6_route_get_saddr(net, from, rt ? &rt->dst : NULL, + &fl6->daddr, sk ? READ_ONCE(inet6_sk(sk)->srcprefs) : 0, fl6->flowi6_l3mdev, &fl6->saddr); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1b2dcc066e19..aec54368e1ba 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5881,7 +5881,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, goto nla_put_failure; } else if (dest) { struct in6_addr saddr_buf; - if (ip6_route_get_saddr(net, rt, dest, 0, 0, &saddr_buf) == 0 && + if (ip6_route_get_saddr(net, rt, dst, dest, 0, 0, &saddr_buf) == 0 && nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf)) goto nla_put_failure; } -- 2.53.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection 2026-12-03 23:47 ` [PATCH v2 1/3] ipv6: Use the selected nexthop for source address selection Tim Menninger @ 2026-12-05 0:37 ` netdev-bot+sashiko 0 siblings, 0 replies; 7+ messages in thread From: netdev-bot+sashiko @ 2026-12-05 0:37 UTC (permalink / raw) To: tmenninger Cc: leon, jgg, bharat, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, shuah, slingappa, rpatil, linux-rdma, netdev, linux-kselftest, linux-kernel Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] In ip6_route_get_saddr() (include/net/ip6_route.h), the new branch treats dst->dev as the device of the selected nexthop whenever… -- ipv6: Use the selected nexthop for source address selection This commit passes the dst to ip6_route_get_saddr(). For routes that use a multipath nexthop group, the source address is then picked for the device of the path the lookup selected, not for the group's first nexthop. Both ip6_dst_lookup_tail() and rt6_fill_node() are updated to pass the dst. > diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h > index 95f936be32c6c..d5754f6442bbf 100644 > --- a/include/net/ip6_route.h > +++ b/include/net/ip6_route.h [ ... ] > @@ -155,8 +156,12 @@ static inline int ip6_route_get_saddr(struct net *net, struct fib6_info *f6i, > rcu_read_lock(); > > l3mdev = dev_get_by_index_rcu(net, l3mdev_index); > - if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev) > - dev = f6i ? fib6_info_nh_dev(f6i) : NULL; > + if (!f6i || !f6i->fib6_prefsrc.plen || l3mdev) { > + if (dst && f6i && f6i->nh && nexthop_is_multipath(f6i->nh)) > + dev = dst_dev_rcu(dst); [Severity: Low] Is dst->dev always the device of the selected nexthop here? For routes with RTF_LOCAL or RTF_ANYCAST set, ip6_rt_pcpu_alloc() and ip6_rt_cache_alloc() build their clones with a device from ip6_rt_get_dev_rcu(), and that function replaces the nexthop device: net/ipv6/route.c:ip6_rt_get_dev_rcu() { struct net_device *dev = res->nh->fib_nh_dev; if (res->fib6_flags & (RTF_LOCAL | RTF_ANYCAST)) { ... if (netif_is_l3_slave(dev) && !rt6_need_strict(&res->f6i->fib6_dst.addr)) dev = l3mdev_master_dev_rcu(dev) ? : dev_net(dev)->loopback_dev; else if (!netif_is_l3_master(dev)) dev = dev_net(dev)->loopback_dev; } ... } It looks like such a route can be created with RTN_LOCAL and an RTA_NH_ID that points at a multipath group. rtm_to_fib6_config() sets RTF_LOCAL, and fib6_check_nexthop() only rejects source routing, IPv4 nexthops and FDB nexthops. For that route, ip6_dst_lookup_tail() and rt6_fill_node() would now pass loopback or the VRF master to ipv6_dev_get_saddr(). Neither is the device of any nexthop in the group. Local routes with a single nexthop, or with no nexthop object, still get the real nexthop device from fib6_info_nh_dev(). For link-local or multicast destinations, or when use_oif_addrs_only is set, only the addresses of the device passed in are considered. Could this return ::1 or no usable address? In other cases, the rule 4 (outgoing interface) and VRF master preference would change. Should the new branch skip routes that have RTF_LOCAL or RTF_ANYCAST in f6i->fib6_flags? > + else > + dev = f6i ? fib6_info_nh_dev(f6i) : NULL; > + } > same_vrf = !l3mdev || l3mdev_master_dev_rcu(dev) == l3mdev; > if (f6i && f6i->fib6_prefsrc.plen && same_vrf) > *saddr = f6i->fib6_prefsrc.addr; [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203234720.2428689-1-tmenninger%40everpuredata.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address 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 ` Tim Menninger 2026-12-05 0:37 ` netdev-bot+sashiko 2026-12-03 23:47 ` [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Tim Menninger 2 siblings, 1 reply; 7+ messages in thread From: Tim Menninger @ 2026-12-03 23:47 UTC (permalink / raw) To: leon Cc: jgg, bharat, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, shuah, slingappa, rpatil, linux-rdma, netdev, linux-kselftest, linux-kernel, Tim Menninger Extend ipv6_mpath_select to check that, for a destination hashed to each member of a multipath nexthop group, the reported source address belongs to the device of the selected nexthop. Without "ipv6: Use the selected nexthop for source address selection", the source address always comes from the first nexthop's device and the check fails for the other member. Signed-off-by: Tim Menninger <tmenninger@everpuredata.com> --- Changes in v2: - New patch tools/testing/selftests/net/fib_nexthops.sh | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh index adbec51917eb..cdc8d53d87ac 100755 --- a/tools/testing/selftests/net/fib_nexthops.sh +++ b/tools/testing/selftests/net/fib_nexthops.sh @@ -387,6 +387,16 @@ get_route_dev() fi } +get_route_prefsrc() +{ + local pfx="$1" + local out + + if out=$($IP -j route get "$pfx" | jq -re ".[0].prefsrc"); then + echo "$out" + fi +} + check_route_dev() { local pfx="$1" @@ -867,6 +877,31 @@ ipv6_mpath_select() done log_test $rc 0 "Use valid neighbor during multipath selection" + # The source address must belong to the selected nexthop's device, + # not the device of the group's first nexthop. + local -A srcs + srcs=([veth1]=2001:db8:91::1 [veth3]=2001:db8:92::1) + rc=0 + for dev in veth1 veth3; do + match=0 + for h in {1..65535}; do + addr=$(printf "2001:db8:101::%x" $h) + if [ "$(get_route_dev "$addr")" = "$dev" ]; then + match=1 + break + fi + done + if (( match == 0 )); then + echo "SKIP: Did not find a route using device $dev" + return $ksft_skip + fi + if ! check_output "$(get_route_prefsrc "$addr")" "${srcs[$dev]}"; then + rc=1 + break + fi + done + log_test $rc 0 "Source address of selected multipath nexthop" + run_cmd "$IP neigh add 2001:db8:91::2 dev veth1 nud incomplete" run_cmd "$IP neigh add 2001:db8:92::2 dev veth3 nud incomplete" run_cmd "$IP route get 2001:db8:101::1" -- 2.53.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address 2026-12-03 23:47 ` [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address Tim Menninger @ 2026-12-05 0:37 ` netdev-bot+sashiko 0 siblings, 0 replies; 7+ messages in thread From: netdev-bot+sashiko @ 2026-12-05 0:37 UTC (permalink / raw) To: tmenninger Cc: leon, jgg, bharat, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, shuah, slingappa, rpatil, linux-rdma, netdev, linux-kselftest, linux-kernel Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] In ipv6_mpath_select() (tools/testing/selftests/net/fib_nexthops.sh), the new "Source address… -- selftests: fib_nexthops: Check the IPv6 multipath source address This commit extends ipv6_mpath_select() in fib_nexthops.sh. For a destination hashed to each member of a multipath nexthop group, the test now checks that the reported source address belongs to the device of the selected nexthop. > diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh > index adbec51917eb8..cdc8d53d87acf 100755 > --- a/tools/testing/selftests/net/fib_nexthops.sh > +++ b/tools/testing/selftests/net/fib_nexthops.sh [ ... ] > @@ -867,6 +877,31 @@ ipv6_mpath_select() > done > log_test $rc 0 "Use valid neighbor during multipath selection" > > + # The source address must belong to the selected nexthop's device, > + # not the device of the group's first nexthop. > + local -A srcs > + srcs=([veth1]=2001:db8:91::1 [veth3]=2001:db8:92::1) > + rc=0 > + for dev in veth1 veth3; do [ ... ] > + if ! check_output "$(get_route_prefsrc "$addr")" "${srcs[$dev]}"; then > + rc=1 > + break > + fi > + done > + log_test $rc 0 "Source address of selected multipath nexthop" > + > run_cmd "$IP neigh add 2001:db8:91::2 dev veth1 nud incomplete" > run_cmd "$IP neigh add 2001:db8:92::2 dev veth3 nud incomplete" > run_cmd "$IP route get 2001:db8:101::1" [Severity: Low] When the new prefsrc check fails, does the failure also show up under the "Multipath selection with no valid neighbor" test? The sub-test that follows in ipv6_mpath_select() never resets or recomputes rc. It throws away the exit status of its run_cmd calls and then reports whatever rc already holds: run_cmd "$IP route get 2001:db8:101::1" # if we did not crash, success log_test $rc 0 "Multipath selection with no valid neighbor" So if check_output() fails for either veth1 or veth3, rc=1 is still set when this log_test runs. That gives a second FAIL line and another nfail increment, and the failure is reported against the crash-only test. The commit message says the new check is expected to fail on kernels without "ipv6: Use the selected nexthop for source address selection". That makes this case likely, for example when only the selftest is backported. This stale rc reuse existed before this patch, since the first sub-test's rc used to carry into the last one. This patch changes which result carries over, and that result can now be an expected failure. Would it make sense to reset rc=0 before the "no valid neighbor" sub-test, or to set rc from the exit status of the run_cmd "$IP route get 2001:db8:101::1" call? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203234720.2428689-1-tmenninger%40everpuredata.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups 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 2026-12-05 0:37 ` netdev-bot+sashiko 2 siblings, 1 reply; 7+ messages in thread From: Tim Menninger @ 2026-12-03 23:47 UTC (permalink / raw) To: leon Cc: jgg, bharat, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, shuah, slingappa, rpatil, linux-rdma, netdev, linux-kselftest, linux-kernel, Tim Menninger 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups 2026-12-03 23:47 ` [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Tim Menninger @ 2026-12-05 0:37 ` netdev-bot+sashiko 0 siblings, 0 replies; 7+ messages in thread From: netdev-bot+sashiko @ 2026-12-05 0:37 UTC (permalink / raw) To: tmenninger Cc: leon, jgg, bharat, dsahern, idosch, davem, edumazet, kuba, pabeni, horms, shuah, slingappa, rpatil, linux-rdma, netdev, linux-kselftest, linux-kernel Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] This patch makes rdma_cm's nexthop choice depend on the connection. -- RDMA/core: Use the CM source port in IP route lookups This patch fills in fl4_sport and fl6_sport in addr4_resolve() and addr6_resolve() from the source port that rdma_cm assigned. With an L4-aware fib_multipath_hash_policy, rdma_cm connections to the same destination then spread across the ECMP nexthops. > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c > index bdaa3eb83bccd..6b80cc2c84c88 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); [Severity: Medium] Can this lead the iWARP drivers to resolve the destination MAC of a different nexthop than the one rdma_cm picked? With this change, the nexthop chosen in addr4_resolve() and addr6_resolve() depends on the CM port. That choice decides the egress netdev, the src_dev_addr, the ib_device the cm_id binds to and the resolved source address. irdma and qedr then do their own route and neighbour lookup for the same connection. They key it only on (saddr, daddr), with no ports and no oif: drivers/infiniband/hw/irdma/cm.c:irdma_addr_resolve_neigh() { ... rt = ip_route_output(&init_net, dst_ipaddr, src_ipaddr, 0, 0, RT_SCOPE_UNIVERSE); ... } drivers/infiniband/hw/irdma/cm.c:irdma_get_dst_ipv6() { ... dst = ip6_route_output(&init_net, NULL, &fl6); ... } qedr_addr4_resolve() and qedr_addr6_resolve() in qedr_iw_cm.c do the same thing. The neigh->ha from that second lookup is then written into the context of the device that rdma_cm selected: - irdma_add_arp() stores it, and irdma_make_cm_node() copies it into cm_node->rem_mac. - qedr_iw_connect() resolves it into in_params.remote_mac_addr. The CM now hashes on (saddr, daddr, sport), while the drivers hash on (saddr, daddr, 0). For IPv4 legacy multipath, fib_select_multipath() prefers the nexthop whose nh_saddr matches fl4->saddr. So the driver lookup should still end up on the CM's nexthop. IPv4 nexthop-object groups skip that preference and select on the hash alone: net/ipv4/fib_semantics.c:fib_select_multipath() { ... if (unlikely(res->fi->nh)) { nexthop_path_fib_result(res, hash); return; } ... } IPv6 has no such preference either. fib6_select_path() selects only on the value from rt6_multipath_hash(). In those cases, with hash policy 1 (or 3 with the source port field selected), could the driver pick up the other path's gateway MAC? Or a neighbour that hasn't been resolved, so irdma returns an error and qedr programs a zero MAC? The QP would still transmit on the CM-selected port. Before this patch both lookups were fixed per destination, so a destination either always worked or always failed. Now a destination that used to work might fail intermittently, depending on the CM port. cxgb4 doesn't seem to be affected. cxgb_find_route() already hashes on sport, dport and IPPROTO_TCP, and it checks cxgb_our_interface(). The commit message says: The normal RoCE CM route setup retains the selected interface and destination MAC. Should it also cover the iWARP drivers that do their own L2 resolution? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203234720.2428689-1-tmenninger%40everpuredata.com ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-12-05 0:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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-05 0:37 ` netdev-bot+sashiko 2026-12-03 23:47 ` [PATCH v2 2/3] selftests: fib_nexthops: Check the IPv6 multipath source address Tim Menninger 2026-12-05 0:37 ` netdev-bot+sashiko 2026-12-03 23:47 ` [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Tim Menninger 2026-12-05 0:37 ` netdev-bot+sashiko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox