From: Ermenson Junior <ermenson.sec@gmail.com>
To: alibuda@linux.alibaba.com, dust.li@linux.alibaba.com,
sidraya@linux.ibm.com, mjambigi@linux.ibm.com
Cc: 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
Subject: [PATCH net-next v2 3/4] net/smc: set a new link's peer gid and mac at creation
Date: Thu, 3 Dec 2026 12:35:13 -0300 [thread overview]
Message-ID: <20261203153514.1440337-4-ermenson.sec@gmail.com> (raw)
In-Reply-To: <20261203153514.1440337-1-ermenson.sec@gmail.com>
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.
peer_qpn, peer_psn and peer_mtu come from the CLC message and stay where
they are.
The add-link paths pass a zeroed smc_init_info, so the new link gets zeros
as before, and smc_llc_save_add_link_info() fills both from the ADD_LINK
message straight after.
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.
Signed-off-by: Ermenson Junior <ermenson.sec@gmail.com>
---
net/smc/smc_core.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index a3164201c142..d265e83f1845 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
+ * 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.
+ */
+ memcpy(lnk->peer_gid, ini->peer_gid, SMC_GID_SIZE);
+ memcpy(lnk->peer_mac, ini->peer_mac, sizeof(lnk->peer_mac));
get_device(&lnk->smcibdev->ibdev->dev);
atomic_inc(&lnk->smcibdev->lnk_cnt);
refcount_set(&lnk->refcnt, 1); /* link refcnt is set to 1 */
--
2.43.0
next prev parent reply other threads:[~2026-12-03 15:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 15:35 [PATCH net-next v2 0/4] net/smc: stop a silent peer stalling every server handshake Ermenson Junior
2026-12-03 15:35 ` [PATCH net-next v2 1/4] net/smc: bound the SMC-Rv1 add-link rkey exchange Ermenson Junior
2026-12-03 15:35 ` [PATCH net-next v2 2/4] net/smc: check the ADD_LINK_CONT send result in the server " Ermenson Junior
2026-12-03 15:35 ` Ermenson Junior [this message]
2026-12-03 15:35 ` [PATCH net-next v2 4/4] net/smc: drop smc_server_lgr_pending across the CLC CONFIRM wait Ermenson Junior
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=20261203153514.1440337-4-ermenson.sec@gmail.com \
--to=ermenson.sec@gmail.com \
--cc=alibuda@linux.alibaba.com \
--cc=davem@davemloft.net \
--cc=dust.li@linux.alibaba.com \
--cc=edumazet@kernel.org \
--cc=guwen@linux.alibaba.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjambigi@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sidraya@linux.ibm.com \
--cc=tonylu@linux.alibaba.com \
--cc=willemb@google.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