aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2010-10-22 11:06:08 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-26 11:40:49 -0400
commita93ff37a8a869c7065a1b05f75e69bfb74eb599c (patch)
tree357ef8d67e3a845c21a8843fc2a5b941e007b33d /drivers/scsi/lpfc/lpfc_sli.c
parent12265f68ae925b9dee8099140b4213c28ef54f14 (diff)
[SCSI] lpfc 8.3.18: Add logic to detect last devloss timeout
Added driver logic to detect the last devloss timeout of remote nodes which was still in use of FCF. At that point, the driver should set the last in-use remote node devloss timeout flag if it was not already set and should perform proper action on the in-use FCF and recover of FCF from firmware, depending on the state the driver's FIP engine is in. Find eligible FCF through FCF table rescan or the next new FCF event when FCF table rescan turned out empty eligible FCF, and the successful flogi into an FCF shall clear the HBA_DEVLOSS_TMO flag, indicating the successful recovery from devloss timeout. [jejb: add delay.h include to lpfc_hbadisc.c to fix ppc compile] Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com> Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c72
1 files changed, 24 insertions, 48 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 0d1e187b005d..9d2e1347cb1d 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -5921,7 +5921,7 @@ lpfc_sli4_bpl2sgl(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq,
5921 * lpfc_sli4_scmd_to_wqidx_distr - scsi command to SLI4 WQ index distribution 5921 * lpfc_sli4_scmd_to_wqidx_distr - scsi command to SLI4 WQ index distribution
5922 * @phba: Pointer to HBA context object. 5922 * @phba: Pointer to HBA context object.
5923 * 5923 *
5924 * This routine performs a round robin SCSI command to SLI4 FCP WQ index 5924 * This routine performs a roundrobin SCSI command to SLI4 FCP WQ index
5925 * distribution. This is called by __lpfc_sli_issue_iocb_s4() with the hbalock 5925 * distribution. This is called by __lpfc_sli_issue_iocb_s4() with the hbalock
5926 * held. 5926 * held.
5927 * 5927 *
@@ -12242,13 +12242,15 @@ lpfc_sli4_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, uint16_t fcf_index)
12242 /* Issue the mailbox command asynchronously */ 12242 /* Issue the mailbox command asynchronously */
12243 mboxq->vport = phba->pport; 12243 mboxq->vport = phba->pport;
12244 mboxq->mbox_cmpl = lpfc_mbx_cmpl_fcf_scan_read_fcf_rec; 12244 mboxq->mbox_cmpl = lpfc_mbx_cmpl_fcf_scan_read_fcf_rec;
12245
12246 spin_lock_irq(&phba->hbalock);
12247 phba->hba_flag |= FCF_TS_INPROG;
12248 spin_unlock_irq(&phba->hbalock);
12249
12245 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); 12250 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT);
12246 if (rc == MBX_NOT_FINISHED) 12251 if (rc == MBX_NOT_FINISHED)
12247 error = -EIO; 12252 error = -EIO;
12248 else { 12253 else {
12249 spin_lock_irq(&phba->hbalock);
12250 phba->hba_flag |= FCF_DISC_INPROGRESS;
12251 spin_unlock_irq(&phba->hbalock);
12252 /* Reset eligible FCF count for new scan */ 12254 /* Reset eligible FCF count for new scan */
12253 if (fcf_index == LPFC_FCOE_FCF_GET_FIRST) 12255 if (fcf_index == LPFC_FCOE_FCF_GET_FIRST)
12254 phba->fcf.eligible_fcf_cnt = 0; 12256 phba->fcf.eligible_fcf_cnt = 0;
@@ -12258,21 +12260,21 @@ fail_fcf_scan:
12258 if (error) { 12260 if (error) {
12259 if (mboxq) 12261 if (mboxq)
12260 lpfc_sli4_mbox_cmd_free(phba, mboxq); 12262 lpfc_sli4_mbox_cmd_free(phba, mboxq);
12261 /* FCF scan failed, clear FCF_DISC_INPROGRESS flag */ 12263 /* FCF scan failed, clear FCF_TS_INPROG flag */
12262 spin_lock_irq(&phba->hbalock); 12264 spin_lock_irq(&phba->hbalock);
12263 phba->hba_flag &= ~FCF_DISC_INPROGRESS; 12265 phba->hba_flag &= ~FCF_TS_INPROG;
12264 spin_unlock_irq(&phba->hbalock); 12266 spin_unlock_irq(&phba->hbalock);
12265 } 12267 }
12266 return error; 12268 return error;
12267} 12269}
12268 12270
12269/** 12271/**
12270 * lpfc_sli4_fcf_rr_read_fcf_rec - Read hba fcf record for round robin fcf. 12272 * lpfc_sli4_fcf_rr_read_fcf_rec - Read hba fcf record for roundrobin fcf.
12271 * @phba: pointer to lpfc hba data structure. 12273 * @phba: pointer to lpfc hba data structure.
12272 * @fcf_index: FCF table entry offset. 12274 * @fcf_index: FCF table entry offset.
12273 * 12275 *
12274 * This routine is invoked to read an FCF record indicated by @fcf_index 12276 * This routine is invoked to read an FCF record indicated by @fcf_index
12275 * and to use it for FLOGI round robin FCF failover. 12277 * and to use it for FLOGI roundrobin FCF failover.
12276 * 12278 *
12277 * Return 0 if the mailbox command is submitted sucessfully, none 0 12279 * Return 0 if the mailbox command is submitted sucessfully, none 0
12278 * otherwise. 12280 * otherwise.
@@ -12318,7 +12320,7 @@ fail_fcf_read:
12318 * @fcf_index: FCF table entry offset. 12320 * @fcf_index: FCF table entry offset.
12319 * 12321 *
12320 * This routine is invoked to read an FCF record indicated by @fcf_index to 12322 * This routine is invoked to read an FCF record indicated by @fcf_index to
12321 * determine whether it's eligible for FLOGI round robin failover list. 12323 * determine whether it's eligible for FLOGI roundrobin failover list.
12322 * 12324 *
12323 * Return 0 if the mailbox command is submitted sucessfully, none 0 12325 * Return 0 if the mailbox command is submitted sucessfully, none 0
12324 * otherwise. 12326 * otherwise.
@@ -12364,7 +12366,7 @@ fail_fcf_read:
12364 * 12366 *
12365 * This routine is to get the next eligible FCF record index in a round 12367 * This routine is to get the next eligible FCF record index in a round
12366 * robin fashion. If the next eligible FCF record index equals to the 12368 * robin fashion. If the next eligible FCF record index equals to the
12367 * initial round robin FCF record index, LPFC_FCOE_FCF_NEXT_NONE (0xFFFF) 12369 * initial roundrobin FCF record index, LPFC_FCOE_FCF_NEXT_NONE (0xFFFF)
12368 * shall be returned, otherwise, the next eligible FCF record's index 12370 * shall be returned, otherwise, the next eligible FCF record's index
12369 * shall be returned. 12371 * shall be returned.
12370 **/ 12372 **/
@@ -12392,28 +12394,10 @@ lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba)
12392 return LPFC_FCOE_FCF_NEXT_NONE; 12394 return LPFC_FCOE_FCF_NEXT_NONE;
12393 } 12395 }
12394 12396
12395 /* Check roundrobin failover index bmask stop condition */
12396 if (next_fcf_index == phba->fcf.fcf_rr_init_indx) {
12397 if (!(phba->fcf.fcf_flag & FCF_REDISC_RRU)) {
12398 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
12399 "2847 Round robin failover FCF index "
12400 "search hit stop condition:x%x\n",
12401 next_fcf_index);
12402 return LPFC_FCOE_FCF_NEXT_NONE;
12403 }
12404 /* The roundrobin failover index bmask updated, start over */
12405 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12406 "2848 Round robin failover FCF index bmask "
12407 "updated, start over\n");
12408 spin_lock_irq(&phba->hbalock);
12409 phba->fcf.fcf_flag &= ~FCF_REDISC_RRU;
12410 spin_unlock_irq(&phba->hbalock);
12411 return phba->fcf.fcf_rr_init_indx;
12412 }
12413
12414 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12397 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12415 "2845 Get next round robin failover " 12398 "2845 Get next roundrobin failover FCF (x%x)\n",
12416 "FCF index x%x\n", next_fcf_index); 12399 next_fcf_index);
12400
12417 return next_fcf_index; 12401 return next_fcf_index;
12418} 12402}
12419 12403
@@ -12422,7 +12406,7 @@ lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba)
12422 * @phba: pointer to lpfc hba data structure. 12406 * @phba: pointer to lpfc hba data structure.
12423 * 12407 *
12424 * This routine sets the FCF record index in to the eligible bmask for 12408 * This routine sets the FCF record index in to the eligible bmask for
12425 * round robin failover search. It checks to make sure that the index 12409 * roundrobin failover search. It checks to make sure that the index
12426 * does not go beyond the range of the driver allocated bmask dimension 12410 * does not go beyond the range of the driver allocated bmask dimension
12427 * before setting the bit. 12411 * before setting the bit.
12428 * 12412 *
@@ -12434,22 +12418,16 @@ lpfc_sli4_fcf_rr_index_set(struct lpfc_hba *phba, uint16_t fcf_index)
12434{ 12418{
12435 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) { 12419 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) {
12436 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, 12420 lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
12437 "2610 HBA FCF index reached driver's " 12421 "2610 FCF (x%x) reached driver's book "
12438 "book keeping dimension: fcf_index:%d, " 12422 "keeping dimension:x%x\n",
12439 "driver_bmask_max:%d\n",
12440 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX); 12423 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX);
12441 return -EINVAL; 12424 return -EINVAL;
12442 } 12425 }
12443 /* Set the eligible FCF record index bmask */ 12426 /* Set the eligible FCF record index bmask */
12444 set_bit(fcf_index, phba->fcf.fcf_rr_bmask); 12427 set_bit(fcf_index, phba->fcf.fcf_rr_bmask);
12445 12428
12446 /* Set the roundrobin index bmask updated */
12447 spin_lock_irq(&phba->hbalock);
12448 phba->fcf.fcf_flag |= FCF_REDISC_RRU;
12449 spin_unlock_irq(&phba->hbalock);
12450
12451 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12429 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12452 "2790 Set FCF index x%x to round robin failover " 12430 "2790 Set FCF (x%x) to roundrobin FCF failover "
12453 "bmask\n", fcf_index); 12431 "bmask\n", fcf_index);
12454 12432
12455 return 0; 12433 return 0;
@@ -12460,7 +12438,7 @@ lpfc_sli4_fcf_rr_index_set(struct lpfc_hba *phba, uint16_t fcf_index)
12460 * @phba: pointer to lpfc hba data structure. 12438 * @phba: pointer to lpfc hba data structure.
12461 * 12439 *
12462 * This routine clears the FCF record index from the eligible bmask for 12440 * This routine clears the FCF record index from the eligible bmask for
12463 * round robin failover search. It checks to make sure that the index 12441 * roundrobin failover search. It checks to make sure that the index
12464 * does not go beyond the range of the driver allocated bmask dimension 12442 * does not go beyond the range of the driver allocated bmask dimension
12465 * before clearing the bit. 12443 * before clearing the bit.
12466 **/ 12444 **/
@@ -12469,9 +12447,8 @@ lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, uint16_t fcf_index)
12469{ 12447{
12470 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) { 12448 if (fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) {
12471 lpfc_printf_log(phba, KERN_ERR, LOG_FIP, 12449 lpfc_printf_log(phba, KERN_ERR, LOG_FIP,
12472 "2762 HBA FCF index goes beyond driver's " 12450 "2762 FCF (x%x) reached driver's book "
12473 "book keeping dimension: fcf_index:%d, " 12451 "keeping dimension:x%x\n",
12474 "driver_bmask_max:%d\n",
12475 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX); 12452 fcf_index, LPFC_SLI4_FCF_TBL_INDX_MAX);
12476 return; 12453 return;
12477 } 12454 }
@@ -12479,7 +12456,7 @@ lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, uint16_t fcf_index)
12479 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask); 12456 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask);
12480 12457
12481 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12458 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12482 "2791 Clear FCF index x%x from round robin failover " 12459 "2791 Clear FCF (x%x) from roundrobin failover "
12483 "bmask\n", fcf_index); 12460 "bmask\n", fcf_index);
12484} 12461}
12485 12462
@@ -12530,8 +12507,7 @@ lpfc_mbx_cmpl_redisc_fcf_table(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
12530 } 12507 }
12531 } else { 12508 } else {
12532 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 12509 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12533 "2775 Start FCF rediscovery quiescent period " 12510 "2775 Start FCF rediscover quiescent timer\n");
12534 "wait timer before scaning FCF table\n");
12535 /* 12511 /*
12536 * Start FCF rediscovery wait timer for pending FCF 12512 * Start FCF rediscovery wait timer for pending FCF
12537 * before rescan FCF record table. 12513 * before rescan FCF record table.