Skip to content

Commit 5b95dea

Browse files
committed
Merge branch 'net-smc-extent-buffer-mapping-and-port-handling'
Karsten Graul says: ==================== net/smc: extent buffer mapping and port handling Add functionality to map/unmap and register/unregister memory buffers for specific SMC-R links and for the whole link group. Prepare LLC layer messages for the support of multiple links and extent the processing of adapter events. And add further small preparations needed for the SMC-R failover support. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 47c0b58 + b45e7f9 commit 5b95dea

File tree

11 files changed

+522
-196
lines changed

11 files changed

+522
-196
lines changed

drivers/net/ethernet/freescale/enetc/enetc_qos.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,13 +1016,15 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv,
10161016
!is_zero_ether_addr(match.mask->src)) {
10171017
NL_SET_ERR_MSG_MOD(extack,
10181018
"Cannot match on both source and destination MAC");
1019+
err = EINVAL;
10191020
goto free_filter;
10201021
}
10211022

10221023
if (!is_zero_ether_addr(match.mask->dst)) {
10231024
if (!is_broadcast_ether_addr(match.mask->dst)) {
10241025
NL_SET_ERR_MSG_MOD(extack,
10251026
"Masked matching on destination MAC not supported");
1027+
err = EINVAL;
10261028
goto free_filter;
10271029
}
10281030
ether_addr_copy(filter->sid.dst_mac, match.key->dst);
@@ -1033,13 +1035,15 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv,
10331035
if (!is_broadcast_ether_addr(match.mask->src)) {
10341036
NL_SET_ERR_MSG_MOD(extack,
10351037
"Masked matching on source MAC not supported");
1038+
err = EINVAL;
10361039
goto free_filter;
10371040
}
10381041
ether_addr_copy(filter->sid.src_mac, match.key->src);
10391042
filter->sid.filtertype = STREAMID_TYPE_SMAC;
10401043
}
10411044
} else {
10421045
NL_SET_ERR_MSG_MOD(extack, "Unsupported, must include ETH_ADDRS");
1046+
err = EINVAL;
10431047
goto free_filter;
10441048
}
10451049

net/smc/af_smc.c

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -337,46 +337,39 @@ static void smc_copy_sock_settings_to_smc(struct smc_sock *smc)
337337
smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC);
338338
}
339339

340-
/* register a new rmb, send confirm_rkey msg to register with peer */
341-
static int smcr_link_reg_rmb(struct smc_link *link,
342-
struct smc_buf_desc *rmb_desc, bool conf_rkey)
343-
{
344-
if (!rmb_desc->is_reg_mr[link->link_idx]) {
345-
/* register memory region for new rmb */
346-
if (smc_wr_reg_send(link, rmb_desc->mr_rx[link->link_idx])) {
347-
rmb_desc->is_reg_err = true;
348-
return -EFAULT;
349-
}
350-
rmb_desc->is_reg_mr[link->link_idx] = true;
351-
}
352-
if (!conf_rkey)
353-
return 0;
354-
355-
/* exchange confirm_rkey msg with peer */
356-
if (!rmb_desc->is_conf_rkey) {
357-
if (smc_llc_do_confirm_rkey(link, rmb_desc)) {
358-
rmb_desc->is_reg_err = true;
359-
return -EFAULT;
360-
}
361-
rmb_desc->is_conf_rkey = true;
362-
}
363-
return 0;
364-
}
365-
366340
/* register the new rmb on all links */
367-
static int smcr_lgr_reg_rmbs(struct smc_link_group *lgr,
341+
static int smcr_lgr_reg_rmbs(struct smc_link *link,
368342
struct smc_buf_desc *rmb_desc)
369343
{
370-
int i, rc;
344+
struct smc_link_group *lgr = link->lgr;
345+
int i, rc = 0;
371346

347+
rc = smc_llc_flow_initiate(lgr, SMC_LLC_FLOW_RKEY);
348+
if (rc)
349+
return rc;
350+
/* protect against parallel smc_llc_cli_rkey_exchange() and
351+
* parallel smcr_link_reg_rmb()
352+
*/
353+
mutex_lock(&lgr->llc_conf_mutex);
372354
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {
373355
if (lgr->lnk[i].state != SMC_LNK_ACTIVE)
374356
continue;
375-
rc = smcr_link_reg_rmb(&lgr->lnk[i], rmb_desc, true);
357+
rc = smcr_link_reg_rmb(&lgr->lnk[i], rmb_desc);
376358
if (rc)
377-
return rc;
359+
goto out;
378360
}
379-
return 0;
361+
362+
/* exchange confirm_rkey msg with peer */
363+
rc = smc_llc_do_confirm_rkey(link, rmb_desc);
364+
if (rc) {
365+
rc = -EFAULT;
366+
goto out;
367+
}
368+
rmb_desc->is_conf_rkey = true;
369+
out:
370+
mutex_unlock(&lgr->llc_conf_mutex);
371+
smc_llc_flow_stop(lgr, &lgr->llc_flow_lcl);
372+
return rc;
380373
}
381374

382375
static int smcr_clnt_conf_first_link(struct smc_sock *smc)
@@ -408,7 +401,7 @@ static int smcr_clnt_conf_first_link(struct smc_sock *smc)
408401

409402
smc_wr_remember_qp_attr(link);
410403

411-
if (smcr_link_reg_rmb(link, smc->conn.rmb_desc, false))
404+
if (smcr_link_reg_rmb(link, smc->conn.rmb_desc))
412405
return SMC_CLC_DECL_ERR_REGRMB;
413406

414407
/* confirm_rkey is implicit on 1st contact */
@@ -670,7 +663,7 @@ static int smc_connect_rdma(struct smc_sock *smc,
670663
return smc_connect_abort(smc, SMC_CLC_DECL_ERR_RDYLNK,
671664
ini->cln_first_contact);
672665
} else {
673-
if (smcr_lgr_reg_rmbs(smc->conn.lgr, smc->conn.rmb_desc))
666+
if (smcr_lgr_reg_rmbs(link, smc->conn.rmb_desc))
674667
return smc_connect_abort(smc, SMC_CLC_DECL_ERR_REGRMB,
675668
ini->cln_first_contact);
676669
}
@@ -1045,7 +1038,7 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)
10451038

10461039
link->lgr->type = SMC_LGR_SINGLE;
10471040

1048-
if (smcr_link_reg_rmb(link, smc->conn.rmb_desc, false))
1041+
if (smcr_link_reg_rmb(link, smc->conn.rmb_desc))
10491042
return SMC_CLC_DECL_ERR_REGRMB;
10501043

10511044
/* send CONFIRM LINK request to client over the RoCE fabric */
@@ -1220,7 +1213,7 @@ static int smc_listen_rdma_reg(struct smc_sock *new_smc, int local_contact)
12201213
struct smc_connection *conn = &new_smc->conn;
12211214

12221215
if (local_contact != SMC_FIRST_CONTACT) {
1223-
if (smcr_lgr_reg_rmbs(conn->lgr, conn->rmb_desc))
1216+
if (smcr_lgr_reg_rmbs(conn->lnk, conn->rmb_desc))
12241217
return SMC_CLC_DECL_ERR_REGRMB;
12251218
}
12261219
smc_rmb_sync_sg_for_device(&new_smc->conn);

0 commit comments

Comments
 (0)