linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saurav Kashyap <saurav.kashyap@qlogic.com>
To: jbottomley@parallels.com
Cc: giridhar.malavali@qlogic.com, saurav.kashyap@qlogic.com,
	andrew.vasquez@qlogic.com, linux-scsi@vger.kernel.org
Subject: [PATCH 22/29] qla2xxx: Add loopback IDC-TIME-EXTEND aen handling support.
Date: Tue, 27 Aug 2013 01:37:48 -0400	[thread overview]
Message-ID: <1377581875-8574-23-git-send-email-saurav.kashyap@qlogic.com> (raw)
In-Reply-To: <1377581875-8574-1-git-send-email-saurav.kashyap@qlogic.com>

From: Santosh Vernekar <santosh.vernekar@qlogic.com>

Earlier IDC-TIME-EXTEND aen was a nop and ignored by driver.
We now have to handle the aen so that other protocol drivers can use time
extension during some loopback operations.

Signed-off-by: Santosh Vernekar <santosh.vernekar@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_bsg.c |   17 ++++++++++++-
 drivers/scsi/qla2xxx/qla_dbg.c |    2 +-
 drivers/scsi/qla2xxx/qla_def.h |    1 +
 drivers/scsi/qla2xxx/qla_isr.c |   47 +++++++++++++++++++++++++--------------
 4 files changed, 47 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index fb5bd6e..b989add 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -627,6 +627,7 @@ qla81xx_set_loopback_mode(scsi_qla_host_t *vha, uint16_t *config,
 {
 	int ret = 0;
 	int rval = 0;
+	unsigned long rem_tmo = 0, current_tmo = 0;
 	struct qla_hw_data *ha = vha->hw;
 
 	if (!IS_QLA81XX(ha) && !IS_QLA8031(ha) && !IS_QLA8044(ha))
@@ -652,8 +653,19 @@ qla81xx_set_loopback_mode(scsi_qla_host_t *vha, uint16_t *config,
 	}
 
 	/* Wait for DCBX complete event */
-	if (!wait_for_completion_timeout(&ha->dcbx_comp,
-	    (DCBX_COMP_TIMEOUT * HZ))) {
+	current_tmo = DCBX_COMP_TIMEOUT * HZ;
+	while (1) {
+		rem_tmo = wait_for_completion_timeout(&ha->dcbx_comp,
+		    current_tmo);
+		if (!ha->idc_extend_tmo || rem_tmo) {
+			ha->idc_extend_tmo = 0;
+			break;
+		}
+		current_tmo = ha->idc_extend_tmo * HZ;
+		ha->idc_extend_tmo = 0;
+	}
+
+	if (!rem_tmo) {
 		ql_dbg(ql_dbg_user, vha, 0x7022,
 		    "DCBX completion not received.\n");
 		ret = qla81xx_reset_loopback_mode(vha, new_config, 0, 0);
@@ -678,6 +690,7 @@ qla81xx_set_loopback_mode(scsi_qla_host_t *vha, uint16_t *config,
 	}
 
 	ha->notify_dcbx_comp = 0;
+	ha->idc_extend_tmo = 0;
 
 done_set_internal:
 	return rval;
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index ca6bcf6..f192c52 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -26,7 +26,7 @@
  * |                              |                    | 0x3036,0x3038  |
  * |                              |                    | 0x303a		|
  * | DPC Thread                   |       0x4022       | 0x4002,0x4013  |
- * | Async Events                 |       0x5086       | 0x502b-0x502f  |
+ * | Async Events                 |       0x5087       | 0x502b-0x502f  |
  * |                              |                    | 0x5047,0x5052  |
  * |                              |                    | 0x5040,0x5075  |
  * |                              |                    | 0x503d,0x5044  |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index d6eefb8..93db74e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3292,6 +3292,7 @@ struct qla_hw_data {
 
 	/* QLA83XX IDC specific fields */
 	uint32_t	idc_audit_ts;
+	uint32_t	idc_extend_tmo;
 
 	/* DPC low-priority workqueue */
 	struct workqueue_struct *dpc_lp_wq;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index bbc24d3..df1b30b 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -282,25 +282,38 @@ qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr)
 	    "%04x %04x %04x %04x %04x %04x %04x.\n",
 	    event[aen & 0xff], mb[0], mb[1], mb[2], mb[3],
 	    mb[4], mb[5], mb[6]);
-	if ((aen == MBA_IDC_COMPLETE && mb[1] >> 15)) {
-		vha->hw->flags.idc_compl_status = 1;
-		if (vha->hw->notify_dcbx_comp)
-			complete(&vha->hw->dcbx_comp);
-	}
-
-	/* Acknowledgement needed? [Notify && non-zero timeout]. */
-	timeout = (descr >> 8) & 0xf;
-	if (aen != MBA_IDC_NOTIFY || !timeout)
-		return;
+	switch (aen) {
+	/* Handle IDC Error completion case. */
+	case MBA_IDC_COMPLETE:
+		if (mb[1] >> 15) {
+			vha->hw->flags.idc_compl_status = 1;
+			if (vha->hw->notify_dcbx_comp)
+				complete(&vha->hw->dcbx_comp);
+		}
+		break;
 
-	ql_dbg(ql_dbg_async, vha, 0x5022,
-	    "%lu Inter-Driver Communication %s -- ACK timeout=%d.\n",
-	    vha->host_no, event[aen & 0xff], timeout);
+	case MBA_IDC_NOTIFY:
+		/* Acknowledgement needed? [Notify && non-zero timeout]. */
+		timeout = (descr >> 8) & 0xf;
+		ql_dbg(ql_dbg_async, vha, 0x5022,
+		    "%lu Inter-Driver Communication %s -- ACK timeout=%d.\n",
+		    vha->host_no, event[aen & 0xff], timeout);
 
-	rval = qla2x00_post_idc_ack_work(vha, mb);
-	if (rval != QLA_SUCCESS)
-		ql_log(ql_log_warn, vha, 0x5023,
-		    "IDC failed to post ACK.\n");
+		if (!timeout)
+			return;
+		rval = qla2x00_post_idc_ack_work(vha, mb);
+		if (rval != QLA_SUCCESS)
+			ql_log(ql_log_warn, vha, 0x5023,
+			    "IDC failed to post ACK.\n");
+		break;
+	case MBA_IDC_TIME_EXT:
+		vha->hw->idc_extend_tmo = descr;
+		ql_dbg(ql_dbg_async, vha, 0x5087,
+		    "%lu Inter-Driver Communication %s -- "
+		    "Extend timeout by=%d.\n",
+		    vha->host_no, event[aen & 0xff], vha->hw->idc_extend_tmo);
+		break;
+	}
 }
 
 #define LS_UNKNOWN	2
-- 
1.7.7


  parent reply	other threads:[~2013-08-27  6:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27  5:37 [PATCH 00/29] Update driver to 8.06.00.08-k Saurav Kashyap
2013-08-27  5:37 ` [PATCH 01/29] qla2xxx: Print some variables to hexadecimal string via %*phN format Saurav Kashyap
2013-08-27  5:37 ` [PATCH 02/29] qla2xxx: Add support for ISP8044 Saurav Kashyap
2013-08-28  7:15   ` James Bottomley
2013-08-28 13:33     ` Saurav Kashyap
2013-08-27  5:37 ` [PATCH 03/29] qla2xxx: Fix incorrect test after list_for_each_entry() exits Saurav Kashyap
2013-08-27  5:37 ` [PATCH 04/29] qla2xxx: Correct multiqueue offset calculations Saurav Kashyap
2013-08-27  5:37 ` [PATCH 05/29] qla2xxx: Set factory reset recovery timeout to 10 min. for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 06/29] qla2xxx: Perform warm reset every 2 minutes if firmware load fails " Saurav Kashyap
2013-08-27  5:37 ` [PATCH 07/29] qla2xxx: Add ISPFX00 specific bus reset routine Saurav Kashyap
2013-08-27  5:37 ` [PATCH 08/29] qla2xxx: Remove QL_DEBUG_LEVEL_17 defines from qla_nx.c Saurav Kashyap
2013-08-27  5:37 ` [PATCH 09/29] qla2xxx: Add setting of driver version string for vendor application Saurav Kashyap
2013-08-27  5:37 ` [PATCH 10/29] qla2xxx: Reconfigure thermal temperature Saurav Kashyap
2013-08-27  5:37 ` [PATCH 11/29] qla2xxx: Notify ISPFX00 firmware when driver is unloaded or system is shut down Saurav Kashyap
2013-08-27  5:37 ` [PATCH 12/29] qla2xxx: Add critical temperature handling for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 13/29] qla2xxx: Make log message that prints when a completion status requires a port down more readable Saurav Kashyap
2013-08-27  5:37 ` [PATCH 14/29] qla2xxx: Add missing FCP statistics to sysfs interface Saurav Kashyap
2013-08-27  5:37 ` [PATCH 15/29] qla2xxx: Add changes to support extended IOs for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 16/29] qla2xxx: Add changes in initialization for ISPFX00 cards with BIOS Saurav Kashyap
2013-08-27  5:37 ` [PATCH 17/29] qla2xxx: Send all AENs for ISPFx00 to above layers Saurav Kashyap
2013-08-27  5:37 ` [PATCH 18/29] qla2xxx: Remove handling of Shutdown Requested AEN from qlafx00_process_aen() Saurav Kashyap
2013-08-27  5:37 ` [PATCH 19/29] qla2xxx: Correct Interrupt Register offset for ISPFX00 Saurav Kashyap
2013-08-27  5:37 ` [PATCH 20/29] qla2xxx: QLAFX00 make over temperature AEN handling informational, add log for normal temperature AEN Saurav Kashyap
2013-08-27  5:37 ` [PATCH 21/29] qla2xxx: Set default critical temperature value in cases when ISPFX00 firmware doesn't provide it Saurav Kashyap
2013-08-27  5:37 ` Saurav Kashyap [this message]
2013-08-27  5:37 ` [PATCH 23/29] qla2xxx: Select link initialization option bits from current operating mode Saurav Kashyap
2013-08-27  5:37 ` [PATCH 24/29] qla2xxx: Move queue depth ramp down message to i/o debug level Saurav Kashyap
2013-08-27  5:37 ` [PATCH 25/29] qla2xxx: Add a new interface to update versions Saurav Kashyap
2013-08-27  5:37 ` [PATCH 26/29] qla2xxx: Correctly print out/in mailbox registers Saurav Kashyap
2013-08-27  5:37 ` [PATCH 27/29] qla2xxx: Correction to message ids Saurav Kashyap
2013-08-27  5:37 ` [PATCH 28/29] qla2xxx: print MAC via %pMR Saurav Kashyap
2013-08-27  5:37 ` [PATCH 29/29] qla2xxx: Update the driver version to 8.06.00.08-k Saurav Kashyap
2013-08-28  3:24 ` [PATCH 00/29] Update driver " James Bottomley
2013-08-28  4:31   ` Saurav Kashyap

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=1377581875-8574-23-git-send-email-saurav.kashyap@qlogic.com \
    --to=saurav.kashyap@qlogic.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=jbottomley@parallels.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;
as well as URLs for NNTP newsgroup(s).