[SCSI] qla2xxx: prep for fc host dev loss tmo support
[pandora-kernel.git] / drivers / scsi / qla2xxx / qla_attr.c
index 420238c..029fe6b 100644 (file)
@@ -1538,22 +1538,22 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
        if (!fcport)
                return;
 
-       if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
-               return;
-
-       if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
-               qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
-               return;
-       }
-
        /*
         * Transport has effectively 'deleted' the rport, clear
         * all local references.
         */
        spin_lock_irq(host->host_lock);
-       fcport->rport = NULL;
+       fcport->rport = fcport->drport = NULL;
        *((fc_port_t **)rport->dd_data) = NULL;
        spin_unlock_irq(host->host_lock);
+
+       if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
+               return;
+
+       if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
+               qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
+               return;
+       }
 }
 
 static void
@@ -1676,14 +1676,14 @@ static void
 qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
 {
        scsi_qla_host_t *vha = shost_priv(shost);
-       u64 node_name;
+       uint8_t node_name[WWN_SIZE] = { 0xFF, 0xFF, 0xFF, 0xFF, \
+               0xFF, 0xFF, 0xFF, 0xFF};
+       u64 fabric_name = wwn_to_u64(node_name);
 
        if (vha->device_flags & SWITCH_FOUND)
-               node_name = wwn_to_u64(vha->fabric_node_name);
-       else
-               node_name = wwn_to_u64(vha->node_name);
+               fabric_name = wwn_to_u64(vha->fabric_node_name);
 
-       fc_host_fabric_name(shost) = node_name;
+       fc_host_fabric_name(shost) = fabric_name;
 }
 
 static void
@@ -1776,6 +1776,7 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
        }
 
        /* initialize attributes */
+       fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
        fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
        fc_host_port_name(vha->host) = wwn_to_u64(vha->port_name);
        fc_host_supported_classes(vha->host) =
@@ -1977,6 +1978,7 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha)
        struct qla_hw_data *ha = vha->hw;
        u32 speed = FC_PORTSPEED_UNKNOWN;
 
+       fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
        fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
        fc_host_port_name(vha->host) = wwn_to_u64(vha->port_name);
        fc_host_supported_classes(vha->host) = FC_COS_CLASS3;