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: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Subject: [PATCH 05/17] libfc: Honor LS_ACC response codes for PRLI
Date: Fri, 11 Jun 2010 16:43:54 -0700	[thread overview]
Message-ID: <20100611234354.4616.31826.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100611234328.4616.95199.stgit@localhost.localdomain>

From: Bhanu Prakash Gollapudi <bprakash@broadcom.com>

As per FC-LS Rev 1.62 table 46, response codes are handled as follows:

1. If the Req executed is true, PRLI is accepted.
2. If Req executed is not set,  if resp code is 5,
   PRLI is not retried and port is logged out.
3. If resp code is anything apart from 1 or 5, PRLI is retired
   upto max retry count.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/libfc/fc_rport.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index 3ee497a..e33c5c7 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -698,6 +698,7 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
 	u32 roles = FC_RPORT_ROLE_UNKNOWN;
 	u32 fcp_parm = 0;
 	u8 op;
+	u8 resp_code = 0;
 
 	mutex_lock(&rdata->rp_mutex);
 
@@ -722,11 +723,25 @@ static void fc_rport_prli_resp(struct fc_seq *sp, struct fc_frame *fp,
 	op = fc_frame_payload_op(fp);
 	if (op == ELS_LS_ACC) {
 		pp = fc_frame_payload_get(fp, sizeof(*pp));
-		if (pp && pp->prli.prli_spp_len >= sizeof(pp->spp)) {
-			fcp_parm = ntohl(pp->spp.spp_params);
-			if (fcp_parm & FCP_SPPF_RETRY)
-				rdata->flags |= FC_RP_FLAGS_RETRY;
+		if (!pp)
+			goto out;
+
+		resp_code = (pp->spp.spp_flags & FC_SPP_RESP_MASK);
+		FC_RPORT_DBG(rdata, "PRLI spp_flags = 0x%x\n",
+			     pp->spp.spp_flags);
+		if (resp_code != FC_SPP_RESP_ACK) {
+			if (resp_code == FC_SPP_RESP_CONF)
+				fc_rport_error(rdata, fp);
+			else
+				fc_rport_error_retry(rdata, fp);
+			goto out;
 		}
+		if (pp->prli.prli_spp_len < sizeof(pp->spp))
+			goto out;
+
+		fcp_parm = ntohl(pp->spp.spp_params);
+		if (fcp_parm & FCP_SPPF_RETRY)
+			rdata->flags |= FC_RP_FLAGS_RETRY;
 
 		rdata->supported_classes = FC_COS_CLASS3;
 		if (fcp_parm & FCP_SPPF_INIT_FCN)


  parent reply	other threads:[~2010-06-11 23:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-11 23:43 [PATCH 00/17] libfc, libfcoe and fcoe fixes Robert Love
2010-06-11 23:43 ` [PATCH 01/17] libfcoe: FIP link keep-alive should continue while logged off Robert Love
2010-06-11 23:43 ` [PATCH 02/17] libfcoe: Avoid hang when receiving non-critical descriptors Robert Love
2010-06-11 23:43 ` [PATCH 03/17] libfcoe: No solicitation if adv is dropped Robert Love
2010-06-11 23:43 ` [PATCH 04/17] libfc: Retry a rejected PRLI request Robert Love
2010-06-11 23:43 ` Robert Love [this message]
2010-06-11 23:43 ` [PATCH 06/17] fcoe: clean up TBD comments in FCoE prototype header Robert Love
2010-06-11 23:44 ` [PATCH 07/17] libfc: Handle unsolicited PRLO request Robert Love
2010-06-11 23:44 ` [PATCH 08/17] libfcoe: fix lenient aging of FCF advertisements Robert Love
2010-06-11 23:44 ` [PATCH 09/17] libfcoe: Use fka_period as periodic timeouts to age out fcf if Robert Love
2010-06-11 23:44 ` [PATCH 10/17] libfcoe: update FIP FCF D flag from advertisments Robert Love
2010-06-11 23:44 ` [PATCH 11/17] libfcoe: Handle duplicate critical descriptors Robert Love
2010-06-11 23:44 ` [PATCH 12/17] libfcoe: Host doesnt handle CVL to NPIV ports Robert Love
2010-06-11 23:44 ` [PATCH 13/17] libfcoe: Check for order and missing critical descriptors for FIP ELS requests Robert Love
2010-06-11 23:44 ` [PATCH 14/17] libfc: lport state is enum not bit mask Robert Love
2010-06-11 23:44 ` [PATCH 15/17] fnic: drivers/scsi/fnic/fnic_scsi.c: clean up Robert Love
2010-06-11 23:44 ` [PATCH 16/17] libfc: Fix remote port restart problem Robert Love
2010-06-11 23:44 ` [PATCH 17/17] libfc: fix indefinite rport restart 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=20100611234354.4616.31826.stgit@localhost.localdomain \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@suse.de \
    --cc=bprakash@broadcom.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