linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saurav Kashyap <saurav.kashyap@qlogic.com>
To: jbottomley@parallels.com
Cc: giridhar.malavali@qlogic.com, saurav.kashyap@qlogic.com,
	chad.dupuis@qlogic.com, andrew.vasquez@qlogic.com,
	linux-scsi@vger.kernel.org
Subject: [PATCH 15/19] qla2xxx: Parameterize the link speed of hba rather than fcport.
Date: Wed, 21 Nov 2012 02:40:40 -0500	[thread overview]
Message-ID: <1353483644-17262-16-git-send-email-saurav.kashyap@qlogic.com> (raw)
In-Reply-To: <1353483644-17262-1-git-send-email-saurav.kashyap@qlogic.com>

From: Joe Carnuccio <joe.carnuccio@qlogic.com>

Parameterize qla2x00_get_link_speed_str() to be generic on link speed.

Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
---
 drivers/scsi/qla2xxx/qla_gbl.h  |    2 +-
 drivers/scsi/qla2xxx/qla_init.c |    5 ++---
 drivers/scsi/qla2xxx/qla_isr.c  |   32 ++++++++++++++------------------
 3 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index dfad959..2411d1a 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -416,7 +416,7 @@ extern int qla2x00_request_irqs(struct qla_hw_data *, struct rsp_que *);
 extern void qla2x00_free_irqs(scsi_qla_host_t *);
 
 extern int qla2x00_get_data_rate(scsi_qla_host_t *);
