aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2010-07-20 18:20:51 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:05:58 -0400
commit079ecd8cfe95dfd28b74f3a00d66fdbcdfc8c611 (patch)
tree474d1f3851f6e33f04843f91f6ed1d7a3ca41765 /drivers/scsi/libfc
parent1dd454d9e5205f9a61d51fb97159afeffa0a506c (diff)
[SCSI] libfc: eliminate rport LOGO state
The LOGO state hasn't been used in a while, except in a brief transition to DELETE state while holding the rport mutex. All port LOGO responses have been ignored as well as any timeout if we don't get a response. So this patch just removes LOGO state and simplifies the response handler. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc')
-rw-r--r--drivers/scsi/libfc/fc_rport.c88
1 files changed, 22 insertions, 66 deletions
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 4d6adf29b4f8..c06d63e4a00f 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -89,7 +89,6 @@ static const char *fc_rport_state_names[] = {
89 [RPORT_ST_PRLI] = "PRLI", 89 [RPORT_ST_PRLI] = "PRLI",
90 [RPORT_ST_RTV] = "RTV", 90 [RPORT_ST_RTV] = "RTV",
91 [RPORT_ST_READY] = "Ready", 91 [RPORT_ST_READY] = "Ready",
92 [RPORT_ST_LOGO] = "LOGO",
93 [RPORT_ST_ADISC] = "ADISC", 92 [RPORT_ST_ADISC] = "ADISC",
94 [RPORT_ST_DELETE] = "Delete", 93 [RPORT_ST_DELETE] = "Delete",
95}; 94};
@@ -514,9 +513,6 @@ static void fc_rport_timeout(struct work_struct *work)
514 case RPORT_ST_RTV: 513 case RPORT_ST_RTV:
515 fc_rport_enter_rtv(rdata); 514 fc_rport_enter_rtv(rdata);
516 break; 515 break;
517 case RPORT_ST_LOGO:
518 fc_rport_enter_logo(rdata);
519 break;
520 case RPORT_ST_ADISC: 516 case RPORT_ST_ADISC:
521 fc_rport_enter_adisc(rdata); 517 fc_rport_enter_adisc(rdata);
522 break; 518 break;
@@ -547,7 +543,6 @@ static void fc_rport_error(struct fc_rport_priv *rdata, struct fc_frame *fp)
547 switch (rdata->rp_state) { 543 switch (rdata->rp_state) {
548 case RPORT_ST_FLOGI: 544 case RPORT_ST_FLOGI:
549 case RPORT_ST_PLOGI: 545 case RPORT_ST_PLOGI:
550 case RPORT_ST_LOGO:
551 rdata->flags &= ~FC_RP_STARTED; 546 rdata->flags &= ~FC_RP_STARTED;
552 fc_rport_enter_delete(rdata, RPORT_EV_FAILED); 547 fc_rport_enter_delete(rdata, RPORT_EV_FAILED);
553 break; 548 break;
@@ -791,7 +786,6 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport,
791 786
792 switch (rdata->rp_state) { 787 switch (rdata->rp_state) {
793 case RPORT_ST_INIT: 788 case RPORT_ST_INIT:
794 case RPORT_ST_LOGO:
795 case RPORT_ST_DELETE: 789 case RPORT_ST_DELETE:
796 mutex_unlock(&rdata->rp_mutex); 790 mutex_unlock(&rdata->rp_mutex);
797 rjt_data.reason = ELS_RJT_FIP; 791 rjt_data.reason = ELS_RJT_FIP;
@@ -1037,52 +1031,6 @@ err:
1037} 1031}
1038 1032
1039/** 1033/**
1040 * fc_rport_logo_resp() - Handler for logout (LOGO) responses
1041 * @sp: The sequence the LOGO was on
1042 * @fp: The LOGO response frame
1043 * @rdata_arg: The remote port that sent the LOGO response
1044 *
1045 * Locking Note: This function will be called without the rport lock
1046 * held, but it will lock, call an _enter_* function or fc_rport_error
1047 * and then unlock the rport.
1048 */
1049static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
1050 void *rdata_arg)
1051{
1052 struct fc_rport_priv *rdata = rdata_arg;
1053 u8 op;
1054
1055 mutex_lock(&rdata->rp_mutex);
1056
1057 FC_RPORT_DBG(rdata, "Received a LOGO %s\n", fc_els_resp_type(fp));
1058
1059 if (rdata->rp_state != RPORT_ST_LOGO) {
1060 FC_RPORT_DBG(rdata, "Received a LOGO response, but in state "
1061 "%s\n", fc_rport_state(rdata));
1062 if (IS_ERR(fp))
1063 goto err;
1064 goto out;
1065 }
1066
1067 if (IS_ERR(fp)) {
1068 fc_rport_error_retry(rdata, fp);
1069 goto err;
1070 }
1071
1072 op = fc_frame_payload_op(fp);
1073 if (op != ELS_LS_ACC)
1074 FC_RPORT_DBG(rdata, "Bad ELS response op %x for LOGO command\n",
1075 op);
1076 fc_rport_enter_delete(rdata, RPORT_EV_LOGO);
1077
1078out:
1079 fc_frame_free(fp);
1080err:
1081 mutex_unlock(&rdata->rp_mutex);
1082 kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy);
1083}
1084
1085/**
1086 * fc_rport_enter_prli() - Send Process Login (PRLI) request 1034 * fc_rport_enter_prli() - Send Process Login (PRLI) request
1087 * @rdata: The remote port to send the PRLI request to 1035 * @rdata: The remote port to send the PRLI request to
1088 * 1036 *
@@ -1224,6 +1172,24 @@ static void fc_rport_enter_rtv(struct fc_rport_priv *rdata)
1224} 1172}
1225 1173
1226/** 1174/**
1175 * fc_rport_logo_resp() - Handler for logout (LOGO) responses
1176 * @sp: The sequence the LOGO was on
1177 * @fp: The LOGO response frame
1178 * @lport_arg: The local port
1179 */
1180static void fc_rport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
1181 void *lport_arg)
1182{
1183 struct fc_lport *lport = lport_arg;
1184
1185 FC_RPORT_ID_DBG(lport, fc_seq_exch(sp)->did,
1186 "Received a LOGO %s\n", fc_els_resp_type(fp));
1187 if (IS_ERR(fp))
1188 return;
1189 fc_frame_free(fp);
1190}
1191
1192/**
1227 * fc_rport_enter_logo() - Send a logout (LOGO) request 1193 * fc_rport_enter_logo() - Send a logout (LOGO) request
1228 * @rdata: The remote port to send the LOGO request to 1194 * @rdata: The remote port to send the LOGO request to
1229 * 1195 *
@@ -1235,23 +1201,14 @@ static void fc_rport_enter_logo(struct fc_rport_priv *rdata)
1235 struct fc_lport *lport = rdata->local_port; 1201 struct fc_lport *lport = rdata->local_port;
1236 struct fc_frame *fp; 1202 struct fc_frame *fp;
1237 1203
1238 FC_RPORT_DBG(rdata, "Port entered LOGO state from %s state\n", 1204 FC_RPORT_DBG(rdata, "Port sending LOGO from %s state\n",
1239 fc_rport_state(rdata)); 1205 fc_rport_state(rdata));
1240 1206
1241 fc_rport_state_enter(rdata, RPORT_ST_LOGO);
1242
1243 fp = fc_frame_alloc(lport, sizeof(struct fc_els_logo)); 1207 fp = fc_frame_alloc(lport, sizeof(struct fc_els_logo));
1244 if (!fp) { 1208 if (!fp)
1245 fc_rport_error_retry(rdata, fp);
1246 return; 1209 return;
1247 } 1210 (void)lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_LOGO,
1248 1211 fc_rport_logo_resp, lport, 0);
1249 if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_LOGO,
1250 fc_rport_logo_resp, rdata,
1251 2 * lport->r_a_tov))
1252 fc_rport_error_retry(rdata, NULL);
1253 else
1254 kref_get(&rdata->kref);
1255} 1212}
1256 1213
1257/** 1214/**
@@ -1670,7 +1627,6 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,
1670 break; 1627 break;
1671 case RPORT_ST_FLOGI: 1628 case RPORT_ST_FLOGI:
1672 case RPORT_ST_DELETE: 1629 case RPORT_ST_DELETE:
1673 case RPORT_ST_LOGO:
1674 FC_RPORT_DBG(rdata, "Received PLOGI in state %s - send busy\n", 1630 FC_RPORT_DBG(rdata, "Received PLOGI in state %s - send busy\n",
1675 fc_rport_state(rdata)); 1631 fc_rport_state(rdata));
1676 mutex_unlock(&rdata->rp_mutex); 1632 mutex_unlock(&rdata->rp_mutex);