/* Return value: SCSI result value to return for completed command  */
static int ibmvfc_get_err_result(struct ibmvfc_cmd *vfc_cmd)
/* Return value: SCSI result value to return for completed command  */
static int ibmvfc_get_err_result(struct ibmvfc_cmd *vfc_cmd)
{
	int err;
	struct ibmvfc_fcp_rsp *rsp = &vfc_cmd->rsp;
	int fc_rsp_len = rsp->fcp_rsp_len;
	if ((rsp->flags & FCP_RSP_LEN_VALID) &&
	    ((fc_rsp_len && fc_rsp_len != 4 && fc_rsp_len != 8) ||
	     rsp->data.info.rsp_code))
		return DID_ERROR << 16;
	err = ibmvfc_get_err_index(vfc_cmd->status, vfc_cmd->error);
	if (err >= 0)
		return rsp->scsi_status | (cmd_status[err].result << 16);
	return rsp->scsi_status | (DID_ERROR << 16);
}