-extern char *qla2x00_get_link_speed_str(struct qla_hw_data *);
+extern const char *qla2x00_get_link_speed_str(struct qla_hw_data *, uint16_t);
 
 /*
  * Global Function Prototypes in qla_sup.c source file.
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 1b5f40d..563eee3 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2983,7 +2983,6 @@ cleanup_allocation:
 static void
 qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 {
-	char *link_speed;
 	int rval;
 	uint16_t mb[4];
 	struct qla_hw_data *ha = vha->hw;
@@ -3010,10 +3009,10 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 		    fcport->port_name[6], fcport->port_name[7], rval,
 		    fcport->fp_speed, mb[0], mb[1]);
 	} else {
-		link_speed = qla2x00_get_link_speed_str(ha);
 		ql_dbg(ql_dbg_disc, vha, 0x2005,
 		    "iIDMA adjusted to %s GB/s "
-		    "on %02x%02x%02x%02x%02x%02x%02x%02x.\n", link_speed,
+		    "on %02x%02x%02x%02x%02x%02x%02x%02x.\n",
+		    qla2x00_get_link_speed_str(ha, fcport->fp_speed),
 		    fcport->port_name[0], fcport->port_name[1],
 		    fcport->port_name[2], fcport->port_name[3],
 		    fcport->port_name[4], fcport->port_name[5],
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index bb611e2..e43b4d5 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -316,25 +316,21 @@ qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr)
 }
 
 #define LS_UNKNOWN	2
-char *
-qla2x00_get_link_speed_str(struct qla_hw_data *ha)
+const char *
+qla2x00_get_link_speed_str(struct qla_hw_data *ha, uint16_t speed)
 {
-	static char *link_speeds[] = {"1", "2", "?", "4", "8", "16", "10"};
-	char *link_speed;
-	int fw_speed = ha->link_data_rate;
+	static const char * const link_speeds[] = {
+		"1", "2", "?", "4", "8", "16", "10"
+	};
 
 	if (IS_QLA2100(ha) || IS_QLA2200(ha))
-		link_speed = link_speeds[0];
-	else if (fw_speed == 0x13)
-		link_speed = link_speeds[6];
-	else {
-		link_speed = link_speeds[LS_UNKNOWN];
-		if (fw_speed < 6)
-			link_speed =
-			    link_speeds[fw_speed];
-	}
-
-	return link_speed;
+		return link_speeds[0];
+	else if (speed == 0x13)
+		return link_speeds[6];
+	else if (speed < 6)
+		return link_speeds[speed];
+	else
+		return link_speeds[LS_UNKNOWN];
 }
 
 static void
@@ -671,7 +667,7 @@ skip_rio:
 
 		ql_dbg(ql_dbg_async, vha, 0x500a,
 		    "LOOP UP detected (%s Gbps).\n",
-		    qla2x00_get_link_speed_str(ha));
+		    qla2x00_get_link_speed_str(ha, ha->link_data_rate));
 
 		vha->flags.management_server_logged_in = 0;
 		qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate);
@@ -860,7 +856,7 @@ skip_rio:
 		    mb[1], mb[2], mb[3]);
 		ql_log(ql_log_warn, vha, 0x505f,
 		    "Link is operational (%s Gbps).\n",
-		    qla2x00_get_link_speed_str(ha));
+		    qla2x00_get_link_speed_str(ha, ha->link_data_rate));
 
 		/*
 		 * Mark all devices as missing so we will login again.
-- 
1.7.7


  parent reply	other threads:[~2012-11-21  7:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21  7:40 [PATCH 00/19] qla2xxx: Patches for scsi "misc" branch Saurav Kashyap
2012-11-21  7:40 ` [PATCH 01/19] qla2xxx: Clear unsupported 'states' during Get-FW-State queries Saurav Kashyap
2012-11-21  7:40 ` [PATCH 02/19] qla2xxx: Remove spurious taking of ha->vport_slock spinlock Saurav Kashyap
2012-11-21  7:40 ` [PATCH 03/19] qla2xxx: Honor status value of 2 for report-id acquisition Saurav Kashyap
2012-11-21  7:40 ` [PATCH 04/19] qla2xxx: Fix for warnings reported by sparse Saurav Kashyap
2012-11-21  7:40 ` [PATCH 05/19] qla2xxx: No fcport FC-4 type assignment in GA_NXT response Saurav Kashyap
2012-11-21  7:40 ` [PATCH 06/19] qla2xxx: Fix coccinelle warnings in qla2x00_relogin Saurav Kashyap
2012-11-21  7:40 ` [PATCH 07/19] qla2xxx: Move noisy Start scsi failed messages to verbose logging level Saurav Kashyap
2012-11-21  7:40 ` [PATCH 08/19] qla2xxx: Use correct Request-Q-Out register during bidirectional request processing Saurav Kashyap
2012-11-21  7:40 ` [PATCH 09/19] qla2xxx: Add Gen3 PCIe speed 8GT/s to the log message Saurav Kashyap
2012-11-21  7:40 ` [PATCH 10/19] qla2xxx: Fix typo in qla83xx_fw_dump function Saurav Kashyap
2012-11-21  7:40 ` [PATCH 11/19] qla2xxx: Ignore driver ack bit if corresponding presence bit is not set Saurav Kashyap
2012-11-21  7:40 ` [PATCH 12/19] qla2xxx: Add acquiring of risc semaphore before doing ISP reset Saurav Kashyap
2012-11-21  7:40 ` [PATCH 13/19] qla2xxx: Move marking fcport online ahead of setting iiDMA speed Saurav Kashyap
2012-11-21  7:40 ` [PATCH 14/19] qla2xxx: Add 16Gb/s case to get port speed capability Saurav Kashyap
2012-11-21  7:40 ` Saurav Kashyap [this message]
2012-11-21  7:40 ` [PATCH 16/19] qla2xxx: Update ql2xextended_error_logging parameter description with new option Saurav Kashyap
2012-11-21  7:40 ` [PATCH 17/19] qla2xxx: Fix typo in qla2xxx driver Saurav Kashyap
2012-11-21  7:40 ` [PATCH 18/19] qla2xxx: Dont clear drv active on iospace config failure Saurav Kashyap
2012-11-21  7:40 ` [PATCH 19/19] qla2xxx: Display that driver is operating in legacy interrupt mode Saurav Kashyap

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=1353483644-17262-16-git-send-email-saurav.kashyap@qlogic.com \
    --to=saurav.kashyap@qlogic.com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=chad.dupuis@qlogic.com \
    --cc=giridhar.malavali@qlogic.com \
    --cc=jbottomley@parallels.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;
as well as URLs for NNTP newsgroup(s).