Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 13937
b: refs/heads/master
c: ee0a90f
h: refs/heads/master
i:
  13935: 88c2dfa
v: v3
  • Loading branch information
brking@us.ibm.com authored and James Bottomley committed Nov 6, 2005
1 parent 51e6531 commit d25b0ca
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee0f05b863df0a623792eaa46703019c100be2de
refs/heads/master: ee0a90fa3efffcaccffea5a9c1599f4c59ca55d4
59 changes: 48 additions & 11 deletions trunk/drivers/scsi/ipr.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ static void ipr_send_hcam(struct ipr_ioa_cfg *ioa_cfg, u8 type,
**/
static void ipr_init_res_entry(struct ipr_resource_entry *res)
{
res->needs_sync_complete = 1;
res->needs_sync_complete = 0;
res->in_erp = 0;
res->add_to_ml = 0;
res->del_from_ml = 0;
Expand Down Expand Up @@ -3251,7 +3251,8 @@ static int ipr_slave_alloc(struct scsi_device *sdev)
res->add_to_ml = 0;
res->in_erp = 0;
sdev->hostdata = res;
res->needs_sync_complete = 1;
if (!ipr_is_naca_model(res))
res->needs_sync_complete = 1;
rc = 0;
break;
}
Expand Down Expand Up @@ -3515,7 +3516,8 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd)
}

list_add_tail(&ipr_cmd->queue, &ioa_cfg->free_q);
res->needs_sync_complete = 1;
if (!ipr_is_naca_model(res))
res->needs_sync_complete = 1;

LEAVE;
return (IPR_IOASC_SENSE_KEY(ioasc) ? FAILED : SUCCESS);
Expand Down Expand Up @@ -3819,7 +3821,8 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd)
}

if (res) {
res->needs_sync_complete = 1;
if (!ipr_is_naca_model(res))
res->needs_sync_complete = 1;
res->in_erp = 0;
}
ipr_unmap_sglist(ioa_cfg, ipr_cmd);
Expand Down Expand Up @@ -4088,6 +4091,30 @@ static void ipr_gen_sense(struct ipr_cmnd *ipr_cmd)
}
}

/**
* ipr_get_autosense - Copy autosense data to sense buffer
* @ipr_cmd: ipr command struct
*
* This function copies the autosense buffer to the buffer
* in the scsi_cmd, if there is autosense available.
*
* Return value:
* 1 if autosense was available / 0 if not
**/
static int ipr_get_autosense(struct ipr_cmnd *ipr_cmd)
{
struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;

if ((be32_to_cpu(ioasa->ioasc_specific) &
(IPR_ADDITIONAL_STATUS_FMT | IPR_AUTOSENSE_VALID)) == 0)
return 0;

memcpy(ipr_cmd->scsi_cmd->sense_buffer, ioasa->auto_sense.data,
min_t(u16, be16_to_cpu(ioasa->auto_sense.auto_sense_len),
SCSI_SENSE_BUFFERSIZE));
return 1;
}

/**
* ipr_erp_start - Process an error response for a SCSI op
* @ioa_cfg: ioa config struct
Expand Down Expand Up @@ -4118,15 +4145,19 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,

switch (ioasc & IPR_IOASC_IOASC_MASK) {
case IPR_IOASC_ABORTED_CMD_TERM_BY_HOST:
scsi_cmd->result |= (DID_IMM_RETRY << 16);
if (ipr_is_naca_model(res))
scsi_cmd->result |= (DID_ABORT << 16);
else
scsi_cmd->result |= (DID_IMM_RETRY << 16);
break;
case IPR_IOASC_IR_RESOURCE_HANDLE:
case IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA:
scsi_cmd->result |= (DID_NO_CONNECT << 16);
break;
case IPR_IOASC_HW_SEL_TIMEOUT:
scsi_cmd->result |= (DID_NO_CONNECT << 16);
res->needs_sync_complete = 1;
if (!ipr_is_naca_model(res))
res->needs_sync_complete = 1;
break;
case IPR_IOASC_SYNC_REQUIRED:
if (!res->in_erp)
Expand All @@ -4146,21 +4177,27 @@ static void ipr_erp_start(struct ipr_ioa_cfg *ioa_cfg,
if (!res->resetting_device)
scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel);
scsi_cmd->result |= (DID_ERROR << 16);
res->needs_sync_complete = 1;
if (!ipr_is_naca_model(res))
res->needs_sync_complete = 1;
break;
case IPR_IOASC_HW_DEV_BUS_STATUS:
scsi_cmd->result |= IPR_IOASC_SENSE_STATUS(ioasc);
if (IPR_IOASC_SENSE_STATUS(ioasc) == SAM_STAT_CHECK_CONDITION) {
ipr_erp_cancel_all(ipr_cmd);
return;
if (!ipr_get_autosense(ipr_cmd)) {
if (!ipr_is_naca_model(res)) {
ipr_erp_cancel_all(ipr_cmd);
return;
}
}
}
res->needs_sync_complete = 1;
if (!ipr_is_naca_model(res))
res->needs_sync_complete = 1;
break;
case IPR_IOASC_NR_INIT_CMD_REQUIRED:
break;
default:
scsi_cmd->result |= (DID_ERROR << 16);
if (!ipr_is_vset_device(res))
if (!ipr_is_vset_device(res) && !ipr_is_naca_model(res))
res->needs_sync_complete = 1;
break;
}
Expand Down
18 changes: 18 additions & 0 deletions trunk/drivers/scsi/ipr.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ struct ipr_config_table_entry {
#define IPR_SUBTYPE_GENERIC_SCSI 1
#define IPR_SUBTYPE_VOLUME_SET 2

#define IPR_QUEUEING_MODEL(res) ((((res)->cfgte.flags) & 0x70) >> 4)
#define IPR_QUEUE_FROZEN_MODEL 0
#define IPR_QUEUE_NACA_MODEL 1

struct ipr_res_addr res_addr;
__be32 res_handle;
__be32 reserved4[2];
Expand Down Expand Up @@ -1293,6 +1297,20 @@ static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
return 0;
}

/**
* ipr_is_naca_model - Determine if a resource is using NACA queueing model
* @res: resource entry struct
*
* Return value:
* 1 if NACA queueing model / 0 if not NACA queueing model
**/
static inline int ipr_is_naca_model(struct ipr_resource_entry *res)
{
if (ipr_is_gscsi(res) && IPR_QUEUEING_MODEL(res) == IPR_QUEUE_NACA_MODEL)
return 1;
return 0;
}

/**
* ipr_is_device - Determine if resource address is that of a device
* @res_addr: resource address struct
Expand Down

0 comments on commit d25b0ca

Please sign in to comment.