Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Karsten Graul <kgraul@linux.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Karsten Graul and committed by
David S. Miller
4667bb4a 92334cfc

+20 -42
+15 -24
net/smc/af_smc.c
··· 1019 1019 static int smcr_serv_conf_first_link(struct smc_sock *smc) 1020 1020 { 1021 1021 struct smc_link *link = smc->conn.lnk; 1022 - int rest; 1022 + struct smc_llc_qentry *qentry; 1023 1023 int rc; 1024 + 1025 + link->lgr->type = SMC_LGR_SINGLE; 1024 1026 1025 1027 if (smcr_link_reg_rmb(link, smc->conn.rmb_desc, false)) 1026 1028 return SMC_CLC_DECL_ERR_REGRMB; ··· 1033 1031 return SMC_CLC_DECL_TIMEOUT_CL; 1034 1032 1035 1033 /* receive CONFIRM LINK response from client over the RoCE fabric */ 1036 - rest = wait_for_completion_interruptible_timeout( 1037 - &link->llc_confirm_resp, 1038 - SMC_LLC_WAIT_FIRST_TIME); 1039 - if (rest <= 0) { 1034 + qentry = smc_llc_wait(link->lgr, link, SMC_LLC_WAIT_TIME, 1035 + SMC_LLC_CONFIRM_LINK); 1036 + if (!qentry) { 1040 1037 struct smc_clc_msg_decline dclc; 1041 1038 1042 1039 rc = smc_clc_wait_msg(smc, &dclc, sizeof(dclc), 1043 1040 SMC_CLC_DECLINE, CLC_WAIT_TIME_SHORT); 1044 1041 return rc == -EAGAIN ? SMC_CLC_DECL_TIMEOUT_CL : rc; 1045 1042 } 1046 - 1047 - if (link->llc_confirm_resp_rc) 1043 + rc = smc_llc_eval_conf_link(qentry, SMC_LLC_RESP); 1044 + smc_llc_flow_qentry_del(&link->lgr->llc_flow_lcl); 1045 + if (rc) 1048 1046 return SMC_CLC_DECL_RMBE_EC; 1049 1047 1050 - /* send ADD LINK request to client over the RoCE fabric */ 1051 - rc = smc_llc_send_add_link(link, 1052 - link->smcibdev->mac[link->ibport - 1], 1053 - link->gid, SMC_LLC_REQ); 1054 - if (rc < 0) 1055 - return SMC_CLC_DECL_TIMEOUT_AL; 1056 - 1057 - /* receive ADD LINK response from client over the RoCE fabric */ 1058 - rest = wait_for_completion_interruptible_timeout(&link->llc_add_resp, 1059 - SMC_LLC_WAIT_TIME); 1060 - if (rest <= 0) { 1061 - struct smc_clc_msg_decline dclc; 1062 - 1063 - rc = smc_clc_wait_msg(smc, &dclc, sizeof(dclc), 1064 - SMC_CLC_DECLINE, CLC_WAIT_TIME_SHORT); 1065 - return rc == -EAGAIN ? SMC_CLC_DECL_TIMEOUT_AL : rc; 1066 - } 1048 + /* confirm_rkey is implicit on 1st contact */ 1049 + smc->conn.rmb_desc->is_conf_rkey = true; 1067 1050 1068 1051 smc_llc_link_active(link); 1069 1052 1053 + /* initial contact - try to establish second link */ 1054 + /* tbd: call smc_llc_srv_add_link(link); */ 1070 1055 return 0; 1071 1056 } 1072 1057 ··· 1229 1240 goto decline; 1230 1241 } 1231 1242 /* QP confirmation over RoCE fabric */ 1243 + smc_llc_flow_initiate(link->lgr, SMC_LLC_FLOW_ADD_LINK); 1232 1244 reason_code = smcr_serv_conf_first_link(new_smc); 1245 + smc_llc_flow_stop(link->lgr, &link->lgr->llc_flow_lcl); 1233 1246 if (reason_code) 1234 1247 goto decline; 1235 1248 }
-3
net/smc/smc_core.h
··· 121 121 122 122 enum smc_link_state state; /* state of link */ 123 123 struct completion llc_confirm; /* wait for rx of conf link */ 124 - struct completion llc_confirm_resp; /* wait 4 rx of cnf lnk rsp */ 125 124 int llc_confirm_rc; /* rc from confirm link msg */ 126 - int llc_confirm_resp_rc; /* rc from conf_resp msg */ 127 125 struct completion llc_add; /* wait for rx of add link */ 128 - struct completion llc_add_resp; /* wait for rx of add link rsp*/ 129 126 struct delayed_work llc_testlink_wrk; /* testlink worker */ 130 127 struct completion llc_testlink_resp; /* wait for rx of testlink */ 131 128 int llc_testlink_time; /* testlink interval */
+5 -15
net/smc/smc_llc.c
··· 724 724 { 725 725 u8 llc_type = qentry->msg.raw.hdr.common.type; 726 726 union smc_llc_msg *llc = &qentry->msg; 727 - int rc = 0; 728 727 729 728 switch (llc_type) { 730 729 case SMC_LLC_TEST_LINK: 731 730 if (link->state == SMC_LNK_ACTIVE) 732 731 complete(&link->llc_testlink_resp); 733 732 break; 734 - case SMC_LLC_CONFIRM_LINK: 735 - if (!(llc->raw.hdr.flags & SMC_LLC_FLAG_NO_RMBE_EYEC)) 736 - rc = ENOTSUPP; 737 - if (link->lgr->role == SMC_SERV && 738 - link->state == SMC_LNK_ACTIVATING) { 739 - link->llc_confirm_resp_rc = rc; 740 - complete(&link->llc_confirm_resp); 741 - } 742 - break; 743 733 case SMC_LLC_ADD_LINK: 744 - if (link->state == SMC_LNK_ACTIVATING) 745 - complete(&link->llc_add_resp); 746 - break; 734 + case SMC_LLC_CONFIRM_LINK: 735 + /* assign responses to the local flow, we requested them */ 736 + smc_llc_flow_qentry_set(&link->lgr->llc_flow_lcl, qentry); 737 + wake_up_interruptible(&link->lgr->llc_waiter); 738 + return; 747 739 case SMC_LLC_DELETE_LINK: 748 740 if (link->lgr->role == SMC_SERV) 749 741 smc_lgr_schedule_free_work_fast(link->lgr); ··· 858 866 int smc_llc_link_init(struct smc_link *link) 859 867 { 860 868 init_completion(&link->llc_confirm); 861 - init_completion(&link->llc_confirm_resp); 862 869 init_completion(&link->llc_add); 863 - init_completion(&link->llc_add_resp); 864 870 init_completion(&link->llc_confirm_rkey_resp); 865 871 init_completion(&link->llc_delete_rkey_resp); 866 872 mutex_init(&link->llc_delete_rkey_mutex);