net/smc: multi-link support for smc_rmb_rtoken_handling()
Extend smc_rmb_rtoken_handling() and smc_rtoken_delete() to support multiple links. Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Reviewed-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b9247544c1
commit
e07d31dc16
|
@ -640,7 +640,7 @@ static int smc_connect_rdma(struct smc_sock *smc,
|
|||
if (ini->cln_first_contact == SMC_FIRST_CONTACT)
|
||||
smc_link_save_peer_info(link, aclc);
|
||||
|
||||
if (smc_rmb_rtoken_handling(&smc->conn, aclc))
|
||||
if (smc_rmb_rtoken_handling(&smc->conn, link, aclc))
|
||||
return smc_connect_abort(smc, SMC_CLC_DECL_ERR_RTOK,
|
||||
ini->cln_first_contact);
|
||||
|
||||
|
@ -1231,7 +1231,7 @@ static int smc_listen_rdma_finish(struct smc_sock *new_smc,
|
|||
if (local_contact == SMC_FIRST_CONTACT)
|
||||
smc_link_save_peer_info(link, cclc);
|
||||
|
||||
if (smc_rmb_rtoken_handling(&new_smc->conn, cclc)) {
|
||||
if (smc_rmb_rtoken_handling(&new_smc->conn, link, cclc)) {
|
||||
reason_code = SMC_CLC_DECL_ERR_RTOK;
|
||||
goto decline;
|
||||
}
|
||||
|
|
|
@ -1392,19 +1392,20 @@ int smc_rtoken_add(struct smc_link *lnk, __be64 nw_vaddr, __be32 nw_rkey)
|
|||
return i;
|
||||
}
|
||||
|
||||
/* delete an rtoken */
|
||||
/* delete an rtoken from all links */
|
||||
int smc_rtoken_delete(struct smc_link *lnk, __be32 nw_rkey)
|
||||
{
|
||||
struct smc_link_group *lgr = smc_get_lgr(lnk);
|
||||
u32 rkey = ntohl(nw_rkey);
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < SMC_RMBS_PER_LGR_MAX; i++) {
|
||||
if (lgr->rtokens[i][lnk->link_idx].rkey == rkey &&
|
||||
test_bit(i, lgr->rtokens_used_mask)) {
|
||||
lgr->rtokens[i][lnk->link_idx].rkey = 0;
|
||||
lgr->rtokens[i][lnk->link_idx].dma_addr = 0;
|
||||
|
||||
for (j = 0; j < SMC_LINKS_PER_LGR_MAX; j++) {
|
||||
lgr->rtokens[i][j].rkey = 0;
|
||||
lgr->rtokens[i][j].dma_addr = 0;
|
||||
}
|
||||
clear_bit(i, lgr->rtokens_used_mask);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1414,9 +1415,10 @@ int smc_rtoken_delete(struct smc_link *lnk, __be32 nw_rkey)
|
|||
|
||||
/* save rkey and dma_addr received from peer during clc handshake */
|
||||
int smc_rmb_rtoken_handling(struct smc_connection *conn,
|
||||
struct smc_link *lnk,
|
||||
struct smc_clc_msg_accept_confirm *clc)
|
||||
{
|
||||
conn->rtoken_idx = smc_rtoken_add(conn->lnk, clc->rmb_dma_addr,
|
||||
conn->rtoken_idx = smc_rtoken_add(lnk, clc->rmb_dma_addr,
|
||||
clc->rmb_rkey);
|
||||
if (conn->rtoken_idx < 0)
|
||||
return conn->rtoken_idx;
|
||||
|
|
|
@ -309,7 +309,7 @@ void smc_smcd_terminate_all(struct smcd_dev *dev);
|
|||
void smc_smcr_terminate_all(struct smc_ib_device *smcibdev);
|
||||
int smc_buf_create(struct smc_sock *smc, bool is_smcd);
|
||||
int smc_uncompress_bufsize(u8 compressed);
|
||||
int smc_rmb_rtoken_handling(struct smc_connection *conn,
|
||||
int smc_rmb_rtoken_handling(struct smc_connection *conn, struct smc_link *link,
|
||||
struct smc_clc_msg_accept_confirm *clc);
|
||||
int smc_rtoken_add(struct smc_link *lnk, __be64 nw_vaddr, __be32 nw_rkey);
|
||||
int smc_rtoken_delete(struct smc_link *lnk, __be32 nw_rkey);
|
||||
|
|
Loading…
Reference in New Issue