linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch
@ 2013-07-08 12:33 adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 1/7] qla4xxx: Allow removal of failed session using logout adheer.chandravanshi
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

James,

Please apply the following patches to the scsi tree at your earliest
convenience.

Adheer Chandravanshi (7):
	qla4xxx: Allow removal of failed session using logout.
	qla4xxx: Use discovery_parent_idx instead of discovery_parent_type
	qla4xxx: Set IPv6 traffic class if device type is IPv6.
	qla4xxx: discovery_parent_idx can be shown without any check.
	qla4xxx: Only BIOS boot target entries should be at index 0 and 1.
	qla4xxx: Export more firmware info in sysfs
	qla4xxx: Update driver version to 5.03.00-k11

Thanks,
Adheer


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/7] qla4xxx: Allow removal of failed session using logout.
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
@ 2013-07-08 12:33 ` adheer.chandravanshi
  2013-08-23 19:32   ` James Bottomley
  2013-07-08 12:33 ` [PATCH 2/7] qla4xxx: Use discovery_parent_idx instead of discovery_parent_type adheer.chandravanshi
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

If logout is performed on a failed session entry then that session
should be gracefully removed.

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_def.h |    1 +
 drivers/scsi/qla4xxx/ql4_os.c  |   48 +++++++++++++++++++++++++++++++++------
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index ddf16a8..50dc0c7 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -335,6 +335,7 @@ struct ql4_tuple_ddb {
 #define DF_BOOT_TGT		1	/* Boot target entry */
 #define DF_ISNS_DISCOVERED	2	/* Device was discovered via iSNS */
 #define DF_FO_MASKED		3
+#define DF_DISABLE_RELOGIN		4	/* Disable relogin to device */
 
 enum qla4_work_type {
 	QLA4_EVENT_AEN,
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 84d9361..ee2f903 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -3583,7 +3583,9 @@ static void qla4xxx_relogin_devices(struct iscsi_cls_session *cls_session)
 		} else {
 			/* Trigger relogin */
 			if (ddb_entry->ddb_type == FLASH_DDB) {
-				if (!test_bit(DF_RELOGIN, &ddb_entry->flags))
+				if (!(test_bit(DF_RELOGIN, &ddb_entry->flags) ||
+				      test_bit(DF_DISABLE_RELOGIN,
+					       &ddb_entry->flags)))
 					qla4xxx_arm_relogin_timer(ddb_entry);
 			} else
 				iscsi_session_failure(cls_session->dd_data,
@@ -3686,6 +3688,9 @@ static void qla4xxx_dpc_relogin(struct iscsi_cls_session *cls_sess)
 	if (!(ddb_entry->ddb_type == FLASH_DDB))
 		return;
 
+	if (test_bit(DF_DISABLE_RELOGIN, &ddb_entry->flags))
+		return;
+
 	if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags) &&
 	    !iscsi_is_session_online(cls_sess)) {
 		DEBUG2(ql4_printk(KERN_INFO, ha,
@@ -6014,13 +6019,6 @@ static int qla4xxx_sysfs_ddb_logout_sid(struct iscsi_cls_session *cls_sess)
 		goto exit_ddb_logout;
 	}
 
-	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__);
-		ret = -EIO;
-		goto exit_ddb_logout;
-	}
-
 	fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry),
 					  &fw_ddb_entry_dma, GFP_KERNEL);
 	if (!fw_ddb_entry) {
@@ -6030,6 +6028,38 @@ static int qla4xxx_sysfs_ddb_logout_sid(struct iscsi_cls_session *cls_sess)
 		goto exit_ddb_logout;
 	}
 
+	if (test_and_set_bit(DF_DISABLE_RELOGIN, &ddb_entry->flags))
+		goto ddb_logout_init;
+
+	ret = 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 (ret == QLA_ERROR)
+		goto ddb_logout_init;
+
+	if (ddb_state == DDB_DS_SESSION_ACTIVE)
+		goto ddb_logout_init;
+
+	/* wait until next relogin is triggered using DF_RELOGIN and
+	 * clear DF_RELOGIN to avoid invocation of further relogin
+	 */
+	wtime = jiffies + (HZ * RELOGIN_TOV);
+	do {
+		if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags))
+			goto ddb_logout_init;
+
+		schedule_timeout_uninterruptible(HZ);
+	} while ((time_after(wtime, jiffies)));
+
+ddb_logout_init:
+	atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY);
+	atomic_set(&ddb_entry->relogin_timer, 0);
+
+	options = LOGOUT_OPTION_CLOSE_SESSION;
+	qla4xxx_session_logout_ddb(ha, ddb_entry, options);
+
+	memset(fw_ddb_entry, 0, sizeof(*fw_ddb_entry));
 	wtime = jiffies + (HZ * LOGOUT_TOV);
 	do {
 		ret = qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index,
@@ -6059,10 +6089,12 @@ ddb_logout_clr_sess:
 
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 	qla4xxx_free_ddb(ha, ddb_entry);
+	clear_bit(ddb_entry->fw_ddb_index, ha->ddb_idx_map);
 	spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
 	iscsi_session_teardown(ddb_entry->sess);
 
+	clear_bit(DF_DISABLE_RELOGIN, &ddb_entry->flags);
 	ret = QLA_SUCCESS;
 
 exit_ddb_logout:
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/7] qla4xxx: Use discovery_parent_idx instead of discovery_parent_type
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 1/7] qla4xxx: Allow removal of failed session using logout adheer.chandravanshi
@ 2013-07-08 12:33 ` adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 3/7] qla4xxx: Set IPv6 traffic class if device type is IPv6 adheer.chandravanshi
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

