aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2010-07-14 15:31:37 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:05:41 -0400
commit3804dc84b8c11038ef75d97fd11e43658f623665 (patch)
tree03f6a03b3a489efb11ed40548a5b79b7da34034b
parent589a52d6a97e01c5ff6c244ee6c8ea57726c610f (diff)
[SCSI] lpfc 8.3.15: FCoE Related Fixes
FCoE Related Fixes - Correct find-next-FCF routine so that it searches at next FCF rather than current one. - Enhanced round-robin FCF failover algorithm to re-start on "New FCF" async event - Update the manner in which we look at FCFs while they may be in their discovery state. - Use LPFC_FCOE_NULL_VID macro when checkinf for valid vlan_id for FCF 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>
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c24
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c28
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c22
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c55
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h1
6 files changed, 92 insertions, 40 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index f80156246e51..afbed6bc31f0 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -813,18 +813,21 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
813 */ 813 */
814 lpfc_printf_log(phba, KERN_WARNING, 814 lpfc_printf_log(phba, KERN_WARNING,
815 LOG_FIP | LOG_ELS, 815 LOG_FIP | LOG_ELS,
816 "2760 FLOGI exhausted FCF " 816 "2760 Completed one round "
817 "round robin failover list, " 817 "of FLOGI FCF round robin "
818 "retry FLOGI on the current " 818 "failover list, retry FLOGI "
819 "registered FCF index:%d\n", 819 "on currently registered "
820 "FCF index:%d\n",
820 phba->fcf.current_rec.fcf_indx); 821 phba->fcf.current_rec.fcf_indx);
821 spin_lock_irq(&phba->hbalock);
822 phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
823 spin_unlock_irq(&phba->hbalock);
824 } else { 822 } else {
823 lpfc_printf_log(phba, KERN_INFO,
824 LOG_FIP | LOG_ELS,
825 "2794 FLOGI FCF round robin "
826 "failover to FCF index x%x\n",
827 fcf_index);
825 rc = lpfc_sli4_fcf_rr_read_fcf_rec(phba, 828 rc = lpfc_sli4_fcf_rr_read_fcf_rec(phba,
826 fcf_index); 829 fcf_index);
827 if (rc) { 830 if (rc)
828 lpfc_printf_log(phba, KERN_WARNING, 831 lpfc_printf_log(phba, KERN_WARNING,
829 LOG_FIP | LOG_ELS, 832 LOG_FIP | LOG_ELS,
830 "2761 FLOGI round " 833 "2761 FLOGI round "
@@ -833,10 +836,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
833 "rc:x%x, fcf_index:" 836 "rc:x%x, fcf_index:"
834 "%d\n", rc, 837 "%d\n", rc,
835 phba->fcf.current_rec.fcf_indx); 838 phba->fcf.current_rec.fcf_indx);
836 spin_lock_irq(&phba->hbalock); 839 else
837 phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
838 spin_unlock_irq(&phba->hbalock);
839 } else
840 goto out; 840 goto out;
841 } 841 }
842 } 842 }
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index a610464da16e..92498e488f4f 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1572,7 +1572,7 @@ lpfc_sli4_new_fcf_random_select(struct lpfc_hba *phba, uint32_t fcf_cnt)
1572} 1572}
1573 1573
1574/** 1574/**
1575 * lpfc_mbx_cmpl_read_fcf_record - Completion handler for read_fcf mbox. 1575 * lpfc_sli4_fcf_rec_mbox_parse - Parse read_fcf mbox command.
1576 * @phba: pointer to lpfc hba data structure. 1576 * @phba: pointer to lpfc hba data structure.
1577 * @mboxq: pointer to mailbox object. 1577 * @mboxq: pointer to mailbox object.
1578 * @next_fcf_index: pointer to holder of next fcf index. 1578 * @next_fcf_index: pointer to holder of next fcf index.
@@ -2026,9 +2026,14 @@ read_next_fcf:
2026 memcpy(&phba->fcf.current_rec, 2026 memcpy(&phba->fcf.current_rec,
2027 &phba->fcf.failover_rec, 2027 &phba->fcf.failover_rec,
2028 sizeof(struct lpfc_fcf_rec)); 2028 sizeof(struct lpfc_fcf_rec));
2029 /* mark the FCF fast failover completed */ 2029 /*
2030 * Mark the fast FCF failover rediscovery completed
2031 * and the start of the first round of the roundrobin
2032 * FCF failover.
2033 */
2030 spin_lock_irq(&phba->hbalock); 2034 spin_lock_irq(&phba->hbalock);
2031 phba->fcf.fcf_flag &= ~FCF_REDISC_FOV; 2035 phba->fcf.fcf_flag &=
2036 ~(FCF_REDISC_FOV | FCF_REDISC_RRU);
2032 spin_unlock_irq(&phba->hbalock); 2037 spin_unlock_irq(&phba->hbalock);
2033 /* 2038 /*
2034 * Set up the initial registered FCF index for FLOGI 2039 * Set up the initial registered FCF index for FLOGI
@@ -2074,9 +2079,14 @@ read_next_fcf:
2074 * through the FCF scanning process. 2079 * through the FCF scanning process.
2075 */ 2080 */
2076 2081
2077 /* mark the initial FCF discovery completed */ 2082 /*
2083 * Mark the initial FCF discovery completed and
2084 * the start of the first round of the roundrobin
2085 * FCF failover.
2086 */
2078 spin_lock_irq(&phba->hbalock); 2087 spin_lock_irq(&phba->hbalock);
2079 phba->fcf.fcf_flag &= ~FCF_INIT_DISC; 2088 phba->fcf.fcf_flag &=
2089 ~(FCF_INIT_DISC | FCF_REDISC_RRU);
2080 spin_unlock_irq(&phba->hbalock); 2090 spin_unlock_irq(&phba->hbalock);
2081 /* 2091 /*
2082 * Set up the initial registered FCF index for FLOGI 2092 * Set up the initial registered FCF index for FLOGI
@@ -2206,7 +2216,7 @@ lpfc_mbx_cmpl_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2206 goto out; 2216 goto out;
2207 2217
2208 /* If FCF discovery period is over, no need to proceed */ 2218 /* If FCF discovery period is over, no need to proceed */
2209 if (phba->fcf.fcf_flag & FCF_DISCOVERY) 2219 if (!(phba->fcf.fcf_flag & FCF_DISCOVERY))
2210 goto out; 2220 goto out;
2211 2221
2212 /* Parse the FCF record from the non-embedded mailbox command */ 2222 /* Parse the FCF record from the non-embedded mailbox command */
@@ -5331,13 +5341,15 @@ void
5331lpfc_unregister_unused_fcf(struct lpfc_hba *phba) 5341lpfc_unregister_unused_fcf(struct lpfc_hba *phba)
5332{ 5342{
5333 /* 5343 /*
5334 * If HBA is not running in FIP mode or if HBA does not support 5344 * If HBA is not running in FIP mode, if HBA does not support
5335 * FCoE or if FCF is not registered, do nothing. 5345 * FCoE, if FCF discovery is ongoing, or if FCF has not been
5346 * registered, do nothing.
5336 */ 5347 */
5337 spin_lock_irq(&phba->hbalock); 5348 spin_lock_irq(&phba->hbalock);
5338 if (!(phba->hba_flag & HBA_FCOE_SUPPORT) || 5349 if (!(phba->hba_flag & HBA_FCOE_SUPPORT) ||
5339 !(phba->fcf.fcf_flag & FCF_REGISTERED) || 5350 !(phba->fcf.fcf_flag & FCF_REGISTERED) ||
5340 !(phba->hba_flag & HBA_FIP_SUPPORT) || 5351 !(phba->hba_flag & HBA_FIP_SUPPORT) ||
5352 (phba->fcf.fcf_flag & FCF_DISCOVERY) ||
5341 (phba->pport->port_state == LPFC_FLOGI)) { 5353 (phba->pport->port_state == LPFC_FLOGI)) {
5342 spin_unlock_irq(&phba->hbalock); 5354 spin_unlock_irq(&phba->hbalock);
5343 return; 5355 return;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index fb06933f8e6c..2786ee3b605d 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -3357,22 +3357,14 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3357 "evt_tag:x%x, fcf_index:x%x\n", 3357 "evt_tag:x%x, fcf_index:x%x\n",
3358 acqe_fcoe->event_tag, 3358 acqe_fcoe->event_tag,
3359 acqe_fcoe->index); 3359 acqe_fcoe->index);
3360 /* If the FCF discovery is in progress, do nothing. */
3360 spin_lock_irq(&phba->hbalock); 3361 spin_lock_irq(&phba->hbalock);
3361 if ((phba->fcf.fcf_flag & FCF_SCAN_DONE) || 3362 if (phba->hba_flag & FCF_DISC_INPROGRESS) {
3362 (phba->hba_flag & FCF_DISC_INPROGRESS)) {
3363 /*
3364 * If the current FCF is in discovered state or
3365 * FCF discovery is in progress, do nothing.
3366 */
3367 spin_unlock_irq(&phba->hbalock); 3363 spin_unlock_irq(&phba->hbalock);
3368 break; 3364 break;
3369 } 3365 }
3370 3366 /* If fast FCF failover rescan event is pending, do nothing */
3371 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) { 3367 if (phba->fcf.fcf_flag & FCF_REDISC_EVT) {
3372 /*
3373 * If fast FCF failover rescan event is pending,
3374 * do nothing.
3375 */
3376 spin_unlock_irq(&phba->hbalock); 3368 spin_unlock_irq(&phba->hbalock);
3377 break; 3369 break;
3378 } 3370 }
@@ -3393,7 +3385,13 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
3393 acqe_fcoe->index); 3385 acqe_fcoe->index);
3394 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index); 3386 rc = lpfc_sli4_read_fcf_rec(phba, acqe_fcoe->index);
3395 } 3387 }
3396 3388 /* If the FCF has been in discovered state, do nothing. */
3389 spin_lock_irq(&phba->hbalock);
3390 if (phba->fcf.fcf_flag & FCF_SCAN_DONE) {
3391 spin_unlock_irq(&phba->hbalock);
3392 break;
3393 }
3394 spin_unlock_irq(&phba->hbalock);
3397 /* Otherwise, scan the entire FCF table and re-discover SAN */ 3395 /* Otherwise, scan the entire FCF table and re-discover SAN */
3398 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY, 3396 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
3399 "2770 Start FCF table scan due to new FCF " 3397 "2770 Start FCF table scan due to new FCF "
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index cb5d93b41b50..9c2c7c7140c7 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -2045,7 +2045,7 @@ lpfc_reg_fcfi(struct lpfc_hba *phba, struct lpfcMboxq *mbox)
2045 phba->fcf.current_rec.fcf_indx); 2045 phba->fcf.current_rec.fcf_indx);
2046 /* reg_fcf addr mode is bit wise inverted value of fcf addr_mode */ 2046 /* reg_fcf addr mode is bit wise inverted value of fcf addr_mode */
2047 bf_set(lpfc_reg_fcfi_mam, reg_fcfi, (~phba->fcf.addr_mode) & 0x3); 2047 bf_set(lpfc_reg_fcfi_mam, reg_fcfi, (~phba->fcf.addr_mode) & 0x3);
2048 if (phba->fcf.current_rec.vlan_id != 0xFFFF) { 2048 if (phba->fcf.current_rec.vlan_id != LPFC_FCOE_NULL_VID) {
2049 bf_set(lpfc_reg_fcfi_vv, reg_fcfi, 1); 2049 bf_set(lpfc_reg_fcfi_vv, reg_fcfi, 1);
2050 bf_set(lpfc_reg_fcfi_vlan_tag, reg_fcfi, 2050 bf_set(lpfc_reg_fcfi_vlan_tag, reg_fcfi,
2051 phba->fcf.current_rec.vlan_id); 2051 phba->fcf.current_rec.vlan_id);
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
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index c916079fbb35..a3b24d99a2a7 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -163,6 +163,7 @@ struct lpfc_fcf {
163#define FCF_REDISC_PEND 0x80 /* FCF rediscovery pending */ 163#define FCF_REDISC_PEND 0x80 /* FCF rediscovery pending */
164#define FCF_REDISC_EVT 0x100 /* FCF rediscovery event to worker thread */ 164#define FCF_REDISC_EVT 0x100 /* FCF rediscovery event to worker thread */
165#define FCF_REDISC_FOV 0x200 /* Post FCF rediscovery fast failover */ 165#define FCF_REDISC_FOV 0x200 /* Post FCF rediscovery fast failover */
166#define FCF_REDISC_RRU 0x400 /* Roundrobin bitmap updated */
166 uint32_t addr_mode; 167 uint32_t addr_mode;
167 uint16_t fcf_rr_init_indx; 168 uint16_t fcf_rr_init_indx;
168 uint32_t eligible_fcf_cnt; 169 uint32_t eligible_fcf_cnt;