diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2010-11-30 19:20:12 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-21 13:24:34 -0500 |
commit | ba9cd5d095b42271588c20ccd6ddd561d0e4cc1e (patch) | |
tree | 81b1f70e4a411c7e9d1415016a67e549394f430a /drivers/scsi/fcoe | |
parent | 981c1154b240ee77133a478fcd3853ac18111672 (diff) |
[SCSI] libfcoe: change fip_select to return new FCF
Neaten several calls to fip_select() by having it return the
pointer to the new FCF.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/fcoe')
-rw-r--r-- | drivers/scsi/fcoe/libfcoe.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c index 1a0bb230dd03..625c6be25396 100644 --- a/drivers/scsi/fcoe/libfcoe.c +++ b/drivers/scsi/fcoe/libfcoe.c | |||
@@ -55,7 +55,6 @@ static void fcoe_ctlr_timeout(unsigned long); | |||
55 | static void fcoe_ctlr_timer_work(struct work_struct *); | 55 | static void fcoe_ctlr_timer_work(struct work_struct *); |
56 | static void fcoe_ctlr_recv_work(struct work_struct *); | 56 | static void fcoe_ctlr_recv_work(struct work_struct *); |
57 | static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *); | 57 | static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *); |
58 | static void fcoe_ctlr_select(struct fcoe_ctlr *); | ||
59 | 58 | ||
60 | static void fcoe_ctlr_vn_start(struct fcoe_ctlr *); | 59 | static void fcoe_ctlr_vn_start(struct fcoe_ctlr *); |
61 | static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *, struct sk_buff *); | 60 | static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *, struct sk_buff *); |
@@ -1398,6 +1397,8 @@ drop: | |||
1398 | * fcoe_ctlr_select() - Select the best FCF (if possible) | 1397 | * fcoe_ctlr_select() - Select the best FCF (if possible) |
1399 | * @fip: The FCoE controller | 1398 | * @fip: The FCoE controller |
1400 | * | 1399 | * |
1400 | * Returns the selected FCF, or NULL if none are usable. | ||
1401 | * | ||
1401 | * If there are conflicting advertisements, no FCF can be chosen. | 1402 | * If there are conflicting advertisements, no FCF can be chosen. |
1402 | * | 1403 | * |
1403 | * If there is already a selected FCF, this will choose a better one or | 1404 | * If there is already a selected FCF, this will choose a better one or |
@@ -1405,7 +1406,7 @@ drop: | |||
1405 | * | 1406 | * |
1406 | * Called with lock held. | 1407 | * Called with lock held. |
1407 | */ | 1408 | */ |
1408 | static void fcoe_ctlr_select(struct fcoe_ctlr *fip) | 1409 | static struct fcoe_fcf *fcoe_ctlr_select(struct fcoe_ctlr *fip) |
1409 | { | 1410 | { |
1410 | struct fcoe_fcf *fcf; | 1411 | struct fcoe_fcf *fcf; |
1411 | struct fcoe_fcf *best = fip->sel_fcf; | 1412 | struct fcoe_fcf *best = fip->sel_fcf; |
@@ -1450,6 +1451,7 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip) | |||
1450 | if (time_before(fip->ctlr_ka_time, fip->timer.expires)) | 1451 | if (time_before(fip->ctlr_ka_time, fip->timer.expires)) |
1451 | mod_timer(&fip->timer, fip->ctlr_ka_time); | 1452 | mod_timer(&fip->timer, fip->ctlr_ka_time); |
1452 | } | 1453 | } |
1454 | return best; | ||
1453 | } | 1455 | } |
1454 | 1456 | ||
1455 | /** | 1457 | /** |
@@ -1507,8 +1509,7 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip) | |||
1507 | mutex_lock(&fip->ctlr_mutex); | 1509 | mutex_lock(&fip->ctlr_mutex); |
1508 | spin_lock_bh(&fip->ctlr_lock); | 1510 | spin_lock_bh(&fip->ctlr_lock); |
1509 | LIBFCOE_FIP_DBG(fip, "re-sending FLOGI - reselect\n"); | 1511 | LIBFCOE_FIP_DBG(fip, "re-sending FLOGI - reselect\n"); |
1510 | fcoe_ctlr_select(fip); | 1512 | fcf = fcoe_ctlr_select(fip); |
1511 | fcf = fip->sel_fcf; | ||
1512 | if (!fcf || fcf->flogi_sent) { | 1513 | if (!fcf || fcf->flogi_sent) { |
1513 | kfree_skb(fip->flogi_req); | 1514 | kfree_skb(fip->flogi_req); |
1514 | fip->flogi_req = NULL; | 1515 | fip->flogi_req = NULL; |
@@ -1548,14 +1549,12 @@ static void fcoe_ctlr_flogi_send(struct fcoe_ctlr *fip) | |||
1548 | */ | 1549 | */ |
1549 | if (fcf->flogi_sent) { | 1550 | if (fcf->flogi_sent) { |
1550 | LIBFCOE_FIP_DBG(fip, "sending FLOGI - reselect\n"); | 1551 | LIBFCOE_FIP_DBG(fip, "sending FLOGI - reselect\n"); |
1551 | fcoe_ctlr_select(fip); | 1552 | fcf = fcoe_ctlr_select(fip); |
1552 | fcf = fip->sel_fcf; | ||
1553 | if (!fcf || fcf->flogi_sent) { | 1553 | if (!fcf || fcf->flogi_sent) { |
1554 | LIBFCOE_FIP_DBG(fip, "sending FLOGI - clearing\n"); | 1554 | LIBFCOE_FIP_DBG(fip, "sending FLOGI - clearing\n"); |
1555 | list_for_each_entry(fcf, &fip->fcfs, list) | 1555 | list_for_each_entry(fcf, &fip->fcfs, list) |
1556 | fcf->flogi_sent = 0; | 1556 | fcf->flogi_sent = 0; |
1557 | fcoe_ctlr_select(fip); | 1557 | fcf = fcoe_ctlr_select(fip); |
1558 | fcf = fip->sel_fcf; | ||
1559 | } | 1558 | } |
1560 | } | 1559 | } |
1561 | if (fcf) { | 1560 | if (fcf) { |
@@ -1612,8 +1611,7 @@ static void fcoe_ctlr_timer_work(struct work_struct *work) | |||
1612 | sel = fip->sel_fcf; | 1611 | sel = fip->sel_fcf; |
1613 | if (!sel && fip->sel_time) { | 1612 | if (!sel && fip->sel_time) { |
1614 | if (time_after_eq(jiffies, fip->sel_time)) { | 1613 | if (time_after_eq(jiffies, fip->sel_time)) { |
1615 | fcoe_ctlr_select(fip); | 1614 | sel = fcoe_ctlr_select(fip); |
1616 | sel = fip->sel_fcf; | ||
1617 | fip->sel_time = 0; | 1615 | fip->sel_time = 0; |
1618 | } else if (time_after(next_timer, fip->sel_time)) | 1616 | } else if (time_after(next_timer, fip->sel_time)) |
1619 | next_timer = fip->sel_time; | 1617 | next_timer = fip->sel_time; |