While setting the values for DDB, discovery_parent_idx needs to be used
instead of discovery_parent_type.

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_os.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index ee2f903..9b25b8c 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -2262,7 +2262,7 @@ static int qla4xxx_copy_to_fwddb_param(struct iscsi_bus_flash_session *sess,
 	fw_ddb_entry->lcl_port = cpu_to_le16(conn->local_port);
 	fw_ddb_entry->stat_sn = cpu_to_le32(conn->statsn);
 	fw_ddb_entry->exp_stat_sn = cpu_to_le32(conn->exp_statsn);
-	fw_ddb_entry->ddb_link = cpu_to_le16(sess->discovery_parent_type);
+	fw_ddb_entry->ddb_link = cpu_to_le16(sess->discovery_parent_idx);
 	fw_ddb_entry->chap_tbl_idx = cpu_to_le16(sess->chap_out_idx);
 	fw_ddb_entry->tsid = cpu_to_le16(sess->tsid);
 	fw_ddb_entry->port = cpu_to_le16(conn->port);
@@ -6654,8 +6654,8 @@ qla4xxx_sysfs_ddb_set_param(struct iscsi_bus_flash_session *fnode_sess,
 			memcpy(fnode_conn->link_local_ipv6_addr,
 			       fnode_param->value, IPv6_ADDR_LEN);
 			break;
-		case ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE:
-			fnode_sess->discovery_parent_type =
+		case ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX:
+			fnode_sess->discovery_parent_idx =
 						*(uint16_t *)fnode_param->value;
 			break;
 		case ISCSI_FLASHNODE_TCP_XMIT_WSF:
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/7] qla4xxx: Set IPv6 traffic class if device type is IPv6.
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 1/7] qla4xxx: Allow removal of failed session using logout adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 2/7] qla4xxx: Use discovery_parent_idx instead of discovery_parent_type adheer.chandravanshi
@ 2013-07-08 12:33 ` adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 4/7] qla4xxx: discovery_parent_idx can be shown without any check adheer.chandravanshi
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_os.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 9b25b8c..85762f7 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -2256,7 +2256,6 @@ static int qla4xxx_copy_to_fwddb_param(struct iscsi_bus_flash_session *sess,
 	fw_ddb_entry->mss = cpu_to_le16(conn->max_segment_size);
 	fw_ddb_entry->tcp_xmt_wsf = (uint8_t) cpu_to_le32(conn->tcp_xmit_wsf);
 	fw_ddb_entry->tcp_rcv_wsf = (uint8_t) cpu_to_le32(conn->tcp_recv_wsf);
-	fw_ddb_entry->ipv4_tos = conn->ipv4_tos;
 	fw_ddb_entry->ipv6_flow_lbl = cpu_to_le16(conn->ipv6_flow_label);
 	fw_ddb_entry->ka_timeout = cpu_to_le16(conn->keepalive_timeout);
 	fw_ddb_entry->lcl_port = cpu_to_le16(conn->local_port);
@@ -2269,6 +2268,11 @@ static int qla4xxx_copy_to_fwddb_param(struct iscsi_bus_flash_session *sess,
 	fw_ddb_entry->def_timeout =
 				cpu_to_le16(sess->default_taskmgmt_timeout);
 
+	if (!strncmp(sess->portal_type, PORTAL_TYPE_IPV6, 4))
+		fw_ddb_entry->ipv4_tos = conn->ipv6_traffic_class;
+	else
+		fw_ddb_entry->ipv4_tos = conn->ipv4_tos;
+
 	if (conn->ipaddress)
 		memcpy(fw_ddb_entry->ip_addr, conn->ipaddress,
 		       sizeof(fw_ddb_entry->ip_addr));
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/7] qla4xxx: discovery_parent_idx can be shown without any check.
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
                   ` (2 preceding siblings ...)
  2013-07-08 12:33 ` [PATCH 3/7] qla4xxx: Set IPv6 traffic class if device type is IPv6 adheer.chandravanshi
@ 2013-07-08 12:33 ` adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 5/7] qla4xxx: Only BIOS boot target entries should be at index 0 and 1 adheer.chandravanshi
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_os.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 85762f7..a6e4d51 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -6235,7 +6235,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess,
 	struct iscsi_bus_flash_conn *fnode_conn;
 	struct ql4_chap_table chap_tbl;
 	struct device *dev;
