All of lore.kernel.org
 help / color / mirror / Atom feed
From: Himanshu Madhani <himanshu.madhani@qlogic.com>
To: jbottomley@parallels.com
Cc: hch@lst.de, giridhar.malavali@qlogic.com,
	himanshu.madhani@qlogic.com, andrew.vasquez@qlogic.com,
	linux-scsi@vger.kernel.org
Subject: [PATCH  02/14] qla2xxx: Handle AEN8014 incoming port logout.
Date: Tue, 4 Aug 2015 13:37:52 -0400	[thread overview]
Message-ID: <1438709884-623-3-git-send-email-himanshu.madhani@qlogic.com> (raw)
In-Reply-To: <1438709884-623-1-git-send-email-himanshu.madhani@qlogic.com>

From: Joe Carnuccio <joe.carnuccio@qlogic.com>

When we get logged out, mark the port lost and set dpc flag for relogin.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_dbg.c |    2 +-
 drivers/scsi/qla2xxx/qla_isr.c |   35 ++++++++++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 8b011ae..cd188cc 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -26,7 +26,7 @@
  * |                              |                    | 0x3036,0x3038  |
  * |                              |                    | 0x303a		|
  * | DPC Thread                   |       0x4023       | 0x4002,0x4013  |
- * | Async Events                 |       0x5087       | 0x502b-0x502f  |
+ * | Async Events                 |       0x508a       | 0x502b-0x502f  |
  * |                              |                    | 0x5047		|
  * |                              |                    | 0x5084,0x5075	|
  * |                              |                    | 0x503d,0x5044  |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 5559d5e..de0d9d8 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -560,6 +560,17 @@ qla2x00_is_a_vp_did(scsi_qla_host_t *vha, uint32_t rscn_entry)
 	return ret;
 }
 
+static inline fc_port_t *
+qla2x00_find_fcport_by_loopid(scsi_qla_host_t *vha, uint16_t loop_id)
+{
+	fc_port_t *fcport;
+
+	list_for_each_entry(fcport, &vha->vp_fcports, list)
+		if (fcport->loop_id == loop_id)
+			return fcport;
+	return NULL;
+}
+
 /**
  * qla2x00_async_event() - Process aynchronous events.
  * @ha: SCSI driver HA context
@@ -897,11 +908,29 @@ skip_rio:
 			(mb[1] != 0xffff)) && vha->vp_idx != (mb[3] & 0xff))
 			break;
 
-		/* Global event -- port logout or port unavailable. */
-		if (mb[1] == 0xffff && mb[2] == 0x7) {
+		if (mb[2] == 0x7) {
 			ql_dbg(ql_dbg_async, vha, 0x5010,
-			    "Port unavailable %04x %04x %04x.\n",
+			    "Port %s %04x %04x %04x.\n",
+			    mb[1] == 0xffff ? "unavailable" : "logout",
 			    mb[1], mb[2], mb[3]);
+
+			if (mb[1] == 0xffff)
+				goto global_port_update;
+
+			/* Port logout */
+			fcport = qla2x00_find_fcport_by_loopid(vha, mb[1]);
+			if (!fcport)
+				break;
+			if (atomic_read(&fcport->state) != FCS_ONLINE)
+				break;
+			ql_dbg(ql_dbg_async, vha, 0x508a,
+			    "Marking port lost loopid=%04x portid=%06x.\n",
+			    fcport->loop_id, fcport->d_id.b24);
+			qla2x00_mark_device_lost(fcport->vha, fcport, 1, 1);
+			break;
+
+global_port_update:
+			/* Port unavailable. */
 			ql_log(ql_log_warn, vha, 0x505e,
 			    "Link is offline.\n");
 
-- 
1.7.7


  parent reply	other threads:[~2015-08-04 18:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 17:37 [PATCH 00/14] qla2xxx: Patches for scsi "misc" branch Himanshu Madhani
2015-08-04 17:37 ` [PATCH 01/14] qla2xxx: Add serdes register read/write support for ISP25xx Himanshu Madhani
2015-08-04 17:37 ` Himanshu Madhani [this message]
2015-08-04 17:37 ` [PATCH 03/14] qla2xxx: Use ssdid to gate semaphore manipulation Himanshu Madhani
2015-08-04 17:37 ` [PATCH 04/14] qla2xxx: Pause risc before manipulating risc semaphore Himanshu Madhani
2015-08-04 17:37 ` [PATCH 05/14] qla2xxx: Add adapter checks for FAWWN functionality Himanshu Madhani
2015-08-04 17:37 ` [PATCH 06/14] qla2xxx: Do not crash system for sp ref count zero Himanshu Madhani
2015-08-04 17:37 ` [PATCH 07/14] qla2xxx: Do not reset adapter if SRB handle is in range Himanshu Madhani
2015-08-04 17:37 ` [PATCH 08/14] qla2xxx: Do not reset ISP for error entry with an out of range handle Himanshu Madhani
2015-08-04 17:37 ` [PATCH 09/14] qla2xxx: Add support to show MPI and PEP FW version for ISP27xx Himanshu Madhani
2015-08-04 17:38 ` [PATCH 10/14] qla2xxx: Remove decrement of sp reference count in abort handler Himanshu Madhani
2015-08-04 17:38 ` [PATCH 11/14] qla2xxx: do not clear slot in outstanding cmd array Himanshu Madhani
2015-08-04 17:38 ` [PATCH 12/14] qla2xxx: Fix missing device login retries Himanshu Madhani
2015-08-04 17:38 ` [PATCH 13/14] qla2xxx: Add pci device id 0x2261 Himanshu Madhani
2015-08-04 17:38 ` [PATCH 14/14] qla2xxx: Update driver version to 8.07.00.26-k Himanshu Madhani

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=1438709884-623-3-git-send-email-himanshu.madhani@qlogic.com \
    --to=himanshu.madhani@qlogic.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=hch@lst.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.