aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorChad Dupuis <chad.dupuis@qlogic.com>2011-03-30 14:46:32 -0400
committerJames Bottomley <James.Bottomley@suse.de>2011-05-01 11:14:42 -0400
commitec426e106c410b000ac590b6e776d5a6cd9bccd9 (patch)
tree214b0e2c5935b2ea2143bf993b86799429427f70 /drivers/scsi/qla2xxx
parenta4f92a32a0fb827f7bd40c69f021cf57d3dc4249 (diff)
[SCSI] qla2xxx: Log fcport state transitions when debug messages are enabled.
Add the inline function qla2x00_set_port_state() so that when a fcport state transition happens we can log the state transition if debug messages are enabled. Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com> Signed-off-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h8
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_inline.h19
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c6
6 files changed, 35 insertions, 8 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index cee3eed5ed13..75faf480aa73 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1568,7 +1568,7 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
1568 1568
1569 /* Now that the rport has been deleted, set the fcport state to 1569 /* Now that the rport has been deleted, set the fcport state to
1570 FCS_DEVICE_DEAD */ 1570 FCS_DEVICE_DEAD */
1571 atomic_set(&fcport->state, FCS_DEVICE_DEAD); 1571 qla2x00_set_fcport_state(fcport, FCS_DEVICE_DEAD);
1572 1572
1573 /* 1573 /*
1574 * Transport has effectively 'deleted' the rport, clear 1574 * Transport has effectively 'deleted' the rport, clear
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index c2fc9652f179..cc5a79259d33 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1717,6 +1717,14 @@ typedef struct fc_port {
1717#define FCS_DEVICE_LOST 3 1717#define FCS_DEVICE_LOST 3
1718#define FCS_ONLINE 4 1718#define FCS_ONLINE 4
1719 1719
1720static const char * const port_state_str[] = {
1721 "Unknown",
1722 "UNCONFIGURED",
1723 "DEAD",
1724 "LOST",
1725 "ONLINE"
1726};
1727
1720/* 1728/*
1721 * FC port flags. 1729 * FC port flags.
1722 */ 1730 */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index d31ac9bd81d9..24d2d195d3c6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2544,7 +2544,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
2544 fcport->vp_idx = vha->vp_idx; 2544 fcport->vp_idx = vha->vp_idx;
2545 fcport->port_type = FCT_UNKNOWN; 2545 fcport->port_type = FCT_UNKNOWN;
2546 fcport->loop_id = FC_NO_LOOP_ID; 2546 fcport->loop_id = FC_NO_LOOP_ID;
2547 atomic_set(&fcport->state, FCS_UNCONFIGURED); 2547 qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED);
2548 fcport->supported_classes = FC_COS_UNSPECIFIED; 2548 fcport->supported_classes = FC_COS_UNSPECIFIED;
2549 2549
2550 return fcport; 2550 return fcport;
@@ -2730,7 +2730,7 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
2730 "loop_id=0x%04x\n", 2730 "loop_id=0x%04x\n",
2731 vha->host_no, fcport->loop_id)); 2731 vha->host_no, fcport->loop_id));
2732 2732
2733 atomic_set(&fcport->state, FCS_DEVICE_LOST); 2733 qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
2734 } 2734 }
2735 } 2735 }
2736 2736
@@ -2942,7 +2942,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
2942 qla2x00_iidma_fcport(vha, fcport); 2942 qla2x00_iidma_fcport(vha, fcport);
2943 qla24xx_update_fcport_fcp_prio(vha, fcport); 2943 qla24xx_update_fcport_fcp_prio(vha, fcport);
2944 qla2x00_reg_remote_port(vha, fcport); 2944 qla2x00_reg_remote_port(vha, fcport);
2945 atomic_set(&fcport->state, FCS_ONLINE); 2945 qla2x00_set_fcport_state(fcport, FCS_ONLINE);
2946} 2946}
2947 2947
2948/* 2948/*
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
index 4d17e7018aa3..4c8167e11f69 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -83,3 +83,22 @@ qla2x00_clean_dsd_pool(struct qla_hw_data *ha, srb_t *sp)
83 } 83 }
84 INIT_LIST_HEAD(&((struct crc_context *)sp->ctx)->dsd_list); 84 INIT_LIST_HEAD(&((struct crc_context *)sp->ctx)->dsd_list);
85} 85}
86
87static inline void
88qla2x00_set_fcport_state(fc_port_t *fcport, int state)
89{
90 int old_state;
91
92 old_state = atomic_read(&fcport->state);
93 atomic_set(&fcport->state, state);
94
95 /* Don't print state transitions during initial allocation of fcport */
96 if (old_state && old_state != state) {
97 DEBUG(qla_printk(KERN_WARNING, fcport->vha->hw,
98 "scsi(%ld): FCPort state transitioned from %s to %s - "
99 "portid=%02x%02x%02x.\n", fcport->vha->host_no,
100 port_state_str[old_state], port_state_str[state],
101 fcport->d_id.b.domain, fcport->d_id.b.area,
102 fcport->d_id.b.al_pa));
103 }
104}
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 3082e2ff7fab..e34d7dd73e82 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -136,7 +136,7 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha)
136 vha->host_no, fcport->loop_id, fcport->vp_idx)); 136 vha->host_no, fcport->loop_id, fcport->vp_idx));
137 137
138 qla2x00_mark_device_lost(vha, fcport, 0, 0); 138 qla2x00_mark_device_lost(vha, fcport, 0, 0);
139 atomic_set(&fcport->state, FCS_UNCONFIGURED); 139 qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED);
140 } 140 }
141} 141}
142 142
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 8791642f19c1..0ca66645e10c 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2552,7 +2552,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport,
2552{ 2552{
2553 if (atomic_read(&fcport->state) == FCS_ONLINE && 2553 if (atomic_read(&fcport->state) == FCS_ONLINE &&
2554 vha->vp_idx == fcport->vp_idx) { 2554 vha->vp_idx == fcport->vp_idx) {
2555 atomic_set(&fcport->state, FCS_DEVICE_LOST); 2555 qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
2556 qla2x00_schedule_rport_del(vha, fcport, defer); 2556 qla2x00_schedule_rport_del(vha, fcport, defer);
2557 } 2557 }
2558 /* 2558 /*
@@ -2560,7 +2560,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *vha, fc_port_t *fcport,
2560 * port but do the retries. 2560 * port but do the retries.
2561 */ 2561 */
2562 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD) 2562 if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD)
2563 atomic_set(&fcport->state, FCS_DEVICE_LOST); 2563 qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
2564 2564
2565 if (!do_login) 2565 if (!do_login)
2566 return; 2566 return;
@@ -2615,7 +2615,7 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *vha, int defer)
2615 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) 2615 if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD)
2616 continue; 2616 continue;
2617 if (atomic_read(&fcport->state) == FCS_ONLINE) { 2617 if (atomic_read(&fcport->state) == FCS_ONLINE) {
2618 atomic_set(&fcport->state, FCS_DEVICE_LOST); 2618 qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
2619 if (defer) 2619 if (defer)
2620 qla2x00_schedule_rport_del(vha, fcport, defer); 2620 qla2x00_schedule_rport_del(vha, fcport, defer);
2621 else if (vha->vp_idx == fcport->vp_idx) 2621 else if (vha->vp_idx == fcport->vp_idx)