-	int parent_type, parent_index = 0xffff;
+	int parent_type;
 	int rc = 0;
 
 	dev = iscsi_find_flashnode_conn(fnode_sess);
@@ -6401,10 +6401,7 @@ qla4xxx_sysfs_ddb_get_param(struct iscsi_bus_flash_session *fnode_sess,
 			rc = sprintf(buf, "\n");
 		break;
 	case ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX:
-		if (fnode_sess->discovery_parent_idx < MAX_DDB_ENTRIES)
-			parent_index = fnode_sess->discovery_parent_idx;
-
-		rc = sprintf(buf, "%u\n", parent_index);
+		rc = sprintf(buf, "%u\n", fnode_sess->discovery_parent_idx);
 		break;
 	case ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE:
 		if (fnode_sess->discovery_parent_type == DDB_ISNS)
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/7] qla4xxx: Only BIOS boot target entries should be at index 0 and 1.
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
                   ` (3 preceding siblings ...)
  2013-07-08 12:33 ` [PATCH 4/7] qla4xxx: discovery_parent_idx can be shown without any check adheer.chandravanshi
@ 2013-07-08 12:33 ` adheer.chandravanshi
  2013-07-08 12:33 ` [PATCH 6/7] qla4xxx: Export more firmware info in sysfs adheer.chandravanshi
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

Flash target index 0 and 1 are reserved for boot target entries created
with BIOS utility.

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_os.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index a6e4d51..52d01ae 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -5707,7 +5707,8 @@ static int qla4xxx_sysfs_ddb_add(struct Scsi_Host *shost, const char *buf,
 		goto exit_ddb_add;
 	}
 
