diff options
author | James Smart <james.smart@emulex.com> | 2010-03-15 11:24:56 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:23:47 -0400 |
commit | 999d813f227435c35b44362ee82211a1458844fc (patch) | |
tree | ba5c1ab8169b8156a59b6484cd032ce3b873dfa8 /drivers/scsi/lpfc/lpfc_hbadisc.c | |
parent | 65c054f235fda2d545ecd2a7948906a3cf0c1f39 (diff) |
[SCSI] lpfc 8.3.11: FCF failover improvements
FCF failover improvements
- Add random FCF failover when there are multiple FCFs available.
- Prevent FCF log messages from being displayed for FC adapters.
- Separate the New FCF and Modified FCF log messages.
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_hbadisc.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index e1466eec56b7..362730b6dd85 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1531,7 +1531,37 @@ lpfc_check_pending_fcoe_event(struct lpfc_hba *phba, uint8_t unreg_fcf) | |||
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | /** | 1533 | /** |
1534 | * lpfc_sli4_fcf_rec_mbox_parse - parse non-embedded fcf record mailbox command | 1534 | * lpfc_sli4_new_fcf_random_select - Randomly select an eligible new fcf record |
1535 | * @phba: pointer to lpfc hba data structure. | ||
1536 | * @fcf_cnt: number of eligible fcf record seen so far. | ||
1537 | * | ||
1538 | * This function makes an running random selection decision on FCF record to | ||
1539 | * use through a sequence of @fcf_cnt eligible FCF records with equal | ||
1540 | * probability. To perform integer manunipulation of random numbers with | ||
1541 | * size unit32_t, the lower 16 bits of the 32-bit random number returned | ||
1542 | * from random32() are taken as the random random number generated. | ||
1543 | * | ||
1544 | * Returns true when outcome is for the newly read FCF record should be | ||
1545 | * chosen; otherwise, return false when outcome is for keeping the previously | ||
1546 | * chosen FCF record. | ||
1547 | **/ | ||
1548 | static bool | ||
1549 | lpfc_sli4_new_fcf_random_select(struct lpfc_hba *phba, uint32_t fcf_cnt) | ||
1550 | { | ||
1551 | uint32_t rand_num; | ||
1552 | |||
1553 | /* Get 16-bit uniform random number */ | ||
1554 | rand_num = (0xFFFF & random32()); | ||
1555 | |||
1556 | /* Decision with probability 1/fcf_cnt */ | ||
1557 | if ((fcf_cnt * rand_num) < 0xFFFF) | ||
1558 | return true; | ||
1559 | else | ||
1560 | return false; | ||
1561 | } | ||
1562 | |||
1563 | /** | ||
1564 | * lpfc_mbx_cmpl_read_fcf_record - Completion handler for read_fcf mbox. | ||
1535 | * @phba: pointer to lpfc hba data structure. | 1565 | * @phba: pointer to lpfc hba data structure. |
1536 | * @mboxq: pointer to mailbox object. | 1566 | * @mboxq: pointer to mailbox object. |
1537 | * @next_fcf_index: pointer to holder of next fcf index. | 1567 | * @next_fcf_index: pointer to holder of next fcf index. |
@@ -1679,6 +1709,8 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
1679 | uint16_t fcf_index, next_fcf_index; | 1709 | uint16_t fcf_index, next_fcf_index; |
1680 | struct lpfc_fcf_rec *fcf_rec = NULL; | 1710 | struct lpfc_fcf_rec *fcf_rec = NULL; |
1681 | uint16_t vlan_id; | 1711 | uint16_t vlan_id; |
1712 | uint32_t seed; | ||
1713 | bool select_new_fcf; | ||
1682 | int rc; | 1714 | int rc; |
1683 | 1715 | ||
1684 | /* If there is pending FCoE event restart FCF table scan */ | 1716 | /* If there is pending FCoE event restart FCF table scan */ |
@@ -1809,9 +1841,21 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
1809 | * than the driver FCF record, use the new record. | 1841 | * than the driver FCF record, use the new record. |
1810 | */ | 1842 | */ |
1811 | if (new_fcf_record->fip_priority < fcf_rec->priority) { | 1843 | if (new_fcf_record->fip_priority < fcf_rec->priority) { |
1812 | /* Choose this FCF record */ | 1844 | /* Choose the new FCF record with lower priority */ |
1813 | __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record, | 1845 | __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record, |
1814 | addr_mode, vlan_id, 0); | 1846 | addr_mode, vlan_id, 0); |
1847 | /* Reset running random FCF selection count */ | ||
1848 | phba->fcf.eligible_fcf_cnt = 1; | ||
1849 | } else if (new_fcf_record->fip_priority == fcf_rec->priority) { | ||
1850 | /* Update running random FCF selection count */ | ||
1851 | phba->fcf.eligible_fcf_cnt++; | ||
1852 | select_new_fcf = lpfc_sli4_new_fcf_random_select(phba, | ||
1853 | phba->fcf.eligible_fcf_cnt); | ||
1854 | if (select_new_fcf) | ||
1855 | /* Choose the new FCF by random selection */ | ||
1856 | __lpfc_update_fcf_record(phba, fcf_rec, | ||
1857 | new_fcf_record, | ||
1858 | addr_mode, vlan_id, 0); | ||
1815 | } | 1859 | } |
1816 | spin_unlock_irq(&phba->hbalock); | 1860 | spin_unlock_irq(&phba->hbalock); |
1817 | goto read_next_fcf; | 1861 | goto read_next_fcf; |
@@ -1825,6 +1869,11 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
1825 | addr_mode, vlan_id, (boot_flag ? | 1869 | addr_mode, vlan_id, (boot_flag ? |
1826 | BOOT_ENABLE : 0)); | 1870 | BOOT_ENABLE : 0)); |
1827 | phba->fcf.fcf_flag |= FCF_AVAILABLE; | 1871 | phba->fcf.fcf_flag |= FCF_AVAILABLE; |
1872 | /* Setup initial running random FCF selection count */ | ||
1873 | phba->fcf.eligible_fcf_cnt = 1; | ||
1874 | /* Seeding the random number generator for random selection */ | ||
1875 | seed = (uint32_t)(0xFFFFFFFF & jiffies); | ||
1876 | srandom32(seed); | ||
1828 | } | 1877 | } |
1829 | spin_unlock_irq(&phba->hbalock); | 1878 | spin_unlock_irq(&phba->hbalock); |
1830 | goto read_next_fcf; | 1879 | goto read_next_fcf; |