aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c55
1 files changed, 48 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 086f95261605..e758eae0d0fd 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -12405,19 +12405,47 @@ lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba)
12405{ 12405{
12406 uint16_t next_fcf_index; 12406 uint16_t next_fcf_index;
12407 12407
12408 /* Search from the currently registered FCF index */ 12408 /* Search start from next bit of currently registered FCF index */
12409 next_fcf_index = (phba->fcf.current_rec.fcf_indx + 1) %
12410 LPFC_SLI4_FCF_TBL_INDX_MAX;
12409 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask, 12411 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask,
12410 LPFC_SLI4_FCF_TBL_INDX_MAX, 12412 LPFC_SLI4_FCF_TBL_INDX_MAX,
12411 phba->fcf.current_rec.fcf_indx); 12413 next_fcf_index);
12414
12412 /* Wrap around condition on phba->fcf.fcf_rr_bmask */ 12415 /* Wrap around condition on phba->fcf.fcf_rr_bmask */
12413 if (next_fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) 12416 if (next_fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX)
12414 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask, 12417 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask,
12415 LPFC_SLI4_FCF_TBL_INDX_MAX, 0); 12418 LPFC_SLI4_FCF_TBL_INDX_MAX, 0);
12416 /* Round robin failover stop condition */ 12419
12417 if ((next_fcf_index == phba->fcf.fcf_rr_init_indx) || 12420 /* Check roundrobin failover list empty condition */
12418 (next_fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX)) 12421 if (next_fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX) {
12422 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
12423 "2844 No roundrobin failover FCF available\n");
12419 return LPFC_FCOE_FCF_NEXT_NONE; 12424 return LPFC_FCOE_FCF_NEXT_NONE;
12425 }
12426
12427 /* Check roundrobin failover index bmask stop condition */
12428 if (next_fcf_index == phba->fcf.fcf_rr_init_indx) {
12429 if (!(phba->fcf.fcf_flag & FCF_REDISC_RRU)) {
12430 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
12431 "2847 Round robin failover FCF index "
12432 "search hit stop condition:x%x\n",
12433 next_fcf_index);
12434 return LPFC_FCOE_FCF_NEXT_NONE;
12435 }
12436 /* The roundrobin failover index bmask updated, start over */
12437 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12438 "2848 Round robin failover FCF index bmask "
12439 "updated, start over\n");
12440 spin_lock_irq(&phba->hbalock);
12441 phba->fcf.fcf_flag &= ~FCF_REDISC_RRU;
12442 spin_unlock_irq(&phba->hbalock);
12443 return phba->fcf.fcf_rr_init_indx;
12444 }
12420 12445
12446 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12447 "2845 Get next round robin failover "
12448 "FCF index x%x\n", next_fcf_index);
12421 return next_fcf_index; 12449 return next_fcf_index;
12422} 12450}
12423 12451
@@ -12447,11 +12475,20 @@ lpfc_sli4_fcf_rr_index_set(struct lpfc_hba *phba, uint16_t fcf_index)
12447 /* Set the eligible FCF record index bmask */ 12475 /* Set the eligible FCF record index bmask */
12448 set_bit(fcf_index, phba->fcf.fcf_rr_bmask); 12476 set_bit(fcf_index, phba->fcf.fcf_rr_bmask);
12449 12477
12478 /* Set the roundrobin index bmask updated */
12479 spin_lock_irq(&phba->hbalock);
12480 phba->fcf.fcf_flag |= FCF_REDISC_RRU;
12481 spin_unlock_irq(&phba->hbalock);
12482
12483 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12484 "2790 Set FCF index x%x to round robin failover "
12485 "bmask\n", fcf_index);
12486
12450 return 0; 12487 return 0;
12451} 12488}
12452 12489
12453/** 12490/**
12454 * lpfc_sli4_fcf_rr_index_set - Clear bmask from eligible fcf record index 12491 * lpfc_sli4_fcf_rr_index_clear - Clear bmask from eligible fcf record index
12455 * @phba: pointer to lpfc hba data structure. 12492 * @phba: pointer to lpfc hba data structure.
12456 * 12493 *
12457 * This routine clears the FCF record index from the eligible bmask for 12494 * This routine clears the FCF record index from the eligible bmask for
@@ -12472,6 +12509,10 @@ lpfc_sli4_fcf_rr_index_clear(struct lpfc_hba *phba, uint16_t fcf_index)
12472 } 12509 }
12473 /* Clear the eligible FCF record index bmask */ 12510 /* Clear the eligible FCF record index bmask */
12474 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask); 12511 clear_bit(fcf_index, phba->fcf.fcf_rr_bmask);
12512
12513 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
12514 "2791 Clear FCF index x%x from round robin failover "
12515 "bmask\n", fcf_index);
12475} 12516}
12476 12517
12477/** 12518/**
@@ -12534,7 +12575,7 @@ lpfc_mbx_cmpl_redisc_fcf_table(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
12534} 12575}
12535 12576
12536/** 12577/**
12537 * lpfc_sli4_redisc_all_fcf - Request to rediscover entire FCF table by port. 12578 * lpfc_sli4_redisc_fcf_table - Request to rediscover entire FCF table by port.
12538 * @phba: pointer to lpfc hba data structure. 12579 * @phba: pointer to lpfc hba data structure.
12539 * 12580 *
12540 * This routine is invoked to request for rediscovery of the entire FCF table 12581 * This routine is invoked to request for rediscovery of the entire FCF table