Article View: linux.kernel.netdev
Article #27193Re: [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 00:37
Date: Sat, 05 Dec 2026 00:37
123 lines
12366 bytes
12366 bytes
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
Technical Details
Message-ID:
<179643105116.3146.11951961371618442363@kernel.org>Path:
mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377769-linux-kernel-netdev=dewy.ruReferences:
<20261203234720.2428689-4-tmenninger@everpuredata.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377769-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v2 3/3] RDMA/core: Use the CM source port in IP route lookups Date: Sat, 05 Dec 2026 00:37:31 +0000 Organization: Usenet Network Message-ID: <179643105116.3146.11951961371618442363@kernel.org> References: <20261203234720.2428689-4-tmenninger@everpuredata.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2917227"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:20Am/tVavKWn8CZLT8zzFCOSUno= sha256:jWbKnLpG9pQdZpLBe5jqDhIa1fjZkIIurHSNC6drIog= sha1:E0Q4i8hBKeGahGffXIc87a0KyxE= sha256:0jetRBNcsIGbBF+vn2veCbDE8kV0ffw6obLRV9w/vzs= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id AFA78117D32; Sat, 5 Dec 2026 03:37:55 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.642 X-Spam-Status: No, score=-3.642 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uAeuL1SFr4SX; Sat, 5 Dec 2026 03:37:52 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-377769-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 405F9117D31; Sat, 5 Dec 2026 03:37:41 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 240596071AC; Sat, 5 Dec 2026 00:37:40 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796431059; b=CvgKG/RfAU9vF8EMTB59G2qKTd2reIzysL5m7YRHYwdAENKBG8QBd/hmPoXOTyoMlR7h p2wKaVKyEjvk10+pDNNL8AjiEN3o11FL84DdzeY+pKKePIGUGc9GlK4+Pg4O6bActDP8x crA+KMK97XU2tVpmS2EAAk0aSKWpXg4VnpwyTvDwJARVIINB7XumsLXKoQwBCvtj0OZoY 1jOYNwkG6s4LZdA/zgrD7oKurQfa65WeCnQyovNfZW8nXfCZ4qL1KSTG0qppXNfZkIZ+q 5ghyBlP4duQo61VGvwNWWpVNEJNW4iU51x+SdBf9ExsgLnVL1sukGPMc1o0RLvZ/16Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796431059; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=1Y4bf2GMqWHxCIzHCRcW/5JWxhLy2vgrBZdyGGpr6AA=; b=ihXP34eHTZOHGQaHaA3QPTzgbo6Gss0P6jU2P4AHAfnRri4rj3sLpwfNtqvork6S4Sf6 BnzIQnnnyZ2L5Wonwmy3y/sCMaLn7u/z9ZejjheDesps3ZSADOLIqwNHKekwZfYrbdWCV EYUmuQXHxW1IIYprMeEiGJZPL3Kd1pIsfi258ER9fRbZS/IFf8uz7RavmOPDzUp/Ba+SC DgJeJHDntK5PL0/Uk3oxAdHdedCepMkoVLdTeQahmE0gt3iHBcACWbOsnzMZBf03ja/ul h6qeMpBbh17KG+2tCTpKV/IT1bvbTVxqWUIK73G9K2cOkwAMxXXclEkmj7kn2k4acYA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BjNTex0e; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F34C606A337; Sat, 5 Dec 2026 00:37:39 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BjNTex0e X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796431053; b=oZgdqWuJGOFl5ZvM/muapsWUOzWXZ0+8ZxltOxuiI6FVScKKCDc2/xALhj0VR4i7hakk xpuKV07CSYalcaDFrUxVovLtJOxf14VV1dRd4tzrjQmrW5j0q7fxTa1mM3X554wHgps+Y jdusdkdo2K4nketcUh5tOMs+oVKKo4ZLQ7c3vb5bEM3fdJnQoFLgZZ9hdoxqm7RkoWROa MaEUAcaRkPPOYe/+6GWD0rhNwIXYTgZaWNzy0IKT8QcXqFQ+UDIqackNrQNArbuEUGQX2 jIG/946yIVtoLPFlZ/pm1gXb3i1Et4J7BhYYwjdHr55OKWbzlsG76Po9x67ysuZu1lg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796431053; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=1Y4bf2GMqWHxCIzHCRcW/5JWxhLy2vgrBZdyGGpr6AA=; b=QOYNc2xEFHpgaUmWFIqXQ+ABmgo7eJLyvzOwAXNg9isypAJU4CRl+MKjGBKF+yRbnJKb EBAerp1MMMiLwj4MALvNEGAALUgkb83DwWEc08U8GiVljNqMwuFk9uhFDoxZBQK2NBhSe +0Uemen1wcwi6Sbf6EeqdQLbefpvEiqeGwxnbnGzjFZUuiXIxJUO4jFcRnoC2xG7sw2qR 9kDO47UGlghzoLT9J+OI2hqfafD4XILEro+c6Jn2IVxYG6iVX75EBhST/EwdJQVTpUI0B /M8C//sUK2qYFJiSdlVPPGe15VL7zM2X7VF4c/Oy1HCLSq0wFdwlGOB+yQiqB51KB1A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BjNTex0e; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3153D606A682; Sat, 5 Dec 2026 00:37:32 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A21181F00A17; Sat, 5 Dec 2026 00:37:31 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796431052; bh=1Y4bf2GMqWHxCIzHCRcW/5JWxhLy2vgrBZdyGGpr6AA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BjNTex0e2R+prXV5a8eTAqkqIt4yjLRuP29qAGDXqoGJ43aUSRATRia6loYeE6J8R FZi1UurL5TK/a5gYF0cmpY0kr2Th8foE89JsAl/OIVH1DKrZUtCdP31Ud6AugpJukh olasgEMYyNqHIJcJwV8IbYDge+qtY0/0JpqMhgaevoMvR8nD4X9BH/b1qHlV9RqbsF eMXT6tYe2XAiTr0Y9XVDhBYMsBXPYKesOU3l94QHIOX1pgQ2XYMSqeZq++dgG9aIFH Bga+FxgP0BSXbNeJ6vwFFjTKkt2KbWz7rtjdG5uGTc+Z8qOxbeKxuTDWOmbaFgQ0WD jqB66FGMz8Kng== X-Cc: leon@kernel.org, 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 X-In-Reply-To: <20261203234720.2428689-4-tmenninger@everpuredata.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list