diff options
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 95 | ||||
-rw-r--r-- | include/scsi/libfc.h | 1 |
2 files changed, 3 insertions, 93 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 807f5b3e4efe..47577e4a2e87 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -108,7 +108,6 @@ static void fc_lport_error(struct fc_lport *, struct fc_frame *); | |||
108 | static void fc_lport_enter_reset(struct fc_lport *); | 108 | static void fc_lport_enter_reset(struct fc_lport *); |
109 | static void fc_lport_enter_flogi(struct fc_lport *); | 109 | static void fc_lport_enter_flogi(struct fc_lport *); |
110 | static void fc_lport_enter_dns(struct fc_lport *); | 110 | static void fc_lport_enter_dns(struct fc_lport *); |
111 | static void fc_lport_enter_rpn_id(struct fc_lport *); | ||
112 | static void fc_lport_enter_rft_id(struct fc_lport *); | 111 | static void fc_lport_enter_rft_id(struct fc_lport *); |
113 | static void fc_lport_enter_scr(struct fc_lport *); | 112 | static void fc_lport_enter_scr(struct fc_lport *); |
114 | static void fc_lport_enter_ready(struct fc_lport *); | 113 | static void fc_lport_enter_ready(struct fc_lport *); |
@@ -118,7 +117,6 @@ static const char *fc_lport_state_names[] = { | |||
118 | [LPORT_ST_DISABLED] = "disabled", | 117 | [LPORT_ST_DISABLED] = "disabled", |
119 | [LPORT_ST_FLOGI] = "FLOGI", | 118 | [LPORT_ST_FLOGI] = "FLOGI", |
120 | [LPORT_ST_DNS] = "dNS", | 119 | [LPORT_ST_DNS] = "dNS", |
121 | [LPORT_ST_RPN_ID] = "RPN_ID", | ||
122 | [LPORT_ST_RFT_ID] = "RFT_ID", | 120 | [LPORT_ST_RFT_ID] = "RFT_ID", |
123 | [LPORT_ST_SCR] = "SCR", | 121 | [LPORT_ST_SCR] = "SCR", |
124 | [LPORT_ST_READY] = "Ready", | 122 | [LPORT_ST_READY] = "Ready", |
@@ -153,7 +151,7 @@ static void fc_lport_rport_callback(struct fc_lport *lport, | |||
153 | case RPORT_EV_READY: | 151 | case RPORT_EV_READY: |
154 | if (lport->state == LPORT_ST_DNS) { | 152 | if (lport->state == LPORT_ST_DNS) { |
155 | lport->dns_rp = rdata; | 153 | lport->dns_rp = rdata; |
156 | fc_lport_enter_rpn_id(lport); | 154 | fc_lport_enter_rft_id(lport); |
157 | } else { | 155 | } else { |
158 | FC_LPORT_DBG(lport, "Received an READY event " | 156 | FC_LPORT_DBG(lport, "Received an READY event " |
159 | "on port (%6x) for the directory " | 157 | "on port (%6x) for the directory " |
@@ -965,7 +963,6 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp) | |||
965 | case LPORT_ST_DISABLED: | 963 | case LPORT_ST_DISABLED: |
966 | case LPORT_ST_READY: | 964 | case LPORT_ST_READY: |
967 | case LPORT_ST_RESET: | 965 | case LPORT_ST_RESET: |
968 | case LPORT_ST_RPN_ID: | ||
969 | case LPORT_ST_RFT_ID: | 966 | case LPORT_ST_RFT_ID: |
970 | case LPORT_ST_SCR: | 967 | case LPORT_ST_SCR: |
971 | case LPORT_ST_DNS: | 968 | case LPORT_ST_DNS: |
@@ -980,8 +977,8 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp) | |||
980 | 977 | ||
981 | /** | 978 | /** |
982 | * fc_lport_rft_id_resp() - Handle response to Register Fibre | 979 | * fc_lport_rft_id_resp() - Handle response to Register Fibre |
983 | * Channel Types by ID (RPN_ID) request | 980 | * Channel Types by ID (RFT_ID) request |
984 | * @sp: current sequence in RPN_ID exchange | 981 | * @sp: current sequence in RFT_ID exchange |
985 | * @fp: response frame | 982 | * @fp: response frame |
986 | * @lp_arg: Fibre Channel host port instance | 983 | * @lp_arg: Fibre Channel host port instance |
987 | * | 984 | * |
@@ -1033,60 +1030,6 @@ err: | |||
1033 | } | 1030 | } |
1034 | 1031 | ||
1035 | /** | 1032 | /** |
1036 | * fc_lport_rpn_id_resp() - Handle response to Register Port | ||
1037 | * Name by ID (RPN_ID) request | ||
1038 | * @sp: current sequence in RPN_ID exchange | ||
1039 | * @fp: response frame | ||
1040 | * @lp_arg: Fibre Channel host port instance | ||
1041 | * | ||
1042 | * Locking Note: This function will be called without the lport lock | ||
1043 | * held, but it will lock, call an _enter_* function or fc_lport_error | ||
1044 | * and then unlock the lport. | ||
1045 | */ | ||
1046 | static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, | ||
1047 | void *lp_arg) | ||
1048 | { | ||
1049 | struct fc_lport *lport = lp_arg; | ||
1050 | struct fc_frame_header *fh; | ||
1051 | struct fc_ct_hdr *ct; | ||
1052 | |||
1053 | FC_LPORT_DBG(lport, "Received a RPN_ID %s\n", fc_els_resp_type(fp)); | ||
1054 | |||
1055 | if (fp == ERR_PTR(-FC_EX_CLOSED)) | ||
1056 | return; | ||
1057 | |||
1058 | mutex_lock(&lport->lp_mutex); | ||
1059 | |||
1060 | if (lport->state != LPORT_ST_RPN_ID) { | ||
1061 | FC_LPORT_DBG(lport, "Received a RPN_ID response, but in state " | ||
1062 | "%s\n", fc_lport_state(lport)); | ||
1063 | if (IS_ERR(fp)) | ||
1064 | goto err; | ||
1065 | goto out; | ||
1066 | } | ||
1067 | |||
1068 | if (IS_ERR(fp)) { | ||
1069 | fc_lport_error(lport, fp); | ||
1070 | goto err; | ||
1071 | } | ||
1072 | |||
1073 | fh = fc_frame_header_get(fp); | ||
1074 | ct = fc_frame_payload_get(fp, sizeof(*ct)); | ||
1075 | if (fh && ct && fh->fh_type == FC_TYPE_CT && | ||
1076 | ct->ct_fs_type == FC_FST_DIR && | ||
1077 | ct->ct_fs_subtype == FC_NS_SUBTYPE && | ||
1078 | ntohs(ct->ct_cmd) == FC_FS_ACC) | ||
1079 | fc_lport_enter_rft_id(lport); | ||
1080 | else | ||
1081 | fc_lport_error(lport, fp); | ||
1082 | |||
1083 | out: | ||
1084 | fc_frame_free(fp); | ||
1085 | err: | ||
1086 | mutex_unlock(&lport->lp_mutex); | ||
1087 | } | ||
1088 | |||
1089 | /** | ||
1090 | * fc_lport_scr_resp() - Handle response to State Change Register (SCR) request | 1033 | * fc_lport_scr_resp() - Handle response to State Change Register (SCR) request |
1091 | * @sp: current sequence in SCR exchange | 1034 | * @sp: current sequence in SCR exchange |
1092 | * @fp: response frame | 1035 | * @fp: response frame |
@@ -1203,35 +1146,6 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport) | |||
1203 | fc_lport_error(lport, fp); | 1146 | fc_lport_error(lport, fp); |
1204 | } | 1147 | } |
1205 | 1148 | ||
1206 | /** | ||
1207 | * fc_rport_enter_rft_id() - Register port name with the name server | ||
1208 | * @lport: Fibre Channel local port to register | ||
1209 | * | ||
1210 | * Locking Note: The lport lock is expected to be held before calling | ||
1211 | * this routine. | ||
1212 | */ | ||
1213 | static void fc_lport_enter_rpn_id(struct fc_lport *lport) | ||
1214 | { | ||
1215 | struct fc_frame *fp; | ||
1216 | |||
1217 | FC_LPORT_DBG(lport, "Entered RPN_ID state from %s state\n", | ||
1218 | fc_lport_state(lport)); | ||
1219 | |||
1220 | fc_lport_state_enter(lport, LPORT_ST_RPN_ID); | ||
1221 | |||
1222 | fp = fc_frame_alloc(lport, sizeof(struct fc_ct_hdr) + | ||
1223 | sizeof(struct fc_ns_rn_id)); | ||
1224 | if (!fp) { | ||
1225 | fc_lport_error(lport, fp); | ||
1226 | return; | ||
1227 | } | ||
1228 | |||
1229 | if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RPN_ID, | ||
1230 | fc_lport_rpn_id_resp, | ||
1231 | lport, lport->e_d_tov)) | ||
1232 | fc_lport_error(lport, NULL); | ||
1233 | } | ||
1234 | |||
1235 | static struct fc_rport_operations fc_lport_rport_ops = { | 1149 | static struct fc_rport_operations fc_lport_rport_ops = { |
1236 | .event_callback = fc_lport_rport_callback, | 1150 | .event_callback = fc_lport_rport_callback, |
1237 | }; | 1151 | }; |
@@ -1293,9 +1207,6 @@ static void fc_lport_timeout(struct work_struct *work) | |||
1293 | case LPORT_ST_DNS: | 1207 | case LPORT_ST_DNS: |
1294 | fc_lport_enter_dns(lport); | 1208 | fc_lport_enter_dns(lport); |
1295 | break; | 1209 | break; |
1296 | case LPORT_ST_RPN_ID: | ||
1297 | fc_lport_enter_rpn_id(lport); | ||
1298 | break; | ||
1299 | case LPORT_ST_RFT_ID: | 1210 | case LPORT_ST_RFT_ID: |
1300 | fc_lport_enter_rft_id(lport); | 1211 | fc_lport_enter_rft_id(lport); |
1301 | break; | 1212 | break; |
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index dad66ce8673d..75be713ea036 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -61,7 +61,6 @@ enum fc_lport_state { | |||
61 | LPORT_ST_DISABLED = 0, | 61 | LPORT_ST_DISABLED = 0, |
62 | LPORT_ST_FLOGI, | 62 | LPORT_ST_FLOGI, |
63 | LPORT_ST_DNS, | 63 | LPORT_ST_DNS, |
64 | LPORT_ST_RPN_ID, | ||
65 | LPORT_ST_RFT_ID, | 64 | LPORT_ST_RFT_ID, |
66 | LPORT_ST_SCR, | 65 | LPORT_ST_SCR, |
67 | LPORT_ST_READY, | 66 | LPORT_ST_READY, |