public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@suse.de, linux-scsi@vger.kernel.org
Cc: Joe Eykholt <jeykholt@cisco.com>
Subject: [PATCH 26/27] libfcoe: change fip_select to return new FCF
Date: Tue, 30 Nov 2010 16:20:12 -0800	[thread overview]
Message-ID: <20101201002012.18369.44411.stgit@localhost.localdomain> (raw)
In-Reply-To: <20101201001756.18369.7107.stgit@localhost.localdomain>

From: Joe Eykholt <jeykholt@cisco.com>

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>
---
 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 1a0bb23..625c6be 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -55,7 +55,6 @@ static void fcoe_ctlr_timeout(unsigned long);
 static void fcoe_ctlr_timer_work(struct work_struct *);
 static void fcoe_ctlr_recv_work(struct work_struct *);
 static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *);
-static void fcoe_ctlr_select(struct fcoe_ctlr *);
 
 static void fcoe_ctlr_vn_start(struct fcoe_ctlr *);
 static int fcoe_ctlr_vn_recv(struct fcoe_ctlr *, struct sk_buff *);
@@ -1398,6 +1397,8 @@ drop:
  * fcoe_ctlr_select() - Select the best FCF (if possible)
  * @fip: The FCoE controller
  *
+ * Returns the selected FCF, or NULL if none are usable.
+ *
  * If there are conflicting advertisements, no FCF can be chosen.
  *
  * If there is already a selected FCF, this will choose a better one or
@@ -1405,7 +1406,7 @@ drop:
  *
  * Called with lock held.
  */
-static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
+static struct fcoe_fcf *fcoe_ctlr_select(struct fcoe_ctlr *fip)
 {
 	struct fcoe_fcf *fcf;
 	struct fcoe_fcf *best = fip->sel_fcf;
@@ -1450,6 +1451,7 @@ static void fcoe_ctlr_select(struct fcoe_ctlr *fip)
 		if (time_before(fip->ctlr_ka_time, fip->timer.expires))
 			mod_timer(&fip->timer, fip->ctlr_ka_time);
 	}