-	for (idx = 0; idx < max_ddbs; idx++) {
+	/* Index 0 and 1 are reserved for boot target entries */
+	for (idx = 2; idx < max_ddbs; idx++) {
 		if (qla4xxx_flashdb_by_index(ha, fw_ddb_entry,
 					     fw_ddb_entry_dma, idx))
 			break;
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/7] qla4xxx: Export more firmware info in sysfs
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
                   ` (4 preceding siblings ...)
  2013-07-08 12:33 ` [PATCH 5/7] qla4xxx: Only BIOS boot target entries should be at index 0 and 1 adheer.chandravanshi
@ 2013-07-08 12:33 ` adheer.chandravanshi
  2013-07-17 17:44   ` Mike Christie
  2013-07-08 12:33 ` [PATCH 7/7] qla4xxx: Update driver version to 5.03.00-k11 adheer.chandravanshi
  2013-07-19 15:56 ` [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch Mike Christie
  7 siblings, 1 reply; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_attr.c |   86 ++++++++++++++++++++++++++++++++++-----
 drivers/scsi/qla4xxx/ql4_def.h  |    9 +---
 drivers/scsi/qla4xxx/ql4_fw.h   |    2 +-
 drivers/scsi/qla4xxx/ql4_mbx.c  |   33 ++++++++++-----
 drivers/scsi/qla4xxx/ql4_os.c   |    4 +-
 5 files changed, 105 insertions(+), 29 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_attr.c b/drivers/scsi/qla4xxx/ql4_attr.c
index 19ee55a..687c07f 100644
--- a/drivers/scsi/qla4xxx/ql4_attr.c
+++ b/drivers/scsi/qla4xxx/ql4_attr.c
@@ -158,14 +158,12 @@ qla4xxx_fw_version_show(struct device *dev,
 
 	if (is_qla80XX(ha))
 		return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n",
-				ha->firmware_version[0],
-				ha->firmware_version[1],
-				ha->patch_number, ha->build_number);
+				ha->fw_info.fw_major, ha->fw_info.fw_minor,
+				ha->fw_info.fw_patch, ha->fw_info.fw_build);
 	else
 		return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n",
-				ha->firmware_version[0],
-				ha->firmware_version[1],
-				ha->patch_number, ha->build_number);
+				ha->fw_info.fw_major, ha->fw_info.fw_minor,
+				ha->fw_info.fw_patch, ha->fw_info.fw_build);
 }
 
 static ssize_t
@@ -181,8 +179,8 @@ qla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr,
 			   char *buf)
 {
 	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
-	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->iscsi_major,
-			ha->iscsi_minor);
+	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major,
+			ha->fw_info.iscsi_minor);
 }
 
 static ssize_t
@@ -191,8 +189,8 @@ qla4xxx_optrom_version_show(struct device *dev, struct device_attribute *attr,
 {
 	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
 	return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d.%02d\n",
-			ha->bootload_major, ha->bootload_minor,
-			ha->bootload_patch, ha->bootload_build);
+			ha->fw_info.bootload_major, ha->fw_info.bootload_minor,
+			ha->fw_info.bootload_patch, ha->fw_info.bootload_build);
 }
 
 static ssize_t
@@ -259,6 +257,63 @@ qla4xxx_hba_model_show(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_name);
 }
 
+static ssize_t
+qla4xxx_fw_timestamp_show(struct device *dev, struct device_attribute *attr,
+			  char *buf)
+{
+	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
+	return snprintf(buf, PAGE_SIZE, "%s %s\n", ha->fw_info.fw_build_date,
+			ha->fw_info.fw_build_time);
+}
+
+static ssize_t
+qla4xxx_fw_build_user_show(struct device *dev, struct device_attribute *attr,
+			   char *buf)
+{
+	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
+	return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.fw_build_user);
+}
+
+static ssize_t
+qla4xxx_fw_ext_timestamp_show(struct device *dev, struct device_attribute *attr,
+			      char *buf)
+{
+	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
+	return snprintf(buf, PAGE_SIZE, "%s\n", ha->fw_info.extended_timestamp);
+}
+
+static ssize_t
+qla4xxx_fw_load_src_show(struct device *dev, struct device_attribute *attr,
+			 char *buf)
+{
+	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
+	char *load_src = NULL;
+
+	switch (ha->fw_info.fw_load_source) {
+	case 1:
+		load_src = "Flash Primary";
+		break;
+	case 2:
+		load_src = "Flash Secondary";
+		break;
+	case 3:
+		load_src = "Host Download";
+		break;
+	}
+
+	return snprintf(buf, PAGE_SIZE, "%s\n", load_src);
+}
+
+static ssize_t
+qla4xxx_fw_uptime_show(struct device *dev, struct device_attribute *attr,
+		       char *buf)
+{
+	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
+	qla4xxx_about_firmware(ha);
+	return snprintf(buf, PAGE_SIZE, "%u.%u secs\n", ha->fw_uptime_secs,
+			ha->fw_uptime_msecs);
+}
+
 static DEVICE_ATTR(fw_version, S_IRUGO, qla4xxx_fw_version_show, NULL);
 static DEVICE_ATTR(serial_num, S_IRUGO, qla4xxx_serial_num_show, NULL);
 static DEVICE_ATTR(iscsi_version, S_IRUGO, qla4xxx_iscsi_version_show, NULL);
