aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorJames Smart <james.smart@emulex.com>2010-06-08 18:31:37 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:01:36 -0400
commitdbb6b3ab10464aa11df74c0d0a14e869a8c6fd1b (patch)
tree88d59281937042a9cd8c4a93573f838763e8c7c7 /drivers/scsi/lpfc
parent75baf69657ea2107f2c202cd29dada206ae4b7c4 (diff)
[SCSI] lpfc 8.3.14: FCoE Discovery Fixes
- Prevent unregistring of unused FCF when FLOGI is pending. - Prevent point to point discovery on a FCoE HBA. - Fixed FCF discovery failure after swapping FCoE port by switching over to fast failover method when no FCF matches in-use 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>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c38
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c151
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c3
-rw-r--r--drivers/scsi/lpfc/lpfc_sli4.h3
4 files changed, 175 insertions, 20 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index f936f8c7efe1..017c933d60ab 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -796,7 +796,9 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
796 * due to new FCF discovery 796 * due to new FCF discovery
797 */ 797 */
798 if ((phba->hba_flag & HBA_FIP_SUPPORT) && 798 if ((phba->hba_flag & HBA_FIP_SUPPORT) &&
799 (phba->fcf.fcf_flag & FCF_DISCOVERY)) { 799 (phba->fcf.fcf_flag & FCF_DISCOVERY) &&
800 (irsp->ulpStatus != IOSTAT_LOCAL_REJECT) &&
801 (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED)) {
800 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | LOG_ELS, 802 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP | LOG_ELS,
801 "2611 FLOGI failed on registered " 803 "2611 FLOGI failed on registered "
802 "FCF record fcf_index:%d, trying " 804 "FCF record fcf_index:%d, trying "
@@ -890,9 +892,39 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
890 */ 892 */
891 if (sp->cmn.fPort) 893 if (sp->cmn.fPort)
892 rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp); 894 rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp);
893 else 895 else if (!(phba->hba_flag & HBA_FCOE_SUPPORT))
894 rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp); 896 rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp);
895 897 else {
898 lpfc_printf_vlog(vport, KERN_ERR,
899 LOG_FIP | LOG_ELS,
900 "2831 FLOGI response with cleared Fabric "
901 "bit fcf_index 0x%x "
902 "Switch Name %02x%02x%02x%02x%02x%02x%02x%02x "
903 "Fabric Name "
904 "%02x%02x%02x%02x%02x%02x%02x%02x\n",
905 phba->fcf.current_rec.fcf_indx,
906 phba->fcf.current_rec.switch_name[0],
907 phba->fcf.current_rec.switch_name[1],
908 phba->fcf.current_rec.switch_name[2],
909 phba->fcf.current_rec.switch_name[3],
910 phba->fcf.current_rec.switch_name[4],
911 phba->fcf.current_rec.switch_name[5],
912 phba->fcf.current_rec.switch_name[6],
913 phba->fcf.current_rec.switch_name[7],
914 phba->fcf.current_rec.fabric_name[0],
915 phba->fcf.current_rec.fabric_name[1],
916 phba->fcf.current_rec.fabric_name[2],
917 phba->fcf.current_rec.fabric_name[3],
918 phba->fcf.current_rec.fabric_name[4],
919 phba->fcf.current_rec.fabric_name[5],
920 phba->fcf.current_rec.fabric_name[6],
921 phba->fcf.current_rec.fabric_name[7]);
922 lpfc_nlp_put(ndlp);
923 spin_lock_irq(&phba->hbalock);
924 phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
925 spin_unlock_irq(&phba->hbalock);
926 goto out;
927 }
896 if (!rc) { 928 if (!rc) {
897 /* Mark the FCF discovery process done */ 929 /* Mark the FCF discovery process done */
898 if (phba->hba_flag & HBA_FIP_SUPPORT) 930 if (phba->hba_flag & HBA_FIP_SUPPORT)
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index d1c5c52b1c25..7cd5c47a66ea 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -1300,7 +1300,7 @@ lpfc_register_fcf(struct lpfc_hba *phba)
1300 * used for this FCF when the function returns. 1300 * used for this FCF when the function returns.
1301 * If the FCF record need to be used with a particular vlan id, the vlan is 1301 * If the FCF record need to be used with a particular vlan id, the vlan is
1302 * set in the vlan_id on return of the function. If not VLAN tagging need to 1302 * set in the vlan_id on return of the function. If not VLAN tagging need to
1303 * be used with the FCF vlan_id will be set to 0xFFFF; 1303 * be used with the FCF vlan_id will be set to LPFC_FCOE_NULL_VID;
1304 **/ 1304 **/
1305static int 1305static int
1306lpfc_match_fcf_conn_list(struct lpfc_hba *phba, 1306lpfc_match_fcf_conn_list(struct lpfc_hba *phba,
@@ -1336,7 +1336,7 @@ lpfc_match_fcf_conn_list(struct lpfc_hba *phba,
1336 if (phba->valid_vlan) 1336 if (phba->valid_vlan)
1337 *vlan_id = phba->vlan_id; 1337 *vlan_id = phba->vlan_id;
1338 else 1338 else
1339 *vlan_id = 0xFFFF; 1339 *vlan_id = LPFC_FCOE_NULL_VID;
1340 return 1; 1340 return 1;
1341 } 1341 }
1342 1342
@@ -1360,7 +1360,7 @@ lpfc_match_fcf_conn_list(struct lpfc_hba *phba,
1360 if (fcf_vlan_id) 1360 if (fcf_vlan_id)
1361 *vlan_id = fcf_vlan_id; 1361 *vlan_id = fcf_vlan_id;
1362 else 1362 else
1363 *vlan_id = 0xFFFF; 1363 *vlan_id = LPFC_FCOE_NULL_VID;
1364 return 1; 1364 return 1;
1365 } 1365 }
1366 1366
@@ -1469,7 +1469,7 @@ lpfc_match_fcf_conn_list(struct lpfc_hba *phba,
1469 else if (fcf_vlan_id) 1469 else if (fcf_vlan_id)
1470 *vlan_id = fcf_vlan_id; 1470 *vlan_id = fcf_vlan_id;
1471 else 1471 else
1472 *vlan_id = 0xFFFF; 1472 *vlan_id = LPFC_FCOE_NULL_VID;
1473 1473
1474 return 1; 1474 return 1;
1475 } 1475 }
@@ -1521,6 +1521,9 @@ lpfc_check_pending_fcoe_event(struct lpfc_hba *phba, uint8_t unreg_fcf)
1521 * Do not continue FCF discovery and clear FCF_DISC_INPROGRESS 1521 * Do not continue FCF discovery and clear FCF_DISC_INPROGRESS
1522 * flag 1522 * flag
1523 */ 1523 */
1524 lpfc_printf_log(phba, KERN_INFO, LOG_FIP | LOG_DISCOVERY,
1525 "2833 Stop FCF discovery process due to link "
1526 "state change (x%x)\n", phba->link_state);
1524 spin_lock_irq(&phba->hbalock); 1527 spin_lock_irq(&phba->hbalock);
1525 phba->hba_flag &= ~FCF_DISC_INPROGRESS; 1528 phba->hba_flag &= ~FCF_DISC_INPROGRESS;
1526 phba->fcf.fcf_flag &= ~(FCF_REDISC_FOV | FCF_DISCOVERY); 1529 phba->fcf.fcf_flag &= ~(FCF_REDISC_FOV | FCF_DISCOVERY);
@@ -1696,6 +1699,37 @@ lpfc_sli4_log_fcf_record_info(struct lpfc_hba *phba,
1696} 1699}
1697 1700
1698/** 1701/**
1702 lpfc_sli4_fcf_record_match - testing new FCF record for matching existing FCF
1703 * @phba: pointer to lpfc hba data structure.
1704 * @fcf_rec: pointer to an existing FCF record.
1705 * @new_fcf_record: pointer to a new FCF record.
1706 * @new_vlan_id: vlan id from the new FCF record.
1707 *
1708 * This function performs matching test of a new FCF record against an existing
1709 * FCF record. If the new_vlan_id passed in is LPFC_FCOE_IGNORE_VID, vlan id
1710 * will not be used as part of the FCF record matching criteria.
1711 *
1712 * Returns true if all the fields matching, otherwise returns false.
1713 */
1714static bool
1715lpfc_sli4_fcf_record_match(struct lpfc_hba *phba,
1716 struct lpfc_fcf_rec *fcf_rec,
1717 struct fcf_record *new_fcf_record,
1718 uint16_t new_vlan_id)
1719{
1720 if (new_vlan_id != LPFC_FCOE_IGNORE_VID)
1721 if (!lpfc_vlan_id_match(fcf_rec->vlan_id, new_vlan_id))
1722 return false;
1723 if (!lpfc_mac_addr_match(fcf_rec->mac_addr, new_fcf_record))
1724 return false;
1725 if (!lpfc_sw_name_match(fcf_rec->switch_name, new_fcf_record))
1726 return false;
1727 if (!lpfc_fab_name_match(fcf_rec->fabric_name, new_fcf_record))
1728 return false;
1729 return true;
1730}
1731
1732/**
1699 * lpfc_mbx_cmpl_fcf_scan_read_fcf_rec - fcf scan read_fcf mbox cmpl handler. 1733 * lpfc_mbx_cmpl_fcf_scan_read_fcf_rec - fcf scan read_fcf mbox cmpl handler.
1700 * @phba: pointer to lpfc hba data structure. 1734 * @phba: pointer to lpfc hba data structure.
1701 * @mboxq: pointer to mailbox object. 1735 * @mboxq: pointer to mailbox object.
@@ -1758,7 +1792,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1758 */ 1792 */
1759 if (!rc) { 1793 if (!rc) {
1760 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP, 1794 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
1761 "2781 FCF record fcf_index:x%x failed FCF " 1795 "2781 FCF record (x%x) failed FCF "
1762 "connection list check, fcf_avail:x%x, " 1796 "connection list check, fcf_avail:x%x, "
1763 "fcf_valid:x%x\n", 1797 "fcf_valid:x%x\n",
1764 bf_get(lpfc_fcf_record_fcf_index, 1798 bf_get(lpfc_fcf_record_fcf_index,
@@ -1767,6 +1801,32 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1767 new_fcf_record), 1801 new_fcf_record),
1768 bf_get(lpfc_fcf_record_fcf_valid, 1802 bf_get(lpfc_fcf_record_fcf_valid,
1769 new_fcf_record)); 1803 new_fcf_record));
1804 if ((phba->fcf.fcf_flag & FCF_IN_USE) &&
1805 lpfc_sli4_fcf_record_match(phba, &phba->fcf.current_rec,
1806 new_fcf_record, LPFC_FCOE_IGNORE_VID)) {
1807 /*
1808 * In case the current in-use FCF record becomes
1809 * invalid/unavailable during FCF discovery that
1810 * was not triggered by fast FCF failover process,
1811 * treat it as fast FCF failover.
1812 */
1813 if (!(phba->fcf.fcf_flag & FCF_REDISC_PEND) &&
1814 !(phba->fcf.fcf_flag & FCF_REDISC_FOV)) {
1815 lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
1816 "2835 Invalid in-use FCF "
1817 "record (x%x) reported, "
1818 "entering fast FCF failover "
1819 "mode scanning.\n",
1820 phba->fcf.current_rec.fcf_indx);
1821 spin_lock_irq(&phba->hbalock);
1822 phba->fcf.fcf_flag |= FCF_REDISC_FOV;
1823 spin_unlock_irq(&phba->hbalock);
1824 lpfc_sli4_mbox_cmd_free(phba, mboxq);
1825 lpfc_sli4_fcf_scan_read_fcf_rec(phba,
1826 LPFC_FCOE_FCF_GET_FIRST);
1827 return;
1828 }
1829 }
1770 goto read_next_fcf; 1830 goto read_next_fcf;
1771 } else { 1831 } else {
1772 fcf_index = bf_get(lpfc_fcf_record_fcf_index, new_fcf_record); 1832 fcf_index = bf_get(lpfc_fcf_record_fcf_index, new_fcf_record);
@@ -1783,14 +1843,8 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1783 */ 1843 */
1784 spin_lock_irq(&phba->hbalock); 1844 spin_lock_irq(&phba->hbalock);
1785 if (phba->fcf.fcf_flag & FCF_IN_USE) { 1845 if (phba->fcf.fcf_flag & FCF_IN_USE) {
1786 if (lpfc_fab_name_match(phba->fcf.current_rec.fabric_name, 1846 if (lpfc_sli4_fcf_record_match(phba, &phba->fcf.current_rec,
1787 new_fcf_record) && 1847 new_fcf_record, vlan_id)) {
1788 lpfc_sw_name_match(phba->fcf.current_rec.switch_name,
1789 new_fcf_record) &&
1790 lpfc_mac_addr_match(phba->fcf.current_rec.mac_addr,
1791 new_fcf_record) &&
1792 lpfc_vlan_id_match(phba->fcf.current_rec.vlan_id,
1793 vlan_id)) {
1794 phba->fcf.fcf_flag |= FCF_AVAILABLE; 1848 phba->fcf.fcf_flag |= FCF_AVAILABLE;
1795 if (phba->fcf.fcf_flag & FCF_REDISC_PEND) 1849 if (phba->fcf.fcf_flag & FCF_REDISC_PEND)
1796 /* Stop FCF redisc wait timer if pending */ 1850 /* Stop FCF redisc wait timer if pending */
@@ -1800,6 +1854,13 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1800 phba->fcf.fcf_flag &= ~(FCF_REDISC_FOV | 1854 phba->fcf.fcf_flag &= ~(FCF_REDISC_FOV |
1801 FCF_DISCOVERY); 1855 FCF_DISCOVERY);
1802 spin_unlock_irq(&phba->hbalock); 1856 spin_unlock_irq(&phba->hbalock);
1857 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
1858 "2836 The new FCF record (x%x) "
1859 "matches the in-use FCF record "
1860 "(x%x)\n",
1861 phba->fcf.current_rec.fcf_indx,
1862 bf_get(lpfc_fcf_record_fcf_index,
1863 new_fcf_record));
1803 goto out; 1864 goto out;
1804 } 1865 }
1805 /* 1866 /*
@@ -1831,6 +1892,12 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1831 */ 1892 */
1832 if (boot_flag && !(fcf_rec->flag & BOOT_ENABLE)) { 1893 if (boot_flag && !(fcf_rec->flag & BOOT_ENABLE)) {
1833 /* Choose this FCF record */ 1894 /* Choose this FCF record */
1895 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
1896 "2837 Update current FCF record "
1897 "(x%x) with new FCF record (x%x)\n",
1898 fcf_rec->fcf_indx,
1899 bf_get(lpfc_fcf_record_fcf_index,
1900 new_fcf_record));
1834 __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record, 1901 __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record,
1835 addr_mode, vlan_id, BOOT_ENABLE); 1902 addr_mode, vlan_id, BOOT_ENABLE);
1836 spin_unlock_irq(&phba->hbalock); 1903 spin_unlock_irq(&phba->hbalock);
@@ -1851,6 +1918,12 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1851 */ 1918 */
1852 if (new_fcf_record->fip_priority < fcf_rec->priority) { 1919 if (new_fcf_record->fip_priority < fcf_rec->priority) {
1853 /* Choose the new FCF record with lower priority */ 1920 /* Choose the new FCF record with lower priority */
1921 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
1922 "2838 Update current FCF record "
1923 "(x%x) with new FCF record (x%x)\n",
1924 fcf_rec->fcf_indx,
1925 bf_get(lpfc_fcf_record_fcf_index,
1926 new_fcf_record));
1854 __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record, 1927 __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record,
1855 addr_mode, vlan_id, 0); 1928 addr_mode, vlan_id, 0);
1856 /* Reset running random FCF selection count */ 1929 /* Reset running random FCF selection count */
@@ -1860,11 +1933,18 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1860 phba->fcf.eligible_fcf_cnt++; 1933 phba->fcf.eligible_fcf_cnt++;
1861 select_new_fcf = lpfc_sli4_new_fcf_random_select(phba, 1934 select_new_fcf = lpfc_sli4_new_fcf_random_select(phba,
1862 phba->fcf.eligible_fcf_cnt); 1935 phba->fcf.eligible_fcf_cnt);
1863 if (select_new_fcf) 1936 if (select_new_fcf) {
1937 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
1938 "2839 Update current FCF record "
1939 "(x%x) with new FCF record (x%x)\n",
1940 fcf_rec->fcf_indx,
1941 bf_get(lpfc_fcf_record_fcf_index,
1942 new_fcf_record));
1864 /* Choose the new FCF by random selection */ 1943 /* Choose the new FCF by random selection */
1865 __lpfc_update_fcf_record(phba, fcf_rec, 1944 __lpfc_update_fcf_record(phba, fcf_rec,
1866 new_fcf_record, 1945 new_fcf_record,
1867 addr_mode, vlan_id, 0); 1946 addr_mode, vlan_id, 0);
1947 }
1868 } 1948 }
1869 spin_unlock_irq(&phba->hbalock); 1949 spin_unlock_irq(&phba->hbalock);
1870 goto read_next_fcf; 1950 goto read_next_fcf;
@@ -1874,6 +1954,11 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
1874 * initial best-fit FCF. 1954 * initial best-fit FCF.
1875 */ 1955 */
1876 if (fcf_rec) { 1956 if (fcf_rec) {
1957 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
1958 "2840 Update current FCF record "
1959 "with initial FCF record (x%x)\n",
1960 bf_get(lpfc_fcf_record_fcf_index,
1961 new_fcf_record));
1877 __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record, 1962 __lpfc_update_fcf_record(phba, fcf_rec, new_fcf_record,
1878 addr_mode, vlan_id, (boot_flag ? 1963 addr_mode, vlan_id, (boot_flag ?
1879 BOOT_ENABLE : 0)); 1964 BOOT_ENABLE : 0));
@@ -1931,6 +2016,12 @@ read_next_fcf:
1931 lpfc_unregister_fcf(phba); 2016 lpfc_unregister_fcf(phba);
1932 2017
1933 /* Replace in-use record with the new record */ 2018 /* Replace in-use record with the new record */
2019 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
2020 "2842 Replace the current in-use "
2021 "FCF record (x%x) with failover FCF "
2022 "record (x%x)\n",
2023 phba->fcf.current_rec.fcf_indx,
2024 phba->fcf.failover_rec.fcf_indx);
1934 memcpy(&phba->fcf.current_rec, 2025 memcpy(&phba->fcf.current_rec,
1935 &phba->fcf.failover_rec, 2026 &phba->fcf.failover_rec,
1936 sizeof(struct lpfc_fcf_rec)); 2027 sizeof(struct lpfc_fcf_rec));
@@ -1954,6 +2045,28 @@ read_next_fcf:
1954 if ((phba->fcf.fcf_flag & FCF_REDISC_EVT) || 2045 if ((phba->fcf.fcf_flag & FCF_REDISC_EVT) ||
1955 (phba->fcf.fcf_flag & FCF_REDISC_PEND)) 2046 (phba->fcf.fcf_flag & FCF_REDISC_PEND))
1956 return; 2047 return;
2048
2049 if (phba->fcf.fcf_flag & FCF_IN_USE) {
2050 /*
2051 * In case the current in-use FCF record no
2052 * longer existed during FCF discovery that
2053 * was not triggered by fast FCF failover
2054 * process, treat it as fast FCF failover.
2055 */
2056 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
2057 "2841 In-use FCF record (x%x) "
2058 "not reported, entering fast "
2059 "FCF failover mode scanning.\n",
2060 phba->fcf.current_rec.fcf_indx);
2061 spin_lock_irq(&phba->hbalock);
2062 phba->fcf.fcf_flag |= FCF_REDISC_FOV;
2063 spin_unlock_irq(&phba->hbalock);
2064 lpfc_sli4_mbox_cmd_free(phba, mboxq);
2065 lpfc_sli4_fcf_scan_read_fcf_rec(phba,
2066 LPFC_FCOE_FCF_GET_FIRST);
2067 return;
2068 }
2069
1957 /* 2070 /*
1958 * Otherwise, initial scan or post linkdown rescan, 2071 * Otherwise, initial scan or post linkdown rescan,
1959 * register with the best FCF record found so far 2072 * register with the best FCF record found so far
@@ -2036,6 +2149,11 @@ lpfc_mbx_cmpl_fcf_rr_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2036 next_fcf_index); 2149 next_fcf_index);
2037 2150
2038 /* Upload new FCF record to the failover FCF record */ 2151 /* Upload new FCF record to the failover FCF record */
2152 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
2153 "2834 Update the current FCF record (x%x) "
2154 "with the next FCF record (x%x)\n",
2155 phba->fcf.failover_rec.fcf_indx,
2156 bf_get(lpfc_fcf_record_fcf_index, new_fcf_record));
2039 spin_lock_irq(&phba->hbalock); 2157 spin_lock_irq(&phba->hbalock);
2040 __lpfc_update_fcf_record(phba, &phba->fcf.failover_rec, 2158 __lpfc_update_fcf_record(phba, &phba->fcf.failover_rec,
2041 new_fcf_record, addr_mode, vlan_id, 2159 new_fcf_record, addr_mode, vlan_id,
@@ -2053,7 +2171,7 @@ lpfc_mbx_cmpl_fcf_rr_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
2053 2171
2054 lpfc_printf_log(phba, KERN_INFO, LOG_FIP, 2172 lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
2055 "2783 FLOGI round robin FCF failover from FCF " 2173 "2783 FLOGI round robin FCF failover from FCF "
2056 "(index:x%x) to FCF (index:x%x).\n", 2174 "(x%x) to FCF (x%x).\n",
2057 current_fcf_index, 2175 current_fcf_index,
2058 bf_get(lpfc_fcf_record_fcf_index, new_fcf_record)); 2176 bf_get(lpfc_fcf_record_fcf_index, new_fcf_record));
2059 2177
@@ -5217,7 +5335,8 @@ lpfc_unregister_unused_fcf(struct lpfc_hba *phba)
5217 spin_lock_irq(&phba->hbalock); 5335 spin_lock_irq(&phba->hbalock);
5218 if (!(phba->hba_flag & HBA_FCOE_SUPPORT) || 5336 if (!(phba->hba_flag & HBA_FCOE_SUPPORT) ||
5219 !(phba->fcf.fcf_flag & FCF_REGISTERED) || 5337 !(phba->fcf.fcf_flag & FCF_REGISTERED) ||
5220 !(phba->hba_flag & HBA_FIP_SUPPORT)) { 5338 !(phba->hba_flag & HBA_FIP_SUPPORT) ||
5339 (phba->pport->port_state == LPFC_FLOGI)) {
5221 spin_unlock_irq(&phba->hbalock); 5340 spin_unlock_irq(&phba->hbalock);
5222 return; 5341 return;
5223 } 5342 }
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 9c609546b4ef..f38c05dc5635 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -12404,7 +12404,8 @@ lpfc_sli4_fcf_rr_next_index_get(struct lpfc_hba *phba)
12404 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask, 12404 next_fcf_index = find_next_bit(phba->fcf.fcf_rr_bmask,
12405 LPFC_SLI4_FCF_TBL_INDX_MAX, 0); 12405 LPFC_SLI4_FCF_TBL_INDX_MAX, 0);
12406 /* Round robin failover stop condition */ 12406 /* Round robin failover stop condition */
12407 if (next_fcf_index == phba->fcf.fcf_rr_init_indx) 12407 if ((next_fcf_index == phba->fcf.fcf_rr_init_indx) ||
12408 (next_fcf_index >= LPFC_SLI4_FCF_TBL_INDX_MAX))
12408 return LPFC_FCOE_FCF_NEXT_NONE; 12409 return LPFC_FCOE_FCF_NEXT_NONE;
12409 12410
12410 return next_fcf_index; 12411 return next_fcf_index;
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index ccdb95774e84..7686c1a9a634 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -51,6 +51,9 @@
51#define LPFC_FCOE_FCF_GET_FIRST 0xFFFF 51#define LPFC_FCOE_FCF_GET_FIRST 0xFFFF
52#define LPFC_FCOE_FCF_NEXT_NONE 0xFFFF 52#define LPFC_FCOE_FCF_NEXT_NONE 0xFFFF
53 53
54#define LPFC_FCOE_NULL_VID 0xFFF
55#define LPFC_FCOE_IGNORE_VID 0xFFFF
56
54/* First 3 bytes of default FCF MAC is specified by FC_MAP */ 57/* First 3 bytes of default FCF MAC is specified by FC_MAP */
55#define LPFC_FCOE_FCF_MAC3 0xFF 58#define LPFC_FCOE_FCF_MAC3 0xFF
56#define LPFC_FCOE_FCF_MAC4 0xFF 59#define LPFC_FCOE_FCF_MAC4 0xFF