public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: PATCH [4/15] qla2xxx:  Endianess fix while reading stats
Date: Sun, 14 Mar 2004 00:24:34 -0800	[thread overview]
Message-ID: <20040314082434.GA3409@linux.local.home> (raw)

ChangeSet
  1.1660 04/02/28 22:02:06 andrew.vasquez@qlogic.com +2 -0
  Return firmware statistics retrieved from
  qla2x00_get_link_status() in host-endian form.

  drivers/scsi/qla2xxx/qla_gbl.h
    1.5 04/02/28 22:02:00 andrew.vasquez@qlogic.com +1 -1
    Use a pointer to a known structure form rather than an
    opaque pointer.

 drivers/scsi/qla2xxx/qla_gbl.h |    2 +-
 drivers/scsi/qla2xxx/qla_mbx.c |   32 ++++++++++++++++++--------------
 2 files changed, 19 insertions(+), 15 deletions(-)

ftp://ftp.qlogic.com/outgoing/linux/patches/8.x/8.00.00b11k/13_endian_fix_link_stats.patch

diff -Nru a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
--- a/drivers/scsi/qla2xxx/qla_gbl.h	Fri Mar 12 17:07:04 2004
+++ b/drivers/scsi/qla2xxx/qla_gbl.h	Fri Mar 12 17:07:04 2004
@@ -195,7 +195,7 @@
 qla2x00_get_port_name(scsi_qla_host_t *, uint16_t, uint8_t *, uint8_t);
 
 extern uint8_t
-qla2x00_get_link_status(scsi_qla_host_t *, uint8_t, void *, uint16_t *);
+qla2x00_get_link_status(scsi_qla_host_t *, uint8_t, link_stat_t *, uint16_t *);
 
 extern int
 qla2x00_lip_reset(scsi_qla_host_t *);
diff -Nru a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
--- a/drivers/scsi/qla2xxx/qla_mbx.c	Fri Mar 12 17:07:04 2004
+++ b/drivers/scsi/qla2xxx/qla_mbx.c	Fri Mar 12 17:07:04 2004
@@ -1598,8 +1598,8 @@
  *	BIT_1 = mailbox error.
  */
 uint8_t
-qla2x00_get_link_status(scsi_qla_host_t *ha, uint8_t loop_id, void *ret_buf,
-    uint16_t *status)
+qla2x00_get_link_status(scsi_qla_host_t *ha, uint8_t loop_id,
+    link_stat_t *ret_buf, uint16_t *status)
 {
 	int rval;
 	mbx_cmd_t mc;
@@ -1646,16 +1646,20 @@
 			status[0] = mcp->mb[0];
 			rval = BIT_1;
 		} else {
-			/* copy over data */
-			memcpy(ret_buf, stat_buf,sizeof(link_stat_t));
-			DEBUG(printk("qla2x00_get_link_status(%ld): stat dump: "
-			    "fail_cnt=%d loss_sync=%d loss_sig=%d seq_err=%d "
-			    "inval_xmt_word=%d inval_crc=%d.\n",
-			    ha->host_no,
-			    stat_buf->link_fail_cnt, stat_buf->loss_sync_cnt,
-			    stat_buf->loss_sig_cnt, stat_buf->prim_seq_err_cnt,
-			    stat_buf->inval_xmit_word_cnt,
-			    stat_buf->inval_crc_cnt);)
+			/* copy over data -- firmware data is LE. */
+			ret_buf->link_fail_cnt =
+			    le32_to_cpu(stat_buf->link_fail_cnt);
+			ret_buf->loss_sync_cnt =
+			    le32_to_cpu(stat_buf->loss_sync_cnt);
+			ret_buf->loss_sig_cnt =
+			    le32_to_cpu(stat_buf->loss_sig_cnt);
+			ret_buf->prim_seq_err_cnt =
+			    le32_to_cpu(stat_buf->prim_seq_err_cnt);
+			ret_buf->inval_xmit_word_cnt =
+			    le32_to_cpu(stat_buf->inval_xmit_word_cnt);
+			ret_buf->inval_crc_cnt =
+			    le32_to_cpu(stat_buf->inval_crc_cnt);
+
 			DEBUG11(printk("qla2x00_get_link_status(%ld): stat "
 			    "dump: fail_cnt=%d loss_sync=%d loss_sig=%d "
 			    "seq_err=%d inval_xmt_word=%d inval_crc=%d.\n",
@@ -1672,8 +1676,8 @@
 		rval = BIT_1;
 	}
 
-	pci_free_consistent(ha->pdev, sizeof(link_stat_t),
-	    stat_buf, phys_address);
+	pci_free_consistent(ha->pdev, sizeof(link_stat_t), stat_buf,
+	    phys_address);
 
 	return rval;
 }

                 reply	other threads:[~2004-03-14  8:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040314082434.GA3409@linux.local.home \
    --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