aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorChad Dupuis <chad.dupuis@qlogic.com>2012-05-15 14:34:23 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-05-22 06:41:17 -0400
commitdaae62a33e4f9b998cc8bf985fdf9eda62c10e57 (patch)
tree7c206436f651f310ac97e86b1d2083885cb4d37a /drivers/scsi/qla2xxx
parent00adc9a034e0b8e2307316ae49754f7ba35f93df (diff)
[SCSI] qla2xxx: Log link up and link down messages to track link flops.
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c44
4 files changed, 35 insertions, 21 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 8e39f8a08ac2..1457186a0f2c 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -19,7 +19,7 @@
19 * | Queue Command and IO tracing | 0x3030 | 0x3006,0x3008 | 19 * | Queue Command and IO tracing | 0x3030 | 0x3006,0x3008 |
20 * | | | 0x302d-0x302e | 20 * | | | 0x302d-0x302e |
21 * | DPC Thread | 0x401c | 0x4002,0x4013 | 21 * | DPC Thread | 0x401c | 0x4002,0x4013 |
22 * | Async Events | 0x505d | 0x502b-0x502f | 22 * | Async Events | 0x505f | 0x502b-0x502f |
23 * | | | 0x5047,0x5052 | 23 * | | | 0x5047,0x5052 |
24 * | Timer Routines | 0x6011 | | 24 * | Timer Routines | 0x6011 | |
25 * | User Space Interactions | 0x709f | 0x7018,0x702e, | 25 * | User Space Interactions | 0x709f | 0x7018,0x702e, |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 9f065804bd12..c0896996b56b 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -383,6 +383,8 @@ extern int qla2x00_request_irqs(struct qla_hw_data *, struct rsp_que *);
383extern void qla2x00_free_irqs(scsi_qla_host_t *); 383extern void qla2x00_free_irqs(scsi_qla_host_t *);
384 384
385extern int qla2x00_get_data_rate(scsi_qla_host_t *); 385extern int qla2x00_get_data_rate(scsi_qla_host_t *);
386extern char *qla2x00_get_link_speed_str(struct qla_hw_data *);
387
386/* 388/*
387 * Global Function Prototypes in qla_sup.c source file. 389 * Global Function Prototypes in qla_sup.c source file.
388 */ 390 */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 33a23eb1cf51..34fca3e983b0 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2795,8 +2795,6 @@ cleanup_allocation:
2795static void 2795static void
2796qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) 2796qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
2797{ 2797{
2798#define LS_UNKNOWN 2
2799 static char *link_speeds[] = { "1", "2", "?", "4", "8", "10" };
2800 char *link_speed; 2798 char *link_speed;
2801 int rval; 2799 int rval;
2802 uint16_t mb[4]; 2800 uint16_t mb[4];
@@ -2824,11 +2822,7 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
2824 fcport->port_name[6], fcport->port_name[7], rval, 2822 fcport->port_name[6], fcport->port_name[7], rval,
2825 fcport->fp_speed, mb[0], mb[1]); 2823 fcport->fp_speed, mb[0], mb[1]);
2826 } else { 2824 } else {
2827 link_speed = link_speeds[LS_UNKNOWN]; 2825 link_speed = qla2x00_get_link_speed_str(ha);
2828 if (fcport->fp_speed < 5)
2829 link_speed = link_speeds[fcport->fp_speed];
2830 else if (fcport->fp_speed == 0x13)
2831 link_speed = link_speeds[5];
2832 ql_dbg(ql_dbg_disc, vha, 0x2005, 2826 ql_dbg(ql_dbg_disc, vha, 0x2005,
2833 "iIDMA adjusted to %s GB/s " 2827 "iIDMA adjusted to %s GB/s "
2834 "on %02x%02x%02x%02x%02x%02x%02x%02x.\n", link_speed, 2828 "on %02x%02x%02x%02x%02x%02x%02x%02x.\n", link_speed,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index f4b8a5f7840a..0e716dcea944 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -309,6 +309,28 @@ qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr)
309 "IDC failed to post ACK.\n"); 309 "IDC failed to post ACK.\n");
310} 310}
311 311
312#define LS_UNKNOWN 2
313char *
314qla2x00_get_link_speed_str(struct qla_hw_data *ha)
315{
316 static char *link_speeds[] = {"1", "2", "?", "4", "8", "16", "10"};
317 char *link_speed;
318 int fw_speed = ha->link_data_rate;
319
320 if (IS_QLA2100(ha) || IS_QLA2200(ha))
321 link_speed = link_speeds[0];
322 else if (fw_speed == 0x13)
323 link_speed = link_speeds[6];
324 else {
325 link_speed = link_speeds[LS_UNKNOWN];
326 if (fw_speed < 6)
327 link_speed =
328 link_speeds[fw_speed];
329 }
330
331 return link_speed;
332}
333
312/** 334/**
313 * qla2x00_async_event() - Process aynchronous events. 335 * qla2x00_async_event() - Process aynchronous events.
314 * @ha: SCSI driver HA context 336 * @ha: SCSI driver HA context
@@ -317,9 +339,6 @@ qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr)
317void 339void
318qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) 340qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
319{ 341{
320#define LS_UNKNOWN 2
321 static char *link_speeds[] = { "1", "2", "?", "4", "8", "16", "10" };
322 char *link_speed;
323 uint16_t handle_cnt; 342 uint16_t handle_cnt;
324 uint16_t cnt, mbx; 343 uint16_t cnt, mbx;
325 uint32_t handles[5]; 344 uint32_t handles[5];
@@ -479,20 +498,14 @@ skip_rio:
479 break; 498 break;
480 499
481 case MBA_LOOP_UP: /* Loop Up Event */ 500 case MBA_LOOP_UP: /* Loop Up Event */
482 if (IS_QLA2100(ha) || IS_QLA2200(ha)) { 501 if (IS_QLA2100(ha) || IS_QLA2200(ha))
483 link_speed = link_speeds[0];
484 ha->link_data_rate = PORT_SPEED_1GB; 502 ha->link_data_rate = PORT_SPEED_1GB;
485 } else { 503 else
486 link_speed = link_speeds[LS_UNKNOWN];
487 if (mb[1] < 6)
488 link_speed = link_speeds[mb[1]];
489 else if (mb[1] == 0x13)
490 link_speed = link_speeds[6];
491 ha->link_data_rate = mb[1]; 504 ha->link_data_rate = mb[1];
492 }
493 505
494 ql_dbg(ql_dbg_async, vha, 0x500a, 506 ql_dbg(ql_dbg_async, vha, 0x500a,
495 "LOOP UP detected (%s Gbps).\n", link_speed); 507 "LOOP UP detected (%s Gbps).\n",
508 qla2x00_get_link_speed_str(ha));
496 509
497 vha->flags.management_server_logged_in = 0; 510 vha->flags.management_server_logged_in = 0;
498 qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate); 511 qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate);
@@ -638,6 +651,8 @@ skip_rio:
638 ql_dbg(ql_dbg_async, vha, 0x5010, 651 ql_dbg(ql_dbg_async, vha, 0x5010,
639 "Port unavailable %04x %04x %04x.\n", 652 "Port unavailable %04x %04x %04x.\n",
640 mb[1], mb[2], mb[3]); 653 mb[1], mb[2], mb[3]);
654 ql_log(ql_log_warn, vha, 0x505e,
655 "Link is offline.\n");
641 656
642 if (atomic_read(&vha->loop_state) != LOOP_DOWN) { 657 if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
643 atomic_set(&vha->loop_state, LOOP_DOWN); 658 atomic_set(&vha->loop_state, LOOP_DOWN);
@@ -676,6 +691,9 @@ skip_rio:
676 ql_dbg(ql_dbg_async, vha, 0x5012, 691 ql_dbg(ql_dbg_async, vha, 0x5012,
677 "Port database changed %04x %04x %04x.\n", 692 "Port database changed %04x %04x %04x.\n",
678 mb[1], mb[2], mb[3]); 693 mb[1], mb[2], mb[3]);
694 ql_log(ql_log_warn, vha, 0x505f,
695 "Link is operational (%s Gbps).\n",
696 qla2x00_get_link_speed_str(ha));
679 697
680 /* 698 /*
681 * Mark all devices as missing so we will login again. 699 * Mark all devices as missing so we will login again.