linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: giridhar.malavali@qlogic.com
To: James.Bottomley@HansenPartnership.com
Cc: giridhar.malavali@qlogic.com, andrew.vasquez@qlogic.com,
	madhu.iyengar@qlogic.com, linux-scsi@vger.kernel.org,
	Madhuranath Iyengar <madhuranath.iyengar@qlogic.com>
Subject: [PATCH 03/17] qla2xxx: Appropriately log FCP priority data messages
Date: Fri, 23 Jul 2010 15:28:24 +0500	[thread overview]
Message-ID: <1279880918-62876-4-git-send-email-giridhar.malavali@qlogic.com> (raw)
In-Reply-To: <1279880918-62876-1-git-send-email-giridhar.malavali@qlogic.com>

From: Madhuranath Iyengar <madhuranath.iyengar@qlogic.com>


Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_bsg.c  |   36 +++++++++++++++++++++++++++++++++---
 drivers/scsi/qla2xxx/qla_init.c |    7 ++-----
 drivers/scsi/qla2xxx/qla_sup.c  |   25 +++++++++++++------------
 3 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 20eaa1c..d551ae1 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -41,13 +41,28 @@ qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag)
 	int i, ret, num_valid;
 	uint8_t *bcode;
 	struct qla_fcp_prio_entry *pri_entry;
+	uint32_t *bcode_val_ptr, bcode_val;
 
 	ret = 1;
 	num_valid = 0;
 	bcode = (uint8_t *)pri_cfg;
+	bcode_val_ptr = (uint32_t *)pri_cfg;
+	bcode_val = (uint32_t)(*bcode_val_ptr);
 
-	if (bcode[0x0] != 'H' || bcode[0x1] != 'Q' || bcode[0x2] != 'O' ||
-			bcode[0x3] != 'S') {
+	if (bcode_val == 0xFFFFFFFF) {
+		/* No FCP Priority config data in flash */
+		DEBUG2(printk(KERN_INFO
+		    "%s: No FCP priority config data.\n",
+		    __func__));
+		return 0;
+	}
+
+	if (bcode[0] != 'H' || bcode[1] != 'Q' || bcode[2] != 'O' ||
+			bcode[3] != 'S') {
+		/* Invalid FCP priority data header*/
+		DEBUG2(printk(KERN_ERR
+		    "%s: Invalid FCP Priority data header. bcode=0x%x\n",
+		    __func__, bcode_val));
 		return 0;
 	}
 	if (flag != 1)
@@ -60,8 +75,18 @@ qla24xx_fcp_prio_cfg_valid(struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag)
 		pri_entry++;
 	}
 
-	if (num_valid == 0)
+	if (num_valid == 0) {
+		/* No valid FCP priority data entries */
+		DEBUG2(printk(KERN_ERR
+		    "%s: No valid FCP Priority data entries.\n",
+		    __func__));
 		ret = 0;
+	} else {
+		/* FCP priority data is valid */
+		DEBUG2(printk(KERN_INFO
+		    "%s: Valid FCP priority data. num entries = %d\n",
+		    __func__, num_valid));
+	}
 
 	return ret;
 }
@@ -78,6 +103,11 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
 
 	bsg_job->reply->reply_payload_rcv_len = 0;
 
+	if (!IS_QLA24XX_TYPE(ha) || !IS_QLA25XX(ha)) {
+		ret = -EINVAL;
+		goto exit_fcp_prio_cfg;
+	}
+
 	if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
 		test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
 		test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) {
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 5bc3170..cea491b 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -566,11 +566,8 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
 		}
 	}
 
-	if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha)) {
-		if (qla24xx_read_fcp_prio_cfg(vha))
-			qla_printk(KERN_ERR, ha,
-			"Unable to read FCP priority data.\n");
-	}
+	if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha))
+		qla24xx_read_fcp_prio_cfg(vha);
 
 	return (rval);
 }
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index de92504..3c5115f 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -664,6 +664,11 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
 	struct qla_hw_data *ha = vha->hw;
 	struct req_que *req = ha->req_q_map[0];
 
+	def = 0;
+	if (IS_QLA25XX(ha))
+		def = 1;
+	else if (IS_QLA81XX(ha))
+		def = 2;
 	ha->flt_region_flt = flt_addr;
 	wptr = (uint16_t *)req->ring;
 	flt = (struct qla_flt_header *)req->ring;
@@ -691,6 +696,10 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
 		goto no_flash_data;
 	}
 
