public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: linux-scsi@vger.kernel.org
Cc: Kiran Patil <kiran.patil@intel.com>
Subject: [PATCH 08/12] libfc:Fix for exchange/seq loopup failure when FCoE stack is used as target and connected to windows initaitor
Date: Mon, 20 Jun 2011 16:30:49 -0700	[thread overview]
Message-ID: <20110620233049.31635.64178.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110620233007.31635.60206.stgit@localhost6.localdomain6>

From: Kiran Patil <kiran.patil@intel.com>

Problem: Linux based SW target (TCM) connected to windows initiator was unable to satisfy
write request of size > 2K.

Fix: Existing linux implememtation of FCoE stack is expecting sequence number to match w.r.t
incoming framme. When DDP is used on target in response to write request from initiator, SW
stack is notified only when last data frame arrives and only the pakcket header of last data
frame is posted to NetRx queue of storage. When that last packet was processed in libfc:Exchange
layer, implementation was expecting sequence number to match, but in this case sequence number
which is embedded in FC Header is assigned by windows initaitor, hence due to sequence number mismatch
post-processing which shall result into sending RSP is not done. Enhanced the code to
utilize the sequence number of incoming last frame and process the packet so that, it
will eventually complete the write request by sending write response (RSP) GOOD.

Notes/Dependencies: This patch is validated using windows and linux initiator to make
sure, it doesn't break anything.

Signed-off-by: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/libfc/fc_exch.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 3b8a645..f5a0665 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -965,8 +965,30 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
 		sp = &ep->seq;
 		if (sp->id != fh->fh_seq_id) {
 			atomic_inc(&mp->stats.seq_not_found);
-			reject = FC_RJT_SEQ_ID;	/* sequence/exch should exist */
-			goto rel;
+			if (f_ctl & FC_FC_END_SEQ) {
+				/*
+				 * Update sequence_id based on incoming last
+				 * frame of sequence exchange. This is needed
+				 * for FCoE target where DDP has been used
+				 * on target where, stack is indicated only
+				 * about last frame's (payload _header) header.
+				 * Whereas "seq_id" which is part of
+				 * frame_header is allocated by initiator
+				 * which is totally different from "seq_id"
+				 * allocated when XFER_RDY was sent by target.
+				 * To avoid false -ve which results into not
+				 * sending RSP, hence write request on other
+				 * end never finishes.
+				 */
+				spin_lock_bh(&ep->ex_lock);
+				sp->ssb_stat |= SSB_ST_RESP;
+				sp->id = fh->fh_seq_id;
+				spin_unlock_bh(&ep->ex_lock);
+			} else {
+				/* sequence/exch should exist */
+				reject = FC_RJT_SEQ_ID;
+				goto rel;
+			}
 		}
 	}
 	WARN_ON(ep != fc_seq_exch(sp));


  parent reply	other threads:[~2011-06-20 23:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20 23:30 [PATCH 00/12] libfc, libfcoe and fcoe updates for scsi-misc Robert Love
2011-06-20 23:30 ` [PATCH 01/12] tcm_fc: Fix warning in file tfc_io Robert Love
2011-06-20 23:30 ` [PATCH 02/12] libfc: Enhancement to RPORT state machine applicable only for VN2VN mode Robert Love
2011-06-20 23:30 ` [PATCH 03/12] libfc, tcm_fc: add ddp_targ() to libfc function template to supprot FCoE DDP in target mode Robert Love
2011-06-20 23:30 ` [PATCH 04/12] fcoe: support ndo_fcoe_ddp_target() for DDP in FCoE targe Robert Love
2011-06-20 23:30 ` [PATCH 05/12] fcoe: Unable to select the exchangeID from offload pool for storage targets Robert Love
2011-06-20 23:30 ` [PATCH 06/12] fcoe: Round-robin based selection of CPU for post-processing of incoming commands Robert Love
2011-06-20 23:30 ` [PATCH 07/12] fcoe: Amends previous patch, Round-robin based selection of CPU for post processing of incoming request for FCoE target Robert Love
2011-06-20 23:30 ` Robert Love [this message]
2011-06-20 23:55 ` [PATCH 00/12] libfc, libfcoe and fcoe updates for scsi-misc Love, Robert W

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=20110620233049.31635.64178.stgit@localhost6.localdomain6 \
    --to=robert.w.love@intel.com \
    --cc=kiran.patil@intel.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