aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi
diff options
context:
space:
mode:
authorBrian King <brking@linux.vnet.ibm.com>2008-12-03 12:02:54 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:23 -0500
commit1c41fa8288277e76785acb50f52bb2f39509f903 (patch)
tree2d56318f2b64753e0e0797d0a1db3b869e4d52a4 /drivers/scsi/ibmvscsi
parent6df19a791bdd5d820cccd8c7a12679888ae62099 (diff)
[SCSI] ibmvfc: Delay NPIV login retry and add retries
Adds a delay prior to retrying a failed NPIV login. This fixes a scenario if the backing fibre channel adapter is getting reset due to an EEH event, NPIV login will fail. Currently, ibmvfc retries three times very quickly, resets the CRQ and tries one more time. If the adapter is getting reset due to EEH, this isn't enough time. This adds a delay prior to retrying a failed NPIV login and also increments the number of retries. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/ibmvscsi')
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c17
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.h4
2 files changed, 15 insertions, 6 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 8715a7b140cc..2aa3d695d548 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -561,7 +561,7 @@ static void ibmvfc_init_host(struct ibmvfc_host *vhost, int relogin)
561 struct ibmvfc_target *tgt; 561 struct ibmvfc_target *tgt;
562 562
563 if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) { 563 if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
564 if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) { 564 if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
565 dev_err(vhost->dev, 565 dev_err(vhost->dev,
566 "Host initialization retries exceeded. Taking adapter offline\n"); 566 "Host initialization retries exceeded. Taking adapter offline\n");
567 ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE); 567 ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
@@ -845,11 +845,12 @@ static void ibmvfc_reset_host(struct ibmvfc_host *vhost)
845static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost) 845static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost)
846{ 846{
847 if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) { 847 if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
848 if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) { 848 vhost->delay_init = 1;
849 if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
849 dev_err(vhost->dev, 850 dev_err(vhost->dev,
850 "Host initialization retries exceeded. Taking adapter offline\n"); 851 "Host initialization retries exceeded. Taking adapter offline\n");
851 ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE); 852 ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
852 } else if (vhost->init_retries == IBMVFC_MAX_INIT_RETRIES) 853 } else if (vhost->init_retries == IBMVFC_MAX_HOST_INIT_RETRIES)
853 __ibmvfc_reset_host(vhost); 854 __ibmvfc_reset_host(vhost);
854 else 855 else
855 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT); 856 ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT);
@@ -2756,7 +2757,7 @@ static void ibmvfc_init_tgt(struct ibmvfc_target *tgt,
2756static void ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt, 2757static void ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt,
2757 void (*job_step) (struct ibmvfc_target *)) 2758 void (*job_step) (struct ibmvfc_target *))
2758{ 2759{
2759 if (++tgt->init_retries > IBMVFC_MAX_INIT_RETRIES) { 2760 if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) {
2760 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); 2761 ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT);
2761 wake_up(&tgt->vhost->work_wait_q); 2762 wake_up(&tgt->vhost->work_wait_q);
2762 } else 2763 } else
@@ -3613,7 +3614,13 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)
3613 break; 3614 break;
3614 case IBMVFC_HOST_ACTION_INIT: 3615 case IBMVFC_HOST_ACTION_INIT:
3615 BUG_ON(vhost->state != IBMVFC_INITIALIZING); 3616 BUG_ON(vhost->state != IBMVFC_INITIALIZING);
3616 vhost->job_step(vhost); 3617 if (vhost->delay_init) {
3618 vhost->delay_init = 0;
3619 spin_unlock_irqrestore(vhost->host->host_lock, flags);
3620 ssleep(5);
3621 return;
3622 } else
3623 vhost->job_step(vhost);
3617 break; 3624 break;
3618 case IBMVFC_HOST_ACTION_QUERY: 3625 case IBMVFC_HOST_ACTION_QUERY:
3619 list_for_each_entry(tgt, &vhost->targets, queue) 3626 list_for_each_entry(tgt, &vhost->targets, queue)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.h b/drivers/scsi/ibmvscsi/ibmvfc.h
index d6bae941c566..cf02216dc8db 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.h
+++ b/drivers/scsi/ibmvscsi/ibmvfc.h
@@ -43,7 +43,8 @@
43#define IBMVFC_MAX_DISC_THREADS 4 43#define IBMVFC_MAX_DISC_THREADS 4
44#define IBMVFC_TGT_MEMPOOL_SZ 64 44#define IBMVFC_TGT_MEMPOOL_SZ 64
45#define IBMVFC_MAX_CMDS_PER_LUN 64 45#define IBMVFC_MAX_CMDS_PER_LUN 64
46#define IBMVFC_MAX_INIT_RETRIES 3 46#define IBMVFC_MAX_HOST_INIT_RETRIES 6
47#define IBMVFC_MAX_TGT_INIT_RETRIES 3
47#define IBMVFC_DEV_LOSS_TMO (5 * 60) 48#define IBMVFC_DEV_LOSS_TMO (5 * 60)
48#define IBMVFC_DEFAULT_LOG_LEVEL 2 49#define IBMVFC_DEFAULT_LOG_LEVEL 2
49#define IBMVFC_MAX_CDB_LEN 16 50#define IBMVFC_MAX_CDB_LEN 16
@@ -673,6 +674,7 @@ struct ibmvfc_host {
673 int discovery_threads; 674 int discovery_threads;
674 int client_migrated; 675 int client_migrated;
675 int reinit; 676 int reinit;
677 int delay_init;
676 int events_to_log; 678 int events_to_log;
677#define IBMVFC_AE_LINKUP 0x0001 679#define IBMVFC_AE_LINKUP 0x0001
678#define IBMVFC_AE_LINKDOWN 0x0002 680#define IBMVFC_AE_LINKDOWN 0x0002