+	/* Assign FCP prio region since older FLT's may not have it */
+	ha->flt_region_fcp_prio = ha->flags.port0 ?
+	    fcp_prio_cfg0[def] : fcp_prio_cfg1[def];
+
 	loc = locations[1];
 	cnt = le16_to_cpu(flt->length) / sizeof(struct qla_flt_region);
 	for ( ; cnt; cnt--, region++) {
@@ -773,13 +782,6 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
 no_flash_data:
 	/* Use hardcoded defaults. */
 	loc = locations[0];
-	def = 0;
-	if (IS_QLA24XX_TYPE(ha))
-		def = 0;
-	else if (IS_QLA25XX(ha))
-		def = 1;
-	else if (IS_QLA81XX(ha))
-		def = 2;
 	ha->flt_region_fw = def_fw[def];
 	ha->flt_region_boot = def_boot[def];
 	ha->flt_region_vpd_nvram = def_vpd_nvram[def];
@@ -790,14 +792,13 @@ no_flash_data:
 	ha->flt_region_fdt = def_fdt[def];
 	ha->flt_region_npiv_conf = ha->flags.port0 ?
 	    def_npiv_conf0[def] : def_npiv_conf1[def];
-	ha->flt_region_fcp_prio = ha->flags.port0 ?
-	    fcp_prio_cfg0[def] : fcp_prio_cfg1[def];
 done:
 	DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x "
 	    "vpd_nvram=0x%x vpd=0x%x nvram=0x%x fdt=0x%x flt=0x%x "
-	    "npiv=0x%x.\n", loc, ha->flt_region_boot, ha->flt_region_fw,
-	    ha->flt_region_vpd_nvram, ha->flt_region_vpd, ha->flt_region_nvram,
-	    ha->flt_region_fdt, ha->flt_region_flt, ha->flt_region_npiv_conf));
+	    "npiv=0x%x. fcp_prio_cfg=0x%x\n", loc, ha->flt_region_boot,
+	    ha->flt_region_fw, ha->flt_region_vpd_nvram, ha->flt_region_vpd,
+	    ha->flt_region_nvram, ha->flt_region_fdt, ha->flt_region_flt,
+	    ha->flt_region_npiv_conf, ha->flt_region_fcp_prio));
 }
 
 static void
-- 
1.6.0.2


  parent reply	other threads:[~2010-07-23  9:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 10:28 [PATCH 00/17] qla2xxx: Updates for scsi-misc-2.6 giridhar.malavali
2010-07-23 10:28 ` [PATCH 01/17] qla2xxx: Don't issue set or get port param MBC if invalid port loop id giridhar.malavali
2010-07-23 10:28 ` [PATCH 02/17] qla2xxx: Removed dependency for SRB structure for Marker processing giridhar.malavali
2010-07-23 10:28 ` giridhar.malavali [this message]
2010-07-23 10:28 ` [PATCH 04/17] qla2xxx: Use GFF_ID to check FCP-SCSI FC4 type before logging into Nx_Ports giridhar.malavali
2010-07-23 10:28 ` [PATCH 05/17] qla2xxx: Check for golden firmware and show version if available giridhar.malavali
2010-07-23 10:28 ` [PATCH 06/17] qla2xxx: Correct extended sense-data handling giridhar.malavali
2010-07-23 10:28 ` [PATCH 07/17] qla2xxx: Propogate transport disrupted status for cable pull conditions for faster failover giridhar.malavali
2010-07-23 10:28 ` [PATCH 08/17] qla2xxx: Stop firmware before doing init firmware giridhar.malavali
2010-07-23 10:28 ` [PATCH 09/17] qla2xxx: Add qla2x00_free_fcports() function giridhar.malavali
2010-07-23 10:28 ` [PATCH 10/17] qla2xxx: Don't issue set or get port param MBC if remote port is not logged in giridhar.malavali
2010-07-23 10:28 ` [PATCH 11/17] qla2xxx: Add CT passthru support for ISP23xx adapters giridhar.malavali
2010-07-23 10:28 ` [PATCH 12/17] qla2xxx: Do not allow ELS Passthru commands " giridhar.malavali
2010-07-23 10:28 ` [PATCH 13/17] qla2xxx: Updates for ISP82xx giridhar.malavali
2010-07-23 10:28 ` [PATCH 14/17] qla2xxx: Rearranged and cleaned up the code for processing the pending commands giridhar.malavali
2010-07-23 10:28 ` [PATCH 15/17] qla2xxx: Update copyright banner giridhar.malavali
2010-07-23 10:28 ` [PATCH 16/17] qla2xxx: Cleanup some dead-code and make some functions static giridhar.malavali
2010-07-23 10:28 ` [PATCH 17/17] qla2xxx: T10 DIF Type 2 support giridhar.malavali

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=1279880918-62876-4-git-send-email-giridhar.malavali@qlogic.com \
    --to=giridhar.malavali@qlogic.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=madhu.iyengar@qlogic.com \
    --cc=madhuranath.iyengar@qlogic.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).