@@ -269,6 +324,12 @@ static DEVICE_ATTR(phy_port_cnt, S_IRUGO, qla4xxx_phy_port_cnt_show, NULL);
 static DEVICE_ATTR(phy_port_num, S_IRUGO, qla4xxx_phy_port_num_show, NULL);
 static DEVICE_ATTR(iscsi_func_cnt, S_IRUGO, qla4xxx_iscsi_func_cnt_show, NULL);
 static DEVICE_ATTR(hba_model, S_IRUGO, qla4xxx_hba_model_show, NULL);
+static DEVICE_ATTR(fw_timestamp, S_IRUGO, qla4xxx_fw_timestamp_show, NULL);
+static DEVICE_ATTR(fw_build_user, S_IRUGO, qla4xxx_fw_build_user_show, NULL);
+static DEVICE_ATTR(fw_ext_timestamp, S_IRUGO, qla4xxx_fw_ext_timestamp_show,
+		   NULL);
+static DEVICE_ATTR(fw_load_src, S_IRUGO, qla4xxx_fw_load_src_show, NULL);
+static DEVICE_ATTR(fw_uptime, S_IRUGO, qla4xxx_fw_uptime_show, NULL);
 
 struct device_attribute *qla4xxx_host_attrs[] = {
 	&dev_attr_fw_version,
@@ -281,5 +342,10 @@ struct device_attribute *qla4xxx_host_attrs[] = {
 	&dev_attr_phy_port_num,
 	&dev_attr_iscsi_func_cnt,
 	&dev_attr_hba_model,
+	&dev_attr_fw_timestamp,
+	&dev_attr_fw_build_user,
+	&dev_attr_fw_ext_timestamp,
+	&dev_attr_fw_load_src,
+	&dev_attr_fw_uptime,
 	NULL,
 };
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 50dc0c7..b0a0e93 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -735,12 +735,9 @@ struct scsi_qla_host {
 	struct iscsi_iface *iface_ipv6_1;
 
 	/* --- From About Firmware --- */
-	uint16_t iscsi_major;
-	uint16_t iscsi_minor;
-	uint16_t bootload_major;
-	uint16_t bootload_minor;
-	uint16_t bootload_patch;
-	uint16_t bootload_build;
+	struct about_fw_info fw_info;
+	uint32_t fw_uptime_secs;  /* seconds elapsed since fw bootup */
+	uint32_t fw_uptime_msecs; /* milliseconds beyond elapsed seconds */
 	uint16_t def_timeout; /* Default login timeout */
 
 	uint32_t flash_state;
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index c7b8892..9a46f59 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -955,7 +955,7 @@ struct about_fw_info {
 	uint16_t bootload_minor;	/* 46 - 47 */
 	uint16_t bootload_patch;	/* 48 - 49 */
 	uint16_t bootload_build;	/* 4A - 4B */
-	uint8_t reserved2[180];		/* 4C - FF */
+	uint8_t extended_timestamp[180];/* 4C - FF */
 };
 
 struct crash_record {
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index a501bea..3c18b7f 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -5,6 +5,7 @@
  * See LICENSE.qla4xxx for copyright and licensing details.
  */
 
+#include <linux/ctype.h>
 #include "ql4_def.h"
 #include "ql4_glbl.h"
 #include "ql4_dbg.h"
@@ -1270,16 +1271,28 @@ int qla4xxx_about_firmware(struct scsi_qla_host *ha)
 	}
 
 	/* Save version information. */
-	ha->firmware_version[0] = le16_to_cpu(about_fw->fw_major);
-	ha->firmware_version[1] = le16_to_cpu(about_fw->fw_minor);
-	ha->patch_number = le16_to_cpu(about_fw->fw_patch);
-	ha->build_number = le16_to_cpu(about_fw->fw_build);
-	ha->iscsi_major = le16_to_cpu(about_fw->iscsi_major);
-	ha->iscsi_minor = le16_to_cpu(about_fw->iscsi_minor);
-	ha->bootload_major = le16_to_cpu(about_fw->bootload_major);
-	ha->bootload_minor = le16_to_cpu(about_fw->bootload_minor);
-	ha->bootload_patch = le16_to_cpu(about_fw->bootload_patch);
-	ha->bootload_build = le16_to_cpu(about_fw->bootload_build);
+	ha->fw_info.fw_major = le16_to_cpu(about_fw->fw_major);
+	ha->fw_info.fw_minor = le16_to_cpu(about_fw->fw_minor);
+	ha->fw_info.fw_patch = le16_to_cpu(about_fw->fw_patch);
+	ha->fw_info.fw_build = le16_to_cpu(about_fw->fw_build);
+	memcpy(ha->fw_info.fw_build_date, about_fw->fw_build_date,
+	       sizeof(about_fw->fw_build_date));
+	memcpy(ha->fw_info.fw_build_time, about_fw->fw_build_time,
+	       sizeof(about_fw->fw_build_time));
+	strcpy((char *)ha->fw_info.fw_build_user,
+	       skip_spaces((char *)about_fw->fw_build_user));
+	ha->fw_info.fw_load_source = le16_to_cpu(about_fw->fw_load_source);
+	ha->fw_info.iscsi_major = le16_to_cpu(about_fw->iscsi_major);
+	ha->fw_info.iscsi_minor = le16_to_cpu(about_fw->iscsi_minor);
+	ha->fw_info.bootload_major = le16_to_cpu(about_fw->bootload_major);
+	ha->fw_info.bootload_minor = le16_to_cpu(about_fw->bootload_minor);
+	ha->fw_info.bootload_patch = le16_to_cpu(about_fw->bootload_patch);
+	ha->fw_info.bootload_build = le16_to_cpu(about_fw->bootload_build);
+	strcpy((char *)ha->fw_info.extended_timestamp,
+	       skip_spaces((char *)about_fw->extended_timestamp));
+
+	ha->fw_uptime_secs = le32_to_cpu(mbox_sts[5]);
+	ha->fw_uptime_msecs = le32_to_cpu(mbox_sts[6]);
 	status = QLA_SUCCESS;
 
 exit_about_fw:
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 52d01ae..14472b1 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -7220,8 +7220,8 @@ skip_retry_init:
 	       " QLogic iSCSI HBA Driver version: %s\n"
 	       "  QLogic ISP%04x @ %s, host#=%ld, fw=%02d.%02d.%02d.%02d\n",
 	       qla4xxx_version_str, ha->pdev->device, pci_name(ha->pdev),
-	       ha->host_no, ha->firmware_version[0], ha->firmware_version[1],
-	       ha->patch_number, ha->build_number);
+	       ha->host_no, ha->fw_info.fw_major, ha->fw_info.fw_minor,
+	       ha->fw_info.fw_patch, ha->fw_info.fw_build);
 
 	/* Set the driver version */
 	if (is_qla80XX(ha))
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/7] qla4xxx: Update driver version to 5.03.00-k11
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
                   ` (5 preceding siblings ...)
  2013-07-08 12:33 ` [PATCH 6/7] qla4xxx: Export more firmware info in sysfs adheer.chandravanshi
@ 2013-07-08 12:33 ` adheer.chandravanshi
  2013-07-19 15:56 ` [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch Mike Christie
  7 siblings, 0 replies; 13+ messages in thread
From: adheer.chandravanshi @ 2013-07-08 12:33 UTC (permalink / raw)
  To: jbottomley, michaelc
  Cc: linux-scsi, vikas.chaudhary, lalit.chandivade,
	Adheer Chandravanshi

From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>

Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_version.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index c5edd0d..c085c9a 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,4 @@
  * See LICENSE.qla4xxx for copyright and licensing details.
  */
 
-#define QLA4XXX_DRIVER_VERSION	"5.03.00-k10"
+#define QLA4XXX_DRIVER_VERSION	"5.03.00-k11"
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/7] qla4xxx: Export more firmware info in sysfs
  2013-07-08 12:33 ` [PATCH 6/7] qla4xxx: Export more firmware info in sysfs adheer.chandravanshi
@ 2013-07-17 17:44   ` Mike Christie
  2013-07-19 15:53     ` Mike Christie
  0 siblings, 1 reply; 13+ messages in thread
From: Mike Christie @ 2013-07-17 17:44 UTC (permalink / raw)
  To: adheer.chandravanshi
  Cc: jbottomley, linux-scsi, vikas.chaudhary, lalit.chandivade

On 07/08/2013 06:33 AM, adheer.chandravanshi@qlogic.com wrote:
>  static ssize_t
> @@ -181,8 +179,8 @@ qla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr,
>  			   char *buf)
>  {
>  	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
> -	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->iscsi_major,
> -			ha->iscsi_minor);
> +	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major,
> +			ha->fw_info.iscsi_minor);
>  }

Is this the same as the iscsi max and min from the iscsi spec? If so, it
should be a iscsi host setting.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/7] qla4xxx: Export more firmware info in sysfs
  2013-07-17 17:44   ` Mike Christie
