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 --- 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