Skip to content

Commit fffe83c

Browse files
karstengrdavem330
authored andcommitted
net/smc: fix toleration of fake add_link messages
Older SMCR implementations had no link failover support and used one link only. Because the handshake protocol requires to try the establishment of a second link the old code sent a fake add_link message and declined any server response afterwards. The current code supports multiple links and inspects the received fake add_link message more closely. To tolerate the fake add_link messages smc_llc_is_local_add_link() needs an improved check of the message to be able to separate between locally enqueued and fake add_link messages. And smc_llc_cli_add_link() needs to check if the provided qp_mtu size is invalid and reject the add_link request in that case. Fixes: c48254f ("net/smc: move add link processing for new device into llc layer") Reviewed-by: Ursula Braun <[email protected]> Signed-off-by: Karsten Graul <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5566993 commit fffe83c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

net/smc/smc_llc.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,9 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry)
841841
struct smc_init_info ini;
842842
int lnk_idx, rc = 0;
843843

844+
if (!llc->qp_mtu)
845+
goto out_reject;
846+
844847
ini.vlan_id = lgr->vlan_id;
845848
smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev);
846849
if (!memcmp(llc->sender_gid, link->peer_gid, SMC_GID_SIZE) &&
@@ -917,10 +920,20 @@ static void smc_llc_cli_add_link_invite(struct smc_link *link,
917920
kfree(qentry);
918921
}
919922

923+
static bool smc_llc_is_empty_llc_message(union smc_llc_msg *llc)
924+
{
925+
int i;
926+
927+
for (i = 0; i < ARRAY_SIZE(llc->raw.data); i++)
928+
if (llc->raw.data[i])
929+
return false;
930+
return true;
931+
}
932+
920933
static bool smc_llc_is_local_add_link(union smc_llc_msg *llc)
921934
{
922935
if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK &&
923-
!llc->add_link.qp_mtu && !llc->add_link.link_num)
936+
smc_llc_is_empty_llc_message(llc))
924937
return true;
925938
return false;
926939
}

0 commit comments

Comments
 (0)