提交 57b49924 编写于 作者: K Karsten Graul 提交者: David S. Miller

net/smc: rkey processing for a new link as SMC server

Part of SMC server new link establishment is the exchange of rkeys for
used buffers.
Loop over all used RMB buffers and send ADD_LINK_CONTINUE LLC messages
to the peer.
Signed-off-by: NKarsten Graul <kgraul@linux.ibm.com>
Reviewed-by: NUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2d2209f2
......@@ -863,6 +863,47 @@ static void smc_llc_process_cli_add_link(struct smc_link_group *lgr)
mutex_unlock(&lgr->llc_conf_mutex);
}
static int smc_llc_srv_rkey_exchange(struct smc_link *link,
struct smc_link *link_new)
{
struct smc_llc_msg_add_link_cont *addc_llc;
struct smc_link_group *lgr = link->lgr;
u8 max, num_rkeys_send, num_rkeys_recv;
struct smc_llc_qentry *qentry = NULL;
struct smc_buf_desc *buf_pos;
int buf_lst;
int rc = 0;
int i;
mutex_lock(&lgr->rmbs_lock);
num_rkeys_send = lgr->conns_num;
buf_pos = smc_llc_get_first_rmb(lgr, &buf_lst);
do {
smc_llc_add_link_cont(link, link_new, &num_rkeys_send,
&buf_lst, &buf_pos);
qentry = smc_llc_wait(lgr, link, SMC_LLC_WAIT_TIME,
SMC_LLC_ADD_LINK_CONT);
if (!qentry) {
rc = -ETIMEDOUT;
goto out;
}
addc_llc = &qentry->msg.add_link_cont;
num_rkeys_recv = addc_llc->num_rkeys;
max = min_t(u8, num_rkeys_recv, SMC_LLC_RKEYS_PER_CONT_MSG);
for (i = 0; i < max; i++) {
smc_rtoken_set(lgr, link->link_idx, link_new->link_idx,
addc_llc->rt[i].rmb_key,
addc_llc->rt[i].rmb_vaddr_new,
addc_llc->rt[i].rmb_key_new);
num_rkeys_recv--;
}
smc_llc_flow_qentry_del(&lgr->llc_flow_lcl);
} while (num_rkeys_send || num_rkeys_recv);
out:
mutex_unlock(&lgr->rmbs_lock);
return rc;
}
int smc_llc_srv_add_link(struct smc_link *link)
{
enum smc_lgr_type lgr_new_t = SMC_LGR_SYMMETRIC;
......@@ -923,7 +964,7 @@ int smc_llc_srv_add_link(struct smc_link *link)
rc = smcr_buf_reg_lgr(link_new);
if (rc)
goto out_err;
/* tbd: rc = smc_llc_srv_rkey_exchange(link, link_new); */
rc = smc_llc_srv_rkey_exchange(link, link_new);
if (rc)
goto out_err;
/* tbd: rc = smc_llc_srv_conf_link(link, link_new, lgr_new_t); */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册