linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jayamohan Kallickal <jayamohank@gmail.com>
To: jbottomley@parallels.com, linux-scsi@vger.kernel.org,
	michaelc@cs.wisc.edu
Cc: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>,
	John Soni Jose <sony.john-n@emulex.com>
Subject: [PATCH V2 08/18] be2iscsi: Fix displaying the FW Version from driver.
Date: Fri,  5 Apr 2013 20:38:28 -0700	[thread overview]
Message-ID: <1365219519-3457-8-git-send-email-jayamohan.kallickal@emulex.com> (raw)
In-Reply-To: <1365219519-3457-1-git-send-email-jayamohan.kallickal@emulex.com>

 The mgmt_hba_attributes structure declared was not proper and
 because of that the FW response returned for the MBX_CMD was not
 matching. This issue went unnoticed as mgmt_hba_attribs structure
 members were never used in the code path.

 This fix of displaying the FW version had to change the mgmt_hba_attrib
 structure also. The latest driver will also work with the older FW as
 the issue was in the driver declaration.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
---
 drivers/scsi/be2iscsi/be_main.c |    2 ++
 drivers/scsi/be2iscsi/be_main.h |    2 ++
 drivers/scsi/be2iscsi/be_mgmt.c |   21 +++++++++++++++++++++
 drivers/scsi/be2iscsi/be_mgmt.h |   30 +++++++++++++++++-------------
 4 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 6be5e29..adc662d 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -153,10 +153,12 @@ BEISCSI_RW_ATTR(log_enable, 0x00,
 
 DEVICE_ATTR(beiscsi_drvr_ver, S_IRUGO, beiscsi_drvr_ver_disp, NULL);
 DEVICE_ATTR(beiscsi_adapter_family, S_IRUGO, beiscsi_adap_family_disp, NULL);
+DEVICE_ATTR(beiscsi_fw_ver, S_IRUGO, beiscsi_fw_ver_disp, NULL);
 struct device_attribute *beiscsi_attrs[] = {
 	&dev_attr_beiscsi_log_enable,
 	&dev_attr_beiscsi_drvr_ver,
 	&dev_attr_beiscsi_adapter_family,
+	&dev_attr_beiscsi_fw_ver,
 	NULL,
 };
 
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 77b13c3..3c5df92 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -68,6 +68,7 @@
 #define BEISCSI_MAX_NUM_CPUS	7
 #define OC_SKH_MAX_NUM_CPUS	31
 
+#define BEISCSI_VER_STRLEN 32
 
 #define BEISCSI_SGLIST_ELEMENTS	30
 
@@ -341,6 +342,7 @@ struct beiscsi_hba {
 	struct delayed_work beiscsi_hw_check_task;
 
 	u8 mac_address[ETH_ALEN];
+	char fw_ver_str[BEISCSI_VER_STRLEN];
 	char wq_name[20];
 	struct workqueue_struct *wq;	/* The actuak work queue */
 	struct be_ctrl_info ctrl;
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index a6c2fe4..7fe8595 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -368,6 +368,8 @@ int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
 		beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
 			    "BM_%d : phba->fw_config.iscsi_features = %d\n",
 			    phba->fw_config.iscsi_features);
+		memcpy(phba->fw_ver_str, resp->params.hba_attribs.
+		       firmware_version_string, BEISCSI_VER_STRLEN);
 	} else
 		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
 			    "BG_%d :  Failed in mgmt_check_supported_fw\n");
