Commit fffe83c8 authored by Karsten Graul's avatar Karsten Graul Committed by David S. Miller

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: c48254fa ("net/smc: move add link processing for new device into llc layer")
Reviewed-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 55669934
...@@ -841,6 +841,9 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry) ...@@ -841,6 +841,9 @@ int smc_llc_cli_add_link(struct smc_link *link, struct smc_llc_qentry *qentry)
struct smc_init_info ini; struct smc_init_info ini;
int lnk_idx, rc = 0; int lnk_idx, rc = 0;
if (!llc->qp_mtu)
goto out_reject;
ini.vlan_id = lgr->vlan_id; ini.vlan_id = lgr->vlan_id;
smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev); smc_pnet_find_alt_roce(lgr, &ini, link->smcibdev);
if (!memcmp(llc->sender_gid, link->peer_gid, SMC_GID_SIZE) && 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, ...@@ -917,10 +920,20 @@ static void smc_llc_cli_add_link_invite(struct smc_link *link,
kfree(qentry); kfree(qentry);
} }
static bool smc_llc_is_empty_llc_message(union smc_llc_msg *llc)
{
int i;
for (i = 0; i < ARRAY_SIZE(llc->raw.data); i++)
if (llc->raw.data[i])
return false;
return true;
}
static bool smc_llc_is_local_add_link(union smc_llc_msg *llc) static bool smc_llc_is_local_add_link(union smc_llc_msg *llc)
{ {
if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK && if (llc->raw.hdr.common.type == SMC_LLC_ADD_LINK &&
!llc->add_link.qp_mtu && !llc->add_link.link_num) smc_llc_is_empty_llc_message(llc))
return true; return true;
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment