libfcoe: Fix Conflicting FCFs issue in the fabric

When multiple FCFs in use, and first FIP Advertisement received is
with "Available for Login" i.e A bit set to 0, FCF selection will fail.
The fix is to remove the assumption in the code that first FCF is only
allowed selectable FCF.
Consider the scenario fip->fcfs contains FCF1(fabricname X, marked A=0)
FCF2(fabricname Y, marked A=1). list_first_entry(first) points to FCF1
and 1st iteration we ignore the FCF and on 2nd iteration we compare
FCF1 & FCF2 fabric name and we fails to perform FCF selection.

Signed-off-by: Krishna Mohan <krmohan@cisco.com>
Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>

authored by Krishna Mohan and committed by Robert Love e6c10b7c c1be5a5b

Changed files
+5 -10
drivers
scsi
+5 -10
drivers/scsi/fcoe/fcoe_ctlr.c
··· 1548 1548 { 1549 1549 struct fcoe_fcf *fcf; 1550 1550 struct fcoe_fcf *best = fip->sel_fcf; 1551 - struct fcoe_fcf *first; 1552 - 1553 - first = list_first_entry(&fip->fcfs, struct fcoe_fcf, list); 1554 1551 1555 1552 list_for_each_entry(fcf, &fip->fcfs, list) { 1556 1553 LIBFCOE_FIP_DBG(fip, "consider FCF fab %16.16llx " ··· 1565 1568 "" : "un"); 1566 1569 continue; 1567 1570 } 1568 - if (fcf->fabric_name != first->fabric_name || 1569 - fcf->vfid != first->vfid || 1570 - fcf->fc_map != first->fc_map) { 1571 + if (!best || fcf->pri < best->pri || best->flogi_sent) 1572 + best = fcf; 1573 + if (fcf->fabric_name != best->fabric_name || 1574 + fcf->vfid != best->vfid || 1575 + fcf->fc_map != best->fc_map) { 1571 1576 LIBFCOE_FIP_DBG(fip, "Conflicting fabric, VFID, " 1572 1577 "or FC-MAP\n"); 1573 1578 return NULL; 1574 1579 } 1575 - if (fcf->flogi_sent) 1576 - continue; 1577 - if (!best || fcf->pri < best->pri || best->flogi_sent) 1578 - best = fcf; 1579 1580 } 1580 1581 fip->sel_fcf = best; 1581 1582 if (best) {