+	return best;
 }
 
 /**
@@ -1507,8 +1509,7 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)
 	mutex_lock(&fip->ctlr_mutex);
 	spin_lock_bh(&fip->ctlr_lock);
 	LIBFCOE_FIP_DBG(fip, "re-sending FLOGI - reselect\n");
-	fcoe_ctlr_select(fip);
-	fcf = fip->sel_fcf;
+	fcf = fcoe_ctlr_select(fip);
 	if (!fcf || fcf->flogi_sent) {
 		kfree_skb(fip->flogi_req);
 		fip->flogi_req = NULL;
@@ -1548,14 +1549,12 @@ static void fcoe_ctlr_flogi_send(struct fcoe_ctlr *fip)
 	 */
 	if (fcf->flogi_sent) {
 		LIBFCOE_FIP_DBG(fip, "sending FLOGI - reselect\n");
-		fcoe_ctlr_select(fip);
-		fcf = fip->sel_fcf;
+		fcf = fcoe_ctlr_select(fip);
 		if (!fcf || fcf->flogi_sent) {
 			LIBFCOE_FIP_DBG(fip, "sending FLOGI - clearing\n");
 			list_for_each_entry(fcf, &fip->fcfs, list)
 				fcf->flogi_sent = 0;
-			fcoe_ctlr_select(fip);
-			fcf = fip->sel_fcf;
+			fcf = fcoe_ctlr_select(fip);
 		}
 	}
 	if (fcf) {
@@ -1612,8 +1611,7 @@ static void fcoe_ctlr_timer_work(struct work_struct *work)
 	sel = fip->sel_fcf;
 	if (!sel && fip->sel_time) {
 		if (time_after_eq(jiffies, fip->sel_time)) {
-			fcoe_ctlr_select(fip);
-			sel = fip->sel_fcf;
+			sel = fcoe_ctlr_select(fip);
 			fip->sel_time = 0;
 		} else if (time_after(next_timer, fip->sel_time))
 			next_timer = fip->sel_time;


  parent reply	other threads:[~2010-12-01  0:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01  0:17 [PATCH 00/27] libfc, libfcoe and fcoe updates for 2.6.38 Robert Love
2010-12-01  0:18 ` [PATCH 01/27] libfc: remove define of fc_seq_exch in fc_exch.c Robert Love
2010-12-01  0:18 ` [PATCH 02/27] libfc: fix NULL pointer dereference bug in fc_fcp_pkt_release Robert Love
2010-12-01  0:18 ` [PATCH 03/27] libfc: fix mem leak in fc_exch_recv_seq_resp() Robert Love
2010-12-01  0:18 ` [PATCH 04/27] libfc: tune fc_exch_em_alloc() to be O(2) Robert Love
2010-12-01  0:18 ` [PATCH 05/27] libfc: Fix incorrect locking and unlocking in FCP Robert Love
2010-12-01  0:18 ` [PATCH 06/27] libfc: fix mem leak in fc_seq_assign() Robert Love
2010-12-01  0:18 ` [PATCH 07/27] libfc: fix stats computation in fc_queuecommand() Robert Love
2010-12-01  0:18 ` [PATCH 08/27] libfc: incorrect scsi host byte codes returned to scsi-ml Robert Love
2010-12-01  0:18 ` [PATCH 09/27] libfc: use rport timeout values for fcp recovery Robert Love
2010-12-01  0:18 ` [PATCH 10/27] libfc: remove tgt_flags from fc_fcp_pkt struct Robert Love
2010-12-01  0:18 ` [PATCH 11/27] libfc: fix memory leakage in local port Robert Love
2010-12-01  0:18 ` [PATCH 12/27] " Robert Love
2010-12-01  0:19 ` [PATCH 13/27] libfc: fix memory leakage in remote port Robert Love
2010-12-01  0:19 ` [PATCH 14/27] drivers/scsi/fcoe: Update WARN uses Robert Love
2010-12-01  0:19 ` [PATCH 15/27] libfc: add print of exchange id for debugging fc_fcp Robert Love
2010-12-01  0:19 ` [PATCH 16/27] libfc: do not fc_io_compl on fsp w/o any scsi_cmnd associated Robert Love
2010-12-01  0:19 ` [PATCH 17/27] libfc: fix exchange being deleted when the abort itself is timed out Robert Love
2010-12-01  0:19 ` [PATCH 18/27] libfc: the timeout for the REC itself is 2 * R_A_TOV_els Robert Love
2010-12-01  0:19 ` [PATCH 19/27] libfc: fix fc_tm_done not freeing the allocated fsp pkt Robert Love
2010-12-01  0:19 ` [PATCH 20/27] libfcoe: update FIP FCF announcements Robert Love
2010-12-01  0:19 ` [PATCH 21/27] libfcoe: move some timer code to make it reusable Robert Love
2010-12-01  0:19 ` [PATCH 22/27] libfcoe: fix checking of conflicting fabrics in fcoe_ctlr_select() Robert Love
2010-12-01  0:19 ` [PATCH 23/27] libfcoe: retry rejected FLOGI to another FCF if possible Robert Love
2010-12-01  0:20 ` [PATCH 24/27] libfcoe: add debug message for FCF destination MAC Robert Love
2010-12-01  0:20 ` [PATCH 25/27] libfcoe: reorder FCF list to put latest advertiser first Robert Love
2010-12-01  0:20 ` Robert Love [this message]
2010-12-01  0:20 ` [PATCH 27/27] libfc: fix statistics for FCP input/output megabytes Robert Love
2010-12-01 19:04 ` [PATCH] scsi: fix libfc sparse warnings Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101201002012.18369.44411.stgit@localhost.localdomain \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@suse.de \
    --cc=jeykholt@cisco.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox