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

net/smc: call consolidation

Consolidate the call to smc_wr_reg_send() in a new function.
No functional changes.
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent df80b8fb
...@@ -292,6 +292,15 @@ static void smc_copy_sock_settings_to_smc(struct smc_sock *smc) ...@@ -292,6 +292,15 @@ static void smc_copy_sock_settings_to_smc(struct smc_sock *smc)
smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC); smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC);
} }
/* register a new rmb */
static int smc_reg_rmb(struct smc_link *link, struct smc_buf_desc *rmb_desc)
{
/* register memory region for new rmb */
if (smc_wr_reg_send(link, rmb_desc->mr_rx[SMC_SINGLE_LINK]))
return -EFAULT;
return 0;
}
static int smc_clnt_conf_first_link(struct smc_sock *smc) static int smc_clnt_conf_first_link(struct smc_sock *smc)
{ {
struct smc_link_group *lgr = smc->conn.lgr; struct smc_link_group *lgr = smc->conn.lgr;
...@@ -321,9 +330,7 @@ static int smc_clnt_conf_first_link(struct smc_sock *smc) ...@@ -321,9 +330,7 @@ static int smc_clnt_conf_first_link(struct smc_sock *smc)
smc_wr_remember_qp_attr(link); smc_wr_remember_qp_attr(link);
rc = smc_wr_reg_send(link, if (smc_reg_rmb(link, smc->conn.rmb_desc))
smc->conn.rmb_desc->mr_rx[SMC_SINGLE_LINK]);
if (rc)
return SMC_CLC_DECL_INTERR; return SMC_CLC_DECL_INTERR;
/* send CONFIRM LINK response over RoCE fabric */ /* send CONFIRM LINK response over RoCE fabric */
...@@ -473,13 +480,8 @@ static int smc_connect_rdma(struct smc_sock *smc) ...@@ -473,13 +480,8 @@ static int smc_connect_rdma(struct smc_sock *smc)
goto decline_rdma_unlock; goto decline_rdma_unlock;
} }
} else { } else {
struct smc_buf_desc *buf_desc = smc->conn.rmb_desc; if (!smc->conn.rmb_desc->reused) {
if (smc_reg_rmb(link, smc->conn.rmb_desc)) {
if (!buf_desc->reused) {
/* register memory region for new rmb */
rc = smc_wr_reg_send(link,
buf_desc->mr_rx[SMC_SINGLE_LINK]);
if (rc) {
reason_code = SMC_CLC_DECL_INTERR; reason_code = SMC_CLC_DECL_INTERR;
goto decline_rdma_unlock; goto decline_rdma_unlock;
} }
...@@ -719,9 +721,7 @@ static int smc_serv_conf_first_link(struct smc_sock *smc) ...@@ -719,9 +721,7 @@ static int smc_serv_conf_first_link(struct smc_sock *smc)
link = &lgr->lnk[SMC_SINGLE_LINK]; link = &lgr->lnk[SMC_SINGLE_LINK];
rc = smc_wr_reg_send(link, if (smc_reg_rmb(link, smc->conn.rmb_desc))
smc->conn.rmb_desc->mr_rx[SMC_SINGLE_LINK]);
if (rc)
return SMC_CLC_DECL_INTERR; return SMC_CLC_DECL_INTERR;
/* send CONFIRM LINK request to client over the RoCE fabric */ /* send CONFIRM LINK request to client over the RoCE fabric */
...@@ -854,13 +854,8 @@ static void smc_listen_work(struct work_struct *work) ...@@ -854,13 +854,8 @@ static void smc_listen_work(struct work_struct *work)
smc_rx_init(new_smc); smc_rx_init(new_smc);
if (local_contact != SMC_FIRST_CONTACT) { if (local_contact != SMC_FIRST_CONTACT) {
struct smc_buf_desc *buf_desc = new_smc->conn.rmb_desc; if (!new_smc->conn.rmb_desc->reused) {
if (smc_reg_rmb(link, new_smc->conn.rmb_desc)) {
if (!buf_desc->reused) {
/* register memory region for new rmb */
rc = smc_wr_reg_send(link,
buf_desc->mr_rx[SMC_SINGLE_LINK]);
if (rc) {
reason_code = SMC_CLC_DECL_INTERR; reason_code = SMC_CLC_DECL_INTERR;
goto decline_rdma_unlock; goto decline_rdma_unlock;
} }
......
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