Skip to content

Commit 079ecd8

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[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>
1 parent 1dd454d commit 079ecd8

2 files changed

Lines changed: 22 additions & 68 deletions

File tree

‎drivers/scsi/libfc/fc_rport.c‎

Lines changed: 22 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ static const char *fc_rport_state_names[] = {
8989
[RPORT_ST_PRLI] = "PRLI",
9090
[RPORT_ST_RTV] = "RTV",
9191
[RPORT_ST_READY] = "Ready",
92-
[RPORT_ST_LOGO] = "LOGO",
9392
[RPORT_ST_ADISC] = "ADISC",
9493
[RPORT_ST_DELETE] = "Delete",
9594
};
@@ -514,9 +513,6 @@ static void fc_rport_timeout(struct work_struct *work)
514513
case RPORT_ST_RTV:
515514
fc_rport_enter_rtv(rdata);
516515
break;
517-
case RPORT_ST_LOGO:
518-
fc_rport_enter_logo(rdata);
519-
break;
520516
case RPORT_ST_ADISC:
521517
fc_rport_enter_adisc(rdata);
522518
break;
@@ -547,7 +543,6 @@ static void fc_rport_error(struct fc_rport_priv *rdata, struct fc_frame *fp)
547543
switch (rdata->rp_state) {
548544
case RPORT_ST_FLOGI:
549545
case RPORT_ST_PLOGI:
550-
case RPORT_ST_LOGO:
551546
rdata->flags &= ~FC_RP_STARTED;
552547
fc_rport_enter_delete(rdata, RPORT_EV_FAILED);
553548
break;
@@ -791,7 +786,6 @@ static void fc_rport_recv_flogi_req(struct fc_lport *lport,
791786

792787
switch (rdata->rp_state) {
793788
case RPORT_ST_INIT:
794-
case RPORT_ST_LOGO:
795789
case RPORT_ST_DELETE:
796790
mutex_unlock(&rdata->rp_mutex);
797791
rjt_data.reason = ELS_RJT_FIP;
@@ -1036,52 +1030,6 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
10361030
kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy);
10371031
}
10381032

1039-
/**
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-
*/
1049-
static 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-
1078-
out:
1079-
fc_frame_free(fp);
1080-
err:
1081-
mutex_unlock(&rdata->rp_mutex);
1082-
kref_put(&rdata->kref, rdata->local_port->tt.rport_destroy);
1083-
}
1084-
10851033
/**
10861034
* fc_rport_enter_prli() - Send Process Login (PRLI) request
10871035
* @rdata: The remote port to send the PRLI request to
@@ -1223,6 +1171,24 @@ static void fc_rport_enter_rtv(struct fc_rport_priv *rdata)
12231171
kref_get(&rdata->kref);
12241172
}
12251173

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+
*/
1180+
static 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+
12261192
/**
12271193
* fc_rport_enter_logo() - Send a logout (LOGO) request
12281194
* @rdata: The remote port to send the LOGO request to
@@ -1235,23 +1201,14 @@ static void fc_rport_enter_logo(struct fc_rport_priv *rdata)
12351201
struct fc_lport *lport = rdata->local_port;
12361202
struct fc_frame *fp;
12371203

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",
12391205
fc_rport_state(rdata));
12401206

1241-
fc_rport_state_enter(rdata, RPORT_ST_LOGO);
1242-
12431207
fp = fc_frame_alloc(lport, sizeof(struct fc_els_logo));
1244-
if (!fp) {
1245-
fc_rport_error_retry(rdata, fp);
1208+
if (!fp)
12461209
return;
1247-
}
1248-
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);
1210+
(void)lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_LOGO,
1211+
fc_rport_logo_resp, lport, 0);
12551212
}
12561213

12571214
/**
@@ -1670,7 +1627,6 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,
16701627
break;
16711628
case RPORT_ST_FLOGI:
16721629
case RPORT_ST_DELETE:
1673-
case RPORT_ST_LOGO:
16741630
FC_RPORT_DBG(rdata, "Received PLOGI in state %s - send busy\n",
16751631
fc_rport_state(rdata));
16761632
mutex_unlock(&rdata->rp_mutex);

‎include/scsi/libfc.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ enum fc_disc_event {
103103
* @RPORT_ST_PRLI: Waiting for PRLI completion
104104
* @RPORT_ST_RTV: Waiting for RTV completion
105105
* @RPORT_ST_READY: Ready for use
106-
* @RPORT_ST_LOGO: Remote port logout (LOGO) sent
107106
* @RPORT_ST_ADISC: Discover Address sent
108107
* @RPORT_ST_DELETE: Remote port being deleted
109108
*/
@@ -115,7 +114,6 @@ enum fc_rport_state {
115114
RPORT_ST_PRLI,
116115
RPORT_ST_RTV,
117116
RPORT_ST_READY,
118-
RPORT_ST_LOGO,
119117
RPORT_ST_ADISC,
120118
RPORT_ST_DELETE,
121119
};

0 commit comments

Comments
 (0)