Skip to contentSkip to conversation

qla4xxx: set device state as per Link UP and LINK DOWN

PATCH In review Ravi Anand 1 participant 1 message Apr 6, 2010

Subsystems (2)
lore
Share & tools
lore

Ravi Anand

author
#0 lore raw

PATCH 3/12 qla4xxx: set device state as per Link UP and LINK DOWN

From: Vikas Chaudhary <[email protected]>

Link Down -> Mark all devices missing
Previously, the driver took no action on a Link Down, and waited for the I/O on a dead connection to timeout in the firmware before marking the DDB missing.

Link Up -> Mark all devices online
F/W will do auto login to all the devices only once. After that its the responsibility of the driver to relogin to devices whenever there is :
* Any sort of connection failure or
* KATO expires indicating target has logged out or
* I/O times out etc.

---
 drivers/scsi/qla4xxx/ql4_def.h  |    1 +
 drivers/scsi/qla4xxx/ql4_init.c |   12 +++++++--
 drivers/scsi/qla4xxx/ql4_isr.c  |   15 +++++++++---
 drivers/scsi/qla4xxx/ql4_os.c   |   46 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 7 deletions(-)
drivers/scsi/qla4xxx/ql4_def.h +1 -0
index bbd9352..45a6779 100644
@@ -311,6 +311,7 @@ struct scsi_qla_host {
 #define DPC_ISNS_RESTART		7 /* 0x00000080 */
 #define DPC_AEN				9 /* 0x00000200 */
 #define DPC_GET_DHCP_IP_ADDR		15 /* 0x00008000 */
+#define DPC_LINK_CHANGED		18 /* 0x00040000 */
 
 	struct Scsi_Host *host; /* pointer to host data */
 	uint32_t tot_ddbs;
drivers/scsi/qla4xxx/ql4_init.c +9 -3
index 6da6f51..2c14235 100644
@@ -1279,6 +1279,7 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha,
 	int status = QLA_ERROR;
 	int8_t ip_address[IP_ADDR_LEN] = {0} ;
 
+	clear_bit(AF_ONLINE, &ha->flags);
 	ha->eeprom_cmd_data = 0;
 
 	qla4x00_pci_config(ha);
@@ -1456,10 +1457,15 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha,
 		 * the device came back.
 		 */
 	} else {
-		/* Device went away, try to relogin. */
-		/* Mark device missing */
-		if (atomic_read(&ddb_entry->state) == DDB_STATE_ONLINE)
+		/* Device went away, mark device missing */
+		if (atomic_read(&ddb_entry->state) == DDB_STATE_ONLINE) {
+			DEBUG2(dev_info(&ha->pdev->dev, "%s mark missing "
+					"ddb_entry 0x%p sess 0x%p conn 0x%p\n",
+					__func__, ddb_entry,
+					ddb_entry->sess, ddb_entry->conn));
 			qla4xxx_mark_device_missing(ha, ddb_entry);
+		}
+
 		/*
 		 * Relogin if device state changed to a not active state.
 		 * However, do not relogin if this aen is a result of an IOCTL
drivers/scsi/qla4xxx/ql4_isr.c +11 -4
index c196d55..9db286d 100644
@@ -498,15 +498,22 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
 			break;
 
 		case MBOX_ASTS_LINK_UP:
-			DEBUG2(printk("scsi%ld: AEN %04x Adapter LINK UP\n",
-				      ha->host_no, mbox_status));
 			set_bit(AF_LINK_UP, &ha->flags);
+			if (test_bit(AF_INIT_DONE, &ha->flags))
+				set_bit(DPC_LINK_CHANGED, &ha->dpc_flags);
+
+			DEBUG2(printk(KERN_INFO "scsi%ld: AEN %04x Adapter"
+					" LINK UP\n", ha->host_no,
+					mbox_status));
 			break;
 
 		case MBOX_ASTS_LINK_DOWN:
-			DEBUG2(printk("scsi%ld: AEN %04x Adapter LINK DOWN\n",
-				      ha->host_no, mbox_status));
 			clear_bit(AF_LINK_UP, &ha->flags);
+			set_bit(DPC_LINK_CHANGED, &ha->dpc_flags);
+
+			DEBUG2(printk(KERN_INFO "scsi%ld: AEN %04x Adapter"
+					" LINK DOWN\n", ha->host_no,
+					mbox_status));
 			break;
 
 		case MBOX_ASTS_HEARTBEAT:
drivers/scsi/qla4xxx/ql4_os.c +46 -0

58 lines not on this page · raw message

Signature · 3 lines
1.6.0.2

----- End forwarded message -----