Commit 25c001d7 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley

[PATCH] PATCH [10/15] qla2xxx: Use fcports list for targets

Consistently use the fcports list of an HA to iterate through the
known target devices.
parent 272fa201
...@@ -2270,10 +2270,10 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer, ...@@ -2270,10 +2270,10 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,
char **start, off_t offset, int length, int inout) char **start, off_t offset, int length, int inout)
{ {
struct info_str info; struct info_str info;
int i; int i;
int retval = -EINVAL; int retval = -EINVAL;
os_lun_t *up; os_lun_t *up;
os_tgt_t *tq; fc_port_t *fcport;
unsigned int t, l; unsigned int t, l;
uint32_t tmp_sn; uint32_t tmp_sn;
unsigned long *flags; unsigned long *flags;
...@@ -2459,20 +2459,23 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer, ...@@ -2459,20 +2459,23 @@ qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,
ha->init_cb->port_name[7]); ha->init_cb->port_name[7]);
/* Print out device port names */ /* Print out device port names */
for (i = 0; i < MAX_TARGETS; i++) { i = 0;
if ((tq = TGT_Q(ha, i)) == NULL) list_for_each_entry(fcport, &ha->fcports, list) {
if (fcport->port_type != FCT_TARGET)
continue; continue;
copy_info(&info, copy_info(&info,
"scsi-qla%d-target-%d=" "scsi-qla%d-target-%d="
"%02x%02x%02x%02x%02x%02x%02x%02x;\n", "%02x%02x%02x%02x%02x%02x%02x%02x:%02x%02x%02x;\n",
(int)ha->instance, i, (int)ha->instance, i,
tq->port_name[0], tq->port_name[1], fcport->port_name[0], fcport->port_name[1],
tq->port_name[2], tq->port_name[3], fcport->port_name[2], fcport->port_name[3],
tq->port_name[4], tq->port_name[5], fcport->port_name[4], fcport->port_name[5],
tq->port_name[6], tq->port_name[7]); fcport->port_name[6], fcport->port_name[7],
fcport->d_id.b.domain, fcport->d_id.b.area,
} /* 2.25 node/port display to proc */ fcport->d_id.b.al_pa);
i++;
}
copy_info(&info, "\nSCSI LUN Information:\n"); copy_info(&info, "\nSCSI LUN Information:\n");
copy_info(&info, copy_info(&info,
...@@ -2776,11 +2779,11 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport, ...@@ -2776,11 +2779,11 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport,
void void
qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha) qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha)
{ {
struct list_head *fcpl; fc_port_t *fcport;
fc_port_t *fcport;
list_for_each(fcpl, &ha->fcports) { list_for_each_entry(fcport, &ha->fcports, list) {
fcport = list_entry(fcpl, fc_port_t, list); if (fcport->port_type != FCT_TARGET)
continue;
/* /*
* No point in marking the device as lost, if the device is * No point in marking the device as lost, if the device is
...@@ -3140,7 +3143,6 @@ qla2x00_do_dpc(void *data) ...@@ -3140,7 +3143,6 @@ qla2x00_do_dpc(void *data)
{ {
DECLARE_MUTEX_LOCKED(sem); DECLARE_MUTEX_LOCKED(sem);
scsi_qla_host_t *ha; scsi_qla_host_t *ha;
struct list_head *fcpl;
fc_port_t *fcport; fc_port_t *fcport;
os_lun_t *q; os_lun_t *q;
srb_t *sp; srb_t *sp;
...@@ -3339,9 +3341,10 @@ qla2x00_do_dpc(void *data) ...@@ -3339,9 +3341,10 @@ qla2x00_do_dpc(void *data)
ha->host_no)); ha->host_no));
next_loopid = 0; next_loopid = 0;
list_for_each(fcpl, &ha->fcports) { list_for_each_entry(fcport, &ha->fcports, list) {
fcport = list_entry(fcpl, fc_port_t, list); if (fcport->port_type != FCT_TARGET)
continue;
/* /*
* If the port is not ONLINE then try to login * If the port is not ONLINE then try to login
* to it if we haven't run out of retries. * to it if we haven't run out of retries.
...@@ -3643,7 +3646,6 @@ qla2x00_timer(scsi_qla_host_t *ha) ...@@ -3643,7 +3646,6 @@ qla2x00_timer(scsi_qla_host_t *ha)
{ {
int t,l; int t,l;
unsigned long cpu_flags = 0; unsigned long cpu_flags = 0;
struct list_head *fcpl;
fc_port_t *fcport; fc_port_t *fcport;
os_lun_t *lq; os_lun_t *lq;
os_tgt_t *tq; os_tgt_t *tq;
...@@ -3678,8 +3680,9 @@ qla2x00_timer(scsi_qla_host_t *ha) ...@@ -3678,8 +3680,9 @@ qla2x00_timer(scsi_qla_host_t *ha)
* the port it marked DEAD. * the port it marked DEAD.
*/ */
t = 0; t = 0;
list_for_each(fcpl, &ha->fcports) { list_for_each_entry(fcport, &ha->fcports, list) {
fcport = list_entry(fcpl, fc_port_t, list); if (fcport->port_type != FCT_TARGET)
continue;
if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) { if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment