πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27007

Re: [PATCH net-next v2 3/4] net/smc: set a new link's peer gid and mac at creation

#27007
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 15:41
177 lines
15174 bytes
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] The commit message never says why the change is needed, and it
  hides a hard dependency.
- [Low] "No reader changes behaviour" is not accurate for user-visible
  output.
- [Low] Both the commit message and the new comment in smcr_link_init()
  say the add-link callers overwrite peer_gid/peer_mac in…
- [Low] The new comment in smcr_link_init() says "peer_qpn, peer_psn and
  peer_mtu come from the peer's CLC CONFIRM".

--

net/smc: set a new link's peer gid and mac at creation

This patch makes smcr_link_init() copy peer_gid and peer_mac from
smc_init_info into the new link when the link is created. Before, both
stayed zero until smc_link_save_peer_info() ran after the CLC accept or
confirm. The add-link paths pass a zeroed smc_init_info and fill both
fields from the ADD_LINK message.

> smcr_link_init() leaves lnk->peer_gid and lnk->peer_mac zero. They are
> filled only once the peer's CLC accept or confirm has been processed, by
> smc_link_save_peer_info(), which copies them out of smc_init_info. Both
> values are already in smc_init_info when the link is created, so set them
> there. This changes when the fields become valid, not what they hold.

[Severity: Low]
The message explains why the change is harmless. Could it also say why
the change is needed?

As far as I can tell, the reason is the next patch in the series,
"net/smc: drop smc_server_lgr_pending across the CLC CONFIRM wait". That
patch adds smcr_lgr_pending_match(), which reads peer_gid and peer_mac of
links still in SMC_LNK_ACTIVATING:

    if (!memcmp(lnk->peer_gid, ini->peer_gid, SMC_GID_SIZE) &&
        (ini->smcr_version == SMC_V2 ||
         !memcmp(lnk->peer_mac, ini->peer_mac, ETH_ALEN)))

These fields are only non-zero at that point because of this patch.
Neither commit message mentions the dependency.

smc_link_save_peer_info() in af_smc.c still does the same copy:

    memcpy(link->peer_gid, ini->peer_gid, SMC_GID_SIZE);
    memcpy(link->peer_mac, ini->peer_mac, sizeof(link->peer_mac));

So the patch writes the same values a second time rather than moving the
first write. Read on its own, the patch looks like a no-op cleanup that
could be dropped. If it were dropped, the next patch would still build,
but smcr_lgr_pending_match() would compare zeros against ini->peer_gid
and never match.

Would it make sense to state this dependency in the commit message?

> No reader changes behaviour: the QP is programmed from the gid only after
> the peer info is saved, smcr_lgr_match() looks at active links, and the
> netlink and diag paths display the field.

[Severity: Low]
Is "No reader changes behaviour" accurate for what user space sees?

smc_nl_handle_lgr() dumps every link that passes smc_link_usable().
smc_link_usable() rejects only SMC_LNK_UNUSED and SMC_LNK_INACTIVE, so
SMC_LNK_ACTIVATING links are dumped too:

net/smc/smc_core.c:smc_nl_handle_lgr() {
    ...
		if (!smc_link_usable(&lgr->lnk[i]))
			continue;
		if (smc_nl_fill_lgr_link(lgr, &lgr->lnk[i], skb, cb))
    ...
}

smc_nl_fill_lgr_link() puts link->peer_gid into SMC_NLA_LINK_PEER_GID.
__smc_diag_dump() in smc_diag.c exports it as well.

On the server, smc_lgr_create() adds the link group to smc_lgr_list right
after smcr_link_init(). The link then stays ACTIVATING for the whole CLC
CONFIRM wait, which can last up to CLC_WAIT_TIME.

Netlink and diag dumps taken during that window used to show an all-zero
peer GID. They now show the GID from the proposal. This includes
handshakes that later time out and get cleared.

The value is the same one smc_link_save_peer_info() stores later, so this
looks harmless. Could the message describe this change rather than call
it a non-change?

The message also leaves out two other readers: the link selection loop in
smc_connect_rdma() and smc_llc_find_asym_link(). Neither seems to change
in practice:

- The smc_connect_rdma() loop also needs peer_qpn to match, and peer_qpn
  is still 0.
- smc_llc_find_asym_link() never sees two links during a first contact.

> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index 34fd8f3e7939f..61d4d4b559caf 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -824,6 +824,15 @@ int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
>  		lnk->wr_rx_sge_cnt = 1;
>  		lnk->wr_rx_buflen = SMC_WR_BUF_SIZE;
>  	}
> +	/* peer_qpn, peer_psn and peer_mtu come from the peer's CLC CONFIRM and
> +	 * are filled later by smc_link_save_peer_info(). The gid and the mac are

[Severity: Low]
Does this hold on the client side? Only the server takes these values
from the CLC CONFIRM, in smc_listen_rdma_finish():

    smc_link_save_peer_info(link, cclc, ini);

On the client, smc_connect_rdma() passes the server's CLC ACCEPT:

    if (ini->first_contact_local)
        smc_link_save_peer_info(link, aclc, ini);

So for client first links, peer_qpn, peer_psn and peer_mtu come from the
ACCEPT. The commit message gets this right ("the peer's CLC accept or
confirm").

At the end of the series, the comment still names only CLC CONFIRM for
these fields. The same comment says the gid and mac come "from the
proposal on the server and from the accept on the client", so the comment
contradicts itself.

> +	 * already in ini here, and smc_link_save_peer_info() copies them from the
> +	 * same fields, so this changes when they become valid and not what they
> +	 * hold. The add-link callers pass a zeroed ini and overwrite both in
> +	 * smc_llc_save_add_link_info() straight after.
> +	 */

[Severity: Low]
Is "straight after" accurate for the server add-link path? It holds for
the client, where smc_llc_cli_add_link() calls
smc_llc_save_add_link_info() right after smcr_link_init().

In smc_llc_srv_add_link(), several steps run between the two calls,
including a blocking wait for the peer:

smc_llc_srv_add_link()
    smcr_link_init()
    smcr_buf_map_lgr()
    smc_llc_send_add_link()
    smc_llc_wait(..., SMC_LLC_WAIT_TIME, SMC_LLC_ADD_LINK)
    ...
    smc_llc_save_add_link_info(link_new, add_llc);

The -ETIMEDOUT and -ENOLINK exits after smc_llc_wait() skip
smc_llc_save_add_link_info() entirely.

Later in the series, "net/smc: drop smc_server_lgr_pending across the CLC
CONFIRM wait" changes the comment to say "afterwards". This commit
message still says "straight after".

Could the comment be fixed in this patch rather than in a later one, and
the commit message updated to match?

The comment also reads like a changelog ("this changes when they become
valid and not what they hold"), and it still does at the end of the
series. It describes the patch rather than the code, which will read
oddly once merged.

Could it describe the code's behaviour instead?

[ ... ]

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203153514.1440337-1-ermenson.sec%40gmail.com
Technical Details
Message-ID: <179639891424.3146.6361540241954783090@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377451-linux-kernel-netdev=dewy.ru
References: <20261203153514.1440337-4-ermenson.sec@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377451-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 3/4] net/smc: set a new link's peer gid and
 mac at creation
Date: Fri, 04 Dec 2026 15:41:54 +0000
Organization: Usenet Network
Message-ID: <179639891424.3146.6361540241954783090@kernel.org>
References: <20261203153514.1440337-4-ermenson.sec@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2797004"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6LnjrhA3h0aR2qk/zKYltY1K70M= sha256:ThFtdZcQnjIYo9jFmWO8J4Fofu92Mx+tkEkQYPNRrjk=
	sha1:w9yMxS/1tKjMVztcCUZQwHbhPW4= sha256:kYTaOPwZiwEa9mUpznCRoS7FA2H/AkAR17NViRSOFaY=
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 B925D117C4D; Fri,  4 Dec 2026 18:42:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.541
X-Spam-Status: No, score=-3.541 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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, URIBL_BLOCKED=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 FJ0-tyagUTg9;
	Fri,  4 Dec 2026 18:42:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377451-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 2043C117C17; Fri,  4 Dec 2026 18:42:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 35E2685EBD; Fri,  4 Dec 2026 15:42:07 +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=1796398927;
	b=nqW8TpDOs6/7KHZ0xIPJQx3IvvremF1wIfWfePieMXi2IYTRUWPNhVp4vDLTT9xi2C2f
	 skioHFJYzpLItMfsStwLVcCWmEsMacAlI8RECIB3bz3NsEsgpThU64LhBJQPr5AE5aYl4
	 vukLJWC8lEbjhL+lu+VGqmR2tWOD8obdnlY08ZWmLhOovmJx/TIcLHY4y4FztZLFLYVMh
	 jQsqiLoo7QkVMWZU8nX4sT+7UMvoobA/jjdthIAXfAOYN81j5hzJTmbM7cWpErZdrOohw
	 sx7yiQqcvm3OVbXpt6X2TMK6IN2vPbRGVdkY86XO6m8tt4EF9SQOZDzCPazQ7SiTslA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796398927;
	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=aetvwxBEKI4V6vIlorY5y2hUJO2VRNYnmhW7YwlVBJg=;
	b=qlienTfbrw1UqCjzF7l5eYQvXp88V+fiFuYnjYhall6DhO/xe81V7m1T5IKGaGfrUmmz
	 16OVEv1QT5zgrocEINAItB6rBtwstYc584IoHlO5n1ozc6DWkSfu5E9EaJ2M3Uc+itHM0
	 AZccQrV30OzaY/aT0ZaB/eJJM5KdPG+hxEoeIyUoiiYMyl6LYPPbwLo31J8sk3R4jukiV
	 dDrghdlN4go7WjqJKrCrAppbs2aMIm1WZ9fWGLFrk/emAcmucrG+aBGiRA2nFis22x7h5
	 ZKs4IXNOFsJNBcwjsr4ZaHM9HH04R86yE1jxrgS3+cPG2gkh+fAMYVUmsoRwse677fQ==
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=RkHy4L11;
	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 E6FAC606A334;
	Fri,  4 Dec 2026 15:42:06 +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=RkHy4L11
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=1796398916;
	b=h6Gtfxb+8z6WE0U3gjm8HKdyj9j/P/BmdKaMakvvRO+L88cgByQt5XdtdnY04bgU0FBS
	 PAi2R+S19zuLN7tN86UTf+dk2AvUbG1QL6Ck0NNCl62lYskmUR1O0KleqYv0C1EZjrUsh
	 fpq6pVcBV57lkuSQvEtFA4Bnh31iqiyq/qRHrIkvYoifYn4n3+8B31rphMRYnvnlDjLZL
	 ubzBNkgrbhnHM3ZYSKy9VxSBW/xdOBOBQrEzVQH6CKlD+d4iNB3ygwsbFxMe7L25Q6EkU
	 m+hoaQtNB4AhsMWPl3zZbuQ+uff80N9lS4mbMf+Ji6n6Ucda9d6qkbyCPnblNTOF9qQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796398916;
	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=aetvwxBEKI4V6vIlorY5y2hUJO2VRNYnmhW7YwlVBJg=;
	b=unhjsi/5j0g+5vi/BeiPg7YBEdiB1Zx0WlVekq37mQX0p6Awa0nCvACXfaW9QN5d2kUx
	 xuB2fc/2g/pSUyJ83IObOFi79anNnhFA7vyqsSxJ+1eBs/FLi3Lhs+QUuesYkc9Q7mm+0
	 TWpqtDeyGW/fBAbqBvEjaB+/7RKz62cBELLvFUG+hawHCamP0f7QIFKuEXkArhh9E4oVL
	 r2jrODHG/er6baF3Cwi6ZjHDd4iJWcthahIdmh8Z5kPhcuMVdBFfa+oOIe6HMh/tb7Mug
	 jahah0l+fOf2tFpNiY8cbLawYXGw9eNXx7WA0yLuyGiwKl+oRbNqovE16qexYu4j0pQ==
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=RkHy4L11;
	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 0D3E5606A32F;
	Fri,  4 Dec 2026 15:41:55 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0C4C1F000C2;
	Fri,  4 Dec 2026 15:41:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796398915;
	bh=aetvwxBEKI4V6vIlorY5y2hUJO2VRNYnmhW7YwlVBJg=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=RkHy4L11mSUpMi6i9YmlH8UxPQrFb2MtPVlwlNwSWzjxvZ+Endz6cDPuragBhKlZF
	 F12Rn7i6wCr5QIJBpOaKpoxFLpR99PYYkekngVQrnRfLvQHrD1jeeXdfVTG4IeJim3
	 r8gfCU/rhzk+pZqLJIBfYKZuUWXWZfeN+2vEOtPs+Q0jNCDTybjsU+Bp8RTs6vHs5y
	 Dj0Te4NAfY69kwrDOCDzHcjSSZedq7WQZZtmS3T2s0g8Ob0ndheb13HRd8yGiJAVJk
	 5Mm35elh5idUiumJXAONlMzl/hL8UqW3JLVbgyLZ4t4H5iHO7yjPQXR+1grmhONoNz
	 3oTS8vTLa52uA==
X-Cc: alibuda@linux.alibaba.com, dust.li@linux.alibaba.com,
 sidraya@linux.ibm.com, mjambigi@linux.ibm.com, tonylu@linux.alibaba.com,
 guwen@linux.alibaba.com, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org,
 netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
 linux-s390@vger.kernel.org
X-In-Reply-To: <20261203153514.1440337-4-ermenson.sec@gmail.com>
X-sashiko-severity: Low
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