From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@suse.de, linux-scsi@vger.kernel.org
Cc: Kiran Patil <kiran.patil@intel.com>
Subject: [PATCH 17/28] libfc: Enhanced exchange ID selection mechanism and fix related EMA selection logic.
Date: Fri, 28 Jan 2011 16:04:39 -0800 [thread overview]
Message-ID: <20110129000439.1784.57517.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20110129000310.1784.58748.stgit@localhost6.localdomain6>
From: Kiran Patil <kiran.patil@intel.com>
Problem: In case of exchange responder case, EMA selection was defaulted to the last EMA
from EMA list (lport.ema_list). If exchange ID is selected from offload pool
and not setup DDP, resulting into incorrect selection of EMA, and eventually
dropping the packet because unable to find exchange.
Fix: Enhanced the exchange ID selection (depending upon request type and exchange responder)
Made necessary enhancement in EMA selection algorithm.
Technical Notes: N/A
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 | 64 ++++++++++++++++++++++++++++--------------
1 files changed, 43 insertions(+), 21 deletions(-)
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index a3d6402..08bf5fa 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -2281,16 +2281,45 @@ void fc_exch_mgr_free(struct fc_lport *lport)
EXPORT_SYMBOL(fc_exch_mgr_free);
/**
+ * fc_find_ema() - Lookup and return appropriate Exchange Manager Anchor depending
+ * upon 'xid'.
+ * @f_ctl: f_ctl
+ * @lport: The local port the frame was received on
+ * @fh: The received frame header
+ */
+static struct fc_exch_mgr_anchor *fc_find_ema(u32 f_ctl,
+ struct fc_lport *lport,
+ struct fc_frame_header *fh)
+{
+ struct fc_exch_mgr_anchor *ema;
+ u16 xid;
+
+ if (f_ctl & FC_FC_EX_CTX)
+ xid = ntohs(fh->fh_ox_id);
+ else {
+ xid = ntohs(fh->fh_rx_id);
+ if (xid == FC_XID_UNKNOWN)
+ return list_entry(lport->ema_list.prev,
+ typeof(*ema), ema_list);
+ }
+
+ list_for_each_entry(ema, &lport->ema_list, ema_list) {
+ if ((xid >= ema->mp->min_xid) &&
+ (xid <= ema->mp->max_xid))
+ return ema;
+ }
+ return NULL;
+}
+/**
* fc_exch_recv() - Handler for received frames
* @lport: The local port the frame was received on
- * @fp: The received frame
+ * @fp: The received frame
*/
void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)
{
struct fc_frame_header *fh = fc_frame_header_get(fp);
struct fc_exch_mgr_anchor *ema;
- u32 f_ctl, found = 0;
- u16 oxid;
+ u32 f_ctl;
/* lport lock ? */
if (!lport || lport->state == LPORT_ST_DISABLED) {
@@ -2301,24 +2330,17 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)
}
f_ctl = ntoh24(fh->fh_f_ctl);
- oxid = ntohs(fh->fh_ox_id);
- if (f_ctl & FC_FC_EX_CTX) {
- list_for_each_entry(ema, &lport->ema_list, ema_list) {
- if ((oxid >= ema->mp->min_xid) &&
- (oxid <= ema->mp->max_xid)) {
- found = 1;
- break;
- }
- }
-
- if (!found) {
- FC_LPORT_DBG(lport, "Received response for out "
- "of range oxid:%hx\n", oxid);
- fc_frame_free(fp);
- return;
- }
- } else
- ema = list_entry(lport->ema_list.prev, typeof(*ema), ema_list);
+ ema = fc_find_ema(f_ctl, lport, fh);
+ if (!ema) {
+ FC_LPORT_DBG(lport, "Unable to find Exchange Manager Anchor,"
+ "fc_ctl <0x%x>, xid <0x%x>\n",
+ f_ctl,
+ (f_ctl & FC_FC_EX_CTX) ?
+ ntohs(fh->fh_ox_id) :
+ ntohs(fh->fh_rx_id));
+ fc_frame_free(fp);
+ return;
+ }
/*
* If frame is marked invalid, just drop it.
next prev parent reply other threads:[~2011-01-29 0:04 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-29 0:03 [PATCH 00/28] libfc/libfcoe/fcoe updates for scsi-misc (2.6.39) Robert Love
2011-01-29 0:03 ` [PATCH 01/28] libfc: always initialize the FCoE DDP exchange id for fsp as FC_XID_UNKNOWN Robert Love
2011-01-29 0:03 ` [PATCH 02/28] libfc: Return a valid return code in fc_fcp_pkt_abort() Robert Love
2011-01-29 0:03 ` [PATCH 03/28] libfc: Cleanup return paths in fc_rport_error_retry Robert Love
2011-01-29 0:03 ` [PATCH 04/28] libfc: dereferencing ERR_PTR in fc_tm_done() Robert Love
2011-01-29 0:03 ` [PATCH 05/28] fnic: fix memory leak Robert Love
2011-01-29 0:03 ` [PATCH 06/28] fnic: Bumping up fnic version from 1.4.0.145 to 1.5.0.1 Robert Love
2011-01-29 0:03 ` [PATCH 07/28] fcoe: Fix module reference count for vports Robert Love
2011-01-29 0:03 ` [PATCH 08/28] fcoe: drop FCoE LOGO in FIP mode Robert Love
2011-01-29 0:03 ` [PATCH 09/28] libfc: fix sparse static and non-ANSI warnings Robert Love
2011-01-29 0:04 ` [PATCH 10/28] libfc: add hook for FC-4 provider registration Robert Love
2011-01-29 0:04 ` [PATCH 11/28] libfc: add method for setting handler for incoming exchange Robert Love
2011-01-29 0:04 ` [PATCH 12/28] libfc: add local port hook for provider session lookup Robert Love
2011-01-29 0:04 ` [PATCH 13/28] libfc: add hook to notify providers of local port changes Robert Love
2011-01-29 0:04 ` [PATCH 14/28] libfc: use PRLI hook to get parameters when sending outgoing PRLI Robert Love
2011-01-29 0:04 ` [PATCH 15/28] libfc: Remove usage of the Scsi_Host's host_lock Robert Love
2011-01-29 0:04 ` [PATCH 16/28] libfc: export seq_release() for users of seq_assign() Robert Love
2011-01-29 0:04 ` Robert Love [this message]
2011-01-29 0:04 ` [PATCH 18/28] libfcoe: move logging macros into the local libfcoe.h header file Robert Love
2011-01-29 0:04 ` [PATCH 19/28] libfcoe: add fcoe_transport structure defines to include/scsi/libfcoe.h Robert Love
2011-01-29 0:04 ` [PATCH 20/28] libfcoe: add implementation to support fcoe transport Robert Love
2011-02-02 6:43 ` Mike Christie
2011-02-03 2:13 ` Robert Love
2011-01-29 0:05 ` [PATCH 21/28] libfcoe: rename libfcoe.c to fcoe_cltr.c for the coming fcoe_transport.c Robert Love
2011-01-29 0:05 ` [PATCH 22/28] libfcoe: include fcoe_transport.c into kernel libfcoe module Robert Love
2011-01-29 0:05 ` [PATCH 23/28] fcoe: prepare fcoe for using fcoe transport Robert Love
2011-01-29 0:05 ` [PATCH 24/28] fcoe: convert fcoe.ko to become an fcoe transport provider driver Robert Love
2011-01-29 0:05 ` [PATCH 25/28] libfc: Extending lport's roles for target if there is a registered target Robert Love
2011-01-29 0:05 ` [PATCH 26/28] libfc: introduce LLD event callback Robert Love
2011-01-29 0:05 ` [PATCH 27/28] fcoe: use dedicated workqueue instead of system_wq Robert Love
2011-01-29 0:05 ` [PATCH 28/28] libfcoe: Move common code from fcoe to libfcoe module 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=20110129000439.1784.57517.stgit@localhost6.localdomain6 \
--to=robert.w.love@intel.com \
--cc=James.Bottomley@suse.de \
--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