diff options
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 1998c03634da..6eb334a8a7fa 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -1012,38 +1012,24 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp) | |||
1012 | PTR_ERR(fp), fc_lport_state(lport), | 1012 | PTR_ERR(fp), fc_lport_state(lport), |
1013 | lport->retry_count); | 1013 | lport->retry_count); |
1014 | 1014 | ||
1015 | if (!fp || PTR_ERR(fp) == -FC_EX_TIMEOUT) { | 1015 | if (PTR_ERR(fp) == -FC_EX_CLOSED) |
1016 | /* | 1016 | return; |
1017 | * Memory allocation failure, or the exchange timed out. | 1017 | |
1018 | * Retry after delay | 1018 | /* |
1019 | */ | 1019 | * Memory allocation failure, or the exchange timed out |
1020 | if (lport->retry_count < lport->max_retry_count) { | 1020 | * or we received LS_RJT. |
1021 | lport->retry_count++; | 1021 | * Retry after delay |
1022 | if (!fp) | 1022 | */ |
1023 | delay = msecs_to_jiffies(500); | 1023 | if (lport->retry_count < lport->max_retry_count) { |
1024 | else | 1024 | lport->retry_count++; |
1025 | delay = msecs_to_jiffies(lport->e_d_tov); | 1025 | if (!fp) |
1026 | 1026 | delay = msecs_to_jiffies(500); | |
1027 | schedule_delayed_work(&lport->retry_work, delay); | 1027 | else |
1028 | } else { | 1028 | delay = msecs_to_jiffies(lport->e_d_tov); |
1029 | switch (lport->state) { | 1029 | |
1030 | case LPORT_ST_DISABLED: | 1030 | schedule_delayed_work(&lport->retry_work, delay); |
1031 | case LPORT_ST_READY: | 1031 | } else |
1032 | case LPORT_ST_RESET: | 1032 | fc_lport_enter_reset(lport); |
1033 | case LPORT_ST_RNN_ID: | ||
1034 | case LPORT_ST_RSNN_NN: | ||
1035 | case LPORT_ST_RSPN_ID: | ||
1036 | case LPORT_ST_RFT_ID: | ||
1037 | case LPORT_ST_RFF_ID: | ||
1038 | case LPORT_ST_SCR: | ||
1039 | case LPORT_ST_DNS: | ||
1040 | case LPORT_ST_FLOGI: | ||
1041 | case LPORT_ST_LOGO: | ||
1042 | fc_lport_enter_reset(lport); | ||
1043 | break; | ||
1044 | } | ||
1045 | } | ||
1046 | } | ||
1047 | } | 1033 | } |
1048 | 1034 | ||
1049 | /** | 1035 | /** |
@@ -1461,7 +1447,13 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1461 | } | 1447 | } |
1462 | 1448 | ||
1463 | did = fc_frame_did(fp); | 1449 | did = fc_frame_did(fp); |
1464 | if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { | 1450 | |
1451 | if (!did) { | ||
1452 | FC_LPORT_DBG(lport, "Bad FLOGI response\n"); | ||
1453 | goto out; | ||
1454 | } | ||
1455 | |||
1456 | if (fc_frame_payload_op(fp) == ELS_LS_ACC) { | ||
1465 | flp = fc_frame_payload_get(fp, sizeof(*flp)); | 1457 | flp = fc_frame_payload_get(fp, sizeof(*flp)); |
1466 | if (flp) { | 1458 | if (flp) { |
1467 | mfs = ntohs(flp->fl_csp.sp_bb_data) & | 1459 | mfs = ntohs(flp->fl_csp.sp_bb_data) & |
@@ -1500,9 +1492,8 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1500 | fc_lport_enter_dns(lport); | 1492 | fc_lport_enter_dns(lport); |
1501 | } | 1493 | } |
1502 | } | 1494 | } |
1503 | } else { | 1495 | } else |
1504 | FC_LPORT_DBG(lport, "Bad FLOGI response\n"); | 1496 | fc_lport_error(lport, fp); |
1505 | } | ||
1506 | 1497 | ||
1507 | out: | 1498 | out: |
1508 | fc_frame_free(fp); | 1499 | fc_frame_free(fp); |