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

net/smc: adapt SMC server code to use the LLC flow

Change the code that processes the SMC server part of connection
establishment to use the LLC flow framework (CONFIRM_LINK response
messages).
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Reviewed-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 92334cfc
...@@ -1019,9 +1019,11 @@ void smc_close_non_accepted(struct sock *sk) ...@@ -1019,9 +1019,11 @@ void smc_close_non_accepted(struct sock *sk)
static int smcr_serv_conf_first_link(struct smc_sock *smc) static int smcr_serv_conf_first_link(struct smc_sock *smc)
{ {
struct smc_link *link = smc->conn.lnk; struct smc_link *link = smc->conn.lnk;
int rest; struct smc_llc_qentry *qentry;
int rc; int rc;
link->lgr->type = SMC_LGR_SINGLE;
if (smcr_link_reg_rmb(link, smc->conn.rmb_desc, false)) if (smcr_link_reg_rmb(link, smc->conn.rmb_desc, false))
return SMC_CLC_DECL_ERR_REGRMB; return SMC_CLC_DECL_ERR_REGRMB;
...@@ -1031,40 +1033,27 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc) ...@@ -1031,40 +1033,27 @@ static int smcr_serv_conf_first_link(struct smc_sock *smc)
return SMC_CLC_DECL_TIMEOUT_CL; return SMC_CLC_DECL_TIMEOUT_CL;
/* receive CONFIRM LINK response from client over the RoCE fabric */ /* receive CONFIRM LINK response from client over the RoCE fabric */
rest = wait_for_completion_interruptible_timeout( qentry = smc_llc_wait(link->lgr, link, SMC_LLC_WAIT_TIME,
&link->llc_confirm_resp, SMC_LLC_CONFIRM_LINK);
SMC_LLC_WAIT_FIRST_TIME); if (!qentry) {
if (rest <= 0) {
struct smc_clc_msg_decline dclc; struct smc_clc_msg_decline dclc;
rc = smc_clc_wait_msg(smc, &dclc, sizeof(dclc), rc = smc_clc_wait_msg(smc, &dclc, sizeof(dclc),
SMC_CLC_DECLINE, CLC_WAIT_TIME_SHORT); SMC_CLC_DECLINE, CLC_WAIT_TIME_SHORT);
return rc == -EAGAIN ? SMC_CLC_DECL_TIMEOUT_CL : rc; return rc == -EAGAIN ? SMC_CLC_DECL_TIMEOUT_CL : rc;
} }
rc = smc_llc_eval_conf_link(qentry, SMC_LLC_RESP);
if (link->llc_confirm_resp_rc) smc_llc_flow_qentry_del(&link->lgr->llc_flow_lcl);
if (rc)
return SMC_CLC_DECL_RMBE_EC; return SMC_CLC_DECL_RMBE_EC;
/* send ADD LINK request to client over the RoCE fabric */ /* confirm_rkey is implicit on 1st contact */
rc = smc_llc_send_add_link(link, smc->conn.rmb_desc->is_conf_rkey = true;
link->smcibdev->mac[link->ibport - 1],
link->gid, SMC_LLC_REQ);
if (rc < 0)
return SMC_CLC_DECL_TIMEOUT_AL;
/* receive ADD LINK response from client over the RoCE fabric */
rest = wait_for_completion_interruptible_timeout(&link->llc_add_resp,
SMC_LLC_WAIT_TIME);
if (rest <= 0) {
struct smc_clc_msg_decline dclc;
rc = smc_clc_wait_msg(smc, &dclc, sizeof(dclc),
SMC_CLC_DECLINE, CLC_WAIT_TIME_SHORT);
return rc == -EAGAIN ? SMC_CLC_DECL_TIMEOUT_AL : rc;
}
smc_llc_link_active(link); smc_llc_link_active(link);
/* initial contact - try to establish second link */
/* tbd: call smc_llc_srv_add_link(link); */
return 0; return 0;
} }
...@@ -1240,7 +1229,9 @@ static int smc_listen_rdma_finish(struct smc_sock *new_smc, ...@@ -1240,7 +1229,9 @@ static int smc_listen_rdma_finish(struct smc_sock *new_smc,
goto decline; goto decline;
} }
/* QP confirmation over RoCE fabric */ /* QP confirmation over RoCE fabric */
smc_llc_flow_initiate(link->lgr, SMC_LLC_FLOW_ADD_LINK);
reason_code = smcr_serv_conf_first_link(new_smc); reason_code = smcr_serv_conf_first_link(new_smc);
smc_llc_flow_stop(link->lgr, &link->lgr->llc_flow_lcl);
if (reason_code) if (reason_code)
goto decline; goto decline;
} }
......
...@@ -121,11 +121,8 @@ struct smc_link { ...@@ -121,11 +121,8 @@ struct smc_link {
enum smc_link_state state; /* state of link */ enum smc_link_state state; /* state of link */
struct completion llc_confirm; /* wait for rx of conf link */ struct completion llc_confirm; /* wait for rx of conf link */
struct completion llc_confirm_resp; /* wait 4 rx of cnf lnk rsp */
int llc_confirm_rc; /* rc from confirm link msg */ int llc_confirm_rc; /* rc from confirm link msg */
int llc_confirm_resp_rc; /* rc from conf_resp msg */
struct completion llc_add; /* wait for rx of add link */ struct completion llc_add; /* wait for rx of add link */
struct completion llc_add_resp; /* wait for rx of add link rsp*/
struct delayed_work llc_testlink_wrk; /* testlink worker */ struct delayed_work llc_testlink_wrk; /* testlink worker */
struct completion llc_testlink_resp; /* wait for rx of testlink */ struct completion llc_testlink_resp; /* wait for rx of testlink */
int llc_testlink_time; /* testlink interval */ int llc_testlink_time; /* testlink interval */
......
...@@ -724,26 +724,18 @@ static void smc_llc_rx_response(struct smc_link *link, ...@@ -724,26 +724,18 @@ static void smc_llc_rx_response(struct smc_link *link,
{ {
u8 llc_type = qentry->msg.raw.hdr.common.type; u8 llc_type = qentry->msg.raw.hdr.common.type;
union smc_llc_msg *llc = &qentry->msg; union smc_llc_msg *llc = &qentry->msg;
int rc = 0;
switch (llc_type) { switch (llc_type) {
case SMC_LLC_TEST_LINK: case SMC_LLC_TEST_LINK:
if (link->state == SMC_LNK_ACTIVE) if (link->state == SMC_LNK_ACTIVE)
complete(&link->llc_testlink_resp); complete(&link->llc_testlink_resp);
break; break;
case SMC_LLC_CONFIRM_LINK:
if (!(llc->raw.hdr.flags & SMC_LLC_FLAG_NO_RMBE_EYEC))
rc = ENOTSUPP;
if (link->lgr->role == SMC_SERV &&
link->state == SMC_LNK_ACTIVATING) {
link->llc_confirm_resp_rc = rc;
complete(&link->llc_confirm_resp);
}
break;
case SMC_LLC_ADD_LINK: case SMC_LLC_ADD_LINK:
if (link->state == SMC_LNK_ACTIVATING) case SMC_LLC_CONFIRM_LINK:
complete(&link->llc_add_resp); /* assign responses to the local flow, we requested them */
break; smc_llc_flow_qentry_set(&link->lgr->llc_flow_lcl, qentry);
wake_up_interruptible(&link->lgr->llc_waiter);
return;
case SMC_LLC_DELETE_LINK: case SMC_LLC_DELETE_LINK:
if (link->lgr->role == SMC_SERV) if (link->lgr->role == SMC_SERV)
smc_lgr_schedule_free_work_fast(link->lgr); smc_lgr_schedule_free_work_fast(link->lgr);
...@@ -866,9 +858,7 @@ void smc_llc_lgr_clear(struct smc_link_group *lgr) ...@@ -866,9 +858,7 @@ void smc_llc_lgr_clear(struct smc_link_group *lgr)
int smc_llc_link_init(struct smc_link *link) int smc_llc_link_init(struct smc_link *link)
{ {
init_completion(&link->llc_confirm); init_completion(&link->llc_confirm);
init_completion(&link->llc_confirm_resp);
init_completion(&link->llc_add); init_completion(&link->llc_add);
init_completion(&link->llc_add_resp);
init_completion(&link->llc_confirm_rkey_resp); init_completion(&link->llc_confirm_rkey_resp);
init_completion(&link->llc_delete_rkey_resp); init_completion(&link->llc_delete_rkey_resp);
mutex_init(&link->llc_delete_rkey_mutex); mutex_init(&link->llc_delete_rkey_mutex);
......
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