aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJoe Carnuccio <joe.carnuccio@qlogic.com>2012-11-21 02:40:40 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-11-30 10:14:48 -0500
commitd0297c9a3f429d76e7e5b6cdbdd9868d3e20e547 (patch)
treede5aa7a09ae36134108b1013ba502ab42a5be3b1 /drivers/scsi
parentc53dfac29070232aaf0c549bdcbdf41249a0686b (diff)
[SCSI] qla2xxx: Parameterize the link speed of hba rather than fcport.
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> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c5
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c32
3 files changed, 17 insertions, 22 deletions
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index dfad9595be56..2411d1a12b26 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 *);
416extern void qla2x00_free_irqs(scsi_qla_host_t *); 416extern void qla2x00_free_irqs(scsi_qla_host_t *);
417 417
418extern int qla2x00_get_data_rate(scsi_qla_host_t *); 418extern int qla2x00_get_data_rate(scsi_qla_host_t *);
419extern char *qla2x00_get_link_speed_str(struct qla_hw_data *); 419extern const char *qla2x00_get_link_speed_str(struct qla_hw_data *, uint16_t);
420 420
421/* 421/*
422 * Global Function Prototypes in qla_sup.c source file. 422 * 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 1b5f40d0a2a1..563eee3fa924 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2983,7 +2983,6 @@ cleanup_allocation:
2983static void 2983static void
2984qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) 2984qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
2985{ 2985{
2986 char *link_speed;
2987 int rval; 2986 int rval;
2988 uint16_t mb[4]; 2987 uint16_t mb[4];
2989 struct qla_hw_data *ha = vha->hw; 2988 struct qla_hw_data *ha = vha->hw;
@@ -3010,10 +3009,10 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
3010 fcport->port_name[6], fcport->port_name[7], rval, 3009 fcport->port_name[6], fcport->port_name[7], rval,
3011 fcport->fp_speed, mb[0], mb[1]); 3010 fcport->fp_speed, mb[0], mb[1]);
3012 } else { 3011 } else {
3013 link_speed = qla2x00_get_link_speed_str(ha);
3014 ql_dbg(ql_dbg_disc, vha, 0x2005, 3012 ql_dbg(ql_dbg_disc, vha, 0x2005,
3015 "iIDMA adjusted to %s GB/s " 3013 "iIDMA adjusted to %s GB/s "
3016 "on %02x%02x%02x%02x%02x%02x%02x%02x.\n", link_speed, 3014 "on %02x%02x%02x%02x%02x%02x%02x%02x.\n",
3015 qla2x00_get_link_speed_str(ha, fcport->fp_speed),
3017 fcport->port_name[0], fcport->port_name[1], 3016 fcport->port_name[0], fcport->port_name[1],
3018 fcport->port_name[2], fcport->port_name[3], 3017 fcport->port_name[2], fcport->port_name[3],
3019 fcport->port_name[4], fcport->port_name[5], 3018 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 bb611e21b301..e43b4d5d923b 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)
316} 316}
317 317
318#define LS_UNKNOWN 2 318#define LS_UNKNOWN 2
319char * 319const char *
320qla2x00_get_link_speed_str(struct qla_hw_data *ha) 320qla2x00_get_link_speed_str(struct qla_hw_data *ha, uint16_t speed)
321{ 321{
322 static char *link_speeds[] = {"1", "2", "?", "4", "8", "16", "10"}; 322 static const char * const link_speeds[] = {
323 char *link_speed; 323 "1", "2", "?", "4", "8", "16", "10"
324 int fw_speed = ha->link_data_rate; 324 };
325 325
326 if (IS_QLA2100(ha) || IS_QLA2200(ha)) 326 if (IS_QLA2100(ha) || IS_QLA2200(ha))
327 link_speed = link_speeds[0]; 327 return link_speeds[0];
328 else if (fw_speed == 0x13) 328 else if (speed == 0x13)
329 link_speed = link_speeds[6]; 329 return link_speeds[6];
330 else { 330 else if (speed < 6)
331 link_speed = link_speeds[LS_UNKNOWN]; 331 return link_speeds[speed];
332 if (fw_speed < 6) 332 else
333 link_speed = 333 return link_speeds[LS_UNKNOWN];
334 link_speeds[fw_speed];
335 }
336
337 return link_speed;
338} 334}
339 335
340static void 336static void
@@ -671,7 +667,7 @@ skip_rio:
671 667
672 ql_dbg(ql_dbg_async, vha, 0x500a, 668 ql_dbg(ql_dbg_async, vha, 0x500a,
673 "LOOP UP detected (%s Gbps).\n", 669 "LOOP UP detected (%s Gbps).\n",
674 qla2x00_get_link_speed_str(ha)); 670 qla2x00_get_link_speed_str(ha, ha->link_data_rate));
675 671
676 vha->flags.management_server_logged_in = 0; 672 vha->flags.management_server_logged_in = 0;
677 qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate); 673 qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate);
@@ -860,7 +856,7 @@ skip_rio:
860 mb[1], mb[2], mb[3]); 856 mb[1], mb[2], mb[3]);
861 ql_log(ql_log_warn, vha, 0x505f, 857 ql_log(ql_log_warn, vha, 0x505f,
862 "Link is operational (%s Gbps).\n", 858 "Link is operational (%s Gbps).\n",
863 qla2x00_get_link_speed_str(ha)); 859 qla2x00_get_link_speed_str(ha, ha->link_data_rate));
864 860
865 /* 861 /*
866 * Mark all devices as missing so we will login again. 862 * Mark all devices as missing so we will login again.