@@ -1260,6 +1262,25 @@ beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute *attr,
 }
 
 /**
+ * beiscsi_fw_ver_disp()- Display Firmware Version
+ * @dev: ptr to device not used.
+ * @attr: device attribute, not used.
+ * @buf: contains formatted text Firmware version
+ *
+ * return
+ * size of the formatted string
+ **/
+ssize_t
+beiscsi_fw_ver_disp(struct device *dev, struct device_attribute *attr,
+		     char *buf)
+{
+	struct Scsi_Host *shost = class_to_shost(dev);
+	struct beiscsi_hba *phba = iscsi_host_priv(shost);
+
+	return snprintf(buf, PAGE_SIZE, "%s\n", phba->fw_ver_str);
+}
+
+/**
  * beiscsi_adap_family_disp()- Display adapter family.
  * @dev: ptr to device to get priv structure
  * @attr: device attribute, not used.
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index 2e4968a..00f3a4f 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -156,25 +156,25 @@ union invalidate_commands_params {
 } __packed;
 
 struct mgmt_hba_attributes {
-	u8 flashrom_version_string[32];
-	u8 manufacturer_name[32];
+	u8 flashrom_version_string[BEISCSI_VER_STRLEN];
+	u8 manufacturer_name[BEISCSI_VER_STRLEN];
 	u32 supported_modes;
 	u8 seeprom_version_lo;
 	u8 seeprom_version_hi;
 	u8 rsvd0[2];
 	u32 fw_cmd_data_struct_version;
 	u32 ep_fw_data_struct_version;
-	u32 future_reserved[12];
+	u8 ncsi_version_string[12];
 	u32 default_extended_timeout;
-	u8 controller_model_number[32];
+	u8 controller_model_number[BEISCSI_VER_STRLEN];
 	u8 controller_description[64];
-	u8 controller_serial_number[32];
-	u8 ip_version_string[32];
-	u8 firmware_version_string[32];
-	u8 bios_version_string[32];
-	u8 redboot_version_string[32];
-	u8 driver_version_string[32];
-	u8 fw_on_flash_version_string[32];
+	u8 controller_serial_number[BEISCSI_VER_STRLEN];
+	u8 ip_version_string[BEISCSI_VER_STRLEN];
+	u8 firmware_version_string[BEISCSI_VER_STRLEN];
+	u8 bios_version_string[BEISCSI_VER_STRLEN];
+	u8 redboot_version_string[BEISCSI_VER_STRLEN];
+	u8 driver_version_string[BEISCSI_VER_STRLEN];
+	u8 fw_on_flash_version_string[BEISCSI_VER_STRLEN];
 	u32 functionalities_supported;
 	u16 max_cdblength;
 	u8 asic_revision;
@@ -190,7 +190,8 @@ struct mgmt_hba_attributes {
 	u32 firmware_post_status;
 	u32 hba_mtu[8];
 	u8 iscsi_features;
-	u8 future_u8[3];
+	u8 asic_generation;
+	u8 future_u8[2];
 	u32 future_u32[3];
 } __packed;
 
@@ -207,7 +208,7 @@ struct mgmt_controller_attributes {
 	u64 unique_identifier;
 	u8 netfilters;
 	u8 rsvd0[3];
-	u8 future_u32[4];
+	u32 future_u32[4];
 } __packed;
 
 struct be_mgmt_controller_attributes {
@@ -311,6 +312,9 @@ int mgmt_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
 ssize_t beiscsi_drvr_ver_disp(struct device *dev,
 			       struct device_attribute *attr, char *buf);
 
+ssize_t beiscsi_fw_ver_disp(struct device *dev,
+			     struct device_attribute *attr, char *buf);
+
 ssize_t beiscsi_adap_family_disp(struct device *dev,
 				  struct device_attribute *attr, char *buf);
 
-- 
1.7.10.4


  parent reply	other threads:[~2013-04-06  3:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-06  3:38 [PATCH V2 01/18] be2iscsi: Fix lack of uninitialize pattern to FW Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 02/18] be2iscsi: Fix returning Failure when MBX fails with Insufficient buffer error Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 03/18] be2iscsi: Fix MBX Command issues Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 04/18] be2iscsi: Fix MSIX support in SKH-R to 32 Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 05/18] be2iscsi: Fix freeing CXN specific driver resources Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 06/18] be2iscsi: Fix MACRO for checking the adapter type Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 07/18] be2iscsi: Fix support for DEFQ extension Jayamohan Kallickal
2013-04-06  3:38 ` Jayamohan Kallickal [this message]
2013-04-06  3:38 ` [PATCH V2 09/18] be2iscsi: Fix displaying the Active Session Count from driver Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 10/18] be2iscsi: Fix the Port Link Status issue Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 11/18] be2iscsi : Fix the NOP-In handling code path Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 12/18] be2iscsi: Fix dynamic CID allocation Mechanism in driver Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 13/18] be2iscsi: Fix checking Adapter state while establishing CXN Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 14/18] be2scsi: Fix the copyright information Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 15/18] be2iscsi: Fix the session cleanup when reboot/shutdown happens Jayamohan Kallickal
2013-04-10 23:41   ` Mike Christie
2013-04-12 20:08     ` Kallickal, Jayamohan
2013-04-06  3:38 ` [PATCH V2 16/18] be2iscsi: Fix possible reentrancy issue in be_iopoll Jayamohan Kallickal
2013-05-02 15:20   ` James Bottomley
2013-04-06  3:38 ` [PATCH V2 17/18] be2iscsi: Fix issue in passing the exp_cmdsn and max_cmdsn Jayamohan Kallickal
2013-04-06  3:38 ` [PATCH V2 18/18] be2iscsi: Bump the driver version Jayamohan Kallickal
2013-04-06  3:38 ` be2iscsi: Patchset for be2iscsi Jayamohan Kallickal
2013-04-12 21:08   ` 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=1365219519-3457-8-git-send-email-jayamohan.kallickal@emulex.com \
    --to=jayamohank@gmail.com \
    --cc=jayamohan.kallickal@emulex.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=sony.john-n@emulex.com \
    /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).