@ 2013-07-19 15:53     ` Mike Christie
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Christie @ 2013-07-19 15:53 UTC (permalink / raw)
  To: adheer.chandravanshi
  Cc: jbottomley, linux-scsi, vikas.chaudhary, lalit.chandivade

On 07/17/2013 11:44 AM, Mike Christie wrote:
> On 07/08/2013 06:33 AM, adheer.chandravanshi@qlogic.com wrote:
>>  static ssize_t
>> @@ -181,8 +179,8 @@ qla4xxx_iscsi_version_show(struct device *dev, struct device_attribute *attr,
>>  			   char *buf)
>>  {
>>  	struct scsi_qla_host *ha = to_qla_host(class_to_shost(dev));
>> -	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->iscsi_major,
>> -			ha->iscsi_minor);
>> +	return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fw_info.iscsi_major,
>> +			ha->fw_info.iscsi_minor);
>>  }
> 
> Is this the same as the iscsi max and min from the iscsi spec? If so, it
> should be a iscsi host setting.
> 

Ignore this comment.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch
  2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
                   ` (6 preceding siblings ...)
  2013-07-08 12:33 ` [PATCH 7/7] qla4xxx: Update driver version to 5.03.00-k11 adheer.chandravanshi
@ 2013-07-19 15:56 ` Mike Christie
  7 siblings, 0 replies; 13+ messages in thread
From: Mike Christie @ 2013-07-19 15:56 UTC (permalink / raw)
  To: adheer.chandravanshi
  Cc: jbottomley, linux-scsi, vikas.chaudhary, lalit.chandivade

On 07/08/2013 06:33 AM, adheer.chandravanshi@qlogic.com wrote:
> From: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
> 
> James,
> 
> Please apply the following patches to the scsi tree at your earliest
> convenience.
> 
> Adheer Chandravanshi (7):
> 	qla4xxx: Allow removal of failed session using logout.
> 	qla4xxx: Use discovery_parent_idx instead of discovery_parent_type
> 	qla4xxx: Set IPv6 traffic class if device type is IPv6.
> 	qla4xxx: discovery_parent_idx can be shown without any check.
> 	qla4xxx: Only BIOS boot target entries should be at index 0 and 1.
> 	qla4xxx: Export more firmware info in sysfs
> 	qla4xxx: Update driver version to 5.03.00-k11
> 


