-
-/**************************************************************************
-* qla2x00_check_tgt_status
-*
-* Description:
-* Checks to see if the target or loop is down.
-*
-* Input:
-* cmd - pointer to Scsi cmd structure
-*
-* Returns:
-* 1 - if target is present
-* 0 - if target is not present
-*
-**************************************************************************/
-int
-qla2x00_check_tgt_status(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
-{
- os_lun_t *lq;
- unsigned int b, t, l;
- fc_port_t *fcport;
-
- /* Generate LU queue on bus, target, LUN */
- b = cmd->device->channel;
- t = cmd->device->id;
- l = cmd->device->lun;
-
- if ((lq = GET_LU_Q(ha,t,l)) == NULL) {
- return (QLA_FUNCTION_FAILED);
- }
-
- fcport = lq->fclun->fcport;
-
- if (TGT_Q(ha, t) == NULL ||
- l >= ha->max_luns ||
- atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
- atomic_read(&ha->loop_state) == LOOP_DEAD ||
- (!atomic_read(&ha->loop_down_timer) &&
- atomic_read(&ha->loop_state) == LOOP_DOWN) ||
- test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
- test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
- atomic_read(&ha->loop_state) != LOOP_READY) {
-
- DEBUG(printk(KERN_INFO
- "scsi(%ld:%2d:%2d:%2d): %s connection is down\n",
- ha->host_no,
- b, t, l,
- __func__));
-
- cmd->result = DID_NO_CONNECT << 16;
- return (QLA_FUNCTION_FAILED);
- }
- return (QLA_SUCCESS);
-}
-
-/**************************************************************************
-* qla2x00_check_port_status
-*
-* Description:
-* Checks to see if the port or loop is down.
-*
-* Input:
-* fcport - pointer to fc_port_t structure.
-*
-* Returns:
-* 1 - if port is present
-* 0 - if port is not present
-*
-**************************************************************************/
-int
-qla2x00_check_port_status(scsi_qla_host_t *ha, fc_port_t *fcport)
-{
- if (fcport == NULL) {
- return (QLA_FUNCTION_FAILED);
- }
-
- if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD ||
- atomic_read(&ha->loop_state) == LOOP_DEAD) {
- return (QLA_FUNCTION_FAILED);
- }
-
- if ((atomic_read(&fcport->state) != FCS_ONLINE) ||
- (!atomic_read(&ha->loop_down_timer) &&
- atomic_read(&ha->loop_state) == LOOP_DOWN) ||
- (test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags)) ||
- test_bit(CFG_ACTIVE, &ha->cfg_flags) ||
- test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) ||
- atomic_read(&ha->loop_state) != LOOP_READY) {
-
- DEBUG(printk(KERN_INFO
- "scsi(%ld): Connection is down. fcport=%p.\n",
- ha->host_no, fcport));
-
- return (QLA_BUSY);
- }
-
- return (QLA_SUCCESS);
-}
-