diff options
author | Karsten Graul <kgraul@linux.ibm.com> | 2018-05-03 11:57:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-03 14:47:31 -0400 |
commit | e63a5f8c19d7807823d68830ebe8cfbd4419ab13 (patch) | |
tree | 2e02c43f8bf5ede18f68eb4c80a7ea61059d7340 /net | |
parent | df80b8fb3c0ef510649d2d6e350cf11be240d15c (diff) |
net/smc: call consolidation
Consolidate the call to smc_wr_reg_send() in a new function.
No functional changes.
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/smc/af_smc.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 8b4c059bd13b..fdb2976117bd 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c | |||
@@ -292,6 +292,15 @@ static void smc_copy_sock_settings_to_smc(struct smc_sock *smc) | |||
292 | smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC); | 292 | smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC); |
293 | } | 293 | } |
294 | 294 | ||
295 | /* register a new rmb */ | ||
296 | static int smc_reg_rmb(struct smc_link *link, struct smc_buf_desc *rmb_desc) | ||
297 | { | ||
298 | /* register memory region for new rmb */ | ||
299 | if (smc_wr_reg_send(link, rmb_desc->mr_rx[SMC_SINGLE_LINK])) | ||
300 | return -EFAULT; | ||
301 | return 0; | ||
302 | } | ||
303 | |||
295 | static int smc_clnt_conf_first_link(struct smc_sock *smc) | 304 | static int smc_clnt_conf_first_link(struct smc_sock *smc) |
296 | { | 305 | { |
297 | struct smc_link_group *lgr = smc->conn.lgr; | 306 | struct smc_link_group *lgr = smc->conn.lgr; |
@@ -321,9 +330,7 @@ static int smc_clnt_conf_first_link(struct smc_sock *smc) | |||
321 | 330 | ||
322 | smc_wr_remember_qp_attr(link); | 331 | smc_wr_remember_qp_attr(link); |
323 | 332 | ||
324 | rc = smc_wr_reg_send(link, | 333 | if (smc_reg_rmb(link, smc->conn.rmb_desc)) |
325 | smc->conn.rmb_desc->mr_rx[SMC_SINGLE_LINK]); | ||
326 | if (rc) | ||
327 | return SMC_CLC_DECL_INTERR; | 334 | return SMC_CLC_DECL_INTERR; |
328 | 335 | ||
329 | /* send CONFIRM LINK response over RoCE fabric */ | 336 | /* send CONFIRM LINK response over RoCE fabric */ |
@@ -473,13 +480,8 @@ static int smc_connect_rdma(struct smc_sock *smc) | |||
473 | goto decline_rdma_unlock; | 480 | goto decline_rdma_unlock; |
474 | } | 481 | } |
475 | } else { | 482 | } else { |
476 | struct smc_buf_desc *buf_desc = smc->conn.rmb_desc; | 483 | if (!smc->conn.rmb_desc->reused) { |
477 | 484 | if (smc_reg_rmb(link, smc->conn.rmb_desc)) { | |
478 | if (!buf_desc->reused) { | ||
479 | /* register memory region for new rmb */ | ||
480 | rc = smc_wr_reg_send(link, | ||
481 | buf_desc->mr_rx[SMC_SINGLE_LINK]); | ||
482 | if (rc) { | ||
483 | reason_code = SMC_CLC_DECL_INTERR; | 485 | reason_code = SMC_CLC_DECL_INTERR; |
484 | goto decline_rdma_unlock; | 486 | goto decline_rdma_unlock; |
485 | } | 487 | } |
@@ -719,9 +721,7 @@ static int smc_serv_conf_first_link(struct smc_sock *smc) | |||
719 | 721 | ||
720 | link = &lgr->lnk[SMC_SINGLE_LINK]; | 722 | link = &lgr->lnk[SMC_SINGLE_LINK]; |
721 | 723 | ||
722 | rc = smc_wr_reg_send(link, | 724 | if (smc_reg_rmb(link, smc->conn.rmb_desc)) |
723 | smc->conn.rmb_desc->mr_rx[SMC_SINGLE_LINK]); | ||
724 | if (rc) | ||
725 | return SMC_CLC_DECL_INTERR; | 725 | return SMC_CLC_DECL_INTERR; |
726 | 726 | ||
727 | /* send CONFIRM LINK request to client over the RoCE fabric */ | 727 | /* send CONFIRM LINK request to client over the RoCE fabric */ |
@@ -854,13 +854,8 @@ static void smc_listen_work(struct work_struct *work) | |||
854 | smc_rx_init(new_smc); | 854 | smc_rx_init(new_smc); |
855 | 855 | ||
856 | if (local_contact != SMC_FIRST_CONTACT) { | 856 | if (local_contact != SMC_FIRST_CONTACT) { |
857 | struct smc_buf_desc *buf_desc = new_smc->conn.rmb_desc; | 857 | if (!new_smc->conn.rmb_desc->reused) { |
858 | 858 | if (smc_reg_rmb(link, new_smc->conn.rmb_desc)) { | |
859 | if (!buf_desc->reused) { | ||
860 | /* register memory region for new rmb */ | ||
861 | rc = smc_wr_reg_send(link, | ||
862 | buf_desc->mr_rx[SMC_SINGLE_LINK]); | ||
863 | if (rc) { | ||
864 | reason_code = SMC_CLC_DECL_INTERR; | 859 | reason_code = SMC_CLC_DECL_INTERR; |
865 | goto decline_rdma_unlock; | 860 | goto decline_rdma_unlock; |
866 | } | 861 | } |