Skip to content

Commit

Permalink
net/smc: rkey processing for a new link as SMC server
Browse files Browse the repository at this point in the history
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: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Karsten Graul authored and David S. Miller committed May 3, 2020
1 parent 2d2209f commit 57b4992
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion net/smc/smc_llc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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); */
Expand Down

0 comments on commit 57b4992

Please sign in to comment.