From: Robert Love <robert.w.love@intel.com>
To: james.bottomley@hansenpartnership.com, linux-scsi@vger.kernel.org
Subject: [PATCH 23/24] fcoe: fix handling of pending queue, prevent out of order frames (v3)
Date: Fri, 27 Feb 2009 10:56:32 -0800 [thread overview]
Message-ID: <20090227185632.25509.38768.stgit@fritz> (raw)
In-Reply-To: <20090227185430.25509.34309.stgit@fritz>
From: Chris Leech <christopher.leech@intel.com>
In fcoe_check_wait_queue() the queue length could temporarily drop to 0,
before the last frame was successfully sent. This resulted in out of order
data frames within a single sequence, leading to IO timeout errors.
This builds on the approach from Vasu Dev to only fix the queue management in
fcoe_check_wait_queue, where my first patch added locking to the transmit
path even when the pending queue was not in use.
This patch continues to use fcoe_pending_queue.qlen instead of introducing a
new length counter, but takes precautions to ensure it never drops to 0 before
the final frame in the queue has successfully been passed to the netdev qdisc
layer. It also includes some cleanup of fcoe_check_wait_queue and removes the
fcoe_insert_wait_queue(_head) wrapper functions.
Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
drivers/scsi/fcoe/libfcoe.c | 81 +++++++++++++------------------------------
1 files changed, 24 insertions(+), 57 deletions(-)
diff --git a/drivers/scsi/fcoe/libfcoe.c b/drivers/scsi/fcoe/libfcoe.c
index 14dd8a0..0e0b494 100644
--- a/drivers/scsi/fcoe/libfcoe.c
+++ b/drivers/scsi/fcoe/libfcoe.c
@@ -70,8 +70,6 @@ struct fcoe_percpu_s *fcoe_percpu[NR_CPUS];
/* Function Prototyes */
static int fcoe_check_wait_queue(struct fc_lport *);
-static void fcoe_insert_wait_queue_head(struct fc_lport *, struct sk_buff *);
-static void fcoe_insert_wait_queue(struct fc_lport *, struct sk_buff *);
static void fcoe_recv_flogi(struct fcoe_softc *, struct fc_frame *, u8 *);
#ifdef CONFIG_HOTPLUG_CPU
static int fcoe_cpu_callback(struct notifier_block *, ulong, void *);
@@ -501,7 +499,9 @@ int fcoe_xmit(struct fc_lport *lp, struct fc_frame *fp)
rc = fcoe_start_io(skb);
if (rc) {
- fcoe_insert_wait_queue(lp, skb);
+ spin_lock_bh(&fc->fcoe_pending_queue.lock);
+ __skb_queue_tail(&fc->fcoe_pending_queue, skb);
+ spin_unlock_bh(&fc->fcoe_pending_queue.lock);
if (fc->fcoe_pending_queue.qlen > FCOE_MAX_QUEUE_DEPTH)
lp->qfull = 1;
}
@@ -756,33 +756,36 @@ void fcoe_watchdog(ulong vp)
*/
static int fcoe_check_wait_queue(struct fc_lport *lp)
{
+ struct fcoe_softc *fc = lport_priv(lp);
struct sk_buff *skb;
- struct fcoe_softc *fc;
int rc = -1;
- fc = lport_priv(lp);
spin_lock_bh(&fc->fcoe_pending_queue.lock);
-
if (fc->fcoe_pending_queue_active)
goto out;
fc->fcoe_pending_queue_active = 1;
- if (fc->fcoe_pending_queue.qlen) {
- while ((skb = __skb_dequeue(&fc->fcoe_pending_queue)) != NULL) {
- spin_unlock_bh(&fc->fcoe_pending_queue.lock);
- rc = fcoe_start_io(skb);
- if (rc)
- fcoe_insert_wait_queue_head(lp, skb);
- spin_lock_bh(&fc->fcoe_pending_queue.lock);
- if (rc)
- break;
+
+ while (fc->fcoe_pending_queue.qlen) {
+ /* keep qlen > 0 until fcoe_start_io succeeds */
+ fc->fcoe_pending_queue.qlen++;
+ skb = __skb_dequeue(&fc->fcoe_pending_queue);
+
+ spin_unlock_bh(&fc->fcoe_pending_queue.lock);
+ rc = fcoe_start_io(skb);
+ spin_lock_bh(&fc->fcoe_pending_queue.lock);
+
+ if (rc) {
+ __skb_queue_head(&fc->fcoe_pending_queue, skb);
+ /* undo temporary increment above */
+ fc->fcoe_pending_queue.qlen--;
+ break;
}
- /*
- * if interface pending queue is below FCOE_LOW_QUEUE_DEPTH
- * then clear qfull flag.
- */
- if (fc->fcoe_pending_queue.qlen < FCOE_LOW_QUEUE_DEPTH)
- lp->qfull = 0;
+ /* undo temporary increment above */
+ fc->fcoe_pending_queue.qlen--;
}
+
+ if (fc->fcoe_pending_queue.qlen < FCOE_LOW_QUEUE_DEPTH)
+ lp->qfull = 0;
fc->fcoe_pending_queue_active = 0;
rc = fc->fcoe_pending_queue.qlen;
out:
@@ -791,42 +794,6 @@ out:
}
/**
- * fcoe_insert_wait_queue_head() - puts skb to fcoe pending queue head
- * @lp: the fc_port for this skb
- * @skb: the associated skb to be xmitted
- *
- * Returns: none
- */
-static void fcoe_insert_wait_queue_head(struct fc_lport *lp,
- struct sk_buff *skb)
-{
- struct fcoe_softc *fc;
-
- fc = lport_priv(lp);
- spin_lock_bh(&fc->fcoe_pending_queue.lock);
- __skb_queue_head(&fc->fcoe_pending_queue, skb);
- spin_unlock_bh(&fc->fcoe_pending_queue.lock);
-}
-
-/**
- * fcoe_insert_wait_queue() - put the skb into fcoe pending queue tail
- * @lp: the fc_port for this skb
- * @skb: the associated skb to be xmitted
- *
- * Returns: none
- */
-static void fcoe_insert_wait_queue(struct fc_lport *lp,
- struct sk_buff *skb)
-{
- struct fcoe_softc *fc;
-
- fc = lport_priv(lp);
- spin_lock_bh(&fc->fcoe_pending_queue.lock);
- __skb_queue_tail(&fc->fcoe_pending_queue, skb);
- spin_unlock_bh(&fc->fcoe_pending_queue.lock);
-}
-
-/**
* fcoe_dev_setup() - setup link change notification interface
*/
static void fcoe_dev_setup()
next prev parent reply other threads:[~2009-02-27 18:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-27 18:54 [PATCH 00/24] libfc and fcoe fixes for 2.6.29-rc Robert Love
2009-02-27 18:54 ` [PATCH 01/24] libfc: Pass lport in exch_mgr_reset Robert Love
2009-02-27 18:54 ` [PATCH 02/24] libfc: when rport goes away (re-plogi), clean up exchanges to/from rport Robert Love
2009-02-27 18:54 ` [PATCH 03/24] libfc: handle RRQ exch timeout Robert Love
2009-02-27 18:54 ` [PATCH 04/24] libfc: fixed a soft lockup issue in fc_exch_recv_abts Robert Love
2009-02-27 18:54 ` [PATCH 05/24] libfc, fcoe: fixed locking issues with lport->lp_mutex around lport->link_status Robert Love
2009-02-27 18:55 ` [PATCH 06/24] libfc: rport retry on LS_RJT from certain ELS Robert Love
2009-02-27 18:55 ` [PATCH 07/24] libfc: fixed a read IO data integrity issue when a IO data frame lost Robert Love
2009-02-27 18:55 ` [PATCH 08/24] libfc: exch mgr is freed while lport still retrying sequences Robert Love
2009-02-27 18:55 ` [PATCH 09/24] libfc: Don't violate transport template for rogue port creation Robert Love
2009-02-27 18:55 ` [PATCH 10/24] libfc: correct RPORT_TO_PRIV usage Robert Love
2009-02-27 18:55 ` [PATCH 11/24] libfc: rename rp to rdata in fc_disc_new_target() Robert Love
2009-02-27 18:55 ` [PATCH 12/24] libfc: check for err when recv and state is incorrect Robert Love
2009-02-27 18:55 ` [PATCH 13/24] libfc: Cleanup libfc_function_template comments Robert Love
2009-02-27 18:55 ` [PATCH 14/24] libfc, fcoe: Fix kerneldoc comments Robert Love
2009-02-27 18:55 ` [PATCH 15/24] libfc, fcoe: Cleanup function formatting and minor typos Robert Love
2009-02-27 18:55 ` [PATCH 16/24] libfc, fcoe: Remove unnecessary cast by removing inline wrapper Robert Love
2009-02-27 18:56 ` [PATCH 17/24] fcoe: Use setup_timer() and mod_timer() Robert Love
2009-02-27 18:56 ` [PATCH 18/24] fcoe: Correct fcoe_transports initialization vs. registration Robert Love
2009-02-27 18:56 ` [PATCH 19/24] libfc: do not change the fh_rx_id of a recevied frame Robert Love
2009-02-27 18:56 ` [PATCH 20/24] fcoe: ETH_P_8021Q is already in if_ether and fcoe is not using it anyway Robert Love
2009-02-27 18:56 ` [PATCH 21/24] fcoe: fix kfree(skb) Robert Love
2009-02-27 18:56 ` [PATCH 22/24] fcoe: Out of order tx frames was causing several check condition SCSI status Robert Love
2009-02-27 18:56 ` Robert Love [this message]
2009-02-27 18:56 ` [PATCH 24/24] fcoe: Change fcoe receive thread nice value from 19 (lowest priority) to -20 Robert Love
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=20090227185632.25509.38768.stgit@fritz \
--to=robert.w.love@intel.com \
--cc=james.bottomley@hansenpartnership.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