/* Now that the rport has been deleted, set the fcport state to
FCS_DEVICE_DEAD */
- atomic_set(&fcport->state, FCS_DEVICE_DEAD);
+ qla2x00_set_fcport_state(fcport, FCS_DEVICE_DEAD);
/*
* Transport has effectively 'deleted' the rport, clear
#define FCS_DEVICE_LOST 3
#define FCS_ONLINE 4
+static const char * const port_state_str[] = {
+ "Unknown",
+ "UNCONFIGURED",
+ "DEAD",
+ "LOST",
+ "ONLINE"
+};
+
/*
* FC port flags.
*/
fcport->vp_idx = vha->vp_idx;
fcport->port_type = FCT_UNKNOWN;
fcport->loop_id = FC_NO_LOOP_ID;
- atomic_set(&fcport->state, FCS_UNCONFIGURED);
+ qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED);
fcport->supported_classes = FC_COS_UNSPECIFIED;
return fcport;
"loop_id=0x%04x\n",
vha->host_no, fcport->loop_id));
- atomic_set(&fcport->state, FCS_DEVICE_LOST);
+ qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
}
}
qla2x00_iidma_fcport(vha, fcport);
qla24xx_update_fcport_fcp_prio(vha, fcport);
qla2x00_reg_remote_port(vha, fcport);
- atomic_set(&fcport->state, FCS_ONLINE);
+ qla2x00_set_fcport_state(fcport, FCS_ONLINE);
}
/*
}
INIT_LIST_HEAD(&((struct crc_context *)sp->ctx)->dsd_list);
}
+
+static inline void
+qla2x00_set_fcport_state(fc_port_t *fcport, int state)
+{
+ int old_state;
+
+ old_state = atomic_read(&fcport->state);
+ atomic_set(&fcport->state, state);
+
+ /* Don't print state transitions during initial allocation of fcport */
+ if (old_state && old_state != state) {
+ DEBUG(qla_printk(KERN_WARNING, fcport->vha->hw,
+ "scsi(%ld): FCPort state transitioned from %s to %s - "
+ "portid=%02x%02x%02x.\n", fcport->vha->host_no,
+ port_state_str[old_state], port_state_str[state],
+ fcport->d_id.b.domain, fcport->d_id.b.area,
+ fcport->d_id.b.al_pa));
+ }
+}
vha->host_no, fcport->loop_id, fcport->vp_idx));
qla2x00_mark_device_lost(vha, fcport, 0, 0);
- atomic_set(&fcport->state, FCS_UNCONFIGURED);
+ qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED);
}
}
{
if (atomic_read(&fcport->state) == FCS_ONLINE &&
vha->vp_idx == fcport->vp_idx) {
- atomic_set(&fcport->state, FCS_DEVICE_LOST);
+ qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
qla2x00_schedule_rport_del(vha, fcport, defer);
}
/*
* port but do the retries.
*/
if (atomic_read(&fcport->state) != FCS_DEVICE_DEAD)
- atomic_set(&fcport->state, FCS_DEVICE_LOST);
+ qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
if (!do_login)
return;
if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD)
continue;
if (atomic_read(&fcport->state) == FCS_ONLINE) {
- atomic_set(&fcport->state, FCS_DEVICE_LOST);
+ qla2x00_set_fcport_state(fcport, FCS_DEVICE_LOST);
if (defer)
qla2x00_schedule_rport_del(vha, fcport, defer);
else if (vha->vp_idx == fcport->vp_idx)