public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: Linux SCSI Mailing List <linux-scsi@vger.kernel.org>,
	James Bottomley <james.bottomley@steeleye.com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Subject: [PATCH 8/14] qla2xxx: Check loop-state before reading host statistics.
Date: Mon, 29 Jan 2007 10:22:25 -0800	[thread overview]
Message-ID: <11700949511417-git-send-email-andrew.vasquez@qlogic.com> (raw)
In-Reply-To: <20070129182124.GA26940@andrew-vasquezs-computer.local>

Non-ISP24xx cards must have a loop-id in order to query host
statistics.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_attr.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 78a5867..834c404 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -885,21 +885,24 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
 	link_stat_t stat_buf;
 	struct fc_host_statistics *pfc_host_stat;
 
+	rval = QLA_FUNCTION_FAILED;
 	pfc_host_stat = &ha->fc_host_stat;
 	memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
 
 	if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
 		rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf,
 		    sizeof(stat_buf) / 4, mb_stat);
-	} else {
+	} else if (atomic_read(&ha->loop_state) == LOOP_READY &&
+		    !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) &&
+		    !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) &&
+		    !ha->dpc_active) {
+		/* Must be in a 'READY' state for statistics retrieval. */
 		rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf,
 		    mb_stat);
 	}
-	if (rval != 0) {
-		qla_printk(KERN_WARNING, ha,
-		    "Unable to retrieve host statistics (%d).\n", mb_stat[0]);
-		return pfc_host_stat;
-	}
+
+	if (rval != QLA_SUCCESS)
+		goto done;
 
 	pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt;
 	pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt;
@@ -907,7 +910,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
 	pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt;
 	pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt;
 	pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt;
-
+done:
 	return pfc_host_stat;
 }
 
-- 
1.5.0.rc2.gdbaa0


  parent reply	other threads:[~2007-01-29 18:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 18:21 [PATCH 0/14] qla2xxx: driver update Andrew Vasquez
2007-01-29 18:22 ` [PATCH 1/14] qla2xxx: Correct sector-erase issues while writing flash Andrew Vasquez
2007-01-29 18:22 ` [PATCH 2/14] qla2xxx: Add MSI-X support Andrew Vasquez
2007-01-29 18:22 ` [PATCH 3/14] qla2xxx: Handle IRQ-0 assignments by the system Andrew Vasquez
2007-01-29 18:22 ` [PATCH 4/14] qla2xxx: Export OptionROM boot-codes version information Andrew Vasquez
2007-01-29 18:22 ` [PATCH 5/14] qla2xxx: Perform implicit LOGO during fabric logout request Andrew Vasquez
2007-01-29 18:22 ` [PATCH 6/14] qla2xxx: Set correct cabling state during initialization Andrew Vasquez
2007-01-29 18:22 ` [PATCH 7/14] qla2xxx: Refactor set-HBA-model/description code Andrew Vasquez
2007-01-29 18:22 ` Andrew Vasquez [this message]
2007-01-29 18:22 ` [PATCH 9/14] qla2xxx: Fail initialization when inconsistent NVRAM detected Andrew Vasquez
2007-01-29 18:22 ` [PATCH 10/14] qla2xxx: Enable queue-full throttling when UNDERRUN detected Andrew Vasquez
2007-01-29 18:22 ` [PATCH 11/14] qla2xxx: Allow NVRAM updates to immediately go into affect Andrew Vasquez
2007-01-29 18:22 ` [PATCH 12/14] qla2xxx: Fixup printk() with proper new-line character Andrew Vasquez
2007-01-29 18:22 ` [PATCH 13/14] qla2xxx: Remove unnecessary spinlock primitive - mbx_reg_lock Andrew Vasquez
2007-01-29 18:22 ` [PATCH 14/14] qla2xxx: Update version number to 8.01.07-k5 Andrew Vasquez

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=11700949511417-git-send-email-andrew.vasquez@qlogic.com \
    --to=andrew.vasquez@qlogic.com \
    --cc=james.bottomley@steeleye.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox