linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <vikas.chaudhary@qlogic.com>
To: jbottomley@parallels.com, michaelc@cs.wisc.edu
Cc: linux-scsi@vger.kernel.org, vikas.chaudhary@qlogic.com,
	lalit.chandivade@qlogic.com
Subject: [PATCH 16/24] qla4xxx: Fix failure of mbox 0x31
Date: Mon, 16 Dec 2013 06:49:46 -0500	[thread overview]
Message-ID: <1387194594-29817-17-git-send-email-vikas.chaudhary@qlogic.com> (raw)
In-Reply-To: <1387194594-29817-1-git-send-email-vikas.chaudhary@qlogic.com>

From: Vikas Chaudhary <vikas.chaudhary@qlogic.com>

Issue:
While unloading driver MBOX 0x31 fail as DDB logout (MBOX 0x56)
operation is not completed.

Fix:
Wait for DDB Logout completion before MBOX 0x31

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_os.c | 54 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 46 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index a27da31..ce20c75 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -8886,10 +8886,54 @@ static void qla4xxx_prevent_other_port_reinit(struct scsi_qla_host *ha)
 	}
 }
 
+static void qla4xxx_destroy_ddb(struct scsi_qla_host *ha,
+		struct ddb_entry *ddb_entry)
+{
+	struct dev_db_entry *fw_ddb_entry = NULL;
+	dma_addr_t fw_ddb_entry_dma;
+	unsigned long wtime;
+	uint32_t ddb_state;
+	int options;
+	int status;
+
+	options = LOGOUT_OPTION_CLOSE_SESSION;
+	if (qla4xxx_session_logout_ddb(ha, ddb_entry, options) == QLA_ERROR) {
+		ql4_printk(KERN_ERR, ha, "%s: Logout failed\n", __func__);
+		goto clear_ddb;
+	}
+
+	fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry),
+					  &fw_ddb_entry_dma, GFP_KERNEL);
+	if (!fw_ddb_entry) {
+		ql4_printk(KERN_ERR, ha,
+			   "%s: Unable to allocate dma buffer\n", __func__);
+		goto clear_ddb;
+	}
+
+	wtime = jiffies + (HZ * LOGOUT_TOV);
+	do {
+		status = qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index,
+						 fw_ddb_entry, fw_ddb_entry_dma,
+						 NULL, NULL, &ddb_state, NULL,
+						 NULL, NULL);
+		if (status == QLA_ERROR)
+			goto clear_ddb;
+
+		if ((ddb_state == DDB_DS_NO_CONNECTION_ACTIVE) ||
+		    (ddb_state == DDB_DS_SESSION_FAILED))
+			goto clear_ddb;
+
+		schedule_timeout_uninterruptible(HZ);
+	} while ((time_after(wtime, jiffies)));
+
+clear_ddb:
+	qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index);
+	return;
+}
+
 static void qla4xxx_destroy_fw_ddb_session(struct scsi_qla_host *ha)
 {
 	struct ddb_entry *ddb_entry;
-	int options;
 	int idx;
 
 	for (idx = 0; idx < MAX_DDB_ENTRIES; idx++) {
@@ -8898,13 +8942,7 @@ static void qla4xxx_destroy_fw_ddb_session(struct scsi_qla_host *ha)
 		if ((ddb_entry != NULL) &&
 		    (ddb_entry->ddb_type == FLASH_DDB)) {
 
-			options = LOGOUT_OPTION_CLOSE_SESSION;
-			if (qla4xxx_session_logout_ddb(ha, ddb_entry, options)
-			    == QLA_ERROR)
-				ql4_printk(KERN_ERR, ha, "%s: Logout failed\n",
-					   __func__);
-
-			qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index);
+			qla4xxx_destroy_ddb(ha, ddb_entry);
 			/*
 			 * we have decremented the reference count of the driver
 			 * when we setup the session to have the driver unload
-- 
1.8.2.GIT


  parent reply	other threads:[~2013-12-16 12:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 11:49 [PATCH 0/24] qla4xxx: 5.04.00-k4: Updates for scsi "misc" branch vikas.chaudhary
2013-12-16 11:49 ` [PATCH 01/24] qla4xxx: ISP8xxx: Correct retry of adapter initialization vikas.chaudhary
2013-12-16 11:49 ` [PATCH 02/24] qla4xxx: Print WARN_ONCE() if iSCSI function presence bit removed vikas.chaudhary
2013-12-16 11:49 ` [PATCH 03/24] qla4xxx: Fix comments in code vikas.chaudhary
2013-12-16 11:49 ` [PATCH 04/24] qla4xxx: Use IDC_CTRL bit1 directly instead of AF_83XX_NO_FWDUMP flag vikas.chaudhary
2013-12-16 11:49 ` [PATCH 05/24] qla4xxx: Improve loopback failure messages vikas.chaudhary
2013-12-16 11:49 ` [PATCH 06/24] qla4xxx: Rename ACB_STATE macros with IP_ADDRSTATE macros vikas.chaudhary
2013-12-16 11:49 ` [PATCH 07/24] qla4xxx: Correctly handle msleep_interruptible vikas.chaudhary
2013-12-16 11:49 ` [PATCH 08/24] qla4xxx: Fixed AER reset sequence for ISP83xx/ISP84xx vikas.chaudhary
2013-12-16 11:49 ` [PATCH 09/24] qla4xxx: Return correct error status from func qla4xxx_request_irqs() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 10/24] qla4xxx: Clear DDB index map upon connection close failure vikas.chaudhary
2013-12-16 11:49 ` [PATCH 11/24] qla4xxx: Fix failure of IDC Time Extend mailbox command vikas.chaudhary
2013-12-16 11:49 ` [PATCH 12/24] qla4xxx: Fix processing response queue during probe vikas.chaudhary
2013-12-16 11:49 ` [PATCH 13/24] qla4xxx: Fix pending IO completion in reset path before initiating chip reset vikas.chaudhary
2013-12-16 11:49 ` [PATCH 14/24] qla4xxx: Driver not able to collect minidump for ISP84xx vikas.chaudhary
2013-12-16 11:49 ` [PATCH 15/24] qla4xxx: Reduce rom-lock contention during reset recovery vikas.chaudhary
2013-12-16 11:49 ` vikas.chaudhary [this message]
2014-01-17  8:30   ` [PATCH 16/24] qla4xxx: Fix failure of mbox 0x31 Mike Christie
2014-01-17 10:34     ` Vikas Chaudhary
2013-12-16 11:49 ` [PATCH 17/24] qla4xxx: Remove unused code from qla4xxx_set_ifcb() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 18/24] qla4xxx: Updated print for device login, logout path vikas.chaudhary
2013-12-16 11:49 ` [PATCH 19/24] qla4xxx: Update print statements in qla4xxx_mailbox_command() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 20/24] qla4xxx: Update print statements in func qla4xxx_eh_abort() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 21/24] qla4xxx: Update print statements in func qla4xxx_do_dpc() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 22/24] qla4xxx: Handle IPv6 AEN notifications vikas.chaudhary
2013-12-16 11:49 ` [PATCH 23/24] qla4xxx: Fix sparse warnings vikas.chaudhary
2013-12-16 11:49 ` [PATCH 24/24] qla4xxx: Update driver version to 5.04.00-k4 vikas.chaudhary
2014-01-17 18:20 ` [PATCH 0/24] qla4xxx: 5.04.00-k4: Updates for scsi "misc" branch Mike Christie

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=1387194594-29817-17-git-send-email-vikas.chaudhary@qlogic.com \
    --to=vikas.chaudhary@qlogic.com \
    --cc=jbottomley@parallels.com \
    --cc=lalit.chandivade@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    /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).