Ignore my comment on that one patch. Patches look ok.

Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/7] qla4xxx: Allow removal of failed session using logout.
  2013-07-08 12:33 ` [PATCH 1/7] qla4xxx: Allow removal of failed session using logout adheer.chandravanshi
@ 2013-08-23 19:32   ` James Bottomley
  2013-08-27 12:28     ` Adheer Chandravanshi
  0 siblings, 1 reply; 13+ messages in thread
From: James Bottomley @ 2013-08-23 19:32 UTC (permalink / raw)
  To: adheer.chandravanshi@qlogic.com
  Cc: michaelc@cs.wisc.edu, linux-scsi@vger.kernel.org,
	vikas.chaudhary@qlogic.com, lalit.chandivade@qlogic.com

On Mon, 2013-07-08 at 08:33 -0400, adheer.chandravanshi@qlogic.com
wrote:
> +       /* wait until next relogin is triggered using DF_RELOGIN and
> +        * clear DF_RELOGIN to avoid invocation of further relogin
> +        */
> +       wtime = jiffies + (HZ * RELOGIN_TOV);
> +       do {
> +               if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags))
> +                       goto ddb_logout_init;
> +
> +               schedule_timeout_uninterruptible(HZ);
> +       } while ((time_after(wtime, jiffies)));

This looks a bit like a hand rolled wait_event_timeout() couldn't you
use the linux primitives?

James


^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/7] qla4xxx: Allow removal of failed session using logout.
  2013-08-23 19:32   ` James Bottomley
@ 2013-08-27 12:28     ` Adheer Chandravanshi
  0 siblings, 0 replies; 13+ messages in thread
From: Adheer Chandravanshi @ 2013-08-27 12:28 UTC (permalink / raw)
  To: James Bottomley
  Cc: michaelc@cs.wisc.edu, linux-scsi, Vikas Chaudhary,
	Lalit Chandivade

[-- Attachment #1: Type: text/plain, Size: 1114 bytes --]

James,

Thanks for pointing this out. We will send the fix for this in the next patch-set.

--
Adheer

> -----Original Message-----
> From: James Bottomley [mailto:jbottomley@parallels.com]
> Sent: Saturday, August 24, 2013 1:03 AM
> To: Adheer Chandravanshi
> Cc: michaelc@cs.wisc.edu; linux-scsi; Vikas Chaudhary; Lalit Chandivade
> Subject: Re: [PATCH 1/7] qla4xxx: Allow removal of failed session using
> logout.
> 
> On Mon, 2013-07-08 at 08:33 -0400, adheer.chandravanshi@qlogic.com
> wrote:
> > +       /* wait until next relogin is triggered using DF_RELOGIN and
> > +        * clear DF_RELOGIN to avoid invocation of further relogin
> > +        */
> > +       wtime = jiffies + (HZ * RELOGIN_TOV);
> > +       do {
> > +               if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags))
> > +                       goto ddb_logout_init;
> > +
> > +               schedule_timeout_uninterruptible(HZ);
> > +       } while ((time_after(wtime, jiffies)));
> 
> This looks a bit like a hand rolled wait_event_timeout() couldn't you use the
> linux primitives?
> 
> James


[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 4659 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-08-27 12:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-08 12:33 [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch adheer.chandravanshi
2013-07-08 12:33 ` [PATCH 1/7] qla4xxx: Allow removal of failed session using logout adheer.chandravanshi
2013-08-23 19:32   ` James Bottomley
2013-08-27 12:28     ` Adheer Chandravanshi
2013-07-08 12:33 ` [PATCH 2/7] qla4xxx: Use discovery_parent_idx instead of discovery_parent_type adheer.chandravanshi
2013-07-08 12:33 ` [PATCH 3/7] qla4xxx: Set IPv6 traffic class if device type is IPv6 adheer.chandravanshi
2013-07-08 12:33 ` [PATCH 4/7] qla4xxx: discovery_parent_idx can be shown without any check adheer.chandravanshi
2013-07-08 12:33 ` [PATCH 5/7] qla4xxx: Only BIOS boot target entries should be at index 0 and 1 adheer.chandravanshi
2013-07-08 12:33 ` [PATCH 6/7] qla4xxx: Export more firmware info in sysfs adheer.chandravanshi
2013-07-17 17:44   ` Mike Christie
2013-07-19 15:53     ` Mike Christie
2013-07-08 12:33 ` [PATCH 7/7] qla4xxx: Update driver version to 5.03.00-k11 adheer.chandravanshi
2013-07-19 15:56 ` [PATCH 0/7] qla4xxx: Updates for scsi "misc" branch Mike Christie

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).