Merge remote-tracking branch 'scsi-queue/core-for-3.19' into for-linus
This commit is contained in:
commit
dc843ef00e
@ -827,10 +827,6 @@ but in the event of any barrier requests in the tag queue we need to ensure
|
||||
that requests are restarted in the order they were queue. This may happen
|
||||
if the driver needs to use blk_queue_invalidate_tags().
|
||||
|
||||
Tagging also defines a new request flag, REQ_QUEUED. This is set whenever
|
||||
a request is currently tagged. You should not use this flag directly,
|
||||
blk_rq_tagged(rq) is the portable way to do so.
|
||||
|
||||
3.3 I/O Submission
|
||||
|
||||
The routine submit_bio() is used to submit a single io. Higher level i/o
|
||||
|
@ -271,9 +271,9 @@ init_this_scsi_driver() ----+
|
||||
slave_destroy() ***
|
||||
------------------------------------------------------------
|
||||
|
||||
The mid level invokes scsi_adjust_queue_depth() with tagged queuing off and
|
||||
"cmd_per_lun" for that host as the queue length. These settings can be
|
||||
overridden by a slave_configure() supplied by the LLD.
|
||||
The mid level invokes scsi_adjust_queue_depth() with "cmd_per_lun" for that
|
||||
host as the queue length. These settings can be overridden by a
|
||||
slave_configure() supplied by the LLD.
|
||||
|
||||
*** For scsi devices that the mid level tries to scan but do not
|
||||
respond, a slave_alloc(), slave_destroy() pair is called.
|
||||
@ -366,13 +366,11 @@ is initialized. The functions below are listed alphabetically and their
|
||||
names all start with "scsi_".
|
||||
|
||||
Summary:
|
||||
scsi_activate_tcq - turn on tag command queueing
|
||||
scsi_add_device - creates new scsi device (lu) instance
|
||||
scsi_add_host - perform sysfs registration and set up transport class
|
||||
scsi_adjust_queue_depth - change the queue depth on a SCSI device
|
||||
scsi_bios_ptable - return copy of block device's partition table
|
||||
scsi_block_requests - prevent further commands being queued to given host
|
||||
scsi_deactivate_tcq - turn off tag command queueing
|
||||
scsi_host_alloc - return a new scsi_host instance whose refcount==1
|
||||
scsi_host_get - increments Scsi_Host instance's refcount
|
||||
scsi_host_put - decrements Scsi_Host instance's refcount (free if 0)
|
||||
@ -389,24 +387,6 @@ Summary:
|
||||
|
||||
Details:
|
||||
|
||||
/**
|
||||
* scsi_activate_tcq - turn on tag command queueing ("ordered" task attribute)
|
||||
* @sdev: device to turn on TCQ for
|
||||
* @depth: queue depth
|
||||
*
|
||||
* Returns nothing
|
||||
*
|
||||
* Might block: no
|
||||
*
|
||||
* Notes: Eventually, it is hoped depth would be the maximum depth
|
||||
* the device could cope with and the real queue depth
|
||||
* would be adjustable from 0 to depth.
|
||||
*
|
||||
* Defined (inline) in: include/scsi/scsi_tcq.h
|
||||
**/
|
||||
void scsi_activate_tcq(struct scsi_device *sdev, int depth)
|
||||
|
||||
|
||||
/**
|
||||
* scsi_add_device - creates new scsi device (lu) instance
|
||||
* @shost: pointer to scsi host instance
|
||||
@ -458,9 +438,6 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
|
||||
/**
|
||||
* scsi_adjust_queue_depth - allow LLD to change queue depth on a SCSI device
|
||||
* @sdev: pointer to SCSI device to change queue depth on
|
||||
* @tagged: 0 - no tagged queuing
|
||||
* MSG_SIMPLE_TAG - simple tagged queuing
|
||||
* MSG_ORDERED_TAG - ordered tagged queuing
|
||||
* @tags Number of tags allowed if tagged queuing enabled,
|
||||
* or number of commands the LLD can queue up
|
||||
* in non-tagged mode (as per cmd_per_lun).
|
||||
@ -471,15 +448,12 @@ int scsi_add_host(struct Scsi_Host *shost, struct device * dev)
|
||||
*
|
||||
* Notes: Can be invoked any time on a SCSI device controlled by this
|
||||
* LLD. [Specifically during and after slave_configure() and prior to
|
||||
* slave_destroy().] Can safely be invoked from interrupt code. Actual
|
||||
* queue depth change may be delayed until the next command is being
|
||||
* processed. See also scsi_activate_tcq() and scsi_deactivate_tcq().
|
||||
* slave_destroy().] Can safely be invoked from interrupt code.
|
||||
*
|
||||
* Defined in: drivers/scsi/scsi.c [see source code for more notes]
|
||||
*
|
||||
**/
|
||||
void scsi_adjust_queue_depth(struct scsi_device * sdev, int tagged,
|
||||
int tags)
|
||||
void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags)
|
||||
|
||||
|
||||
/**
|
||||
@ -514,20 +488,6 @@ unsigned char *scsi_bios_ptable(struct block_device *dev)
|
||||
void scsi_block_requests(struct Scsi_Host * shost)
|
||||
|
||||
|
||||
/**
|
||||
* scsi_deactivate_tcq - turn off tag command queueing
|
||||
* @sdev: device to turn off TCQ for
|
||||
* @depth: queue depth (stored in sdev)
|
||||
*
|
||||
* Returns nothing
|
||||
*
|
||||
* Might block: no
|
||||
*
|
||||
* Defined (inline) in: include/scsi/scsi_tcq.h
|
||||
**/
|
||||
void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
|
||||
|
||||
|
||||
/**
|
||||
* scsi_host_alloc - create a scsi host adapter instance and perform basic
|
||||
* initialization.
|
||||
|
@ -506,9 +506,11 @@ user does not request data that far.)
|
||||
|
||||
DEBUGGING HINTS
|
||||
|
||||
To enable debugging messages, edit st.c and #define DEBUG 1. As seen
|
||||
above, debugging can be switched off with an ioctl if debugging is
|
||||
compiled into the driver. The debugging output is not voluminous.
|
||||
Debugging code is now compiled in by default but debugging is turned off
|
||||
with the kernel module parameter debug_flag defaulting to 0. Debugging
|
||||
can still be switched on and off with an ioctl. To enable debug at
|
||||
module load time add debug_flag=1 to the module load options, the
|
||||
debugging output is not voluminous.
|
||||
|
||||
If the tape seems to hang, I would be very interested to hear where
|
||||
the driver is waiting. With the command 'ps -l' you can see the state
|
||||
|
@ -1266,7 +1266,7 @@ void blk_requeue_request(struct request_queue *q, struct request *rq)
|
||||
blk_clear_rq_complete(rq);
|
||||
trace_block_rq_requeue(q, rq);
|
||||
|
||||
if (blk_rq_tagged(rq))
|
||||
if (rq->cmd_flags & REQ_QUEUED)
|
||||
blk_queue_end_tag(q, rq);
|
||||
|
||||
BUG_ON(blk_queued_rq(rq));
|
||||
@ -2554,7 +2554,7 @@ EXPORT_SYMBOL_GPL(blk_unprep_request);
|
||||
*/
|
||||
void blk_finish_request(struct request *req, int error)
|
||||
{
|
||||
if (blk_rq_tagged(req))
|
||||
if (req->cmd_flags & REQ_QUEUED)
|
||||
blk_queue_end_tag(req->q, req);
|
||||
|
||||
BUG_ON(blk_queued_rq(req));
|
||||
|
@ -584,6 +584,34 @@ int blk_mq_tag_update_depth(struct blk_mq_tags *tags, unsigned int tdepth)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_mq_unique_tag() - return a tag that is unique queue-wide
|
||||
* @rq: request for which to compute a unique tag
|
||||
*
|
||||
* The tag field in struct request is unique per hardware queue but not over
|
||||
* all hardware queues. Hence this function that returns a tag with the
|
||||
* hardware context index in the upper bits and the per hardware queue tag in
|
||||
* the lower bits.
|
||||
*
|
||||
* Note: When called for a request that is queued on a non-multiqueue request
|
||||
* queue, the hardware context index is set to zero.
|
||||
*/
|
||||
u32 blk_mq_unique_tag(struct request *rq)
|
||||
{
|
||||
struct request_queue *q = rq->q;
|
||||
struct blk_mq_hw_ctx *hctx;
|
||||
int hwq = 0;
|
||||
|
||||
if (q->mq_ops) {
|
||||
hctx = q->mq_ops->map_queue(q, rq->mq_ctx->cpu);
|
||||
hwq = hctx->queue_num;
|
||||
}
|
||||
|
||||
return (hwq << BLK_MQ_UNIQUE_TAG_BITS) |
|
||||
(rq->tag & BLK_MQ_UNIQUE_TAG_MASK);
|
||||
}
|
||||
EXPORT_SYMBOL(blk_mq_unique_tag);
|
||||
|
||||
ssize_t blk_mq_tag_sysfs_show(struct blk_mq_tags *tags, char *page)
|
||||
{
|
||||
char *orig_page = page;
|
||||
|
@ -2049,6 +2049,8 @@ static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
|
||||
*/
|
||||
int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set)
|
||||
{
|
||||
BUILD_BUG_ON(BLK_MQ_MAX_DEPTH > 1 << BLK_MQ_UNIQUE_TAG_BITS);
|
||||
|
||||
if (!set->nr_hw_queues)
|
||||
return -EINVAL;
|
||||
if (!set->queue_depth)
|
||||
|
@ -142,7 +142,7 @@ static void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
|
||||
__set_bit(GPCMD_VERIFY_10, filter->read_ok);
|
||||
__set_bit(VERIFY_16, filter->read_ok);
|
||||
__set_bit(REPORT_LUNS, filter->read_ok);
|
||||
__set_bit(SERVICE_ACTION_IN, filter->read_ok);
|
||||
__set_bit(SERVICE_ACTION_IN_16, filter->read_ok);
|
||||
__set_bit(RECEIVE_DIAGNOSTIC, filter->read_ok);
|
||||
__set_bit(MAINTENANCE_IN, filter->read_ok);
|
||||
__set_bit(GPCMD_READ_BUFFER_CAPACITY, filter->read_ok);
|
||||
|
@ -1164,7 +1164,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
|
||||
|
||||
depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
|
||||
depth = min(ATA_MAX_QUEUE - 1, depth);
|
||||
scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
}
|
||||
|
||||
blk_queue_flush_queueable(q, false);
|
||||
@ -1282,7 +1282,7 @@ int __ata_change_queue_depth(struct ata_port *ap, struct scsi_device *sdev,
|
||||
if (sdev->queue_depth == queue_depth)
|
||||
return -EINVAL;
|
||||
|
||||
scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
return queue_depth;
|
||||
}
|
||||
|
||||
@ -3570,7 +3570,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
|
||||
ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap);
|
||||
break;
|
||||
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
if ((scsicmd[1] & 0x1f) == SAI_READ_CAPACITY_16)
|
||||
ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap);
|
||||
else
|
||||
|
@ -329,7 +329,7 @@ INQUIRY_EVPD_BIT_MASK) ? 1 : 0)
|
||||
(GET_U32_FROM_CDB(cdb, READ_CAP_16_CDB_ALLOC_LENGTH_OFFSET))
|
||||
|
||||
#define IS_READ_CAP_16(cdb) \
|
||||
((cdb[0] == SERVICE_ACTION_IN && cdb[1] == SAI_READ_CAPACITY_16) ? 1 : 0)
|
||||
((cdb[0] == SERVICE_ACTION_IN_16 && cdb[1] == SAI_READ_CAPACITY_16) ? 1 : 0)
|
||||
|
||||
/* Request Sense Helper Macros */
|
||||
#define GET_REQUEST_SENSE_ALLOC_LENGTH(cdb) \
|
||||
@ -2947,7 +2947,7 @@ static int nvme_scsi_translate(struct nvme_ns *ns, struct sg_io_hdr *hdr)
|
||||
case READ_CAPACITY:
|
||||
retcode = nvme_trans_read_capacity(ns, hdr, cmd);
|
||||
break;
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
if (IS_READ_CAP_16(cmd))
|
||||
retcode = nvme_trans_read_capacity(ns, hdr, cmd);
|
||||
else
|
||||
|
@ -2258,28 +2258,6 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* srp_change_queue_type - changing device queue tag type
|
||||
* @sdev: scsi device struct
|
||||
* @tag_type: requested tag type
|
||||
*
|
||||
* Returns queue tag type.
|
||||
*/
|
||||
static int
|
||||
srp_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
|
||||
return tag_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* srp_change_queue_depth - setting device queue depth
|
||||
* @sdev: scsi device struct
|
||||
@ -2300,7 +2278,7 @@ srp_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
max_depth = 1;
|
||||
if (qdepth > max_depth)
|
||||
qdepth = max_depth;
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
} else if (reason == SCSI_QDEPTH_QFULL)
|
||||
scsi_track_queue_full(sdev, qdepth);
|
||||
else
|
||||
@ -2600,7 +2578,7 @@ static struct scsi_host_template srp_template = {
|
||||
.info = srp_target_info,
|
||||
.queuecommand = srp_queuecommand,
|
||||
.change_queue_depth = srp_change_queue_depth,
|
||||
.change_queue_type = srp_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.eh_abort_handler = srp_abort,
|
||||
.eh_device_reset_handler = srp_reset_device,
|
||||
.eh_host_reset_handler = srp_reset_host,
|
||||
|
@ -1994,6 +1994,7 @@ static struct scsi_host_template mptsas_driver_template = {
|
||||
.cmd_per_lun = 7,
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.shost_attrs = mptscsih_host_attrs,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static int mptsas_get_linkerrors(struct sas_phy *phy)
|
||||
|
@ -2322,7 +2322,6 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
VirtTarget *vtarget;
|
||||
struct scsi_target *starget;
|
||||
int max_depth;
|
||||
int tagged;
|
||||
MPT_ADAPTER *ioc = hd->ioc;
|
||||
|
||||
starget = scsi_target(sdev);
|
||||
@ -2347,12 +2346,8 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
|
||||
if (qdepth > max_depth)
|
||||
qdepth = max_depth;
|
||||
if (qdepth == 1)
|
||||
tagged = 0;
|
||||
else
|
||||
tagged = MSG_SIMPLE_TAG;
|
||||
|
||||
scsi_adjust_queue_depth(sdev, tagged, qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
@ -2400,9 +2395,8 @@ mptscsih_slave_configure(struct scsi_device *sdev)
|
||||
mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH,
|
||||
SCSI_QDEPTH_DEFAULT);
|
||||
dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
|
||||
"tagged %d, simple %d, ordered %d\n",
|
||||
ioc->name,sdev->tagged_supported, sdev->simple_tags,
|
||||
sdev->ordered_tags));
|
||||
"tagged %d, simple %d\n",
|
||||
ioc->name,sdev->tagged_supported, sdev->simple_tags));
|
||||
|
||||
blk_queue_dma_alignment (sdev->request_queue, 512 - 1);
|
||||
|
||||
|
@ -187,6 +187,7 @@ void enclosure_unregister(struct enclosure_device *edev)
|
||||
EXPORT_SYMBOL_GPL(enclosure_unregister);
|
||||
|
||||
#define ENCLOSURE_NAME_SIZE 64
|
||||
#define COMPONENT_NAME_SIZE 64
|
||||
|
||||
static void enclosure_link_name(struct enclosure_component *cdev, char *name)
|
||||
{
|
||||
@ -246,6 +247,29 @@ static void enclosure_component_release(struct device *dev)
|
||||
put_device(dev->parent);
|
||||
}
|
||||
|
||||
static struct enclosure_component *
|
||||
enclosure_component_find_by_name(struct enclosure_device *edev,
|
||||
const char *name)
|
||||
{
|
||||
int i;
|
||||
const char *cname;
|
||||
struct enclosure_component *ecomp;
|
||||
|
||||
if (!edev || !name || !name[0])
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < edev->components; i++) {
|
||||
ecomp = &edev->component[i];
|
||||
cname = dev_name(&ecomp->cdev);
|
||||
if (ecomp->number != -1 &&
|
||||
cname && cname[0] &&
|
||||
!strcmp(cname, name))
|
||||
return ecomp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const struct attribute_group *enclosure_component_groups[];
|
||||
|
||||
/**
|
||||
@ -269,7 +293,8 @@ enclosure_component_register(struct enclosure_device *edev,
|
||||
{
|
||||
struct enclosure_component *ecomp;
|
||||
struct device *cdev;
|
||||
int err;
|
||||
int err, i;
|
||||
char newname[COMPONENT_NAME_SIZE];
|
||||
|
||||
if (number >= edev->components)
|
||||
return ERR_PTR(-EINVAL);
|
||||
@ -283,9 +308,20 @@ enclosure_component_register(struct enclosure_device *edev,
|
||||
ecomp->number = number;
|
||||
cdev = &ecomp->cdev;
|
||||
cdev->parent = get_device(&edev->edev);
|
||||
if (name && name[0])
|
||||
dev_set_name(cdev, "%s", name);
|
||||
else
|
||||
|
||||
if (name && name[0]) {
|
||||
/* Some hardware (e.g. enclosure in RX300 S6) has components
|
||||
* with non unique names. Registering duplicates in sysfs
|
||||
* will lead to warnings during bootup. So make the names
|
||||
* unique by appending consecutive numbers -1, -2, ... */
|
||||
i = 1;
|
||||
snprintf(newname, COMPONENT_NAME_SIZE,
|
||||
"%s", name);
|
||||
while (enclosure_component_find_by_name(edev, newname))
|
||||
snprintf(newname, COMPONENT_NAME_SIZE,
|
||||
"%s-%i", name, i++);
|
||||
dev_set_name(cdev, "%s", newname);
|
||||
} else
|
||||
dev_set_name(cdev, "%u", number);
|
||||
|
||||
cdev->release = enclosure_component_release;
|
||||
|
@ -212,8 +212,6 @@ static inline
|
||||
void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi,
|
||||
u8 tm_flags)
|
||||
{
|
||||
char tag[2];
|
||||
|
||||
int_to_scsilun(scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun);
|
||||
|
||||
if (unlikely(tm_flags)) {
|
||||
@ -221,17 +219,7 @@ void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi,
|
||||
return;
|
||||
}
|
||||
|
||||
if (scsi_populate_tag_msg(scsi, tag)) {
|
||||
switch (tag[0]) {
|
||||
case MSG_ORDERED_TAG:
|
||||
fcp->fc_pri_ta |= FCP_PTA_ORDERED;
|
||||
break;
|
||||
case MSG_SIMPLE_TAG:
|
||||
fcp->fc_pri_ta |= FCP_PTA_SIMPLE;
|
||||
break;
|
||||
};
|
||||
} else
|
||||
fcp->fc_pri_ta = FCP_PTA_SIMPLE;
|
||||
fcp->fc_pri_ta = FCP_PTA_SIMPLE;
|
||||
|
||||
if (scsi->sc_data_direction == DMA_FROM_DEVICE)
|
||||
fcp->fc_flags |= FCP_CFL_RDDATA;
|
||||
|
@ -37,13 +37,13 @@ static int zfcp_scsi_change_queue_depth(struct scsi_device *sdev, int depth,
|
||||
{
|
||||
switch (reason) {
|
||||
case SCSI_QDEPTH_DEFAULT:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
break;
|
||||
case SCSI_QDEPTH_QFULL:
|
||||
scsi_track_queue_full(sdev, depth);
|
||||
break;
|
||||
case SCSI_QDEPTH_RAMP_UP:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
break;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
@ -66,9 +66,7 @@ static void zfcp_scsi_slave_destroy(struct scsi_device *sdev)
|
||||
static int zfcp_scsi_slave_configure(struct scsi_device *sdp)
|
||||
{
|
||||
if (sdp->tagged_supported)
|
||||
scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, default_depth);
|
||||
else
|
||||
scsi_adjust_queue_depth(sdp, 0, 1);
|
||||
scsi_adjust_queue_depth(sdp, default_depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth,
|
||||
|
||||
if (queue_depth > TW_Q_LENGTH-2)
|
||||
queue_depth = TW_Q_LENGTH-2;
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
return queue_depth;
|
||||
} /* End twa_change_queue_depth() */
|
||||
|
||||
|
@ -200,7 +200,7 @@ static int twl_change_queue_depth(struct scsi_device *sdev, int queue_depth,
|
||||
|
||||
if (queue_depth > TW_Q_LENGTH-2)
|
||||
queue_depth = TW_Q_LENGTH-2;
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
return queue_depth;
|
||||
} /* End twl_change_queue_depth() */
|
||||
|
||||
|
@ -532,7 +532,7 @@ static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth,
|
||||
|
||||
if (queue_depth > TW_Q_LENGTH-2)
|
||||
queue_depth = TW_Q_LENGTH-2;
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
return queue_depth;
|
||||
} /* End tw_change_queue_depth() */
|
||||
|
||||
|
@ -327,6 +327,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
|
||||
tpnt->slave_alloc = NCR_700_slave_alloc;
|
||||
tpnt->change_queue_depth = NCR_700_change_queue_depth;
|
||||
tpnt->change_queue_type = NCR_700_change_queue_type;
|
||||
tpnt->use_blk_tags = 1;
|
||||
|
||||
if(tpnt->name == NULL)
|
||||
tpnt->name = "53c700";
|
||||
@ -592,19 +593,14 @@ NCR_700_scsi_done(struct NCR_700_Host_Parameters *hostdata,
|
||||
hostdata->cmd = NULL;
|
||||
|
||||
if(SCp != NULL) {
|
||||
struct NCR_700_command_slot *slot =
|
||||
struct NCR_700_command_slot *slot =
|
||||
(struct NCR_700_command_slot *)SCp->host_scribble;
|
||||
|
||||
|
||||
dma_unmap_single(hostdata->dev, slot->pCmd,
|
||||
MAX_COMMAND_SIZE, DMA_TO_DEVICE);
|
||||
if (slot->flags == NCR_700_FLAG_AUTOSENSE) {
|
||||
char *cmnd = NCR_700_get_sense_cmnd(SCp->device);
|
||||
#ifdef NCR_700_DEBUG
|
||||
printk(" ORIGINAL CMD %p RETURNED %d, new return is %d sense is\n",
|
||||
SCp, SCp->cmnd[7], result);
|
||||
scsi_print_sense("53c700", SCp);
|
||||
|
||||
#endif
|
||||
dma_unmap_single(hostdata->dev, slot->dma_handle,
|
||||
SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
|
||||
/* restore the old result if the request sense was
|
||||
@ -906,8 +902,10 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
|
||||
/* we're done negotiating */
|
||||
NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION);
|
||||
hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
|
||||
|
||||
SCp->device->tagged_supported = 0;
|
||||
scsi_deactivate_tcq(SCp->device, host->cmd_per_lun);
|
||||
scsi_adjust_queue_depth(SCp->device, host->cmd_per_lun);
|
||||
scsi_set_tag_type(SCp->device, 0);
|
||||
} else {
|
||||
shost_printk(KERN_WARNING, host,
|
||||
"(%d:%d) Unexpected REJECT Message %s\n",
|
||||
@ -1432,7 +1430,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
|
||||
if((hostdata->tag_negotiated & (1<<scmd_id(SCp)))
|
||||
&& (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE &&
|
||||
slot->flags != NCR_700_FLAG_AUTOSENSE)) {
|
||||
count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]);
|
||||
count += spi_populate_tag_msg(&hostdata->msgout[count], SCp);
|
||||
}
|
||||
|
||||
if(hostdata->fast &&
|
||||
@ -1772,7 +1770,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
|
||||
*/
|
||||
if(NCR_700_get_depth(SCp->device) != 0
|
||||
&& (!(hostdata->tag_negotiated & (1<<scmd_id(SCp)))
|
||||
|| !blk_rq_tagged(SCp->request))) {
|
||||
|| !(SCp->flags & SCMD_TAGGED))) {
|
||||
CDEBUG(KERN_ERR, SCp, "has non zero depth %d\n",
|
||||
NCR_700_get_depth(SCp->device));
|
||||
return SCSI_MLQUEUE_DEVICE_BUSY;
|
||||
@ -1800,7 +1798,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
|
||||
printk("53c700: scsi%d, command ", SCp->device->host->host_no);
|
||||
scsi_print_command(SCp);
|
||||
#endif
|
||||
if(blk_rq_tagged(SCp->request)
|
||||
if ((SCp->flags & SCMD_TAGGED)
|
||||
&& (hostdata->tag_negotiated &(1<<scmd_id(SCp))) == 0
|
||||
&& NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) {
|
||||
scmd_printk(KERN_ERR, SCp, "Enabling Tag Command Queuing\n");
|
||||
@ -1814,7 +1812,7 @@ NCR_700_queuecommand_lck(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)
|
||||
*
|
||||
* FIXME: This will royally screw up on multiple LUN devices
|
||||
* */
|
||||
if(!blk_rq_tagged(SCp->request)
|
||||
if (!(SCp->flags & SCMD_TAGGED)
|
||||
&& (hostdata->tag_negotiated &(1<<scmd_id(SCp)))) {
|
||||
scmd_printk(KERN_INFO, SCp, "Disabling Tag Command Queuing\n");
|
||||
hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
|
||||
@ -1911,9 +1909,7 @@ NCR_700_abort(struct scsi_cmnd * SCp)
|
||||
{
|
||||
struct NCR_700_command_slot *slot;
|
||||
|
||||
scmd_printk(KERN_INFO, SCp,
|
||||
"New error handler wants to abort command\n\t");
|
||||
scsi_print_command(SCp);
|
||||
scmd_printk(KERN_INFO, SCp, "abort command\n");
|
||||
|
||||
slot = (struct NCR_700_command_slot *)SCp->host_scribble;
|
||||
|
||||
@ -2056,13 +2052,10 @@ NCR_700_slave_configure(struct scsi_device *SDp)
|
||||
|
||||
/* to do here: allocate memory; build a queue_full list */
|
||||
if(SDp->tagged_supported) {
|
||||
scsi_set_tag_type(SDp, MSG_ORDERED_TAG);
|
||||
scsi_activate_tcq(SDp, NCR_700_DEFAULT_TAGS);
|
||||
scsi_adjust_queue_depth(SDp, NCR_700_DEFAULT_TAGS);
|
||||
NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
|
||||
} else {
|
||||
/* initialise to default depth */
|
||||
scsi_adjust_queue_depth(SDp, 0, SDp->host->cmd_per_lun);
|
||||
}
|
||||
|
||||
if(hostdata->fast) {
|
||||
/* Find the correct offset and period via domain validation */
|
||||
if (!spi_initial_dv(SDp->sdev_target))
|
||||
@ -2090,7 +2083,7 @@ NCR_700_change_queue_depth(struct scsi_device *SDp, int depth, int reason)
|
||||
if (depth > NCR_700_MAX_TAGS)
|
||||
depth = NCR_700_MAX_TAGS;
|
||||
|
||||
scsi_adjust_queue_depth(SDp, scsi_get_tag_type(SDp), depth);
|
||||
scsi_adjust_queue_depth(SDp, depth);
|
||||
return depth;
|
||||
}
|
||||
|
||||
@ -2101,8 +2094,6 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
|
||||
struct NCR_700_Host_Parameters *hostdata =
|
||||
(struct NCR_700_Host_Parameters *)SDp->host->hostdata[0];
|
||||
|
||||
scsi_set_tag_type(SDp, tag_type);
|
||||
|
||||
/* We have a global (per target) flag to track whether TCQ is
|
||||
* enabled, so we'll be turning it off for the entire target here.
|
||||
* our tag algorithm will fail if we mix tagged and untagged commands,
|
||||
@ -2110,15 +2101,16 @@ static int NCR_700_change_queue_type(struct scsi_device *SDp, int tag_type)
|
||||
if (change_tag)
|
||||
scsi_target_quiesce(SDp->sdev_target);
|
||||
|
||||
scsi_set_tag_type(SDp, tag_type);
|
||||
if (!tag_type) {
|
||||
/* shift back to the default unqueued number of commands
|
||||
* (the user can still raise this) */
|
||||
scsi_deactivate_tcq(SDp, SDp->host->cmd_per_lun);
|
||||
scsi_adjust_queue_depth(SDp, SDp->host->cmd_per_lun);
|
||||
hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
|
||||
} else {
|
||||
/* Here, we cleared the negotiation flag above, so this
|
||||
* will force the driver to renegotiate */
|
||||
scsi_activate_tcq(SDp, SDp->queue_depth);
|
||||
scsi_adjust_queue_depth(SDp, SDp->queue_depth);
|
||||
if (change_tag)
|
||||
NCR_700_set_tag_neg_state(SDp, NCR_700_START_TAG_NEGOTIATION);
|
||||
}
|
||||
|
@ -2327,12 +2327,12 @@ static int blogic_slaveconfig(struct scsi_device *dev)
|
||||
if (qdepth == 0)
|
||||
qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH;
|
||||
adapter->qdepth[tgt_id] = qdepth;
|
||||
scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, qdepth);
|
||||
scsi_adjust_queue_depth(dev, qdepth);
|
||||
} else {
|
||||
adapter->tagq_ok &= ~(1 << tgt_id);
|
||||
qdepth = adapter->untag_qdepth;
|
||||
adapter->qdepth[tgt_id] = qdepth;
|
||||
scsi_adjust_queue_depth(dev, 0, qdepth);
|
||||
scsi_adjust_queue_depth(dev, qdepth);
|
||||
}
|
||||
qdepth = 0;
|
||||
for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
|
||||
|
@ -2647,14 +2647,14 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) {
|
||||
*
|
||||
* Purpose : abort a command
|
||||
*
|
||||
* Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the
|
||||
* host byte of the result field to, if zero DID_ABORTED is
|
||||
* Inputs : cmd - the Scsi_Cmnd to abort, code - code to set the
|
||||
* host byte of the result field to, if zero DID_ABORTED is
|
||||
* used.
|
||||
*
|
||||
* Returns : 0 - success, -1 on failure.
|
||||
* Returns : SUCCESS - success, FAILED on failure.
|
||||
*
|
||||
* XXX - there is no way to abort the command that is currently
|
||||
* connected, you have to wait for it to complete. If this is
|
||||
* XXX - there is no way to abort the command that is currently
|
||||
* connected, you have to wait for it to complete. If this is
|
||||
* a problem, we could implement longjmp() / setjmp(), setjmp()
|
||||
* called where the loop started in NCR5380_main().
|
||||
*
|
||||
@ -2666,9 +2666,8 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
|
||||
struct Scsi_Host *instance = cmd->device->host;
|
||||
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
|
||||
Scsi_Cmnd *tmp, **prev;
|
||||
|
||||
printk(KERN_WARNING "scsi%d : aborting command\n", instance->host_no);
|
||||
scsi_print_command(cmd);
|
||||
|
||||
scmd_printk(KERN_WARNING, cmd, "aborting command\n");
|
||||
|
||||
NCR5380_print_status(instance);
|
||||
|
||||
@ -2704,7 +2703,7 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
|
||||
* aborted flag and get back into our main loop.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2181,7 +2181,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
|
||||
(fsa_dev_ptr[cid].sense_data.sense_key ==
|
||||
NOT_READY)) {
|
||||
switch (scsicmd->cmnd[0]) {
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
if (!(dev->raw_io_interface) ||
|
||||
!(dev->raw_io_64) ||
|
||||
((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
|
||||
@ -2309,7 +2309,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
|
||||
scsi_sg_copy_from_buffer(scsicmd, &inq_data, sizeof(inq_data));
|
||||
return aac_get_container_name(scsicmd);
|
||||
}
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
if (!(dev->raw_io_interface) ||
|
||||
!(dev->raw_io_64) ||
|
||||
((scsicmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
|
||||
|
@ -462,9 +462,9 @@ static int aac_slave_configure(struct scsi_device *sdev)
|
||||
depth = 256;
|
||||
else if (depth < 2)
|
||||
depth = 2;
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
} else
|
||||
scsi_adjust_queue_depth(sdev, 0, 1);
|
||||
scsi_adjust_queue_depth(sdev, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -504,9 +504,9 @@ static int aac_change_queue_depth(struct scsi_device *sdev, int depth,
|
||||
depth = 256;
|
||||
else if (depth < 2)
|
||||
depth = 2;
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
} else
|
||||
scsi_adjust_queue_depth(sdev, 0, 1);
|
||||
scsi_adjust_queue_depth(sdev, 1);
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
|
||||
AAC_DRIVERNAME,
|
||||
host->host_no, sdev_channel(dev), sdev_id(dev), dev->lun);
|
||||
switch (cmd->cmnd[0]) {
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
if (!(aac->raw_io_interface) ||
|
||||
!(aac->raw_io_64) ||
|
||||
((cmd->cmnd[1] & 0x1f) != SAI_READ_CAPACITY_16))
|
||||
|
@ -7706,7 +7706,7 @@ advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc)
|
||||
asc_dvc->cfg->can_tagged_qng |= tid_bit;
|
||||
asc_dvc->use_tagged_qng |= tid_bit;
|
||||
}
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
|
||||
scsi_adjust_queue_depth(sdev,
|
||||
asc_dvc->max_dvc_qng[sdev->id]);
|
||||
}
|
||||
} else {
|
||||
@ -7714,7 +7714,6 @@ advansys_narrow_slave_configure(struct scsi_device *sdev, ASC_DVC_VAR *asc_dvc)
|
||||
asc_dvc->cfg->can_tagged_qng &= ~tid_bit;
|
||||
asc_dvc->use_tagged_qng &= ~tid_bit;
|
||||
}
|
||||
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
|
||||
}
|
||||
|
||||
if ((sdev->lun == 0) &&
|
||||
@ -7849,10 +7848,8 @@ advansys_wide_slave_configure(struct scsi_device *sdev, ADV_DVC_VAR *adv_dvc)
|
||||
}
|
||||
|
||||
if ((adv_dvc->tagqng_able & tidmask) && sdev->tagged_supported) {
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
|
||||
scsi_adjust_queue_depth(sdev,
|
||||
adv_dvc->max_dvc_qng);
|
||||
} else {
|
||||
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -531,7 +531,7 @@ static int aha1740_eh_abort_handler (Scsi_Cmnd *dummy)
|
||||
* quiet as possible...
|
||||
*/
|
||||
|
||||
return 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static struct scsi_host_template aha1740_template = {
|
||||
|
@ -925,6 +925,7 @@ struct scsi_host_template aic79xx_driver_template = {
|
||||
.slave_configure = ahd_linux_slave_configure,
|
||||
.target_alloc = ahd_linux_target_alloc,
|
||||
.target_destroy = ahd_linux_target_destroy,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/******************************** Bus DMA *************************************/
|
||||
@ -1468,12 +1469,9 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
|
||||
|
||||
switch ((dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED))) {
|
||||
case AHD_DEV_Q_BASIC:
|
||||
scsi_set_tag_type(sdev, MSG_SIMPLE_TASK);
|
||||
scsi_activate_tcq(sdev, dev->openings + dev->active);
|
||||
break;
|
||||
case AHD_DEV_Q_TAGGED:
|
||||
scsi_set_tag_type(sdev, MSG_ORDERED_TASK);
|
||||
scsi_activate_tcq(sdev, dev->openings + dev->active);
|
||||
scsi_adjust_queue_depth(sdev,
|
||||
dev->openings + dev->active);
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
@ -1482,7 +1480,7 @@ ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
|
||||
* serially on the controller/device. This should
|
||||
* remove some latency.
|
||||
*/
|
||||
scsi_deactivate_tcq(sdev, 1);
|
||||
scsi_adjust_queue_depth(sdev, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1619,15 +1617,6 @@ ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
|
||||
}
|
||||
|
||||
if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) != 0) {
|
||||
int msg_bytes;
|
||||
uint8_t tag_msgs[2];
|
||||
|
||||
msg_bytes = scsi_populate_tag_msg(cmd, tag_msgs);
|
||||
if (msg_bytes && tag_msgs[0] != MSG_SIMPLE_TASK) {
|
||||
hscb->control |= tag_msgs[0];
|
||||
if (tag_msgs[0] == MSG_ORDERED_TASK)
|
||||
dev->commands_since_idle_or_otag = 0;
|
||||
} else
|
||||
if (dev->commands_since_idle_or_otag == AHD_OTAG_THRESH
|
||||
&& (dev->flags & AHD_DEV_Q_TAGGED) != 0) {
|
||||
hscb->control |= MSG_ORDERED_TASK;
|
||||
|
@ -812,6 +812,7 @@ struct scsi_host_template aic7xxx_driver_template = {
|
||||
.slave_configure = ahc_linux_slave_configure,
|
||||
.target_alloc = ahc_linux_target_alloc,
|
||||
.target_destroy = ahc_linux_target_destroy,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/**************************** Tasklet Handler *********************************/
|
||||
@ -1334,13 +1335,9 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
|
||||
}
|
||||
switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) {
|
||||
case AHC_DEV_Q_BASIC:
|
||||
scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
|
||||
scsi_activate_tcq(sdev, dev->openings + dev->active);
|
||||
break;
|
||||
case AHC_DEV_Q_TAGGED:
|
||||
scsi_set_tag_type(sdev, MSG_ORDERED_TAG);
|
||||
scsi_activate_tcq(sdev, dev->openings + dev->active);
|
||||
break;
|
||||
scsi_adjust_queue_depth(sdev,
|
||||
dev->openings + dev->active);
|
||||
default:
|
||||
/*
|
||||
* We allow the OS to queue 2 untagged transactions to
|
||||
@ -1348,7 +1345,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
|
||||
* serially on the controller/device. This should
|
||||
* remove some latency.
|
||||
*/
|
||||
scsi_deactivate_tcq(sdev, 2);
|
||||
scsi_adjust_queue_depth(sdev, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1447,7 +1444,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
|
||||
* we are storing a full busy target *lun*
|
||||
* table in SCB space.
|
||||
*/
|
||||
if (!blk_rq_tagged(cmd->request)
|
||||
if (!(cmd->flags & SCMD_TAGGED)
|
||||
&& (ahc->features & AHC_SCB_BTT) == 0) {
|
||||
int target_offset;
|
||||
|
||||
@ -1501,15 +1498,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
|
||||
}
|
||||
|
||||
if ((dev->flags & (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) {
|
||||
int msg_bytes;
|
||||
uint8_t tag_msgs[2];
|
||||
|
||||
msg_bytes = scsi_populate_tag_msg(cmd, tag_msgs);
|
||||
if (msg_bytes && tag_msgs[0] != MSG_SIMPLE_TASK) {
|
||||
hscb->control |= tag_msgs[0];
|
||||
if (tag_msgs[0] == MSG_ORDERED_TASK)
|
||||
dev->commands_since_idle_or_otag = 0;
|
||||
} else if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH
|
||||
if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH
|
||||
&& (dev->flags & AHC_DEV_Q_TAGGED) != 0) {
|
||||
hscb->control |= MSG_ORDERED_TASK;
|
||||
dev->commands_since_idle_or_otag = 0;
|
||||
|
@ -83,6 +83,7 @@ static struct scsi_host_template aic94xx_sht = {
|
||||
.eh_bus_reset_handler = sas_eh_bus_reset_handler,
|
||||
.target_destroy = sas_target_destroy,
|
||||
.ioctl = sas_ioctl,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static int asd_map_memio(struct asd_ha_struct *asd_ha)
|
||||
|
@ -122,7 +122,7 @@ static int arcmsr_adjust_disk_queue_depth(struct scsi_device *sdev,
|
||||
|
||||
if (queue_depth > ARCMSR_MAX_CMD_PERLUN)
|
||||
queue_depth = ARCMSR_MAX_CMD_PERLUN;
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
return queue_depth;
|
||||
}
|
||||
|
||||
|
@ -850,13 +850,13 @@ static void acornscsi_done(AS_Host *host, struct scsi_cmnd **SCpntp,
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_ERR "scsi%d.H: incomplete data transfer detected: result=%08X command=",
|
||||
host->host->host_no, SCpnt->result);
|
||||
__scsi_print_command(SCpnt->cmnd);
|
||||
scmd_printk(KERN_ERR, SCpnt,
|
||||
"incomplete data transfer detected: "
|
||||
"result=%08X", SCpnt->result);
|
||||
scsi_print_command(SCpnt);
|
||||
acornscsi_dumpdma(host, "done");
|
||||
acornscsi_dumplog(host, SCpnt->device->id);
|
||||
SCpnt->result &= 0xffff;
|
||||
SCpnt->result |= DID_ERROR << 16;
|
||||
acornscsi_dumplog(host, SCpnt->device->id);
|
||||
set_host_byte(SCpnt, DID_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,8 +308,7 @@ static void fas216_log_command(FAS216_Info *info, int level,
|
||||
fas216_do_log(info, '0' + SCpnt->device->id, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
printk(" CDB: ");
|
||||
__scsi_print_command(SCpnt->cmnd);
|
||||
scsi_print_command(SCpnt);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2079,14 +2078,12 @@ fas216_std_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result)
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_ERR "scsi%d.%c: incomplete data transfer "
|
||||
"detected: res=%08X ptr=%p len=%X CDB: ",
|
||||
info->host->host_no, '0' + SCpnt->device->id,
|
||||
SCpnt->result, info->scsi.SCp.ptr,
|
||||
info->scsi.SCp.this_residual);
|
||||
__scsi_print_command(SCpnt->cmnd);
|
||||
SCpnt->result &= ~(255 << 16);
|
||||
SCpnt->result |= DID_BAD_TARGET << 16;
|
||||
scmd_printk(KERN_ERR, SCpnt,
|
||||
"incomplete data transfer detected: res=%08X ptr=%p len=%X\n",
|
||||
SCpnt->result, info->scsi.SCp.ptr,
|
||||
info->scsi.SCp.this_residual);
|
||||
scsi_print_command(SCpnt);
|
||||
set_host_byte(SCpnt, DID_ERROR);
|
||||
goto request_sense;
|
||||
}
|
||||
}
|
||||
@ -2158,12 +2155,11 @@ static void fas216_done(FAS216_Info *info, unsigned int result)
|
||||
* to transfer, we should not have a valid pointer.
|
||||
*/
|
||||
if (info->scsi.SCp.ptr && info->scsi.SCp.this_residual == 0) {
|
||||
printk("scsi%d.%c: zero bytes left to transfer, but "
|
||||
"buffer pointer still valid: ptr=%p len=%08x CDB: ",
|
||||
info->host->host_no, '0' + SCpnt->device->id,
|
||||
info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
|
||||
scmd_printk(KERN_INFO, SCpnt,
|
||||
"zero bytes left to transfer, but buffer pointer still valid: ptr=%p len=%08x\n",
|
||||
info->scsi.SCp.ptr, info->scsi.SCp.this_residual);
|
||||
info->scsi.SCp.ptr = NULL;
|
||||
__scsi_print_command(SCpnt->cmnd);
|
||||
scsi_print_command(SCpnt);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2427,14 +2423,11 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)
|
||||
|
||||
info->stats.aborts += 1;
|
||||
|
||||
printk(KERN_WARNING "scsi%d: abort command ", info->host->host_no);
|
||||
__scsi_print_command(SCpnt->cmnd);
|
||||
scmd_printk(KERN_WARNING, SCpnt, "abort command\n");
|
||||
|
||||
print_debug_list();
|
||||
fas216_dumpstate(info);
|
||||
|
||||
printk(KERN_WARNING "scsi%d: abort %p ", info->host->host_no, SCpnt);
|
||||
|
||||
switch (fas216_find_command(info, SCpnt)) {
|
||||
/*
|
||||
* We found the command, and cleared it out. Either
|
||||
@ -2442,7 +2435,7 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)
|
||||
* target, or the busylun bit is not set.
|
||||
*/
|
||||
case res_success:
|
||||
printk("success\n");
|
||||
scmd_printk(KERN_WARNING, SCpnt, "abort %p success\n", SCpnt);
|
||||
result = SUCCESS;
|
||||
break;
|
||||
|
||||
@ -2452,14 +2445,13 @@ int fas216_eh_abort(struct scsi_cmnd *SCpnt)
|
||||
* if the bus is free.
|
||||
*/
|
||||
case res_hw_abort:
|
||||
|
||||
|
||||
/*
|
||||
* We are unable to abort the command for some reason.
|
||||
*/
|
||||
default:
|
||||
case res_failed:
|
||||
printk("failed\n");
|
||||
scmd_printk(KERN_WARNING, SCpnt, "abort %p failed\n", SCpnt);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2664,8 +2656,7 @@ int fas216_eh_host_reset(struct scsi_cmnd *SCpnt)
|
||||
|
||||
fas216_checkmagic(info);
|
||||
|
||||
printk("scsi%d.%c: %s: resetting host\n",
|
||||
info->host->host_no, '0' + SCpnt->device->id, __func__);
|
||||
fas216_log(info, LOG_ERROR, "resetting host");
|
||||
|
||||
/*
|
||||
* Reset the SCSI chip.
|
||||
|
@ -2607,7 +2607,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
|
||||
* host byte of the result field to, if zero DID_ABORTED is
|
||||
* used.
|
||||
*
|
||||
* Returns : 0 - success, -1 on failure.
|
||||
* Returns : SUCCESS - success, FAILED on failure.
|
||||
*
|
||||
* XXX - there is no way to abort the command that is currently
|
||||
* connected, you have to wait for it to complete. If this is
|
||||
@ -2623,8 +2623,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
|
||||
Scsi_Cmnd *tmp, **prev;
|
||||
unsigned long flags;
|
||||
|
||||
printk(KERN_NOTICE "scsi%d: aborting command\n", HOSTNO);
|
||||
scsi_print_command(cmd);
|
||||
scmd_printk(KERN_NOTICE, cmd, "aborting command\n");
|
||||
|
||||
NCR5380_print_status(instance);
|
||||
|
||||
|
@ -776,11 +776,7 @@ bfad_thread_workq(struct bfad_s *bfad)
|
||||
static int
|
||||
bfad_im_slave_configure(struct scsi_device *sdev)
|
||||
{
|
||||
if (sdev->tagged_supported)
|
||||
scsi_activate_tcq(sdev, bfa_lun_queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, bfa_lun_queue_depth);
|
||||
|
||||
scsi_adjust_queue_depth(sdev, bfa_lun_queue_depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -804,6 +800,7 @@ struct scsi_host_template bfad_im_scsi_host_template = {
|
||||
.shost_attrs = bfad_im_host_attrs,
|
||||
.max_sectors = BFAD_MAX_SECTORS,
|
||||
.vendor_id = BFA_PCI_VENDOR_ID_BROCADE,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
struct scsi_host_template bfad_im_vport_template = {
|
||||
@ -825,6 +822,7 @@ struct scsi_host_template bfad_im_vport_template = {
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.shost_attrs = bfad_im_vport_attrs,
|
||||
.max_sectors = BFAD_MAX_SECTORS,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
bfa_status_t
|
||||
@ -868,14 +866,8 @@ bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
|
||||
if (bfa_lun_queue_depth > tmp_sdev->queue_depth) {
|
||||
if (tmp_sdev->id != sdev->id)
|
||||
continue;
|
||||
if (tmp_sdev->ordered_tags)
|
||||
scsi_adjust_queue_depth(tmp_sdev,
|
||||
MSG_ORDERED_TAG,
|
||||
tmp_sdev->queue_depth + 1);
|
||||
else
|
||||
scsi_adjust_queue_depth(tmp_sdev,
|
||||
MSG_SIMPLE_TAG,
|
||||
tmp_sdev->queue_depth + 1);
|
||||
scsi_adjust_queue_depth(tmp_sdev,
|
||||
tmp_sdev->queue_depth + 1);
|
||||
|
||||
itnim->last_ramp_up_time = jiffies;
|
||||
}
|
||||
|
@ -2791,12 +2791,13 @@ static struct scsi_host_template bnx2fc_shost_template = {
|
||||
.eh_host_reset_handler = fc_eh_host_reset,
|
||||
.slave_alloc = fc_slave_alloc,
|
||||
.change_queue_depth = fc_change_queue_depth,
|
||||
.change_queue_type = fc_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.this_id = -1,
|
||||
.cmd_per_lun = 3,
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.sg_tablesize = BNX2FC_MAX_BDS_PER_CMD,
|
||||
.max_sectors = 1024,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static struct libfc_function_template bnx2fc_libfc_fcn_templ = {
|
||||
|
@ -1725,7 +1725,6 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
|
||||
struct fcp_cmnd *fcp_cmnd)
|
||||
{
|
||||
struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
|
||||
char tag[2];
|
||||
|
||||
memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd));
|
||||
|
||||
@ -1739,21 +1738,10 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
|
||||
fcp_cmnd->fc_tm_flags = io_req->mp_req.tm_flags;
|
||||
fcp_cmnd->fc_flags = io_req->io_req_flags;
|
||||
|
||||
if (scsi_populate_tag_msg(sc_cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
fcp_cmnd->fc_pri_ta = FCP_PTA_HEADQ;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
fcp_cmnd->fc_pri_ta = FCP_PTA_ORDERED;
|
||||
break;
|
||||
default:
|
||||
fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (sc_cmd->flags & SCMD_TAGGED)
|
||||
fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
|
||||
else
|
||||
fcp_cmnd->fc_pri_ta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
|
||||
|
@ -85,8 +85,7 @@ static const char * vendor_labels[CH_TYPES-4] = {
|
||||
// module_param_string_array(vendor_labels, NULL, 0444);
|
||||
|
||||
#define ch_printk(prefix, ch, fmt, a...) \
|
||||
sdev_printk(prefix, (ch)->device, "[%s] " fmt, \
|
||||
(ch)->name, ##a)
|
||||
sdev_prefix_printk(prefix, (ch)->device, (ch)->name, fmt, ##a)
|
||||
|
||||
#define DPRINTK(fmt, arg...) \
|
||||
do { \
|
||||
@ -183,7 +182,7 @@ static int ch_find_errno(struct scsi_sense_hdr *sshdr)
|
||||
}
|
||||
|
||||
static int
|
||||
ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
|
||||
ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len,
|
||||
void *buffer, unsigned buflength,
|
||||
enum dma_data_direction direction)
|
||||
{
|
||||
@ -197,7 +196,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
|
||||
errno = 0;
|
||||
if (debug) {
|
||||
DPRINTK("command: ");
|
||||
__scsi_print_command(cmd);
|
||||
__scsi_print_command(cmd, cmd_len);
|
||||
}
|
||||
|
||||
result = scsi_execute_req(ch->device, cmd, direction, buffer,
|
||||
@ -207,7 +206,7 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd,
|
||||
DPRINTK("result: 0x%x\n",result);
|
||||
if (driver_byte(result) & DRIVER_SENSE) {
|
||||
if (debug)
|
||||
scsi_print_sense_hdr(ch->name, &sshdr);
|
||||
scsi_print_sense_hdr(ch->device, ch->name, &sshdr);
|
||||
errno = ch_find_errno(&sshdr);
|
||||
|
||||
switch(sshdr.sense_key) {
|
||||
@ -258,7 +257,8 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data)
|
||||
cmd[3] = elem & 0xff;
|
||||
cmd[5] = 1;
|
||||
cmd[9] = 255;
|
||||
if (0 == (result = ch_do_scsi(ch, cmd, buffer, 256, DMA_FROM_DEVICE))) {
|
||||
if (0 == (result = ch_do_scsi(ch, cmd, 12,
|
||||
buffer, 256, DMA_FROM_DEVICE))) {
|
||||
if (((buffer[16] << 8) | buffer[17]) != elem) {
|
||||
DPRINTK("asked for element 0x%02x, got 0x%02x\n",
|
||||
elem,(buffer[16] << 8) | buffer[17]);
|
||||
@ -288,7 +288,7 @@ ch_init_elem(scsi_changer *ch)
|
||||
memset(cmd,0,sizeof(cmd));
|
||||
cmd[0] = INITIALIZE_ELEMENT_STATUS;
|
||||
cmd[1] = (ch->device->lun & 0x7) << 5;
|
||||
err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE);
|
||||
err = ch_do_scsi(ch, cmd, 6, NULL, 0, DMA_NONE);
|
||||
VPRINTK(KERN_INFO, "... finished\n");
|
||||
return err;
|
||||
}
|
||||
@ -310,10 +310,10 @@ ch_readconfig(scsi_changer *ch)
|
||||
cmd[1] = (ch->device->lun & 0x7) << 5;
|
||||
cmd[2] = 0x1d;
|
||||
cmd[4] = 255;
|
||||
result = ch_do_scsi(ch, cmd, buffer, 255, DMA_FROM_DEVICE);
|
||||
result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE);
|
||||
if (0 != result) {
|
||||
cmd[1] |= (1<<3);
|
||||
result = ch_do_scsi(ch, cmd, buffer, 255, DMA_FROM_DEVICE);
|
||||
result = ch_do_scsi(ch, cmd, 10, buffer, 255, DMA_FROM_DEVICE);
|
||||
}
|
||||
if (0 == result) {
|
||||
ch->firsts[CHET_MT] =
|
||||
@ -438,7 +438,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate)
|
||||
cmd[4] = (elem >> 8) & 0xff;
|
||||
cmd[5] = elem & 0xff;
|
||||
cmd[8] = rotate ? 1 : 0;
|
||||
return ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE);
|
||||
return ch_do_scsi(ch, cmd, 10, NULL, 0, DMA_NONE);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -459,7 +459,7 @@ ch_move(scsi_changer *ch, u_int trans, u_int src, u_int dest, int rotate)
|
||||
cmd[6] = (dest >> 8) & 0xff;
|
||||
cmd[7] = dest & 0xff;
|
||||
cmd[10] = rotate ? 1 : 0;
|
||||
return ch_do_scsi(ch, cmd, NULL,0, DMA_NONE);
|
||||
return ch_do_scsi(ch, cmd, 12, NULL,0, DMA_NONE);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -485,7 +485,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src,
|
||||
cmd[9] = dest2 & 0xff;
|
||||
cmd[10] = (rotate1 ? 1 : 0) | (rotate2 ? 2 : 0);
|
||||
|
||||
return ch_do_scsi(ch, cmd, NULL,0, DMA_NONE);
|
||||
return ch_do_scsi(ch, cmd, 12, NULL, 0, DMA_NONE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -535,7 +535,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem,
|
||||
memcpy(buffer,tag,32);
|
||||
ch_check_voltag(buffer);
|
||||
|
||||
result = ch_do_scsi(ch, cmd, buffer, 256, DMA_TO_DEVICE);
|
||||
result = ch_do_scsi(ch, cmd, 12, buffer, 256, DMA_TO_DEVICE);
|
||||
kfree(buffer);
|
||||
return result;
|
||||
}
|
||||
@ -616,6 +616,11 @@ static long ch_ioctl(struct file *file,
|
||||
int retval;
|
||||
void __user *argp = (void __user *)arg;
|
||||
|
||||
retval = scsi_ioctl_block_when_processing_errors(ch->device, cmd,
|
||||
file->f_flags & O_NDELAY);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
switch (cmd) {
|
||||
case CHIOGPARAMS:
|
||||
{
|
||||
@ -766,7 +771,8 @@ static long ch_ioctl(struct file *file,
|
||||
ch_cmd[5] = 1;
|
||||
ch_cmd[9] = 255;
|
||||
|
||||
result = ch_do_scsi(ch, ch_cmd, buffer, 256, DMA_FROM_DEVICE);
|
||||
result = ch_do_scsi(ch, ch_cmd, 12,
|
||||
buffer, 256, DMA_FROM_DEVICE);
|
||||
if (!result) {
|
||||
cge.cge_status = buffer[18];
|
||||
cge.cge_flags = 0;
|
||||
@ -966,9 +972,9 @@ static int ch_remove(struct device *dev)
|
||||
}
|
||||
|
||||
static struct scsi_driver ch_template = {
|
||||
.owner = THIS_MODULE,
|
||||
.gendrv = {
|
||||
.name = "ch",
|
||||
.owner = THIS_MODULE,
|
||||
.probe = ch_probe,
|
||||
.remove = ch_remove,
|
||||
},
|
||||
|
@ -21,15 +21,21 @@
|
||||
|
||||
|
||||
/* Commands with service actions that change the command name */
|
||||
#define SERVICE_ACTION_IN_12 0xab
|
||||
#define SERVICE_ACTION_OUT_12 0xa9
|
||||
#define SERVICE_ACTION_BIDIRECTIONAL 0x9d
|
||||
#define SERVICE_ACTION_IN_16 0x9e
|
||||
#define SERVICE_ACTION_OUT_16 0x9f
|
||||
#define THIRD_PARTY_COPY_OUT 0x83
|
||||
#define THIRD_PARTY_COPY_IN 0x84
|
||||
|
||||
#define VENDOR_SPECIFIC_CDB 0xc0
|
||||
|
||||
struct sa_name_list {
|
||||
int opcode;
|
||||
const struct value_name_pair *arr;
|
||||
int arr_sz;
|
||||
};
|
||||
|
||||
struct value_name_pair {
|
||||
int value;
|
||||
const char * name;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
static const char * cdb_byte0_names[] = {
|
||||
@ -102,11 +108,6 @@ static const char * cdb_byte0_names[] = {
|
||||
"Volume set (out), Send DVD structure",
|
||||
};
|
||||
|
||||
struct value_name_pair {
|
||||
int value;
|
||||
const char * name;
|
||||
};
|
||||
|
||||
static const struct value_name_pair maint_in_arr[] = {
|
||||
{0x5, "Report identifying information"},
|
||||
{0xa, "Report target port groups"},
|
||||
@ -244,170 +245,119 @@ static const struct value_name_pair variable_length_arr[] = {
|
||||
};
|
||||
#define VARIABLE_LENGTH_SZ ARRAY_SIZE(variable_length_arr)
|
||||
|
||||
static const char * get_sa_name(const struct value_name_pair * arr,
|
||||
int arr_sz, int service_action)
|
||||
static struct sa_name_list sa_names_arr[] = {
|
||||
{VARIABLE_LENGTH_CMD, variable_length_arr, VARIABLE_LENGTH_SZ},
|
||||
{MAINTENANCE_IN, maint_in_arr, MAINT_IN_SZ},
|
||||
{MAINTENANCE_OUT, maint_out_arr, MAINT_OUT_SZ},
|
||||
{PERSISTENT_RESERVE_IN, pr_in_arr, PR_IN_SZ},
|
||||
{PERSISTENT_RESERVE_OUT, pr_out_arr, PR_OUT_SZ},
|
||||
{SERVICE_ACTION_IN_12, serv_in12_arr, SERV_IN12_SZ},
|
||||
{SERVICE_ACTION_OUT_12, serv_out12_arr, SERV_OUT12_SZ},
|
||||
{SERVICE_ACTION_BIDIRECTIONAL, serv_bidi_arr, SERV_BIDI_SZ},
|
||||
{SERVICE_ACTION_IN_16, serv_in16_arr, SERV_IN16_SZ},
|
||||
{SERVICE_ACTION_OUT_16, serv_out16_arr, SERV_OUT16_SZ},
|
||||
{THIRD_PARTY_COPY_IN, tpc_in_arr, TPC_IN_SZ},
|
||||
{THIRD_PARTY_COPY_OUT, tpc_out_arr, TPC_OUT_SZ},
|
||||
{0, NULL, 0},
|
||||
};
|
||||
|
||||
#else /* ifndef CONFIG_SCSI_CONSTANTS */
|
||||
static const char *cdb_byte0_names[0];
|
||||
|
||||
static struct sa_name_list sa_names_arr[] = {
|
||||
{VARIABLE_LENGTH_CMD, NULL, 0},
|
||||
{MAINTENANCE_IN, NULL, 0},
|
||||
{MAINTENANCE_OUT, NULL, 0},
|
||||
{PERSISTENT_RESERVE_IN, NULL, 0},
|
||||
{PERSISTENT_RESERVE_OUT, NULL, 0},
|
||||
{SERVICE_ACTION_IN_12, NULL, 0},
|
||||
{SERVICE_ACTION_OUT_12, NULL, 0},
|
||||
{SERVICE_ACTION_BIDIRECTIONAL, NULL, 0},
|
||||
{SERVICE_ACTION_IN_16, NULL, 0},
|
||||
{SERVICE_ACTION_OUT_16, NULL, 0},
|
||||
{THIRD_PARTY_COPY_IN, NULL, 0},
|
||||
{THIRD_PARTY_COPY_OUT, NULL, 0},
|
||||
{0, NULL, 0},
|
||||
};
|
||||
#endif /* CONFIG_SCSI_CONSTANTS */
|
||||
|
||||
static bool scsi_opcode_sa_name(int opcode, int service_action,
|
||||
const char **cdb_name, const char **sa_name)
|
||||
{
|
||||
int k;
|
||||
struct sa_name_list *sa_name_ptr;
|
||||
const struct value_name_pair *arr = NULL;
|
||||
int arr_sz, k;
|
||||
|
||||
*cdb_name = NULL;
|
||||
if (opcode >= VENDOR_SPECIFIC_CDB)
|
||||
return false;
|
||||
|
||||
if (opcode < ARRAY_SIZE(cdb_byte0_names))
|
||||
*cdb_name = cdb_byte0_names[opcode];
|
||||
|
||||
for (sa_name_ptr = sa_names_arr; sa_name_ptr->arr; ++sa_name_ptr) {
|
||||
if (sa_name_ptr->opcode == opcode) {
|
||||
arr = sa_name_ptr->arr;
|
||||
arr_sz = sa_name_ptr->arr_sz;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!arr)
|
||||
return false;
|
||||
|
||||
for (k = 0; k < arr_sz; ++k, ++arr) {
|
||||
if (service_action == arr->value)
|
||||
break;
|
||||
}
|
||||
return (k < arr_sz) ? arr->name : NULL;
|
||||
if (k < arr_sz)
|
||||
*sa_name = arr->name;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* attempt to guess cdb length if cdb_len==0 . No trailing linefeed. */
|
||||
static void print_opcode_name(unsigned char * cdbp, int cdb_len)
|
||||
static void print_opcode_name(const unsigned char *cdbp, size_t cdb_len)
|
||||
{
|
||||
int sa, len, cdb0;
|
||||
int fin_name = 0;
|
||||
const char * name;
|
||||
int sa, cdb0;
|
||||
const char *cdb_name = NULL, *sa_name = NULL;
|
||||
|
||||
cdb0 = cdbp[0];
|
||||
switch(cdb0) {
|
||||
case VARIABLE_LENGTH_CMD:
|
||||
len = scsi_varlen_cdb_length(cdbp);
|
||||
if (len < 10) {
|
||||
printk("short variable length command, "
|
||||
"len=%d ext_len=%d", len, cdb_len);
|
||||
break;
|
||||
if (cdb0 == VARIABLE_LENGTH_CMD) {
|
||||
if (cdb_len < 10) {
|
||||
printk("short variable length command, len=%zu",
|
||||
cdb_len);
|
||||
return;
|
||||
}
|
||||
sa = (cdbp[8] << 8) + cdbp[9];
|
||||
name = get_sa_name(variable_length_arr, VARIABLE_LENGTH_SZ,
|
||||
sa);
|
||||
if (name)
|
||||
printk("%s", name);
|
||||
else
|
||||
printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
|
||||
} else
|
||||
sa = cdbp[1] & 0x1f;
|
||||
|
||||
if ((cdb_len > 0) && (len != cdb_len))
|
||||
printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len);
|
||||
|
||||
break;
|
||||
case MAINTENANCE_IN:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case MAINTENANCE_OUT:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(maint_out_arr, MAINT_OUT_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case PERSISTENT_RESERVE_IN:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(pr_in_arr, PR_IN_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case PERSISTENT_RESERVE_OUT:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(pr_out_arr, PR_OUT_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case SERVICE_ACTION_IN_12:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(serv_in12_arr, SERV_IN12_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case SERVICE_ACTION_OUT_12:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(serv_out12_arr, SERV_OUT12_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case SERVICE_ACTION_BIDIRECTIONAL:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(serv_bidi_arr, SERV_BIDI_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case SERVICE_ACTION_IN_16:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(serv_in16_arr, SERV_IN16_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case SERVICE_ACTION_OUT_16:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(serv_out16_arr, SERV_OUT16_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case THIRD_PARTY_COPY_IN:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(tpc_in_arr, TPC_IN_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
case THIRD_PARTY_COPY_OUT:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
name = get_sa_name(tpc_out_arr, TPC_OUT_SZ, sa);
|
||||
fin_name = 1;
|
||||
break;
|
||||
default:
|
||||
if (cdb0 < 0xc0) {
|
||||
name = cdb_byte0_names[cdb0];
|
||||
if (name)
|
||||
printk("%s", name);
|
||||
else
|
||||
printk("cdb[0]=0x%x (reserved)", cdb0);
|
||||
} else
|
||||
if (!scsi_opcode_sa_name(cdb0, sa, &cdb_name, &sa_name)) {
|
||||
if (cdb_name)
|
||||
printk("%s", cdb_name);
|
||||
else if (cdb0 >= VENDOR_SPECIFIC_CDB)
|
||||
printk("cdb[0]=0x%x (vendor)", cdb0);
|
||||
break;
|
||||
}
|
||||
if (fin_name) {
|
||||
if (name)
|
||||
printk("%s", name);
|
||||
else if (cdb0 >= 0x60 && cdb0 < 0x7e)
|
||||
printk("cdb[0]=0x%x (reserved)", cdb0);
|
||||
else
|
||||
printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* ifndef CONFIG_SCSI_CONSTANTS */
|
||||
|
||||
static void print_opcode_name(unsigned char * cdbp, int cdb_len)
|
||||
{
|
||||
int sa, len, cdb0;
|
||||
|
||||
cdb0 = cdbp[0];
|
||||
switch(cdb0) {
|
||||
case VARIABLE_LENGTH_CMD:
|
||||
len = scsi_varlen_cdb_length(cdbp);
|
||||
if (len < 10) {
|
||||
printk("short opcode=0x%x command, len=%d "
|
||||
"ext_len=%d", cdb0, len, cdb_len);
|
||||
break;
|
||||
}
|
||||
sa = (cdbp[8] << 8) + cdbp[9];
|
||||
printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
|
||||
if (len != cdb_len)
|
||||
printk(", in_cdb_len=%d, ext_len=%d", len, cdb_len);
|
||||
break;
|
||||
case MAINTENANCE_IN:
|
||||
case MAINTENANCE_OUT:
|
||||
case PERSISTENT_RESERVE_IN:
|
||||
case PERSISTENT_RESERVE_OUT:
|
||||
case SERVICE_ACTION_IN_12:
|
||||
case SERVICE_ACTION_OUT_12:
|
||||
case SERVICE_ACTION_BIDIRECTIONAL:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
case SERVICE_ACTION_OUT_16:
|
||||
case THIRD_PARTY_COPY_IN:
|
||||
case THIRD_PARTY_COPY_OUT:
|
||||
sa = cdbp[1] & 0x1f;
|
||||
printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
|
||||
break;
|
||||
default:
|
||||
if (cdb0 < 0xc0)
|
||||
printk("cdb[0]=0x%x", cdb0);
|
||||
} else {
|
||||
if (sa_name)
|
||||
printk("%s", sa_name);
|
||||
else if (cdb_name)
|
||||
printk("%s, sa=0x%x", cdb_name, sa);
|
||||
else
|
||||
printk("cdb[0]=0x%x (vendor)", cdb0);
|
||||
break;
|
||||
printk("cdb[0]=0x%x, sa=0x%x", cdb0, sa);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void __scsi_print_command(unsigned char *cdb)
|
||||
void __scsi_print_command(const unsigned char *cdb, size_t cdb_len)
|
||||
{
|
||||
int k, len;
|
||||
|
||||
print_opcode_name(cdb, 0);
|
||||
print_opcode_name(cdb, cdb_len);
|
||||
len = scsi_command_size(cdb);
|
||||
if (cdb_len < len)
|
||||
len = cdb_len;
|
||||
/* print out all bytes in cdb */
|
||||
for (k = 0; k < len; ++k)
|
||||
printk(" %02x", cdb[k]);
|
||||
@ -433,41 +383,6 @@ void scsi_print_command(struct scsi_cmnd *cmd)
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_print_command);
|
||||
|
||||
/**
|
||||
* scsi_print_status - print scsi status description
|
||||
* @scsi_status: scsi status value
|
||||
*
|
||||
* If the status is recognized, the description is printed.
|
||||
* Otherwise "Unknown status" is output. No trailing space.
|
||||
* If CONFIG_SCSI_CONSTANTS is not set, then print status in hex
|
||||
* (e.g. "0x2" for Check Condition).
|
||||
**/
|
||||
void
|
||||
scsi_print_status(unsigned char scsi_status) {
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
const char * ccp;
|
||||
|
||||
switch (scsi_status) {
|
||||
case 0: ccp = "Good"; break;
|
||||
case 0x2: ccp = "Check Condition"; break;
|
||||
case 0x4: ccp = "Condition Met"; break;
|
||||
case 0x8: ccp = "Busy"; break;
|
||||
case 0x10: ccp = "Intermediate"; break;
|
||||
case 0x14: ccp = "Intermediate-Condition Met"; break;
|
||||
case 0x18: ccp = "Reservation Conflict"; break;
|
||||
case 0x22: ccp = "Command Terminated"; break; /* obsolete */
|
||||
case 0x28: ccp = "Task set Full"; break; /* was: Queue Full */
|
||||
case 0x30: ccp = "ACA Active"; break;
|
||||
case 0x40: ccp = "Task Aborted"; break;
|
||||
default: ccp = "Unknown status";
|
||||
}
|
||||
printk(KERN_INFO "%s", ccp);
|
||||
#else
|
||||
printk(KERN_INFO "0x%0x", scsi_status);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_print_status);
|
||||
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
|
||||
struct error_info {
|
||||
@ -1292,18 +1207,19 @@ static const struct error_info additional[] =
|
||||
|
||||
struct error_info2 {
|
||||
unsigned char code1, code2_min, code2_max;
|
||||
const char * str;
|
||||
const char * fmt;
|
||||
};
|
||||
|
||||
static const struct error_info2 additional2[] =
|
||||
{
|
||||
{0x40, 0x00, 0x7f, "Ram failure (%x)"},
|
||||
{0x40, 0x80, 0xff, "Diagnostic failure on component (%x)"},
|
||||
{0x41, 0x00, 0xff, "Data path failure (%x)"},
|
||||
{0x42, 0x00, 0xff, "Power-on or self-test failure (%x)"},
|
||||
{0x4D, 0x00, 0xff, "Tagged overlapped commands (task tag %x)"},
|
||||
{0x70, 0x00, 0xff, "Decompression exception short algorithm id of %x"},
|
||||
{0, 0, 0, NULL}
|
||||
{0x40, 0x00, 0x7f, "Ram failure", ""},
|
||||
{0x40, 0x80, 0xff, "Diagnostic failure on component", ""},
|
||||
{0x41, 0x00, 0xff, "Data path failure", ""},
|
||||
{0x42, 0x00, 0xff, "Power-on or self-test failure", ""},
|
||||
{0x4D, 0x00, 0xff, "Tagged overlapped commands", "task tag "},
|
||||
{0x70, 0x00, 0xff, "Decompression exception", "short algorithm id of "},
|
||||
{0, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
||||
/* description of the sense key values */
|
||||
@ -1349,69 +1265,79 @@ EXPORT_SYMBOL(scsi_sense_key_string);
|
||||
* This string may contain a "%x" and should be printed with ascq as arg.
|
||||
*/
|
||||
const char *
|
||||
scsi_extd_sense_format(unsigned char asc, unsigned char ascq) {
|
||||
scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
|
||||
{
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
int i;
|
||||
unsigned short code = ((asc << 8) | ascq);
|
||||
|
||||
*fmt = NULL;
|
||||
for (i = 0; additional[i].text; i++)
|
||||
if (additional[i].code12 == code)
|
||||
return additional[i].text;
|
||||
for (i = 0; additional2[i].fmt; i++) {
|
||||
if (additional2[i].code1 == asc &&
|
||||
ascq >= additional2[i].code2_min &&
|
||||
ascq <= additional2[i].code2_max)
|
||||
return additional2[i].fmt;
|
||||
ascq <= additional2[i].code2_max) {
|
||||
*fmt = additional2[i].fmt;
|
||||
return additional2[i].str;
|
||||
}
|
||||
}
|
||||
#else
|
||||
*fmt = NULL;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_extd_sense_format);
|
||||
|
||||
void
|
||||
scsi_show_extd_sense(unsigned char asc, unsigned char ascq)
|
||||
scsi_show_extd_sense(const struct scsi_device *sdev, const char *name,
|
||||
unsigned char asc, unsigned char ascq)
|
||||
{
|
||||
const char *extd_sense_fmt = scsi_extd_sense_format(asc, ascq);
|
||||
const char *extd_sense_fmt = NULL;
|
||||
const char *extd_sense_str = scsi_extd_sense_format(asc, ascq,
|
||||
&extd_sense_fmt);
|
||||
|
||||
if (extd_sense_fmt) {
|
||||
if (strstr(extd_sense_fmt, "%x")) {
|
||||
printk("Add. Sense: ");
|
||||
printk(extd_sense_fmt, ascq);
|
||||
} else
|
||||
printk("Add. Sense: %s", extd_sense_fmt);
|
||||
} else {
|
||||
if (asc >= 0x80)
|
||||
printk("<<vendor>> ASC=0x%x ASCQ=0x%x", asc,
|
||||
ascq);
|
||||
if (ascq >= 0x80)
|
||||
printk("ASC=0x%x <<vendor>> ASCQ=0x%x", asc,
|
||||
ascq);
|
||||
if (extd_sense_str) {
|
||||
if (extd_sense_fmt)
|
||||
sdev_prefix_printk(KERN_INFO, sdev, name,
|
||||
"Add. Sense: %s (%s%x)",
|
||||
extd_sense_str, extd_sense_fmt,
|
||||
ascq);
|
||||
else
|
||||
printk("ASC=0x%x ASCQ=0x%x", asc, ascq);
|
||||
}
|
||||
sdev_prefix_printk(KERN_INFO, sdev, name,
|
||||
"Add. Sense: %s", extd_sense_str);
|
||||
|
||||
printk("\n");
|
||||
} else {
|
||||
sdev_prefix_printk(KERN_INFO, sdev, name,
|
||||
"%sASC=0x%x %sASCQ=0x%x\n",
|
||||
asc >= 0x80 ? "<<vendor>> " : "", asc,
|
||||
ascq >= 0x80 ? "<<vendor>> " : "", ascq);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_show_extd_sense);
|
||||
|
||||
void
|
||||
scsi_show_sense_hdr(struct scsi_sense_hdr *sshdr)
|
||||
scsi_show_sense_hdr(const struct scsi_device *sdev, const char *name,
|
||||
const struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
const char *sense_txt;
|
||||
|
||||
sense_txt = scsi_sense_key_string(sshdr->sense_key);
|
||||
if (sense_txt)
|
||||
printk("Sense Key : %s ", sense_txt);
|
||||
sdev_prefix_printk(KERN_INFO, sdev, name,
|
||||
"Sense Key : %s [%s]%s\n", sense_txt,
|
||||
scsi_sense_is_deferred(sshdr) ?
|
||||
"deferred" : "current",
|
||||
sshdr->response_code >= 0x72 ?
|
||||
" [descriptor]" : "");
|
||||
else
|
||||
printk("Sense Key : 0x%x ", sshdr->sense_key);
|
||||
|
||||
printk("%s", scsi_sense_is_deferred(sshdr) ? "[deferred] " :
|
||||
"[current] ");
|
||||
|
||||
if (sshdr->response_code >= 0x72)
|
||||
printk("[descriptor]");
|
||||
|
||||
printk("\n");
|
||||
sdev_prefix_printk(KERN_INFO, sdev, name,
|
||||
"Sense Key : 0x%x [%s]%s", sshdr->sense_key,
|
||||
scsi_sense_is_deferred(sshdr) ?
|
||||
"deferred" : "current",
|
||||
sshdr->response_code >= 0x72 ?
|
||||
" [descriptor]" : "");
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_show_sense_hdr);
|
||||
|
||||
@ -1419,141 +1345,55 @@ EXPORT_SYMBOL(scsi_show_sense_hdr);
|
||||
* Print normalized SCSI sense header with a prefix.
|
||||
*/
|
||||
void
|
||||
scsi_print_sense_hdr(const char *name, struct scsi_sense_hdr *sshdr)
|
||||
scsi_print_sense_hdr(const struct scsi_device *sdev, const char *name,
|
||||
const struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
printk(KERN_INFO "%s: ", name);
|
||||
scsi_show_sense_hdr(sshdr);
|
||||
printk(KERN_INFO "%s: ", name);
|
||||
scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
|
||||
scsi_show_sense_hdr(sdev, name, sshdr);
|
||||
scsi_show_extd_sense(sdev, name, sshdr->asc, sshdr->ascq);
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_print_sense_hdr);
|
||||
|
||||
/*
|
||||
* Print normalized SCSI sense header with device information and a prefix.
|
||||
*/
|
||||
void
|
||||
scsi_cmd_print_sense_hdr(struct scsi_cmnd *scmd, const char *desc,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
scmd_printk(KERN_INFO, scmd, "%s: ", desc);
|
||||
scsi_show_sense_hdr(sshdr);
|
||||
scmd_printk(KERN_INFO, scmd, "%s: ", desc);
|
||||
scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_cmd_print_sense_hdr);
|
||||
|
||||
static void
|
||||
scsi_decode_sense_buffer(const unsigned char *sense_buffer, int sense_len,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
scsi_dump_sense_buffer(const unsigned char *sense_buffer, int sense_len)
|
||||
{
|
||||
int k, num, res;
|
||||
int k, num;
|
||||
|
||||
res = scsi_normalize_sense(sense_buffer, sense_len, sshdr);
|
||||
if (0 == res) {
|
||||
/* this may be SCSI-1 sense data */
|
||||
num = (sense_len < 32) ? sense_len : 32;
|
||||
printk("Unrecognized sense data (in hex):");
|
||||
for (k = 0; k < num; ++k) {
|
||||
if (0 == (k % 16)) {
|
||||
printk("\n");
|
||||
printk(KERN_INFO " ");
|
||||
}
|
||||
printk("%02x ", sense_buffer[k]);
|
||||
num = (sense_len < 32) ? sense_len : 32;
|
||||
printk("Unrecognized sense data (in hex):");
|
||||
for (k = 0; k < num; ++k) {
|
||||
if (0 == (k % 16)) {
|
||||
printk("\n");
|
||||
printk(KERN_INFO " ");
|
||||
}
|
||||
printk("\n");
|
||||
return;
|
||||
printk("%02x ", sense_buffer[k]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
scsi_decode_sense_extras(const unsigned char *sense_buffer, int sense_len,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
int k, num, res;
|
||||
|
||||
if (sshdr->response_code < 0x72)
|
||||
{
|
||||
/* only decode extras for "fixed" format now */
|
||||
char buff[80];
|
||||
int blen, fixed_valid;
|
||||
unsigned int info;
|
||||
|
||||
fixed_valid = sense_buffer[0] & 0x80;
|
||||
info = ((sense_buffer[3] << 24) | (sense_buffer[4] << 16) |
|
||||
(sense_buffer[5] << 8) | sense_buffer[6]);
|
||||
res = 0;
|
||||
memset(buff, 0, sizeof(buff));
|
||||
blen = sizeof(buff) - 1;
|
||||
if (fixed_valid)
|
||||
res += snprintf(buff + res, blen - res,
|
||||
"Info fld=0x%x", info);
|
||||
if (sense_buffer[2] & 0x80) {
|
||||
/* current command has read a filemark */
|
||||
if (res > 0)
|
||||
res += snprintf(buff + res, blen - res, ", ");
|
||||
res += snprintf(buff + res, blen - res, "FMK");
|
||||
}
|
||||
if (sense_buffer[2] & 0x40) {
|
||||
/* end-of-medium condition exists */
|
||||
if (res > 0)
|
||||
res += snprintf(buff + res, blen - res, ", ");
|
||||
res += snprintf(buff + res, blen - res, "EOM");
|
||||
}
|
||||
if (sense_buffer[2] & 0x20) {
|
||||
/* incorrect block length requested */
|
||||
if (res > 0)
|
||||
res += snprintf(buff + res, blen - res, ", ");
|
||||
res += snprintf(buff + res, blen - res, "ILI");
|
||||
}
|
||||
if (res > 0)
|
||||
printk("%s\n", buff);
|
||||
} else if (sshdr->additional_length > 0) {
|
||||
/* descriptor format with sense descriptors */
|
||||
num = 8 + sshdr->additional_length;
|
||||
num = (sense_len < num) ? sense_len : num;
|
||||
printk("Descriptor sense data with sense descriptors "
|
||||
"(in hex):");
|
||||
for (k = 0; k < num; ++k) {
|
||||
if (0 == (k % 16)) {
|
||||
printk("\n");
|
||||
printk(KERN_INFO " ");
|
||||
}
|
||||
printk("%02x ", sense_buffer[k]);
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
printk("\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Normalize and print sense buffer with name prefix */
|
||||
void __scsi_print_sense(const char *name, const unsigned char *sense_buffer,
|
||||
int sense_len)
|
||||
void __scsi_print_sense(const struct scsi_device *sdev, const char *name,
|
||||
const unsigned char *sense_buffer, int sense_len)
|
||||
{
|
||||
struct scsi_sense_hdr sshdr;
|
||||
|
||||
printk(KERN_INFO "%s: ", name);
|
||||
scsi_decode_sense_buffer(sense_buffer, sense_len, &sshdr);
|
||||
scsi_show_sense_hdr(&sshdr);
|
||||
scsi_decode_sense_extras(sense_buffer, sense_len, &sshdr);
|
||||
printk(KERN_INFO "%s: ", name);
|
||||
scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
|
||||
if (!scsi_normalize_sense(sense_buffer, sense_len, &sshdr)) {
|
||||
scsi_dump_sense_buffer(sense_buffer, sense_len);
|
||||
return;
|
||||
}
|
||||
scsi_show_sense_hdr(sdev, name, &sshdr);
|
||||
scsi_show_extd_sense(sdev, name, sshdr.asc, sshdr.ascq);
|
||||
}
|
||||
EXPORT_SYMBOL(__scsi_print_sense);
|
||||
|
||||
/* Normalize and print sense buffer in SCSI command */
|
||||
void scsi_print_sense(char *name, struct scsi_cmnd *cmd)
|
||||
void scsi_print_sense(const struct scsi_cmnd *cmd)
|
||||
{
|
||||
struct scsi_sense_hdr sshdr;
|
||||
struct gendisk *disk = cmd->request->rq_disk;
|
||||
const char *disk_name = disk ? disk->disk_name : NULL;
|
||||
|
||||
scmd_printk(KERN_INFO, cmd, " ");
|
||||
scsi_decode_sense_buffer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
|
||||
&sshdr);
|
||||
scsi_show_sense_hdr(&sshdr);
|
||||
scsi_decode_sense_extras(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
|
||||
&sshdr);
|
||||
scmd_printk(KERN_INFO, cmd, " ");
|
||||
scsi_show_extd_sense(sshdr.asc, sshdr.ascq);
|
||||
__scsi_print_sense(cmd->device, disk_name, cmd->sense_buffer,
|
||||
SCSI_SENSE_BUFFERSIZE);
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_print_sense);
|
||||
|
||||
@ -1565,38 +1405,87 @@ static const char * const hostbyte_table[]={
|
||||
"DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY", "DID_REQUEUE",
|
||||
"DID_TRANSPORT_DISRUPTED", "DID_TRANSPORT_FAILFAST", "DID_TARGET_FAILURE",
|
||||
"DID_NEXUS_FAILURE" };
|
||||
#define NUM_HOSTBYTE_STRS ARRAY_SIZE(hostbyte_table)
|
||||
|
||||
static const char * const driverbyte_table[]={
|
||||
"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR",
|
||||
"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"};
|
||||
#define NUM_DRIVERBYTE_STRS ARRAY_SIZE(driverbyte_table)
|
||||
|
||||
void scsi_show_result(int result)
|
||||
{
|
||||
int hb = host_byte(result);
|
||||
int db = driver_byte(result);
|
||||
|
||||
printk("Result: hostbyte=%s driverbyte=%s\n",
|
||||
(hb < NUM_HOSTBYTE_STRS ? hostbyte_table[hb] : "invalid"),
|
||||
(db < NUM_DRIVERBYTE_STRS ? driverbyte_table[db] : "invalid"));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void scsi_show_result(int result)
|
||||
{
|
||||
printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n",
|
||||
host_byte(result), driver_byte(result));
|
||||
}
|
||||
|
||||
#endif
|
||||
EXPORT_SYMBOL(scsi_show_result);
|
||||
|
||||
|
||||
void scsi_print_result(struct scsi_cmnd *cmd)
|
||||
const char *scsi_hostbyte_string(int result)
|
||||
{
|
||||
scmd_printk(KERN_INFO, cmd, " ");
|
||||
scsi_show_result(cmd->result);
|
||||
const char *hb_string = NULL;
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
int hb = host_byte(result);
|
||||
|
||||
if (hb < ARRAY_SIZE(hostbyte_table))
|
||||
hb_string = hostbyte_table[hb];
|
||||
#endif
|
||||
return hb_string;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_hostbyte_string);
|
||||
|
||||
const char *scsi_driverbyte_string(int result)
|
||||
{
|
||||
const char *db_string = NULL;
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
int db = driver_byte(result);
|
||||
|
||||
if (db < ARRAY_SIZE(driverbyte_table))
|
||||
db_string = driverbyte_table[db];
|
||||
#endif
|
||||
return db_string;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_driverbyte_string);
|
||||
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
#define scsi_mlreturn_name(result) { result, #result }
|
||||
static const struct value_name_pair scsi_mlreturn_arr[] = {
|
||||
scsi_mlreturn_name(NEEDS_RETRY),
|
||||
scsi_mlreturn_name(SUCCESS),
|
||||
scsi_mlreturn_name(FAILED),
|
||||
scsi_mlreturn_name(QUEUED),
|
||||
scsi_mlreturn_name(SOFT_ERROR),
|
||||
scsi_mlreturn_name(ADD_TO_MLQUEUE),
|
||||
scsi_mlreturn_name(TIMEOUT_ERROR),
|
||||
scsi_mlreturn_name(SCSI_RETURN_NOT_HANDLED),
|
||||
scsi_mlreturn_name(FAST_IO_FAIL)
|
||||
};
|
||||
#endif
|
||||
|
||||
const char *scsi_mlreturn_string(int result)
|
||||
{
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
const struct value_name_pair *arr = scsi_mlreturn_arr;
|
||||
int k;
|
||||
|
||||
for (k = 0; k < ARRAY_SIZE(scsi_mlreturn_arr); ++k, ++arr) {
|
||||
if (result == arr->value)
|
||||
return arr->name;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_mlreturn_string);
|
||||
|
||||
void scsi_print_result(struct scsi_cmnd *cmd, const char *msg, int disposition)
|
||||
{
|
||||
const char *mlret_string = scsi_mlreturn_string(disposition);
|
||||
const char *hb_string = scsi_hostbyte_string(cmd->result);
|
||||
const char *db_string = scsi_driverbyte_string(cmd->result);
|
||||
|
||||
if (hb_string || db_string)
|
||||
scmd_printk(KERN_INFO, cmd,
|
||||
"%s%s Result: hostbyte=%s driverbyte=%s",
|
||||
msg ? msg : "",
|
||||
mlret_string ? mlret_string : "UNKNOWN",
|
||||
hb_string ? hb_string : "invalid",
|
||||
db_string ? db_string : "invalid");
|
||||
else
|
||||
scmd_printk(KERN_INFO, cmd,
|
||||
"%s%s Result: hostbyte=0x%02x driverbyte=0x%02x",
|
||||
msg ? msg : "",
|
||||
mlret_string ? mlret_string : "UNKNOWN",
|
||||
host_byte(cmd->result), driver_byte(cmd->result));
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_print_result);
|
||||
|
@ -152,28 +152,6 @@ csio_scsi_itnexus_loss_error(uint16_t error)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
csio_scsi_tag(struct scsi_cmnd *scmnd, uint8_t *tag, uint8_t hq,
|
||||
uint8_t oq, uint8_t sq)
|
||||
{
|
||||
char stag[2];
|
||||
|
||||
if (scsi_populate_tag_msg(scmnd, stag)) {
|
||||
switch (stag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
*tag = hq;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
*tag = oq;
|
||||
break;
|
||||
default:
|
||||
*tag = sq;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
*tag = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* csio_scsi_fcp_cmnd - Frame the SCSI FCP command paylod.
|
||||
* @req: IO req structure.
|
||||
@ -192,11 +170,12 @@ csio_scsi_fcp_cmnd(struct csio_ioreq *req, void *addr)
|
||||
int_to_scsilun(scmnd->device->lun, &fcp_cmnd->fc_lun);
|
||||
fcp_cmnd->fc_tm_flags = 0;
|
||||
fcp_cmnd->fc_cmdref = 0;
|
||||
fcp_cmnd->fc_pri_ta = 0;
|
||||
|
||||
memcpy(fcp_cmnd->fc_cdb, scmnd->cmnd, 16);
|
||||
csio_scsi_tag(scmnd, &fcp_cmnd->fc_pri_ta,
|
||||
FCP_PTA_HEADQ, FCP_PTA_ORDERED, FCP_PTA_SIMPLE);
|
||||
if (scmnd->flags & SCMD_TAGGED)
|
||||
fcp_cmnd->fc_pri_ta = FCP_PTA_SIMPLE;
|
||||
else
|
||||
fcp_cmnd->fc_pri_ta = 0;
|
||||
fcp_cmnd->fc_dl = cpu_to_be32(scsi_bufflen(scmnd));
|
||||
|
||||
if (req->nsge)
|
||||
@ -2262,11 +2241,7 @@ csio_slave_alloc(struct scsi_device *sdev)
|
||||
static int
|
||||
csio_slave_configure(struct scsi_device *sdev)
|
||||
{
|
||||
if (sdev->tagged_supported)
|
||||
scsi_activate_tcq(sdev, csio_lun_qdepth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, csio_lun_qdepth);
|
||||
|
||||
scsi_adjust_queue_depth(sdev, csio_lun_qdepth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2311,6 +2286,7 @@ struct scsi_host_template csio_fcoe_shost_template = {
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.shost_attrs = csio_fcoe_lport_attrs,
|
||||
.max_sectors = CSIO_MAX_SECTOR_SIZE,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
struct scsi_host_template csio_fcoe_shost_vport_template = {
|
||||
@ -2330,6 +2306,7 @@ struct scsi_host_template csio_fcoe_shost_vport_template = {
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.shost_attrs = csio_fcoe_vport_attrs,
|
||||
.max_sectors = CSIO_MAX_SECTOR_SIZE,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -98,27 +98,51 @@ device_handler_match(struct scsi_device_handler *scsi_dh,
|
||||
static int scsi_dh_handler_attach(struct scsi_device *sdev,
|
||||
struct scsi_device_handler *scsi_dh)
|
||||
{
|
||||
int err = 0;
|
||||
struct scsi_dh_data *d;
|
||||
|
||||
if (sdev->scsi_dh_data) {
|
||||
if (sdev->scsi_dh_data->scsi_dh != scsi_dh)
|
||||
err = -EBUSY;
|
||||
else
|
||||
kref_get(&sdev->scsi_dh_data->kref);
|
||||
} else if (scsi_dh->attach) {
|
||||
err = scsi_dh->attach(sdev);
|
||||
if (!err) {
|
||||
kref_init(&sdev->scsi_dh_data->kref);
|
||||
sdev->scsi_dh_data->sdev = sdev;
|
||||
}
|
||||
return -EBUSY;
|
||||
|
||||
kref_get(&sdev->scsi_dh_data->kref);
|
||||
return 0;
|
||||
}
|
||||
return err;
|
||||
|
||||
if (!try_module_get(scsi_dh->module))
|
||||
return -EINVAL;
|
||||
|
||||
d = scsi_dh->attach(sdev);
|
||||
if (IS_ERR(d)) {
|
||||
sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%ld)\n",
|
||||
scsi_dh->name, PTR_ERR(d));
|
||||
module_put(scsi_dh->module);
|
||||
return PTR_ERR(d);
|
||||
}
|
||||
|
||||
d->scsi_dh = scsi_dh;
|
||||
kref_init(&d->kref);
|
||||
d->sdev = sdev;
|
||||
|
||||
spin_lock_irq(sdev->request_queue->queue_lock);
|
||||
sdev->scsi_dh_data = d;
|
||||
spin_unlock_irq(sdev->request_queue->queue_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __detach_handler (struct kref *kref)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data = container_of(kref, struct scsi_dh_data, kref);
|
||||
scsi_dh_data->scsi_dh->detach(scsi_dh_data->sdev);
|
||||
struct scsi_dh_data *scsi_dh_data =
|
||||
container_of(kref, struct scsi_dh_data, kref);
|
||||
struct scsi_device_handler *scsi_dh = scsi_dh_data->scsi_dh;
|
||||
struct scsi_device *sdev = scsi_dh_data->sdev;
|
||||
|
||||
spin_lock_irq(sdev->request_queue->queue_lock);
|
||||
sdev->scsi_dh_data = NULL;
|
||||
spin_unlock_irq(sdev->request_queue->queue_lock);
|
||||
|
||||
scsi_dh->detach(sdev);
|
||||
sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", scsi_dh->name);
|
||||
module_put(scsi_dh->module);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -141,7 +165,7 @@ static void scsi_dh_handler_detach(struct scsi_device *sdev,
|
||||
if (!scsi_dh)
|
||||
scsi_dh = sdev->scsi_dh_data->scsi_dh;
|
||||
|
||||
if (scsi_dh && scsi_dh->detach)
|
||||
if (scsi_dh)
|
||||
kref_put(&sdev->scsi_dh_data->kref, __detach_handler);
|
||||
}
|
||||
|
||||
@ -330,6 +354,9 @@ int scsi_register_device_handler(struct scsi_device_handler *scsi_dh)
|
||||
if (get_device_handler(scsi_dh->name))
|
||||
return -EBUSY;
|
||||
|
||||
if (!scsi_dh->attach || !scsi_dh->detach)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock(&list_lock);
|
||||
list_add(&scsi_dh->list, &scsi_dh_list);
|
||||
spin_unlock(&list_lock);
|
||||
|
@ -62,6 +62,7 @@
|
||||
#define ALUA_OPTIMIZE_STPG 1
|
||||
|
||||
struct alua_dh_data {
|
||||
struct scsi_dh_data dh_data;
|
||||
int group_id;
|
||||
int rel_port;
|
||||
int tpgs;
|
||||
@ -87,9 +88,7 @@ static int alua_check_sense(struct scsi_device *, struct scsi_sense_hdr *);
|
||||
|
||||
static inline struct alua_dh_data *get_alua_data(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data;
|
||||
BUG_ON(scsi_dh_data == NULL);
|
||||
return ((struct alua_dh_data *) scsi_dh_data->buf);
|
||||
return container_of(sdev->scsi_dh_data, struct alua_dh_data, dh_data);
|
||||
}
|
||||
|
||||
static int realloc_buffer(struct alua_dh_data *h, unsigned len)
|
||||
@ -825,8 +824,49 @@ static bool alua_match(struct scsi_device *sdev)
|
||||
return (scsi_device_tpgs(sdev) != 0);
|
||||
}
|
||||
|
||||
static int alua_bus_attach(struct scsi_device *sdev);
|
||||
static void alua_bus_detach(struct scsi_device *sdev);
|
||||
/*
|
||||
* alua_bus_attach - Attach device handler
|
||||
* @sdev: device to be attached to
|
||||
*/
|
||||
static struct scsi_dh_data *alua_bus_attach(struct scsi_device *sdev)
|
||||
{
|
||||
struct alua_dh_data *h;
|
||||
int err;
|
||||
|
||||
h = kzalloc(sizeof(*h) , GFP_KERNEL);
|
||||
if (!h)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
h->tpgs = TPGS_MODE_UNINITIALIZED;
|
||||
h->state = TPGS_STATE_OPTIMIZED;
|
||||
h->group_id = -1;
|
||||
h->rel_port = -1;
|
||||
h->buff = h->inq;
|
||||
h->bufflen = ALUA_INQUIRY_SIZE;
|
||||
h->sdev = sdev;
|
||||
|
||||
err = alua_initialize(sdev, h);
|
||||
if (err != SCSI_DH_OK && err != SCSI_DH_DEV_OFFLINED)
|
||||
goto failed;
|
||||
|
||||
sdev_printk(KERN_NOTICE, sdev, "%s: Attached\n", ALUA_DH_NAME);
|
||||
return &h->dh_data;
|
||||
failed:
|
||||
kfree(h);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
/*
|
||||
* alua_bus_detach - Detach device handler
|
||||
* @sdev: device to be detached from
|
||||
*/
|
||||
static void alua_bus_detach(struct scsi_device *sdev)
|
||||
{
|
||||
struct alua_dh_data *h = get_alua_data(sdev);
|
||||
|
||||
if (h->buff && h->inq != h->buff)
|
||||
kfree(h->buff);
|
||||
kfree(h);
|
||||
}
|
||||
|
||||
static struct scsi_device_handler alua_dh = {
|
||||
.name = ALUA_DH_NAME,
|
||||
@ -840,78 +880,6 @@ static struct scsi_device_handler alua_dh = {
|
||||
.match = alua_match,
|
||||
};
|
||||
|
||||
/*
|
||||
* alua_bus_attach - Attach device handler
|
||||
* @sdev: device to be attached to
|
||||
*/
|
||||
static int alua_bus_attach(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
struct alua_dh_data *h;
|
||||
unsigned long flags;
|
||||
int err = SCSI_DH_OK;
|
||||
|
||||
scsi_dh_data = kzalloc(sizeof(*scsi_dh_data)
|
||||
+ sizeof(*h) , GFP_KERNEL);
|
||||
if (!scsi_dh_data) {
|
||||
sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
|
||||
ALUA_DH_NAME);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
scsi_dh_data->scsi_dh = &alua_dh;
|
||||
h = (struct alua_dh_data *) scsi_dh_data->buf;
|
||||
h->tpgs = TPGS_MODE_UNINITIALIZED;
|
||||
h->state = TPGS_STATE_OPTIMIZED;
|
||||
h->group_id = -1;
|
||||
h->rel_port = -1;
|
||||
h->buff = h->inq;
|
||||
h->bufflen = ALUA_INQUIRY_SIZE;
|
||||
h->sdev = sdev;
|
||||
|
||||
err = alua_initialize(sdev, h);
|
||||
if ((err != SCSI_DH_OK) && (err != SCSI_DH_DEV_OFFLINED))
|
||||
goto failed;
|
||||
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
goto failed;
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
sdev->scsi_dh_data = scsi_dh_data;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
sdev_printk(KERN_NOTICE, sdev, "%s: Attached\n", ALUA_DH_NAME);
|
||||
|
||||
return 0;
|
||||
|
||||
failed:
|
||||
kfree(scsi_dh_data);
|
||||
sdev_printk(KERN_ERR, sdev, "%s: not attached\n", ALUA_DH_NAME);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* alua_bus_detach - Detach device handler
|
||||
* @sdev: device to be detached from
|
||||
*/
|
||||
static void alua_bus_detach(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
struct alua_dh_data *h;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
scsi_dh_data = sdev->scsi_dh_data;
|
||||
sdev->scsi_dh_data = NULL;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
|
||||
h = (struct alua_dh_data *) scsi_dh_data->buf;
|
||||
if (h->buff && h->inq != h->buff)
|
||||
kfree(h->buff);
|
||||
kfree(scsi_dh_data);
|
||||
module_put(THIS_MODULE);
|
||||
sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", ALUA_DH_NAME);
|
||||
}
|
||||
|
||||
static int __init alua_init(void)
|
||||
{
|
||||
int r;
|
||||
|
@ -72,6 +72,7 @@ static const char * lun_state[] =
|
||||
};
|
||||
|
||||
struct clariion_dh_data {
|
||||
struct scsi_dh_data dh_data;
|
||||
/*
|
||||
* Flags:
|
||||
* CLARIION_SHORT_TRESPASS
|
||||
@ -116,9 +117,8 @@ struct clariion_dh_data {
|
||||
static inline struct clariion_dh_data
|
||||
*get_clariion_data(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data;
|
||||
BUG_ON(scsi_dh_data == NULL);
|
||||
return ((struct clariion_dh_data *) scsi_dh_data->buf);
|
||||
return container_of(sdev->scsi_dh_data, struct clariion_dh_data,
|
||||
dh_data);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -622,7 +622,10 @@ done:
|
||||
return result;
|
||||
}
|
||||
|
||||
static const struct scsi_dh_devlist clariion_dev_list[] = {
|
||||
static const struct {
|
||||
char *vendor;
|
||||
char *model;
|
||||
} clariion_dev_list[] = {
|
||||
{"DGC", "RAID"},
|
||||
{"DGC", "DISK"},
|
||||
{"DGC", "VRAID"},
|
||||
@ -647,39 +650,14 @@ static bool clariion_match(struct scsi_device *sdev)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int clariion_bus_attach(struct scsi_device *sdev);
|
||||
static void clariion_bus_detach(struct scsi_device *sdev);
|
||||
|
||||
static struct scsi_device_handler clariion_dh = {
|
||||
.name = CLARIION_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.devlist = clariion_dev_list,
|
||||
.attach = clariion_bus_attach,
|
||||
.detach = clariion_bus_detach,
|
||||
.check_sense = clariion_check_sense,
|
||||
.activate = clariion_activate,
|
||||
.prep_fn = clariion_prep_fn,
|
||||
.set_params = clariion_set_params,
|
||||
.match = clariion_match,
|
||||
};
|
||||
|
||||
static int clariion_bus_attach(struct scsi_device *sdev)
|
||||
static struct scsi_dh_data *clariion_bus_attach(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
struct clariion_dh_data *h;
|
||||
unsigned long flags;
|
||||
int err;
|
||||
|
||||
scsi_dh_data = kzalloc(sizeof(*scsi_dh_data)
|
||||
+ sizeof(*h) , GFP_KERNEL);
|
||||
if (!scsi_dh_data) {
|
||||
sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
|
||||
CLARIION_NAME);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
scsi_dh_data->scsi_dh = &clariion_dh;
|
||||
h = (struct clariion_dh_data *) scsi_dh_data->buf;
|
||||
h = kzalloc(sizeof(*h) , GFP_KERNEL);
|
||||
if (!h)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
h->lun_state = CLARIION_LUN_UNINITIALIZED;
|
||||
h->default_sp = CLARIION_UNBOUND_LU;
|
||||
h->current_sp = CLARIION_UNBOUND_LU;
|
||||
@ -692,45 +670,37 @@ static int clariion_bus_attach(struct scsi_device *sdev)
|
||||
if (err != SCSI_DH_OK)
|
||||
goto failed;
|
||||
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
goto failed;
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
sdev->scsi_dh_data = scsi_dh_data;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: connected to SP %c Port %d (%s, default SP %c)\n",
|
||||
CLARIION_NAME, h->current_sp + 'A',
|
||||
h->port, lun_state[h->lun_state],
|
||||
h->default_sp + 'A');
|
||||
|
||||
return 0;
|
||||
return &h->dh_data;
|
||||
|
||||
failed:
|
||||
kfree(scsi_dh_data);
|
||||
sdev_printk(KERN_ERR, sdev, "%s: not attached\n",
|
||||
CLARIION_NAME);
|
||||
return -EINVAL;
|
||||
kfree(h);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static void clariion_bus_detach(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
unsigned long flags;
|
||||
struct clariion_dh_data *h = get_clariion_data(sdev);
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
scsi_dh_data = sdev->scsi_dh_data;
|
||||
sdev->scsi_dh_data = NULL;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
|
||||
sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n",
|
||||
CLARIION_NAME);
|
||||
|
||||
kfree(scsi_dh_data);
|
||||
module_put(THIS_MODULE);
|
||||
kfree(h);
|
||||
}
|
||||
|
||||
static struct scsi_device_handler clariion_dh = {
|
||||
.name = CLARIION_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.attach = clariion_bus_attach,
|
||||
.detach = clariion_bus_detach,
|
||||
.check_sense = clariion_check_sense,
|
||||
.activate = clariion_activate,
|
||||
.prep_fn = clariion_prep_fn,
|
||||
.set_params = clariion_set_params,
|
||||
.match = clariion_match,
|
||||
};
|
||||
|
||||
static int __init clariion_init(void)
|
||||
{
|
||||
int r;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#define HP_SW_PATH_PASSIVE 1
|
||||
|
||||
struct hp_sw_dh_data {
|
||||
struct scsi_dh_data dh_data;
|
||||
unsigned char sense[SCSI_SENSE_BUFFERSIZE];
|
||||
int path_state;
|
||||
int retries;
|
||||
@ -51,9 +52,7 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *);
|
||||
|
||||
static inline struct hp_sw_dh_data *get_hp_sw_data(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data;
|
||||
BUG_ON(scsi_dh_data == NULL);
|
||||
return ((struct hp_sw_dh_data *) scsi_dh_data->buf);
|
||||
return container_of(sdev->scsi_dh_data, struct hp_sw_dh_data, dh_data);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -312,7 +311,10 @@ static int hp_sw_activate(struct scsi_device *sdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct scsi_dh_devlist hp_sw_dh_data_list[] = {
|
||||
static const struct {
|
||||
char *vendor;
|
||||
char *model;
|
||||
} hp_sw_dh_data_list[] = {
|
||||
{"COMPAQ", "MSA1000 VOLUME"},
|
||||
{"COMPAQ", "HSV110"},
|
||||
{"HP", "HSV100"},
|
||||
@ -338,37 +340,14 @@ static bool hp_sw_match(struct scsi_device *sdev)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int hp_sw_bus_attach(struct scsi_device *sdev);
|
||||
static void hp_sw_bus_detach(struct scsi_device *sdev);
|
||||
|
||||
static struct scsi_device_handler hp_sw_dh = {
|
||||
.name = HP_SW_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.devlist = hp_sw_dh_data_list,
|
||||
.attach = hp_sw_bus_attach,
|
||||
.detach = hp_sw_bus_detach,
|
||||
.activate = hp_sw_activate,
|
||||
.prep_fn = hp_sw_prep_fn,
|
||||
.match = hp_sw_match,
|
||||
};
|
||||
|
||||
static int hp_sw_bus_attach(struct scsi_device *sdev)
|
||||
static struct scsi_dh_data *hp_sw_bus_attach(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
struct hp_sw_dh_data *h;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
scsi_dh_data = kzalloc(sizeof(*scsi_dh_data)
|
||||
+ sizeof(*h) , GFP_KERNEL);
|
||||
if (!scsi_dh_data) {
|
||||
sdev_printk(KERN_ERR, sdev, "%s: Attach Failed\n",
|
||||
HP_SW_NAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
scsi_dh_data->scsi_dh = &hp_sw_dh;
|
||||
h = (struct hp_sw_dh_data *) scsi_dh_data->buf;
|
||||
h = kzalloc(sizeof(*h), GFP_KERNEL);
|
||||
if (!h)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
h->path_state = HP_SW_PATH_UNINITIALIZED;
|
||||
h->retries = HP_SW_RETRIES;
|
||||
h->sdev = sdev;
|
||||
@ -377,42 +356,32 @@ static int hp_sw_bus_attach(struct scsi_device *sdev)
|
||||
if (ret != SCSI_DH_OK || h->path_state == HP_SW_PATH_UNINITIALIZED)
|
||||
goto failed;
|
||||
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
goto failed;
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
sdev->scsi_dh_data = scsi_dh_data;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
|
||||
sdev_printk(KERN_INFO, sdev, "%s: attached to %s path\n",
|
||||
HP_SW_NAME, h->path_state == HP_SW_PATH_ACTIVE?
|
||||
"active":"passive");
|
||||
|
||||
return 0;
|
||||
|
||||
return &h->dh_data;
|
||||
failed:
|
||||
kfree(scsi_dh_data);
|
||||
sdev_printk(KERN_ERR, sdev, "%s: not attached\n",
|
||||
HP_SW_NAME);
|
||||
return -EINVAL;
|
||||
kfree(h);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static void hp_sw_bus_detach( struct scsi_device *sdev )
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
unsigned long flags;
|
||||
struct hp_sw_dh_data *h = get_hp_sw_data(sdev);
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
scsi_dh_data = sdev->scsi_dh_data;
|
||||
sdev->scsi_dh_data = NULL;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
module_put(THIS_MODULE);
|
||||
|
||||
sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", HP_SW_NAME);
|
||||
|
||||
kfree(scsi_dh_data);
|
||||
kfree(h);
|
||||
}
|
||||
|
||||
static struct scsi_device_handler hp_sw_dh = {
|
||||
.name = HP_SW_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.attach = hp_sw_bus_attach,
|
||||
.detach = hp_sw_bus_detach,
|
||||
.activate = hp_sw_activate,
|
||||
.prep_fn = hp_sw_prep_fn,
|
||||
.match = hp_sw_match,
|
||||
};
|
||||
|
||||
static int __init hp_sw_init(void)
|
||||
{
|
||||
return scsi_register_device_handler(&hp_sw_dh);
|
||||
|
@ -181,6 +181,7 @@ struct c2_inquiry {
|
||||
};
|
||||
|
||||
struct rdac_dh_data {
|
||||
struct scsi_dh_data dh_data;
|
||||
struct rdac_controller *ctlr;
|
||||
#define UNINITIALIZED_LUN (1 << 8)
|
||||
unsigned lun;
|
||||
@ -261,9 +262,7 @@ do { \
|
||||
|
||||
static inline struct rdac_dh_data *get_rdac_data(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data;
|
||||
BUG_ON(scsi_dh_data == NULL);
|
||||
return ((struct rdac_dh_data *) scsi_dh_data->buf);
|
||||
return container_of(sdev->scsi_dh_data, struct rdac_dh_data, dh_data);
|
||||
}
|
||||
|
||||
static struct request *get_rdac_req(struct scsi_device *sdev,
|
||||
@ -779,7 +778,10 @@ static int rdac_check_sense(struct scsi_device *sdev,
|
||||
return SCSI_RETURN_NOT_HANDLED;
|
||||
}
|
||||
|
||||
static const struct scsi_dh_devlist rdac_dev_list[] = {
|
||||
static const struct {
|
||||
char *vendor;
|
||||
char *model;
|
||||
} rdac_dev_list[] = {
|
||||
{"IBM", "1722"},
|
||||
{"IBM", "1724"},
|
||||
{"IBM", "1726"},
|
||||
@ -825,40 +827,16 @@ static bool rdac_match(struct scsi_device *sdev)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int rdac_bus_attach(struct scsi_device *sdev);
|
||||
static void rdac_bus_detach(struct scsi_device *sdev);
|
||||
|
||||
static struct scsi_device_handler rdac_dh = {
|
||||
.name = RDAC_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.devlist = rdac_dev_list,
|
||||
.prep_fn = rdac_prep_fn,
|
||||
.check_sense = rdac_check_sense,
|
||||
.attach = rdac_bus_attach,
|
||||
.detach = rdac_bus_detach,
|
||||
.activate = rdac_activate,
|
||||
.match = rdac_match,
|
||||
};
|
||||
|
||||
static int rdac_bus_attach(struct scsi_device *sdev)
|
||||
static struct scsi_dh_data *rdac_bus_attach(struct scsi_device *sdev)
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
struct rdac_dh_data *h;
|
||||
unsigned long flags;
|
||||
int err;
|
||||
char array_name[ARRAY_LABEL_LEN];
|
||||
char array_id[UNIQUE_ID_LEN];
|
||||
|
||||
scsi_dh_data = kzalloc(sizeof(*scsi_dh_data)
|
||||
+ sizeof(*h) , GFP_KERNEL);
|
||||
if (!scsi_dh_data) {
|
||||
sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
|
||||
RDAC_NAME);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
scsi_dh_data->scsi_dh = &rdac_dh;
|
||||
h = (struct rdac_dh_data *) scsi_dh_data->buf;
|
||||
h = kzalloc(sizeof(*h) , GFP_KERNEL);
|
||||
if (!h)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
h->lun = UNINITIALIZED_LUN;
|
||||
h->state = RDAC_STATE_ACTIVE;
|
||||
|
||||
@ -878,19 +856,12 @@ static int rdac_bus_attach(struct scsi_device *sdev)
|
||||
if (err != SCSI_DH_OK)
|
||||
goto clean_ctlr;
|
||||
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
goto clean_ctlr;
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
sdev->scsi_dh_data = scsi_dh_data;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
|
||||
sdev_printk(KERN_NOTICE, sdev,
|
||||
"%s: LUN %d (%s) (%s)\n",
|
||||
RDAC_NAME, h->lun, mode[(int)h->mode],
|
||||
lun_state[(int)h->lun_state]);
|
||||
|
||||
return 0;
|
||||
return &h->dh_data;
|
||||
|
||||
clean_ctlr:
|
||||
spin_lock(&list_lock);
|
||||
@ -898,37 +869,34 @@ clean_ctlr:
|
||||
spin_unlock(&list_lock);
|
||||
|
||||
failed:
|
||||
kfree(scsi_dh_data);
|
||||
sdev_printk(KERN_ERR, sdev, "%s: not attached\n",
|
||||
RDAC_NAME);
|
||||
return -EINVAL;
|
||||
kfree(h);
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static void rdac_bus_detach( struct scsi_device *sdev )
|
||||
{
|
||||
struct scsi_dh_data *scsi_dh_data;
|
||||
struct rdac_dh_data *h;
|
||||
unsigned long flags;
|
||||
struct rdac_dh_data *h = get_rdac_data(sdev);
|
||||
|
||||
scsi_dh_data = sdev->scsi_dh_data;
|
||||
h = (struct rdac_dh_data *) scsi_dh_data->buf;
|
||||
if (h->ctlr && h->ctlr->ms_queued)
|
||||
flush_workqueue(kmpath_rdacd);
|
||||
|
||||
spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
|
||||
sdev->scsi_dh_data = NULL;
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
|
||||
spin_lock(&list_lock);
|
||||
if (h->ctlr)
|
||||
kref_put(&h->ctlr->kref, release_controller);
|
||||
spin_unlock(&list_lock);
|
||||
kfree(scsi_dh_data);
|
||||
module_put(THIS_MODULE);
|
||||
sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME);
|
||||
kfree(h);
|
||||
}
|
||||
|
||||
|
||||
static struct scsi_device_handler rdac_dh = {
|
||||
.name = RDAC_NAME,
|
||||
.module = THIS_MODULE,
|
||||
.prep_fn = rdac_prep_fn,
|
||||
.check_sense = rdac_check_sense,
|
||||
.attach = rdac_bus_attach,
|
||||
.detach = rdac_bus_detach,
|
||||
.activate = rdac_activate,
|
||||
.match = rdac_match,
|
||||
};
|
||||
|
||||
static int __init rdac_init(void)
|
||||
{
|
||||
|
@ -415,10 +415,8 @@ static int adpt_slave_configure(struct scsi_device * device)
|
||||
pHba = (adpt_hba *) host->hostdata[0];
|
||||
|
||||
if (host->can_queue && device->tagged_supported) {
|
||||
scsi_adjust_queue_depth(device, MSG_SIMPLE_TAG,
|
||||
scsi_adjust_queue_depth(device,
|
||||
host->can_queue - 1);
|
||||
} else {
|
||||
scsi_adjust_queue_depth(device, 0, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -946,20 +946,18 @@ static int eata2x_slave_configure(struct scsi_device *dev)
|
||||
|
||||
if (TLDEV(dev->type) && dev->tagged_supported) {
|
||||
if (tag_mode == TAG_SIMPLE) {
|
||||
scsi_adjust_queue_depth(dev, MSG_SIMPLE_TAG, tqd);
|
||||
tag_suffix = ", simple tags";
|
||||
} else if (tag_mode == TAG_ORDERED) {
|
||||
scsi_adjust_queue_depth(dev, MSG_ORDERED_TAG, tqd);
|
||||
tag_suffix = ", ordered tags";
|
||||
} else {
|
||||
scsi_adjust_queue_depth(dev, 0, tqd);
|
||||
tag_suffix = ", no tags";
|
||||
}
|
||||
scsi_adjust_queue_depth(dev, tqd);
|
||||
} else if (TLDEV(dev->type) && linked_comm) {
|
||||
scsi_adjust_queue_depth(dev, 0, tqd);
|
||||
scsi_adjust_queue_depth(dev, tqd);
|
||||
tag_suffix = ", untagged";
|
||||
} else {
|
||||
scsi_adjust_queue_depth(dev, 0, utqd);
|
||||
scsi_adjust_queue_depth(dev, utqd);
|
||||
tag_suffix = "";
|
||||
}
|
||||
|
||||
|
@ -972,11 +972,7 @@ u8 handle_hba_ioctl(struct esas2r_adapter *a,
|
||||
struct atto_ioctl *ioctl_hba);
|
||||
int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd);
|
||||
int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh);
|
||||
int esas2r_slave_alloc(struct scsi_device *dev);
|
||||
int esas2r_slave_configure(struct scsi_device *dev);
|
||||
void esas2r_slave_destroy(struct scsi_device *dev);
|
||||
int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason);
|
||||
int esas2r_change_queue_type(struct scsi_device *dev, int type);
|
||||
long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
|
||||
|
||||
/* SCSI error handler (eh) functions */
|
||||
|
@ -254,12 +254,10 @@ static struct scsi_host_template driver_template = {
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.emulated = 0,
|
||||
.proc_name = ESAS2R_DRVR_NAME,
|
||||
.slave_configure = esas2r_slave_configure,
|
||||
.slave_alloc = esas2r_slave_alloc,
|
||||
.slave_destroy = esas2r_slave_destroy,
|
||||
.change_queue_depth = esas2r_change_queue_depth,
|
||||
.change_queue_type = esas2r_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.max_sectors = 0xFFFF,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
int sgl_page_size = 512;
|
||||
@ -1057,7 +1055,7 @@ int esas2r_eh_abort(struct scsi_cmnd *cmd)
|
||||
|
||||
cmd->scsi_done(cmd);
|
||||
|
||||
return 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&a->queue_lock, flags);
|
||||
@ -1263,56 +1261,11 @@ int esas2r_change_queue_depth(struct scsi_device *dev, int depth, int reason)
|
||||
{
|
||||
esas2r_log(ESAS2R_LOG_INFO, "change_queue_depth %p, %d", dev, depth);
|
||||
|
||||
scsi_adjust_queue_depth(dev, scsi_get_tag_type(dev), depth);
|
||||
scsi_adjust_queue_depth(dev, depth);
|
||||
|
||||
return dev->queue_depth;
|
||||
}
|
||||
|
||||
int esas2r_change_queue_type(struct scsi_device *dev, int type)
|
||||
{
|
||||
esas2r_log(ESAS2R_LOG_INFO, "change_queue_type %p, %d", dev, type);
|
||||
|
||||
if (dev->tagged_supported) {
|
||||
scsi_set_tag_type(dev, type);
|
||||
|
||||
if (type)
|
||||
scsi_activate_tcq(dev, dev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(dev, dev->queue_depth);
|
||||
} else {
|
||||
type = 0;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
int esas2r_slave_alloc(struct scsi_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int esas2r_slave_configure(struct scsi_device *dev)
|
||||
{
|
||||
esas2r_log_dev(ESAS2R_LOG_INFO, &(dev->sdev_gendev),
|
||||
"esas2r_slave_configure()");
|
||||
|
||||
if (dev->tagged_supported) {
|
||||
scsi_set_tag_type(dev, MSG_SIMPLE_TAG);
|
||||
scsi_activate_tcq(dev, cmd_per_lun);
|
||||
} else {
|
||||
scsi_set_tag_type(dev, 0);
|
||||
scsi_deactivate_tcq(dev, cmd_per_lun);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void esas2r_slave_destroy(struct scsi_device *dev)
|
||||
{
|
||||
esas2r_log_dev(ESAS2R_LOG_INFO, &(dev->sdev_gendev),
|
||||
"esas2r_slave_destroy()");
|
||||
}
|
||||
|
||||
void esas2r_log_request_failure(struct esas2r_adapter *a,
|
||||
struct esas2r_request *rq)
|
||||
{
|
||||
|
@ -663,7 +663,7 @@ static struct esp_cmd_entry *find_and_prep_issuable_command(struct esp *esp)
|
||||
return ent;
|
||||
}
|
||||
|
||||
if (!scsi_populate_tag_msg(cmd, &ent->tag[0])) {
|
||||
if (!spi_populate_tag_msg(&ent->tag[0], cmd)) {
|
||||
ent->tag[0] = 0;
|
||||
ent->tag[1] = 0;
|
||||
}
|
||||
@ -2402,28 +2402,14 @@ static int esp_slave_configure(struct scsi_device *dev)
|
||||
{
|
||||
struct esp *esp = shost_priv(dev->host);
|
||||
struct esp_target_data *tp = &esp->target[dev->id];
|
||||
int goal_tags, queue_depth;
|
||||
|
||||
goal_tags = 0;
|
||||
|
||||
if (dev->tagged_supported) {
|
||||
/* XXX make this configurable somehow XXX */
|
||||
goal_tags = ESP_DEFAULT_TAGS;
|
||||
int goal_tags = min(ESP_DEFAULT_TAGS, ESP_MAX_TAG);
|
||||
|
||||
if (goal_tags > ESP_MAX_TAG)
|
||||
goal_tags = ESP_MAX_TAG;
|
||||
scsi_adjust_queue_depth(dev, goal_tags);
|
||||
}
|
||||
|
||||
queue_depth = goal_tags;
|
||||
if (queue_depth < dev->host->cmd_per_lun)
|
||||
queue_depth = dev->host->cmd_per_lun;
|
||||
|
||||
if (goal_tags) {
|
||||
scsi_set_tag_type(dev, MSG_ORDERED_TAG);
|
||||
scsi_activate_tcq(dev, queue_depth);
|
||||
} else {
|
||||
scsi_deactivate_tcq(dev, queue_depth);
|
||||
}
|
||||
tp->flags |= ESP_TGT_DISCONNECT;
|
||||
|
||||
if (!spi_initial_dv(dev->sdev_target))
|
||||
@ -2631,6 +2617,7 @@ struct scsi_host_template scsi_esp_template = {
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.max_sectors = 0xffff,
|
||||
.skip_settle_delay = 1,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
EXPORT_SYMBOL(scsi_esp_template);
|
||||
|
||||
|
@ -281,13 +281,14 @@ static struct scsi_host_template fcoe_shost_template = {
|
||||
.eh_host_reset_handler = fc_eh_host_reset,
|
||||
.slave_alloc = fc_slave_alloc,
|
||||
.change_queue_depth = fc_change_queue_depth,
|
||||
.change_queue_type = fc_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.this_id = -1,
|
||||
.cmd_per_lun = 3,
|
||||
.can_queue = FCOE_MAX_OUTSTANDING_COMMANDS,
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.sg_tablesize = SG_ALL,
|
||||
.max_sectors = 0xffff,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -95,12 +95,10 @@ static int fnic_slave_alloc(struct scsi_device *sdev)
|
||||
{
|
||||
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
|
||||
|
||||
sdev->tagged_supported = 1;
|
||||
|
||||
if (!rport || fc_remote_port_chkready(rport))
|
||||
return -ENXIO;
|
||||
|
||||
scsi_activate_tcq(sdev, fnic_max_qdepth);
|
||||
scsi_adjust_queue_depth(sdev, fnic_max_qdepth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -113,7 +111,7 @@ static struct scsi_host_template fnic_host_template = {
|
||||
.eh_host_reset_handler = fnic_host_reset,
|
||||
.slave_alloc = fnic_slave_alloc,
|
||||
.change_queue_depth = fc_change_queue_depth,
|
||||
.change_queue_type = fc_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.this_id = -1,
|
||||
.cmd_per_lun = 3,
|
||||
.can_queue = FNIC_DFLT_IO_REQ,
|
||||
@ -121,6 +119,7 @@ static struct scsi_host_template fnic_host_template = {
|
||||
.sg_tablesize = FNIC_MAX_SG_DESC_CNT,
|
||||
.max_sectors = 0xffff,
|
||||
.shost_attrs = fnic_attrs,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -325,13 +325,11 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
|
||||
struct fc_rport_libfc_priv *rp = rport->dd_data;
|
||||
struct host_sg_desc *desc;
|
||||
struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats;
|
||||
u8 pri_tag = 0;
|
||||
unsigned int i;
|
||||
unsigned long intr_flags;
|
||||
int flags;
|
||||
u8 exch_flags;
|
||||
struct scsi_lun fc_lun;
|
||||
char msg[2];
|
||||
|
||||
if (sg_count) {
|
||||
/* For each SGE, create a device desc entry */
|
||||
@ -357,12 +355,6 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
|
||||
|
||||
int_to_scsilun(sc->device->lun, &fc_lun);
|
||||
|
||||
pri_tag = FCPIO_ICMND_PTA_SIMPLE;
|
||||
msg[0] = MSG_SIMPLE_TAG;
|
||||
scsi_populate_tag_msg(sc, msg);
|
||||
if (msg[0] == MSG_ORDERED_TAG)
|
||||
pri_tag = FCPIO_ICMND_PTA_ORDERED;
|
||||
|
||||
/* Enqueue the descriptor in the Copy WQ */
|
||||
spin_lock_irqsave(&fnic->wq_copy_lock[0], intr_flags);
|
||||
|
||||
@ -394,7 +386,8 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
|
||||
io_req->sgl_list_pa,
|
||||
io_req->sense_buf_pa,
|
||||
0, /* scsi cmd ref, always 0 */
|
||||
pri_tag, /* scsi pri and tag */
|
||||
FCPIO_ICMND_PTA_SIMPLE,
|
||||
/* scsi pri and tag */
|
||||
flags, /* command flags */
|
||||
sc->cmnd, sc->cmd_len,
|
||||
scsi_bufflen(sc),
|
||||
|
@ -2159,7 +2159,7 @@ static void gdth_next(gdth_ha_str *ha)
|
||||
case VERIFY:
|
||||
case START_STOP:
|
||||
case MODE_SENSE:
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
TRACE(("cache cmd %x/%x/%x/%x/%x/%x\n",nscp->cmnd[0],
|
||||
nscp->cmnd[1],nscp->cmnd[2],nscp->cmnd[3],
|
||||
nscp->cmnd[4],nscp->cmnd[5]));
|
||||
@ -2391,7 +2391,7 @@ static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp)
|
||||
gdth_copy_internal_data(ha, scp, (char*)&rdc, sizeof(gdth_rdcap_data));
|
||||
break;
|
||||
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
if ((scp->cmnd[1] & 0x1f) == SAI_READ_CAPACITY_16 &&
|
||||
(ha->cache_feat & GDT_64BIT)) {
|
||||
gdth_rdcap16_data rdc16;
|
||||
@ -4661,7 +4661,6 @@ static void gdth_flush(gdth_ha_str *ha)
|
||||
/* configure lun */
|
||||
static int gdth_slave_configure(struct scsi_device *sdev)
|
||||
{
|
||||
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
|
||||
sdev->skip_ms_page_3f = 1;
|
||||
sdev->skip_ms_page_8 = 1;
|
||||
return 0;
|
||||
|
@ -418,7 +418,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
|
||||
shost->cmd_per_lun = sht->cmd_per_lun;
|
||||
shost->unchecked_isa_dma = sht->unchecked_isa_dma;
|
||||
shost->use_clustering = sht->use_clustering;
|
||||
shost->ordered_tag = sht->ordered_tag;
|
||||
shost->no_write_same = sht->no_write_same;
|
||||
|
||||
if (shost_eh_deadline == -1 || !sht->eh_host_reset_handler)
|
||||
@ -485,8 +484,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
|
||||
WQ_UNBOUND | WQ_MEM_RECLAIM,
|
||||
1, shost->host_no);
|
||||
if (!shost->tmf_work_q) {
|
||||
printk(KERN_WARNING "scsi%d: failed to create tmf workq\n",
|
||||
shost->host_no);
|
||||
shost_printk(KERN_WARNING, shost,
|
||||
"failed to create tmf workq\n");
|
||||
goto fail_kthread;
|
||||
}
|
||||
scsi_proc_hostdir_add(shost->hostt);
|
||||
|
@ -4165,7 +4165,7 @@ static int hpsa_change_queue_depth(struct scsi_device *sdev,
|
||||
else
|
||||
if (qdepth > h->nr_cmds)
|
||||
qdepth = h->nr_cmds;
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1127,7 @@ static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev,
|
||||
|
||||
if (queue_depth > hba->max_requests)
|
||||
queue_depth = hba->max_requests;
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
return queue_depth;
|
||||
}
|
||||
|
||||
|
@ -1643,19 +1643,9 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
|
||||
int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun);
|
||||
memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len);
|
||||
|
||||
if (scsi_populate_tag_msg(cmnd, tag)) {
|
||||
vfc_cmd->task_tag = cpu_to_be64(tag[1]);
|
||||
switch (tag[0]) {
|
||||
case MSG_SIMPLE_TAG:
|
||||
vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK;
|
||||
break;
|
||||
case MSG_HEAD_TAG:
|
||||
vfc_cmd->iu.pri_task_attr = IBMVFC_HEAD_OF_QUEUE;
|
||||
break;
|
||||
case MSG_ORDERED_TAG:
|
||||
vfc_cmd->iu.pri_task_attr = IBMVFC_ORDERED_TASK;
|
||||
break;
|
||||
};
|
||||
if (cmnd->flags & SCMD_TAGGED) {
|
||||
vfc_cmd->task_tag = cpu_to_be64(cmnd->tag);
|
||||
vfc_cmd->iu.pri_task_attr = IBMVFC_SIMPLE_TASK;
|
||||
}
|
||||
|
||||
if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev))))
|
||||
@ -2897,12 +2887,6 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
|
||||
spin_lock_irqsave(shost->host_lock, flags);
|
||||
if (sdev->type == TYPE_DISK)
|
||||
sdev->allow_restart = 1;
|
||||
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, MSG_SIMPLE_TAG);
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
spin_unlock_irqrestore(shost->host_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
@ -2925,33 +2909,10 @@ static int ibmvfc_change_queue_depth(struct scsi_device *sdev, int qdepth,
|
||||
if (qdepth > IBMVFC_MAX_CMDS_PER_LUN)
|
||||
qdepth = IBMVFC_MAX_CMDS_PER_LUN;
|
||||
|
||||
scsi_adjust_queue_depth(sdev, 0, qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* ibmvfc_change_queue_type - Change the device's queue type
|
||||
* @sdev: scsi device struct
|
||||
* @tag_type: type of tags to use
|
||||
*
|
||||
* Return value:
|
||||
* actual queue type set
|
||||
**/
|
||||
static int ibmvfc_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
|
||||
return tag_type;
|
||||
}
|
||||
|
||||
static ssize_t ibmvfc_show_host_partition_name(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
@ -3133,7 +3094,7 @@ static struct scsi_host_template driver_template = {
|
||||
.target_alloc = ibmvfc_target_alloc,
|
||||
.scan_finished = ibmvfc_scan_finished,
|
||||
.change_queue_depth = ibmvfc_change_queue_depth,
|
||||
.change_queue_type = ibmvfc_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.cmd_per_lun = 16,
|
||||
.can_queue = IBMVFC_MAX_REQUESTS_DEFAULT,
|
||||
.this_id = -1,
|
||||
@ -3141,6 +3102,7 @@ static struct scsi_host_template driver_template = {
|
||||
.max_sectors = IBMVFC_MAX_SECTORS,
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.shost_attrs = ibmvfc_attrs,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1929,7 +1929,6 @@ static int ibmvscsi_slave_configure(struct scsi_device *sdev)
|
||||
blk_queue_rq_timeout(sdev->request_queue, 120 * HZ);
|
||||
}
|
||||
spin_unlock_irqrestore(shost->host_lock, lock_flags);
|
||||
scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1951,7 +1950,7 @@ static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth,
|
||||
if (qdepth > IBMVSCSI_MAX_CMDS_PER_LUN)
|
||||
qdepth = IBMVSCSI_MAX_CMDS_PER_LUN;
|
||||
|
||||
scsi_adjust_queue_depth(sdev, 0, qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
|
@ -4344,7 +4344,7 @@ static int ipr_change_queue_depth(struct scsi_device *sdev, int qdepth,
|
||||
qdepth = IPR_MAX_CMD_PER_ATA_LUN;
|
||||
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
|
||||
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
@ -4364,24 +4364,10 @@ static int ipr_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
|
||||
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
|
||||
res = (struct ipr_resource_entry *)sdev->hostdata;
|
||||
|
||||
if (res) {
|
||||
if (ipr_is_gscsi(res) && sdev->tagged_supported) {
|
||||
/*
|
||||
* We don't bother quiescing the device here since the
|
||||
* adapter firmware does it for us.
|
||||
*/
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
} else
|
||||
if (res && ipr_is_gscsi(res))
|
||||
tag_type = scsi_change_queue_type(sdev, tag_type);
|
||||
else
|
||||
tag_type = 0;
|
||||
|
||||
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
|
||||
return tag_type;
|
||||
}
|
||||
@ -4765,10 +4751,10 @@ static int ipr_slave_configure(struct scsi_device *sdev)
|
||||
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
|
||||
|
||||
if (ap) {
|
||||
scsi_adjust_queue_depth(sdev, 0, IPR_MAX_CMD_PER_ATA_LUN);
|
||||
scsi_adjust_queue_depth(sdev, IPR_MAX_CMD_PER_ATA_LUN);
|
||||
ata_sas_slave_configure(sdev, ap);
|
||||
} else
|
||||
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
|
||||
}
|
||||
|
||||
if (ioa_cfg->sis64)
|
||||
sdev_printk(KERN_INFO, sdev, "Resource path: %s\n",
|
||||
ipr_format_res_path(ioa_cfg,
|
||||
@ -5672,35 +5658,6 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipr_get_task_attributes - Translate SPI Q-Tag to task attributes
|
||||
* @scsi_cmd: scsi command struct
|
||||
*
|
||||
* Return value:
|
||||
* task attributes
|
||||
**/
|
||||
static u8 ipr_get_task_attributes(struct scsi_cmnd *scsi_cmd)
|
||||
{
|
||||
u8 tag[2];
|
||||
u8 rc = IPR_FLAGS_LO_UNTAGGED_TASK;
|
||||
|
||||
if (scsi_populate_tag_msg(scsi_cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case MSG_SIMPLE_TAG:
|
||||
rc = IPR_FLAGS_LO_SIMPLE_TASK;
|
||||
break;
|
||||
case MSG_HEAD_TAG:
|
||||
rc = IPR_FLAGS_LO_HEAD_OF_Q_TASK;
|
||||
break;
|
||||
case MSG_ORDERED_TAG:
|
||||
rc = IPR_FLAGS_LO_ORDERED_TASK;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipr_erp_done - Process completion of ERP for a device
|
||||
* @ipr_cmd: ipr command struct
|
||||
@ -6236,7 +6193,10 @@ static int ipr_queuecommand(struct Scsi_Host *shost,
|
||||
ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_DELAY_AFTER_RST;
|
||||
}
|
||||
ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_ALIGNED_BFR;
|
||||
ioarcb->cmd_pkt.flags_lo |= ipr_get_task_attributes(scsi_cmd);
|
||||
if (scsi_cmd->flags & SCMD_TAGGED)
|
||||
ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_SIMPLE_TASK;
|
||||
else
|
||||
ioarcb->cmd_pkt.flags_lo |= IPR_FLAGS_LO_UNTAGGED_TASK;
|
||||
}
|
||||
|
||||
if (scsi_cmd->cmnd[0] >= 0xC0 &&
|
||||
@ -6357,6 +6317,7 @@ static struct scsi_host_template driver_template = {
|
||||
.sdev_attrs = ipr_dev_attrs,
|
||||
.proc_name = IPR_NAME,
|
||||
.no_write_same = 1,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1210,7 +1210,7 @@ ips_slave_configure(struct scsi_device * SDptr)
|
||||
min = ha->max_cmds / 2;
|
||||
if (ha->enq->ucLogDriveCount <= 2)
|
||||
min = ha->max_cmds - 1;
|
||||
scsi_adjust_queue_depth(SDptr, MSG_ORDERED_TAG, min);
|
||||
scsi_adjust_queue_depth(SDptr, min);
|
||||
}
|
||||
|
||||
SDptr->skip_ms_page_8 = 1;
|
||||
|
@ -172,6 +172,7 @@ static struct scsi_host_template isci_sht = {
|
||||
.target_destroy = sas_target_destroy,
|
||||
.ioctl = sas_ioctl,
|
||||
.shost_attrs = isci_host_attrs,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static struct sas_domain_function_template isci_transport_ops = {
|
||||
|
@ -2160,12 +2160,7 @@ int fc_slave_alloc(struct scsi_device *sdev)
|
||||
if (!rport || fc_remote_port_chkready(rport))
|
||||
return -ENXIO;
|
||||
|
||||
if (sdev->tagged_supported)
|
||||
scsi_activate_tcq(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
|
||||
else
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
|
||||
FC_FCP_DFLT_QUEUE_DEPTH);
|
||||
|
||||
scsi_adjust_queue_depth(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(fc_slave_alloc);
|
||||
@ -2180,13 +2175,13 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case SCSI_QDEPTH_DEFAULT:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
break;
|
||||
case SCSI_QDEPTH_QFULL:
|
||||
scsi_track_queue_full(sdev, qdepth);
|
||||
break;
|
||||
case SCSI_QDEPTH_RAMP_UP:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
break;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
@ -2195,26 +2190,6 @@ int fc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
}
|
||||
EXPORT_SYMBOL(fc_change_queue_depth);
|
||||
|
||||
/**
|
||||
* fc_change_queue_type() - Change a device's queue type
|
||||
* @sdev: The SCSI device whose queue depth is to change
|
||||
* @tag_type: Identifier for queue type
|
||||
*/
|
||||
int fc_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
|
||||
return tag_type;
|
||||
}
|
||||
EXPORT_SYMBOL(fc_change_queue_type);
|
||||
|
||||
/**
|
||||
* fc_fcp_destory() - Tear down the FCP layer for a given local port
|
||||
* @lport: The local port that no longer needs the FCP layer
|
||||
|
@ -1775,13 +1775,13 @@ int iscsi_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case SCSI_QDEPTH_DEFAULT:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
break;
|
||||
case SCSI_QDEPTH_QFULL:
|
||||
scsi_track_queue_full(sdev, depth);
|
||||
break;
|
||||
case SCSI_QDEPTH_RAMP_UP:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
break;
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
|
@ -940,15 +940,12 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
|
||||
sas_read_port_mode_page(scsi_dev);
|
||||
|
||||
if (scsi_dev->tagged_supported) {
|
||||
scsi_set_tag_type(scsi_dev, MSG_SIMPLE_TAG);
|
||||
scsi_activate_tcq(scsi_dev, SAS_DEF_QD);
|
||||
scsi_adjust_queue_depth(scsi_dev, SAS_DEF_QD);
|
||||
} else {
|
||||
SAS_DPRINTK("device %llx, LUN %llx doesn't support "
|
||||
"TCQ\n", SAS_ADDR(dev->sas_addr),
|
||||
scsi_dev->lun);
|
||||
scsi_dev->tagged_supported = 0;
|
||||
scsi_set_tag_type(scsi_dev, 0);
|
||||
scsi_deactivate_tcq(scsi_dev, 1);
|
||||
scsi_adjust_queue_depth(scsi_dev, 1);
|
||||
}
|
||||
|
||||
scsi_dev->allow_restart = 1;
|
||||
@ -969,7 +966,7 @@ int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
|
||||
case SCSI_QDEPTH_RAMP_UP:
|
||||
if (!sdev->tagged_supported)
|
||||
depth = 1;
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
break;
|
||||
case SCSI_QDEPTH_QFULL:
|
||||
scsi_track_queue_full(sdev, depth);
|
||||
@ -981,22 +978,11 @@ int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
|
||||
return depth;
|
||||
}
|
||||
|
||||
int sas_change_queue_type(struct scsi_device *scsi_dev, int qt)
|
||||
int sas_change_queue_type(struct scsi_device *scsi_dev, int type)
|
||||
{
|
||||
struct domain_device *dev = sdev_to_domain_dev(scsi_dev);
|
||||
|
||||
if (dev_is_sata(dev))
|
||||
if (dev_is_sata(sdev_to_domain_dev(scsi_dev)))
|
||||
return -EINVAL;
|
||||
|
||||
if (!scsi_dev->tagged_supported)
|
||||
return 0;
|
||||
|
||||
scsi_deactivate_tcq(scsi_dev, 1);
|
||||
|
||||
scsi_set_tag_type(scsi_dev, qt);
|
||||
scsi_activate_tcq(scsi_dev, scsi_dev->queue_depth);
|
||||
|
||||
return qt;
|
||||
return scsi_change_queue_type(scsi_dev, type);
|
||||
}
|
||||
|
||||
int sas_bios_param(struct scsi_device *scsi_dev,
|
||||
|
@ -320,7 +320,7 @@ lpfc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
case SCSI_QDEPTH_DEFAULT:
|
||||
/* change request from sysfs, fall through */
|
||||
case SCSI_QDEPTH_RAMP_UP:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
break;
|
||||
case SCSI_QDEPTH_QFULL:
|
||||
if (scsi_track_queue_full(sdev, qdepth) == 0)
|
||||
@ -344,26 +344,6 @@ lpfc_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* lpfc_change_queue_type() - Change a device's scsi tag queuing type
|
||||
* @sdev: Pointer the scsi device whose queue depth is to change
|
||||
* @tag_type: Identifier for queue tag type
|
||||
*/
|
||||
static int
|
||||
lpfc_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
|
||||
return tag_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* lpfc_rampdown_queue_depth - Post RAMP_DOWN_QUEUE event to worker thread
|
||||
* @phba: The Hba for which this call is being executed.
|
||||
@ -4286,7 +4266,6 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
|
||||
IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb;
|
||||
struct lpfc_iocbq *piocbq = &(lpfc_cmd->cur_iocbq);
|
||||
int datadir = scsi_cmnd->sc_data_direction;
|
||||
char tag[2];
|
||||
uint8_t *ptr;
|
||||
bool sli4;
|
||||
uint32_t fcpdl;
|
||||
@ -4308,20 +4287,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
|
||||
memset(ptr, 0, (LPFC_FCP_CDB_LEN - scsi_cmnd->cmd_len));
|
||||
}
|
||||
|
||||
if (scsi_populate_tag_msg(scsi_cmnd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
fcp_cmnd->fcpCntl1 = HEAD_OF_Q;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
fcp_cmnd->fcpCntl1 = ORDERED_Q;
|
||||
break;
|
||||
default:
|
||||
fcp_cmnd->fcpCntl1 = SIMPLE_Q;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
fcp_cmnd->fcpCntl1 = SIMPLE_Q;
|
||||
fcp_cmnd->fcpCntl1 = SIMPLE_Q;
|
||||
|
||||
sli4 = (phba->sli_rev == LPFC_SLI_REV4);
|
||||
piocbq->iocb.un.fcpi.fcpi_XRdy = 0;
|
||||
@ -5632,10 +5598,7 @@ lpfc_slave_configure(struct scsi_device *sdev)
|
||||
struct lpfc_vport *vport = (struct lpfc_vport *) sdev->host->hostdata;
|
||||
struct lpfc_hba *phba = vport->phba;
|
||||
|
||||
if (sdev->tagged_supported)
|
||||
scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, vport->cfg_lun_queue_depth);
|
||||
|
||||
if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
|
||||
lpfc_sli_handle_fast_ring_event(phba,
|
||||
@ -6019,7 +5982,8 @@ struct scsi_host_template lpfc_template = {
|
||||
.max_sectors = 0xFFFF,
|
||||
.vendor_id = LPFC_NL_VENDOR_ID,
|
||||
.change_queue_depth = lpfc_change_queue_depth,
|
||||
.change_queue_type = lpfc_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
struct scsi_host_template lpfc_vport_template = {
|
||||
@ -6042,5 +6006,6 @@ struct scsi_host_template lpfc_vport_template = {
|
||||
.shost_attrs = lpfc_vport_attrs,
|
||||
.max_sectors = 0xFFFF,
|
||||
.change_queue_depth = lpfc_change_queue_depth,
|
||||
.change_queue_type = lpfc_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
@ -1945,7 +1945,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
|
||||
cmd->device->id, (u32)cmd->device->lun);
|
||||
|
||||
if(list_empty(&adapter->pending_list))
|
||||
return FALSE;
|
||||
return FAILED;
|
||||
|
||||
list_for_each_safe(pos, next, &adapter->pending_list) {
|
||||
|
||||
@ -1968,7 +1968,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
|
||||
(aor==SCB_ABORT) ? "ABORTING":"RESET",
|
||||
scb->idx);
|
||||
|
||||
return FALSE;
|
||||
return FAILED;
|
||||
}
|
||||
else {
|
||||
|
||||
@ -1993,12 +1993,12 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
|
||||
list_add_tail(SCSI_LIST(cmd),
|
||||
&adapter->completed_list);
|
||||
|
||||
return TRUE;
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FAILED;
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@ -349,7 +349,7 @@ static int megaraid_change_queue_depth(struct scsi_device *sdev, int qdepth,
|
||||
|
||||
if (qdepth > MBOX_MAX_SCSI_CMDS)
|
||||
qdepth = MBOX_MAX_SCSI_CMDS;
|
||||
scsi_adjust_queue_depth(sdev, 0, qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
|
@ -2594,8 +2594,7 @@ static int megasas_change_queue_depth(struct scsi_device *sdev,
|
||||
|
||||
if (queue_depth > sdev->host->can_queue)
|
||||
queue_depth = sdev->host->can_queue;
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
|
||||
queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
|
||||
return queue_depth;
|
||||
}
|
||||
|
@ -1222,7 +1222,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth)
|
||||
max_depth = 1;
|
||||
if (qdepth > max_depth)
|
||||
qdepth = max_depth;
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1246,36 +1246,14 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
|
||||
if (sdev->inquiry_len > 7)
|
||||
sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), "
|
||||
"simple(%d), ordered(%d), scsi_level(%d), cmd_que(%d)\n",
|
||||
"simple(%d), scsi_level(%d), cmd_que(%d)\n",
|
||||
sdev->queue_depth, sdev->tagged_supported, sdev->simple_tags,
|
||||
sdev->ordered_tags, sdev->scsi_level,
|
||||
sdev->scsi_level,
|
||||
(sdev->inquiry[7] & 2) >> 1);
|
||||
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* _scsih_change_queue_type - changing device queue tag type
|
||||
* @sdev: scsi device struct
|
||||
* @tag_type: requested tag type
|
||||
*
|
||||
* Returns queue tag type.
|
||||
*/
|
||||
static int
|
||||
_scsih_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
|
||||
return tag_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* _scsih_target_alloc - target add routine
|
||||
* @starget: scsi target struct
|
||||
@ -3966,16 +3944,8 @@ _scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
|
||||
mpi_control = MPI2_SCSIIO_CONTROL_NODATATRANSFER;
|
||||
|
||||
/* set tags */
|
||||
if (!(sas_device_priv_data->flags & MPT_DEVICE_FLAGS_INIT)) {
|
||||
if (scmd->device->tagged_supported) {
|
||||
if (scmd->device->ordered_tags)
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_ORDEREDQ;
|
||||
else
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
} else
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
} else
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
|
||||
/* Make sure Device is not raid volume.
|
||||
* We do not expose raid functionality to upper layer for warpdrive.
|
||||
*/
|
||||
@ -7653,7 +7623,7 @@ static struct scsi_host_template scsih_driver_template = {
|
||||
.scan_finished = _scsih_scan_finished,
|
||||
.scan_start = _scsih_scan_start,
|
||||
.change_queue_depth = _scsih_change_queue_depth,
|
||||
.change_queue_type = _scsih_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.eh_abort_handler = _scsih_abort,
|
||||
.eh_device_reset_handler = _scsih_dev_reset,
|
||||
.eh_target_reset_handler = _scsih_target_reset,
|
||||
|
@ -1090,7 +1090,7 @@ _scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth)
|
||||
max_depth = 1;
|
||||
if (qdepth > max_depth)
|
||||
qdepth = max_depth;
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1114,37 +1114,14 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
|
||||
if (sdev->inquiry_len > 7)
|
||||
sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), " \
|
||||
"simple(%d), ordered(%d), scsi_level(%d), cmd_que(%d)\n",
|
||||
"simple(%d), scsi_level(%d), cmd_que(%d)\n",
|
||||
sdev->queue_depth, sdev->tagged_supported, sdev->simple_tags,
|
||||
sdev->ordered_tags, sdev->scsi_level,
|
||||
sdev->scsi_level,
|
||||
(sdev->inquiry[7] & 2) >> 1);
|
||||
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* _scsih_change_queue_type - changing device queue tag type
|
||||
* @sdev: scsi device struct
|
||||
* @tag_type: requested tag type
|
||||
*
|
||||
* Returns queue tag type.
|
||||
*/
|
||||
static int
|
||||
_scsih_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
|
||||
return tag_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* _scsih_target_alloc - target add routine
|
||||
* @starget: scsi target struct
|
||||
@ -3586,16 +3563,7 @@ _scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
|
||||
mpi_control = MPI2_SCSIIO_CONTROL_NODATATRANSFER;
|
||||
|
||||
/* set tags */
|
||||
if (!(sas_device_priv_data->flags & MPT_DEVICE_FLAGS_INIT)) {
|
||||
if (scmd->device->tagged_supported) {
|
||||
if (scmd->device->ordered_tags)
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_ORDEREDQ;
|
||||
else
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
} else
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
} else
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
mpi_control |= MPI2_SCSIIO_CONTROL_SIMPLEQ;
|
||||
|
||||
if ((sas_device_priv_data->flags & MPT_DEVICE_TLR_ON) &&
|
||||
scmd->cmd_len != 32)
|
||||
@ -7284,7 +7252,7 @@ static struct scsi_host_template scsih_driver_template = {
|
||||
.scan_finished = _scsih_scan_finished,
|
||||
.scan_start = _scsih_scan_start,
|
||||
.change_queue_depth = _scsih_change_queue_depth,
|
||||
.change_queue_type = _scsih_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.eh_abort_handler = _scsih_abort,
|
||||
.eh_device_reset_handler = _scsih_dev_reset,
|
||||
.eh_target_reset_handler = _scsih_target_reset,
|
||||
|
@ -76,6 +76,7 @@ static struct scsi_host_template mvs_sht = {
|
||||
.target_destroy = sas_target_destroy,
|
||||
.ioctl = sas_ioctl,
|
||||
.shost_attrs = mvst_host_attrs,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static struct sas_domain_function_template mvs_transport_ops = {
|
||||
|
@ -7997,10 +7997,7 @@ static int ncr53c8xx_slave_configure(struct scsi_device *device)
|
||||
if (depth_to_use > MAX_TAGS)
|
||||
depth_to_use = MAX_TAGS;
|
||||
|
||||
scsi_adjust_queue_depth(device,
|
||||
(device->tagged_supported ?
|
||||
MSG_SIMPLE_TAG : 0),
|
||||
depth_to_use);
|
||||
scsi_adjust_queue_depth(device, depth_to_use);
|
||||
|
||||
/*
|
||||
** Since the queue depth is not tunable under Linux,
|
||||
|
@ -540,9 +540,9 @@ static int osd_remove(struct device *dev)
|
||||
*/
|
||||
|
||||
static struct scsi_driver osd_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
.gendrv = {
|
||||
.name = osd_name,
|
||||
.owner = THIS_MODULE,
|
||||
.probe = osd_probe,
|
||||
.remove = osd_remove,
|
||||
}
|
||||
|
@ -172,9 +172,9 @@ static int osst_probe(struct device *);
|
||||
static int osst_remove(struct device *);
|
||||
|
||||
static struct scsi_driver osst_template = {
|
||||
.owner = THIS_MODULE,
|
||||
.gendrv = {
|
||||
.name = "osst",
|
||||
.owner = THIS_MODULE,
|
||||
.probe = osst_probe,
|
||||
.remove = osst_remove,
|
||||
}
|
||||
@ -259,9 +259,10 @@ static int osst_chk_result(struct osst_tape * STp, struct osst_request * SRpnt)
|
||||
SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2],
|
||||
SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]);
|
||||
if (scode) printk(OSST_DEB_MSG "%s:D: Sense: %02x, ASC: %02x, ASCQ: %02x\n",
|
||||
name, scode, sense[12], sense[13]);
|
||||
name, scode, sense[12], sense[13]);
|
||||
if (cmdstatp->have_sense)
|
||||
__scsi_print_sense("osst ", SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
|
||||
__scsi_print_sense(STp->device, name,
|
||||
SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -275,7 +276,8 @@ static int osst_chk_result(struct osst_tape * STp, struct osst_request * SRpnt)
|
||||
SRpnt->cmd[0] != TEST_UNIT_READY)) { /* Abnormal conditions for tape */
|
||||
if (cmdstatp->have_sense) {
|
||||
printk(KERN_WARNING "%s:W: Command with sense data:\n", name);
|
||||
__scsi_print_sense("osst ", SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
|
||||
__scsi_print_sense(STp->device, name,
|
||||
SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
|
||||
}
|
||||
else {
|
||||
static int notyetprinted = 1;
|
||||
@ -3325,19 +3327,18 @@ static int osst_write_frame(struct osst_tape * STp, struct osst_request ** aSRpn
|
||||
/* Lock or unlock the drive door. Don't use when struct osst_request allocated. */
|
||||
static int do_door_lock(struct osst_tape * STp, int do_lock)
|
||||
{
|
||||
int retval, cmd;
|
||||
int retval;
|
||||
|
||||
cmd = do_lock ? SCSI_IOCTL_DOORLOCK : SCSI_IOCTL_DOORUNLOCK;
|
||||
#if DEBUG
|
||||
printk(OSST_DEB_MSG "%s:D: %socking drive door.\n", tape_name(STp), do_lock ? "L" : "Unl");
|
||||
#endif
|
||||
retval = scsi_ioctl(STp->device, cmd, NULL);
|
||||
if (!retval) {
|
||||
|
||||
retval = scsi_set_medium_removal(STp->device,
|
||||
do_lock ? SCSI_REMOVAL_PREVENT : SCSI_REMOVAL_ALLOW);
|
||||
if (!retval)
|
||||
STp->door_locked = do_lock ? ST_LOCKED_EXPLICIT : ST_UNLOCKED;
|
||||
}
|
||||
else {
|
||||
else
|
||||
STp->door_locked = ST_LOCK_FAILS;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -4967,10 +4968,10 @@ static long osst_ioctl(struct file * file,
|
||||
* may try and take the device offline, in which case all further
|
||||
* access to the device is prohibited.
|
||||
*/
|
||||
if( !scsi_block_when_processing_errors(STp->device) ) {
|
||||
retval = (-ENXIO);
|
||||
retval = scsi_ioctl_block_when_processing_errors(STp->device, cmd_in,
|
||||
file->f_flags & O_NDELAY);
|
||||
if (retval)
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd_type = _IOC_TYPE(cmd_in);
|
||||
cmd_nr = _IOC_NR(cmd_in);
|
||||
|
@ -89,6 +89,7 @@ static struct scsi_host_template pm8001_sht = {
|
||||
.target_destroy = sas_target_destroy,
|
||||
.ioctl = sas_ioctl,
|
||||
.shost_attrs = pm8001_host_attrs,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -249,15 +249,11 @@ static int pmcraid_slave_configure(struct scsi_device *scsi_dev)
|
||||
PMCRAID_VSET_MAX_SECTORS);
|
||||
}
|
||||
|
||||
if (scsi_dev->tagged_supported &&
|
||||
(RES_IS_GSCSI(res->cfg_entry) || RES_IS_VSET(res->cfg_entry))) {
|
||||
scsi_activate_tcq(scsi_dev, scsi_dev->queue_depth);
|
||||
scsi_adjust_queue_depth(scsi_dev, MSG_SIMPLE_TAG,
|
||||
scsi_dev->host->cmd_per_lun);
|
||||
} else {
|
||||
scsi_adjust_queue_depth(scsi_dev, 0,
|
||||
scsi_dev->host->cmd_per_lun);
|
||||
}
|
||||
/*
|
||||
* We never want to report TCQ support for these types of devices.
|
||||
*/
|
||||
if (!RES_IS_GSCSI(res->cfg_entry) && !RES_IS_VSET(res->cfg_entry))
|
||||
scsi_dev->tagged_supported = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -303,40 +299,11 @@ static int pmcraid_change_queue_depth(struct scsi_device *scsi_dev, int depth,
|
||||
if (depth > PMCRAID_MAX_CMD_PER_LUN)
|
||||
depth = PMCRAID_MAX_CMD_PER_LUN;
|
||||
|
||||
scsi_adjust_queue_depth(scsi_dev, scsi_get_tag_type(scsi_dev), depth);
|
||||
scsi_adjust_queue_depth(scsi_dev, depth);
|
||||
|
||||
return scsi_dev->queue_depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* pmcraid_change_queue_type - Change the device's queue type
|
||||
* @scsi_dev: scsi device struct
|
||||
* @tag: type of tags to use
|
||||
*
|
||||
* Return value:
|
||||
* actual queue type set
|
||||
*/
|
||||
static int pmcraid_change_queue_type(struct scsi_device *scsi_dev, int tag)
|
||||
{
|
||||
struct pmcraid_resource_entry *res;
|
||||
|
||||
res = (struct pmcraid_resource_entry *)scsi_dev->hostdata;
|
||||
|
||||
if ((res) && scsi_dev->tagged_supported &&
|
||||
(RES_IS_GSCSI(res->cfg_entry) || RES_IS_VSET(res->cfg_entry))) {
|
||||
scsi_set_tag_type(scsi_dev, tag);
|
||||
|
||||
if (tag)
|
||||
scsi_activate_tcq(scsi_dev, scsi_dev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(scsi_dev, scsi_dev->queue_depth);
|
||||
} else
|
||||
tag = 0;
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pmcraid_init_cmdblk - initializes a command block
|
||||
*
|
||||
@ -3174,36 +3141,6 @@ static int pmcraid_eh_host_reset_handler(struct scsi_cmnd *scmd)
|
||||
return pmcraid_reset_bringup(pinstance) == 0 ? SUCCESS : FAILED;
|
||||
}
|
||||
|
||||
/**
|
||||
* pmcraid_task_attributes - Translate SPI Q-Tags to task attributes
|
||||
* @scsi_cmd: scsi command struct
|
||||
*
|
||||
* Return value
|
||||
* number of tags or 0 if the task is not tagged
|
||||
*/
|
||||
static u8 pmcraid_task_attributes(struct scsi_cmnd *scsi_cmd)
|
||||
{
|
||||
char tag[2];
|
||||
u8 rc = 0;
|
||||
|
||||
if (scsi_populate_tag_msg(scsi_cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case MSG_SIMPLE_TAG:
|
||||
rc = TASK_TAG_SIMPLE;
|
||||
break;
|
||||
case MSG_HEAD_TAG:
|
||||
rc = TASK_TAG_QUEUE_HEAD;
|
||||
break;
|
||||
case MSG_ORDERED_TAG:
|
||||
rc = TASK_TAG_ORDERED;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pmcraid_init_ioadls - initializes IOADL related fields in IOARCB
|
||||
* @cmd: pmcraid command struct
|
||||
@ -3559,7 +3496,9 @@ static int pmcraid_queuecommand_lck(
|
||||
}
|
||||
|
||||
ioarcb->request_flags0 |= NO_LINK_DESCS;
|
||||
ioarcb->request_flags1 |= pmcraid_task_attributes(scsi_cmd);
|
||||
|
||||
if (scsi_cmd->flags & SCMD_TAGGED)
|
||||
ioarcb->request_flags1 |= TASK_TAG_SIMPLE;
|
||||
|
||||
if (RES_IS_GSCSI(res->cfg_entry))
|
||||
ioarcb->request_flags1 |= DELAY_AFTER_RESET;
|
||||
@ -4320,7 +4259,7 @@ static struct scsi_host_template pmcraid_host_template = {
|
||||
.slave_configure = pmcraid_slave_configure,
|
||||
.slave_destroy = pmcraid_slave_destroy,
|
||||
.change_queue_depth = pmcraid_change_queue_depth,
|
||||
.change_queue_type = pmcraid_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.can_queue = PMCRAID_MAX_IO_CMD,
|
||||
.this_id = -1,
|
||||
.sg_tablesize = PMCRAID_MAX_IOADLS,
|
||||
@ -4329,7 +4268,8 @@ static struct scsi_host_template pmcraid_host_template = {
|
||||
.cmd_per_lun = PMCRAID_MAX_CMD_PER_LUN,
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
.shost_attrs = pmcraid_host_attrs,
|
||||
.proc_name = PMCRAID_DRIVER_NAME
|
||||
.proc_name = PMCRAID_DRIVER_NAME,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -220,10 +220,6 @@ static int ps3rom_queuecommand_lck(struct scsi_cmnd *cmd,
|
||||
unsigned char opcode;
|
||||
int res;
|
||||
|
||||
#ifdef DEBUG
|
||||
scsi_print_command(cmd);
|
||||
#endif
|
||||
|
||||
priv->curr_cmd = cmd;
|
||||
cmd->scsi_done = done;
|
||||
|
||||
|
@ -1224,10 +1224,9 @@ qla1280_slave_configure(struct scsi_device *device)
|
||||
|
||||
if (device->tagged_supported &&
|
||||
(ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) {
|
||||
scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
|
||||
ha->bus_settings[bus].hiwat);
|
||||
scsi_adjust_queue_depth(device, ha->bus_settings[bus].hiwat);
|
||||
} else {
|
||||
scsi_adjust_queue_depth(device, 0, default_depth);
|
||||
scsi_adjust_queue_depth(device, default_depth);
|
||||
}
|
||||
|
||||
nv->bus[bus].target[target].parameter.enable_sync = device->sdtr;
|
||||
|
@ -325,7 +325,6 @@ qla2x00_start_scsi(srb_t *sp)
|
||||
struct qla_hw_data *ha;
|
||||
struct req_que *req;
|
||||
struct rsp_que *rsp;
|
||||
char tag[2];
|
||||
|
||||
/* Setup device pointers. */
|
||||
ret = 0;
|
||||
@ -404,26 +403,7 @@ qla2x00_start_scsi(srb_t *sp)
|
||||
/* Set target ID and LUN number*/
|
||||
SET_TARGET_ID(ha, cmd_pkt->target, sp->fcport->loop_id);
|
||||
cmd_pkt->lun = cpu_to_le16(cmd->device->lun);
|
||||
|
||||
/* Update tagged queuing modifier */
|
||||
if (scsi_populate_tag_msg(cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
cmd_pkt->control_flags =
|
||||
__constant_cpu_to_le16(CF_HEAD_TAG);
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
cmd_pkt->control_flags =
|
||||
__constant_cpu_to_le16(CF_ORDERED_TAG);
|
||||
break;
|
||||
default:
|
||||
cmd_pkt->control_flags =
|
||||
__constant_cpu_to_le16(CF_SIMPLE_TAG);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
|
||||
}
|
||||
cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
|
||||
|
||||
/* Load SCSI command packet. */
|
||||
memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len);
|
||||
@ -1264,7 +1244,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
|
||||
uint16_t fcp_cmnd_len;
|
||||
struct fcp_cmnd *fcp_cmnd;
|
||||
dma_addr_t crc_ctx_dma;
|
||||
char tag[2];
|
||||
|
||||
cmd = GET_CMD_SP(sp);
|
||||
|
||||
@ -1356,25 +1335,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
|
||||
cmd_pkt->fcp_cmnd_dseg_address[1] = cpu_to_le32(
|
||||
MSD(crc_ctx_dma + CRC_CONTEXT_FCPCMND_OFF));
|
||||
fcp_cmnd->task_management = 0;
|
||||
|
||||
/*
|
||||
* Update tagged queuing modifier if using command tag queuing
|
||||
*/
|
||||
if (scsi_populate_tag_msg(cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
fcp_cmnd->task_attribute = TSK_HEAD_OF_QUEUE;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
fcp_cmnd->task_attribute = TSK_ORDERED;
|
||||
break;
|
||||
default:
|
||||
fcp_cmnd->task_attribute = TSK_SIMPLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
fcp_cmnd->task_attribute = TSK_SIMPLE;
|
||||
}
|
||||
fcp_cmnd->task_attribute = TSK_SIMPLE;
|
||||
|
||||
cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */
|
||||
|
||||
@ -1495,7 +1456,6 @@ qla24xx_start_scsi(srb_t *sp)
|
||||
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
|
||||
struct scsi_qla_host *vha = sp->fcport->vha;
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
char tag[2];
|
||||
|
||||
/* Setup device pointers. */
|
||||
ret = 0;
|
||||
@ -1578,22 +1538,7 @@ qla24xx_start_scsi(srb_t *sp)
|
||||
int_to_scsilun(cmd->device->lun, &cmd_pkt->lun);
|
||||
host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
|
||||
|
||||
/* Update tagged queuing modifier -- default is TSK_SIMPLE (0). */
|
||||
if (scsi_populate_tag_msg(cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
cmd_pkt->task = TSK_HEAD_OF_QUEUE;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
cmd_pkt->task = TSK_ORDERED;
|
||||
break;
|
||||
default:
|
||||
cmd_pkt->task = TSK_SIMPLE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
cmd_pkt->task = TSK_SIMPLE;
|
||||
}
|
||||
cmd_pkt->task = TSK_SIMPLE;
|
||||
|
||||
/* Load SCSI command packet. */
|
||||
memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
|
||||
@ -2310,7 +2255,6 @@ qla82xx_start_scsi(srb_t *sp)
|
||||
struct qla_hw_data *ha = vha->hw;
|
||||
struct req_que *req = NULL;
|
||||
struct rsp_que *rsp = NULL;
|
||||
char tag[2];
|
||||
|
||||
/* Setup device pointers. */
|
||||
ret = 0;
|
||||
@ -2489,22 +2433,6 @@ sufficient_dsds:
|
||||
else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
|
||||
ctx->fcp_cmnd->additional_cdb_len |= 2;
|
||||
|
||||
/*
|
||||
* Update tagged queuing modifier -- default is TSK_SIMPLE (0).
|
||||
*/
|
||||
if (scsi_populate_tag_msg(cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
ctx->fcp_cmnd->task_attribute =
|
||||
TSK_HEAD_OF_QUEUE;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
ctx->fcp_cmnd->task_attribute =
|
||||
TSK_ORDERED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Populate the FCP_PRIO. */
|
||||
if (ha->flags.fcp_prio_enabled)
|
||||
ctx->fcp_cmnd->task_attribute |=
|
||||
@ -2565,20 +2493,6 @@ sufficient_dsds:
|
||||
host_to_fcp_swap((uint8_t *)&cmd_pkt->lun,
|
||||
sizeof(cmd_pkt->lun));
|
||||
|
||||
/*
|
||||
* Update tagged queuing modifier -- default is TSK_SIMPLE (0).
|
||||
*/
|
||||
if (scsi_populate_tag_msg(cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
cmd_pkt->task = TSK_HEAD_OF_QUEUE;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
cmd_pkt->task = TSK_ORDERED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Populate the FCP_PRIO. */
|
||||
if (ha->flags.fcp_prio_enabled)
|
||||
cmd_pkt->task |= sp->fcport->fcp_prio << 3;
|
||||
|
@ -3086,7 +3086,6 @@ qlafx00_start_scsi(srb_t *sp)
|
||||
struct cmd_type_7_fx00 *cmd_pkt;
|
||||
struct cmd_type_7_fx00 lcmd_pkt;
|
||||
struct scsi_lun llun;
|
||||
char tag[2];
|
||||
|
||||
/* Setup device pointers. */
|
||||
ret = 0;
|
||||
@ -3157,18 +3156,6 @@ qlafx00_start_scsi(srb_t *sp)
|
||||
host_to_adap((uint8_t *)&llun, (uint8_t *)&lcmd_pkt.lun,
|
||||
sizeof(lcmd_pkt.lun));
|
||||
|
||||
/* Update tagged queuing modifier -- default is TSK_SIMPLE (0). */
|
||||
if (scsi_populate_tag_msg(cmd, tag)) {
|
||||
switch (tag[0]) {
|
||||
case HEAD_OF_QUEUE_TAG:
|
||||
lcmd_pkt.task = TSK_HEAD_OF_QUEUE;
|
||||
break;
|
||||
case ORDERED_QUEUE_TAG:
|
||||
lcmd_pkt.task = TSK_ORDERED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load SCSI command packet. */
|
||||
host_to_adap(cmd->cmnd, lcmd_pkt.fcp_cdb, sizeof(lcmd_pkt.fcp_cdb));
|
||||
lcmd_pkt.byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
|
||||
|
@ -237,7 +237,6 @@ static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
|
||||
static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
|
||||
|
||||
static int qla2x00_change_queue_depth(struct scsi_device *, int, int);
|
||||
static int qla2x00_change_queue_type(struct scsi_device *, int);
|
||||
static void qla2x00_clear_drv_active(struct qla_hw_data *);
|
||||
static void qla2x00_free_device(scsi_qla_host_t *);
|
||||
static void qla83xx_disable_laser(scsi_qla_host_t *vha);
|
||||
@ -260,7 +259,7 @@ struct scsi_host_template qla2xxx_driver_template = {
|
||||
.scan_finished = qla2xxx_scan_finished,
|
||||
.scan_start = qla2xxx_scan_start,
|
||||
.change_queue_depth = qla2x00_change_queue_depth,
|
||||
.change_queue_type = qla2x00_change_queue_type,
|
||||
.change_queue_type = scsi_change_queue_type,
|
||||
.this_id = -1,
|
||||
.cmd_per_lun = 3,
|
||||
.use_clustering = ENABLE_CLUSTERING,
|
||||
@ -270,6 +269,7 @@ struct scsi_host_template qla2xxx_driver_template = {
|
||||
.shost_attrs = qla2x00_host_attrs,
|
||||
|
||||
.supported_mode = MODE_INITIATOR,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static struct scsi_transport_template *qla2xxx_transport_template = NULL;
|
||||
@ -1405,10 +1405,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
|
||||
if (IS_T10_PI_CAPABLE(vha->hw))
|
||||
blk_queue_update_dma_alignment(sdev->request_queue, 0x7);
|
||||
|
||||
if (sdev->tagged_supported)
|
||||
scsi_activate_tcq(sdev, req->max_q_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, req->max_q_depth);
|
||||
scsi_adjust_queue_depth(sdev, req->max_q_depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1443,10 +1440,7 @@ static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth)
|
||||
if (req->max_q_depth <= sdev->queue_depth || req->max_q_depth < qdepth)
|
||||
return;
|
||||
|
||||
if (sdev->ordered_tags)
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, qdepth);
|
||||
else
|
||||
scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
|
||||
ql_dbg(ql_dbg_io, vha, 0x302a,
|
||||
"Queue depth adjusted-up to %d for nexus=%ld:%d:%llu.\n",
|
||||
@ -1458,7 +1452,7 @@ qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case SCSI_QDEPTH_DEFAULT:
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
break;
|
||||
case SCSI_QDEPTH_QFULL:
|
||||
qla2x00_handle_queue_full(sdev, qdepth);
|
||||
@ -1473,21 +1467,6 @@ qla2x00_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
return sdev->queue_depth;
|
||||
}
|
||||
|
||||
static int
|
||||
qla2x00_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
if (tag_type)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
tag_type = 0;
|
||||
|
||||
return tag_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
|
||||
* @ha: HA context
|
||||
|
@ -280,7 +280,6 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
|
||||
uint16_t req_cnt;
|
||||
unsigned long flags;
|
||||
uint32_t index;
|
||||
char tag[2];
|
||||
|
||||
/* Get real lun and adapter */
|
||||
ddb_entry = srb->ddb;
|
||||
@ -352,15 +351,6 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
|
||||
|
||||
/* Set tagged queueing control flags */
|
||||
cmd_entry->control_flags |= CF_SIMPLE_TAG;
|
||||
if (scsi_populate_tag_msg(cmd, tag))
|
||||
switch (tag[0]) {
|
||||
case MSG_HEAD_TAG:
|
||||
cmd_entry->control_flags |= CF_HEAD_TAG;
|
||||
break;
|
||||
case MSG_ORDERED_TAG:
|
||||
cmd_entry->control_flags |= CF_ORDERED_TAG;
|
||||
break;
|
||||
}
|
||||
|
||||
qla4xxx_advance_req_ring_ptr(ha);
|
||||
qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds);
|
||||
|
@ -162,8 +162,6 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd);
|
||||
static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd);
|
||||
static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd);
|
||||
static int qla4xxx_slave_alloc(struct scsi_device *device);
|
||||
static int qla4xxx_slave_configure(struct scsi_device *device);
|
||||
static void qla4xxx_slave_destroy(struct scsi_device *sdev);
|
||||
static umode_t qla4_attr_is_visible(int param_type, int param);
|
||||
static int qla4xxx_host_reset(struct Scsi_Host *shost, int reset_type);
|
||||
static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth,
|
||||
@ -204,9 +202,7 @@ static struct scsi_host_template qla4xxx_driver_template = {
|
||||
.eh_host_reset_handler = qla4xxx_eh_host_reset,
|
||||
.eh_timed_out = qla4xxx_eh_cmd_timed_out,
|
||||
|
||||
.slave_configure = qla4xxx_slave_configure,
|
||||
.slave_alloc = qla4xxx_slave_alloc,
|
||||
.slave_destroy = qla4xxx_slave_destroy,
|
||||
.change_queue_depth = qla4xxx_change_queue_depth,
|
||||
|
||||
.this_id = -1,
|
||||
@ -218,6 +214,7 @@ static struct scsi_host_template qla4xxx_driver_template = {
|
||||
.shost_attrs = qla4xxx_host_attrs,
|
||||
.host_reset = qla4xxx_host_reset,
|
||||
.vendor_id = SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_QLOGIC,
|
||||
.use_blk_tags = 1,
|
||||
};
|
||||
|
||||
static struct iscsi_transport qla4xxx_iscsi_transport = {
|
||||
@ -9060,26 +9057,14 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev)
|
||||
ddb = sess->dd_data;
|
||||
|
||||
sdev->hostdata = ddb;
|
||||
sdev->tagged_supported = 1;
|
||||
|
||||
if (ql4xmaxqdepth != 0 && ql4xmaxqdepth <= 0xffffU)
|
||||
queue_depth = ql4xmaxqdepth;
|
||||
|
||||
scsi_activate_tcq(sdev, queue_depth);
|
||||
scsi_adjust_queue_depth(sdev, queue_depth);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qla4xxx_slave_configure(struct scsi_device *sdev)
|
||||
{
|
||||
sdev->tagged_supported = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void qla4xxx_slave_destroy(struct scsi_device *sdev)
|
||||
{
|
||||
scsi_deactivate_tcq(sdev, 1);
|
||||
}
|
||||
|
||||
static int qla4xxx_change_queue_depth(struct scsi_device *sdev, int qdepth,
|
||||
int reason)
|
||||
{
|
||||
|
@ -527,9 +527,9 @@ void scsi_log_send(struct scsi_cmnd *cmd)
|
||||
*
|
||||
* 1: nothing (match completion)
|
||||
*
|
||||
* 2: log opcode + command of all commands
|
||||
* 2: log opcode + command of all commands + cmd address
|
||||
*
|
||||
* 3: same as 2 plus dump cmd address
|
||||
* 3: same as 2
|
||||
*
|
||||
* 4: same as 3 plus dump extra junk
|
||||
*/
|
||||
@ -537,10 +537,8 @@ void scsi_log_send(struct scsi_cmnd *cmd)
|
||||
level = SCSI_LOG_LEVEL(SCSI_LOG_MLQUEUE_SHIFT,
|
||||
SCSI_LOG_MLQUEUE_BITS);
|
||||
if (level > 1) {
|
||||
scmd_printk(KERN_INFO, cmd, "Send: ");
|
||||
if (level > 2)
|
||||
printk("0x%p ", cmd);
|
||||
printk("\n");
|
||||
scmd_printk(KERN_INFO, cmd,
|
||||
"Send: scmd 0x%p\n", cmd);
|
||||
scsi_print_command(cmd);
|
||||
if (level > 3) {
|
||||
printk(KERN_INFO "buffer = 0x%p, bufflen = %d,"
|
||||
@ -565,7 +563,7 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
|
||||
*
|
||||
* 2: same as 1 but for all command completions.
|
||||
*
|
||||
* 3: same as 2 plus dump cmd address
|
||||
* 3: same as 2
|
||||
*
|
||||
* 4: same as 3 plus dump extra junk
|
||||
*/
|
||||
@ -574,39 +572,10 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
|
||||
SCSI_LOG_MLCOMPLETE_BITS);
|
||||
if (((level > 0) && (cmd->result || disposition != SUCCESS)) ||
|
||||
(level > 1)) {
|
||||
scmd_printk(KERN_INFO, cmd, "Done: ");
|
||||
if (level > 2)
|
||||
printk("0x%p ", cmd);
|
||||
/*
|
||||
* Dump truncated values, so we usually fit within
|
||||
* 80 chars.
|
||||
*/
|
||||
switch (disposition) {
|
||||
case SUCCESS:
|
||||
printk("SUCCESS\n");
|
||||
break;
|
||||
case NEEDS_RETRY:
|
||||
printk("RETRY\n");
|
||||
break;
|
||||
case ADD_TO_MLQUEUE:
|
||||
printk("MLQUEUE\n");
|
||||
break;
|
||||
case FAILED:
|
||||
printk("FAILED\n");
|
||||
break;
|
||||
case TIMEOUT_ERROR:
|
||||
/*
|
||||
* If called via scsi_times_out.
|
||||
*/
|
||||
printk("TIMEOUT\n");
|
||||
break;
|
||||
default:
|
||||
printk("UNKNOWN\n");
|
||||
}
|
||||
scsi_print_result(cmd);
|
||||
scsi_print_result(cmd, "Done: ", disposition);
|
||||
scsi_print_command(cmd);
|
||||
if (status_byte(cmd->result) & CHECK_CONDITION)
|
||||
scsi_print_sense("", cmd);
|
||||
scsi_print_sense(cmd);
|
||||
if (level > 3)
|
||||
scmd_printk(KERN_INFO, cmd,
|
||||
"scsi host busy %d failed %d\n",
|
||||
@ -633,87 +602,6 @@ void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd)
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_cmd_get_serial);
|
||||
|
||||
/**
|
||||
* scsi_dispatch_command - Dispatch a command to the low-level driver.
|
||||
* @cmd: command block we are dispatching.
|
||||
*
|
||||
* Return: nonzero return request was rejected and device's queue needs to be
|
||||
* plugged.
|
||||
*/
|
||||
int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
|
||||
{
|
||||
struct Scsi_Host *host = cmd->device->host;
|
||||
int rtn = 0;
|
||||
|
||||
atomic_inc(&cmd->device->iorequest_cnt);
|
||||
|
||||
/* check if the device is still usable */
|
||||
if (unlikely(cmd->device->sdev_state == SDEV_DEL)) {
|
||||
/* in SDEV_DEL we error all commands. DID_NO_CONNECT
|
||||
* returns an immediate error upwards, and signals
|
||||
* that the device is no longer present */
|
||||
cmd->result = DID_NO_CONNECT << 16;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Check to see if the scsi lld made this device blocked. */
|
||||
if (unlikely(scsi_device_blocked(cmd->device))) {
|
||||
/*
|
||||
* in blocked state, the command is just put back on
|
||||
* the device queue. The suspend state has already
|
||||
* blocked the queue so future requests should not
|
||||
* occur until the device transitions out of the
|
||||
* suspend state.
|
||||
*/
|
||||
SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
|
||||
"queuecommand : device blocked\n"));
|
||||
return SCSI_MLQUEUE_DEVICE_BUSY;
|
||||
}
|
||||
|
||||
/* Store the LUN value in cmnd, if needed. */
|
||||
if (cmd->device->lun_in_cdb)
|
||||
cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
|
||||
(cmd->device->lun << 5 & 0xe0);
|
||||
|
||||
scsi_log_send(cmd);
|
||||
|
||||
/*
|
||||
* Before we queue this command, check if the command
|
||||
* length exceeds what the host adapter can handle.
|
||||
*/
|
||||
if (cmd->cmd_len > cmd->device->host->max_cmd_len) {
|
||||
SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
|
||||
"queuecommand : command too long. "
|
||||
"cdb_size=%d host->max_cmd_len=%d\n",
|
||||
cmd->cmd_len, cmd->device->host->max_cmd_len));
|
||||
cmd->result = (DID_ABORT << 16);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (unlikely(host->shost_state == SHOST_DEL)) {
|
||||
cmd->result = (DID_NO_CONNECT << 16);
|
||||
goto done;
|
||||
|
||||
}
|
||||
|
||||
trace_scsi_dispatch_cmd_start(cmd);
|
||||
rtn = host->hostt->queuecommand(host, cmd);
|
||||
if (rtn) {
|
||||
trace_scsi_dispatch_cmd_error(cmd, rtn);
|
||||
if (rtn != SCSI_MLQUEUE_DEVICE_BUSY &&
|
||||
rtn != SCSI_MLQUEUE_TARGET_BUSY)
|
||||
rtn = SCSI_MLQUEUE_HOST_BUSY;
|
||||
|
||||
SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
|
||||
"queuecommand : request rejected\n"));
|
||||
}
|
||||
|
||||
return rtn;
|
||||
done:
|
||||
cmd->scsi_done(cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* scsi_finish_command - cleanup and pass command back to upper layer
|
||||
* @cmd: the command
|
||||
@ -775,8 +663,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
|
||||
/**
|
||||
* scsi_adjust_queue_depth - Let low level drivers change a device's queue depth
|
||||
* @sdev: SCSI Device in question
|
||||
* @tagged: Do we use tagged queueing (non-0) or do we treat
|
||||
* this device as an untagged device (0)
|
||||
* @tags: Number of tags allowed if tagged queueing enabled,
|
||||
* or number of commands the low level driver can
|
||||
* queue up in non-tagged mode (as per cmd_per_lun).
|
||||
@ -790,7 +676,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
|
||||
* currently active and whether or not it even has the
|
||||
* command blocks built yet.
|
||||
*/
|
||||
void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
|
||||
void scsi_adjust_queue_depth(struct scsi_device *sdev, int tags)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
@ -818,26 +704,6 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
|
||||
}
|
||||
|
||||
sdev->queue_depth = tags;
|
||||
switch (tagged) {
|
||||
case 0:
|
||||
sdev->ordered_tags = 0;
|
||||
sdev->simple_tags = 0;
|
||||
break;
|
||||
case MSG_ORDERED_TAG:
|
||||
sdev->ordered_tags = 1;
|
||||
sdev->simple_tags = 1;
|
||||
break;
|
||||
case MSG_SIMPLE_TAG:
|
||||
sdev->ordered_tags = 0;
|
||||
sdev->simple_tags = 1;
|
||||
break;
|
||||
default:
|
||||
sdev->ordered_tags = 0;
|
||||
sdev->simple_tags = 0;
|
||||
sdev_printk(KERN_WARNING, sdev,
|
||||
"scsi_adjust_queue_depth, bad queue type, "
|
||||
"disabled\n");
|
||||
}
|
||||
out:
|
||||
spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
|
||||
}
|
||||
@ -885,18 +751,32 @@ int scsi_track_queue_full(struct scsi_device *sdev, int depth)
|
||||
return 0;
|
||||
if (sdev->last_queue_full_depth < 8) {
|
||||
/* Drop back to untagged */
|
||||
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
|
||||
scsi_set_tag_type(sdev, 0);
|
||||
scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sdev->ordered_tags)
|
||||
scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
|
||||
else
|
||||
scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
|
||||
|
||||
scsi_adjust_queue_depth(sdev, depth);
|
||||
return depth;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_track_queue_full);
|
||||
|
||||
/**
|
||||
* scsi_change_queue_type() - Change a device's queue type
|
||||
* @sdev: The SCSI device whose queue depth is to change
|
||||
* @tag_type: Identifier for queue type
|
||||
*/
|
||||
int scsi_change_queue_type(struct scsi_device *sdev, int tag_type)
|
||||
{
|
||||
if (!sdev->tagged_supported)
|
||||
return 0;
|
||||
|
||||
scsi_set_tag_type(sdev, tag_type);
|
||||
return tag_type;
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_change_queue_type);
|
||||
|
||||
/**
|
||||
* scsi_vpd_inquiry - Request a device provide us with a VPD page
|
||||
* @sdev: The device to ask
|
||||
|
@ -2701,10 +2701,6 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
|
||||
if (NULL == devip)
|
||||
return 1; /* no resources, will be marked offline */
|
||||
sdp->hostdata = devip;
|
||||
sdp->tagged_supported = 1;
|
||||
if (sdp->host->cmd_per_lun)
|
||||
scsi_adjust_queue_depth(sdp, DEF_TAGGED_QUEUING,
|
||||
DEF_CMD_PER_LUN);
|
||||
blk_queue_max_segment_size(sdp->request_queue, -1U);
|
||||
if (scsi_debug_no_uld)
|
||||
sdp->no_uld_attach = 1;
|
||||
@ -4214,7 +4210,7 @@ scsi_debug_queuecommand(struct scsi_cmnd *SCpnt)
|
||||
case READ_CAPACITY:
|
||||
errsts = resp_readcap(SCpnt, devip);
|
||||
break;
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
if (cmd[1] == SAI_READ_CAPACITY_16)
|
||||
errsts = resp_readcap16(SCpnt, devip);
|
||||
else if (cmd[1] == SAI_GET_LBA_STATUS) {
|
||||
@ -4494,7 +4490,7 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
/* allow to exceed max host queued_arr elements for testing */
|
||||
if (qdepth > SCSI_DEBUG_CANQUEUE + 10)
|
||||
qdepth = SCSI_DEBUG_CANQUEUE + 10;
|
||||
scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
|
||||
scsi_adjust_queue_depth(sdev, qdepth);
|
||||
} else if (reason == SCSI_QDEPTH_QFULL)
|
||||
scsi_track_queue_full(sdev, qdepth);
|
||||
else
|
||||
@ -4532,14 +4528,7 @@ sdebug_change_qdepth(struct scsi_device *sdev, int qdepth, int reason)
|
||||
static int
|
||||
sdebug_change_qtype(struct scsi_device *sdev, int qtype)
|
||||
{
|
||||
if (sdev->tagged_supported) {
|
||||
scsi_set_tag_type(sdev, qtype);
|
||||
if (qtype)
|
||||
scsi_activate_tcq(sdev, sdev->queue_depth);
|
||||
else
|
||||
scsi_deactivate_tcq(sdev, sdev->queue_depth);
|
||||
} else
|
||||
qtype = 0;
|
||||
qtype = scsi_change_queue_type(sdev, qtype);
|
||||
if (SCSI_DEBUG_OPT_Q_NOISE & scsi_debug_opts) {
|
||||
const char *cp;
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <scsi/scsi_transport.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <scsi/scsi_ioctl.h>
|
||||
#include <scsi/sg.h>
|
||||
|
||||
#include "scsi_priv.h"
|
||||
#include "scsi_logging.h"
|
||||
@ -157,8 +158,9 @@ scmd_eh_abort_handler(struct work_struct *work)
|
||||
} else {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
scmd_printk(KERN_INFO, scmd,
|
||||
"scmd %p abort failed, rtn %d\n",
|
||||
scmd, rtn));
|
||||
"scmd %p abort %s\n", scmd,
|
||||
(rtn == FAST_IO_FAIL) ?
|
||||
"not send" : "failed"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,7 +357,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost,
|
||||
|
||||
if (cmd_cancel || cmd_failed) {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"%s: cmds failed: %d, cancel: %d\n",
|
||||
__func__, cmd_failed,
|
||||
cmd_cancel));
|
||||
@ -869,7 +871,24 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
|
||||
return rtn;
|
||||
}
|
||||
|
||||
static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct scsi_cmnd *scmd)
|
||||
/**
|
||||
* scsi_try_to_abort_cmd - Ask host to abort a SCSI command
|
||||
* @scmd: SCSI cmd used to send a target reset
|
||||
*
|
||||
* Return value:
|
||||
* SUCCESS, FAILED, or FAST_IO_FAIL
|
||||
*
|
||||
* Notes:
|
||||
* SUCCESS does not necessarily indicate that the command
|
||||
* has been aborted; it only indicates that the LLDDs
|
||||
* has cleared all references to that command.
|
||||
* LLDDs should return FAILED only if an abort was required
|
||||
* but could not be executed. LLDDs should return FAST_IO_FAIL
|
||||
* if the device is temporarily unavailable (eg due to a
|
||||
* link down on FibreChannel)
|
||||
*/
|
||||
static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt,
|
||||
struct scsi_cmnd *scmd)
|
||||
{
|
||||
if (!hostt->eh_abort_handler)
|
||||
return FAILED;
|
||||
@ -1156,9 +1175,9 @@ int scsi_eh_get_sense(struct list_head *work_q,
|
||||
shost = scmd->device->host;
|
||||
if (scsi_host_eh_past_deadline(shost)) {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"skip %s, past eh deadline\n",
|
||||
__func__));
|
||||
scmd_printk(KERN_INFO, scmd,
|
||||
"%s: skip request sense, past eh deadline\n",
|
||||
current->comm));
|
||||
break;
|
||||
}
|
||||
if (status_byte(scmd->result) != CHECK_CONDITION)
|
||||
@ -1180,7 +1199,7 @@ int scsi_eh_get_sense(struct list_head *work_q,
|
||||
SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd,
|
||||
"sense requested for %p result %x\n",
|
||||
scmd, scmd->result));
|
||||
SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense("bh", scmd));
|
||||
SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense(scmd));
|
||||
|
||||
rtn = scsi_decide_disposition(scmd);
|
||||
|
||||
@ -1265,9 +1284,9 @@ static int scsi_eh_test_devices(struct list_head *cmd_list,
|
||||
/* Push items back onto work_q */
|
||||
list_splice_init(cmd_list, work_q);
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, sdev->host,
|
||||
"skip %s, past eh deadline",
|
||||
__func__));
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: skip test device, past eh deadline",
|
||||
current->comm));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1318,21 +1337,20 @@ static int scsi_eh_abort_cmds(struct list_head *work_q,
|
||||
if (scsi_host_eh_past_deadline(shost)) {
|
||||
list_splice_init(&check_list, work_q);
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"skip %s, past eh deadline\n",
|
||||
__func__));
|
||||
scmd_printk(KERN_INFO, scmd,
|
||||
"%s: skip aborting cmd, past eh deadline\n",
|
||||
current->comm));
|
||||
return list_empty(work_q);
|
||||
}
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"%s: aborting cmd: 0x%p\n",
|
||||
current->comm, scmd));
|
||||
scmd_printk(KERN_INFO, scmd,
|
||||
"%s: aborting cmd\n", current->comm));
|
||||
rtn = scsi_try_to_abort_cmd(shost->hostt, scmd);
|
||||
if (rtn == FAILED) {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"%s: aborting cmd failed: 0x%p\n",
|
||||
current->comm, scmd));
|
||||
scmd_printk(KERN_INFO, scmd,
|
||||
"%s: aborting cmd failed\n",
|
||||
current->comm));
|
||||
list_splice_init(&check_list, work_q);
|
||||
return list_empty(work_q);
|
||||
}
|
||||
@ -1390,9 +1408,9 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
|
||||
shost_for_each_device(sdev, shost) {
|
||||
if (scsi_host_eh_past_deadline(shost)) {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"skip %s, past eh deadline\n",
|
||||
__func__));
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: skip START_UNIT, past eh deadline\n",
|
||||
current->comm));
|
||||
break;
|
||||
}
|
||||
stu_scmd = NULL;
|
||||
@ -1407,9 +1425,9 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
|
||||
continue;
|
||||
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"%s: Sending START_UNIT to sdev: 0x%p\n",
|
||||
current->comm, sdev));
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: Sending START_UNIT\n",
|
||||
current->comm));
|
||||
|
||||
if (!scsi_eh_try_stu(stu_scmd)) {
|
||||
if (!scsi_device_online(sdev) ||
|
||||
@ -1423,9 +1441,9 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
|
||||
}
|
||||
} else {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"%s: START_UNIT failed to sdev:"
|
||||
" 0x%p\n", current->comm, sdev));
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: START_UNIT failed\n",
|
||||
current->comm));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1456,9 +1474,9 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
|
||||
shost_for_each_device(sdev, shost) {
|
||||
if (scsi_host_eh_past_deadline(shost)) {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"skip %s, past eh deadline\n",
|
||||
__func__));
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: skip BDR, past eh deadline\n",
|
||||
current->comm));
|
||||
break;
|
||||
}
|
||||
bdr_scmd = NULL;
|
||||
@ -1472,9 +1490,8 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
|
||||
continue;
|
||||
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"%s: Sending BDR sdev: 0x%p\n",
|
||||
current->comm, sdev));
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: Sending BDR\n", current->comm));
|
||||
rtn = scsi_try_bus_device_reset(bdr_scmd);
|
||||
if (rtn == SUCCESS || rtn == FAST_IO_FAIL) {
|
||||
if (!scsi_device_online(sdev) ||
|
||||
@ -1490,9 +1507,8 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
|
||||
}
|
||||
} else {
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"%s: BDR failed sdev: 0x%p\n",
|
||||
current->comm, sdev));
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"%s: BDR failed\n", current->comm));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1528,8 +1544,8 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost,
|
||||
list_splice_init(&tmp_list, work_q);
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"skip %s, past eh deadline\n",
|
||||
__func__));
|
||||
"%s: Skip target reset, past eh deadline\n",
|
||||
current->comm));
|
||||
return list_empty(work_q);
|
||||
}
|
||||
|
||||
@ -1591,8 +1607,8 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,
|
||||
list_splice_init(&check_list, work_q);
|
||||
SCSI_LOG_ERROR_RECOVERY(3,
|
||||
shost_printk(KERN_INFO, shost,
|
||||
"skip %s, past eh deadline\n",
|
||||
__func__));
|
||||
"%s: skip BRST, past eh deadline\n",
|
||||
current->comm));
|
||||
return list_empty(work_q);
|
||||
}
|
||||
|
||||
@ -2193,9 +2209,9 @@ int scsi_error_handler(void *data)
|
||||
*/
|
||||
if (!shost->eh_noresume && scsi_autopm_get_host(shost) != 0) {
|
||||
SCSI_LOG_ERROR_RECOVERY(1,
|
||||
printk(KERN_ERR "Error handler scsi_eh_%d "
|
||||
"unable to autoresume\n",
|
||||
shost->host_no));
|
||||
shost_printk(KERN_ERR, shost,
|
||||
"scsi_eh_%d: unable to autoresume\n",
|
||||
shost->host_no));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2296,42 +2312,34 @@ scsi_reset_provider_done_command(struct scsi_cmnd *scmd)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: scsi_reset_provider
|
||||
*
|
||||
* Purpose: Send requested reset to a bus or device at any phase.
|
||||
*
|
||||
* Arguments: device - device to send reset to
|
||||
* flag - reset type (see scsi.h)
|
||||
*
|
||||
* Returns: SUCCESS/FAILURE.
|
||||
*
|
||||
* Notes: This is used by the SCSI Generic driver to provide
|
||||
* Bus/Device reset capability.
|
||||
/**
|
||||
* scsi_ioctl_reset: explicitly reset a host/bus/target/device
|
||||
* @dev: scsi_device to operate on
|
||||
* @arg: reset type (see sg.h)
|
||||
*/
|
||||
int
|
||||
scsi_reset_provider(struct scsi_device *dev, int flag)
|
||||
scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
|
||||
{
|
||||
struct scsi_cmnd *scmd;
|
||||
struct Scsi_Host *shost = dev->host;
|
||||
struct request req;
|
||||
unsigned long flags;
|
||||
int rtn;
|
||||
int error = 0, rtn, val;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
|
||||
return -EACCES;
|
||||
|
||||
error = get_user(val, arg);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (scsi_autopm_get_host(shost) < 0)
|
||||
return FAILED;
|
||||
|
||||
if (!get_device(&dev->sdev_gendev)) {
|
||||
rtn = FAILED;
|
||||
goto out_put_autopm_host;
|
||||
}
|
||||
return -EIO;
|
||||
|
||||
error = -EIO;
|
||||
scmd = scsi_get_command(dev, GFP_KERNEL);
|
||||
if (!scmd) {
|
||||
rtn = FAILED;
|
||||
put_device(&dev->sdev_gendev);
|
||||
if (!scmd)
|
||||
goto out_put_autopm_host;
|
||||
}
|
||||
|
||||
blk_rq_init(NULL, &req);
|
||||
scmd->request = &req;
|
||||
@ -2349,29 +2357,37 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
|
||||
shost->tmf_in_progress = 1;
|
||||
spin_unlock_irqrestore(shost->host_lock, flags);
|
||||
|
||||
switch (flag) {
|
||||
case SCSI_TRY_RESET_DEVICE:
|
||||
rtn = scsi_try_bus_device_reset(scmd);
|
||||
if (rtn == SUCCESS)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case SCSI_TRY_RESET_TARGET:
|
||||
rtn = scsi_try_target_reset(scmd);
|
||||
if (rtn == SUCCESS)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case SCSI_TRY_RESET_BUS:
|
||||
rtn = scsi_try_bus_reset(scmd);
|
||||
if (rtn == SUCCESS)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case SCSI_TRY_RESET_HOST:
|
||||
rtn = scsi_try_host_reset(scmd);
|
||||
switch (val & ~SG_SCSI_RESET_NO_ESCALATE) {
|
||||
case SG_SCSI_RESET_NOTHING:
|
||||
rtn = SUCCESS;
|
||||
break;
|
||||
case SG_SCSI_RESET_DEVICE:
|
||||
rtn = scsi_try_bus_device_reset(scmd);
|
||||
if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case SG_SCSI_RESET_TARGET:
|
||||
rtn = scsi_try_target_reset(scmd);
|
||||
if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case SG_SCSI_RESET_BUS:
|
||||
rtn = scsi_try_bus_reset(scmd);
|
||||
if (rtn == SUCCESS || (val & SG_SCSI_RESET_NO_ESCALATE))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case SG_SCSI_RESET_HOST:
|
||||
rtn = scsi_try_host_reset(scmd);
|
||||
if (rtn == SUCCESS)
|
||||
break;
|
||||
default:
|
||||
/* FALLTHROUGH */
|
||||
rtn = FAILED;
|
||||
break;
|
||||
}
|
||||
|
||||
error = (rtn == SUCCESS) ? 0 : -EIO;
|
||||
|
||||
spin_lock_irqsave(shost->host_lock, flags);
|
||||
shost->tmf_in_progress = 0;
|
||||
spin_unlock_irqrestore(shost->host_lock, flags);
|
||||
@ -2385,15 +2401,15 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
|
||||
"waking up host to restart after TMF\n"));
|
||||
|
||||
wake_up(&shost->host_wait);
|
||||
|
||||
scsi_run_host_queues(shost);
|
||||
|
||||
scsi_next_command(scmd);
|
||||
scsi_put_command(scmd);
|
||||
|
||||
out_put_autopm_host:
|
||||
scsi_autopm_put_host(shost);
|
||||
return rtn;
|
||||
return error;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_reset_provider);
|
||||
EXPORT_SYMBOL(scsi_ioctl_reset);
|
||||
|
||||
/**
|
||||
* scsi_normalize_sense - normalize main elements from either fixed or
|
||||
@ -2412,20 +2428,20 @@ EXPORT_SYMBOL(scsi_reset_provider);
|
||||
* responded to a SCSI command with the CHECK_CONDITION status.
|
||||
*
|
||||
* Return value:
|
||||
* 1 if valid sense data information found, else 0;
|
||||
* true if valid sense data information found, else false;
|
||||
*/
|
||||
int scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
if (!sense_buffer || !sb_len)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
memset(sshdr, 0, sizeof(struct scsi_sense_hdr));
|
||||
|
||||
sshdr->response_code = (sense_buffer[0] & 0x7f);
|
||||
|
||||
if (!scsi_sense_valid(sshdr))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
if (sshdr->response_code >= 0x72) {
|
||||
/*
|
||||
@ -2455,12 +2471,12 @@ int scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_normalize_sense);
|
||||
|
||||
int scsi_command_normalize_sense(struct scsi_cmnd *cmd,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
bool scsi_command_normalize_sense(const struct scsi_cmnd *cmd,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
return scsi_normalize_sense(cmd->sense_buffer,
|
||||
SCSI_SENSE_BUFFERSIZE, sshdr);
|
||||
|
@ -126,7 +126,7 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
|
||||
sdev_printk(KERN_INFO, sdev,
|
||||
"ioctl_internal_command return code = %x\n",
|
||||
result);
|
||||
scsi_print_sense_hdr(" ", &sshdr);
|
||||
scsi_print_sense_hdr(sdev, NULL, &sshdr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -200,19 +200,6 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
|
||||
{
|
||||
char scsi_cmd[MAX_COMMAND_SIZE];
|
||||
|
||||
/* No idea how this happens.... */
|
||||
if (!sdev)
|
||||
return -ENXIO;
|
||||
|
||||
/*
|
||||
* If we are in the middle of error recovery, don't let anyone
|
||||
* else try and use this device. Also, if error recovery fails, it
|
||||
* may try and take the device offline, in which case all further
|
||||
* access to the device is prohibited.
|
||||
*/
|
||||
if (!scsi_block_when_processing_errors(sdev))
|
||||
return -ENODEV;
|
||||
|
||||
/* Check for deprecated ioctls ... all the ioctls which don't
|
||||
* follow the new unique numbering scheme are deprecated */
|
||||
switch (cmd) {
|
||||
@ -273,6 +260,8 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
|
||||
START_STOP_TIMEOUT, NORMAL_RETRIES);
|
||||
case SCSI_IOCTL_GET_PCI:
|
||||
return scsi_ioctl_get_pci(sdev, arg);
|
||||
case SG_SCSI_RESET:
|
||||
return scsi_ioctl_reset(sdev, arg);
|
||||
default:
|
||||
if (sdev->host->hostt->ioctl)
|
||||
return sdev->host->hostt->ioctl(sdev, cmd, arg);
|
||||
@ -281,55 +270,20 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_ioctl);
|
||||
|
||||
/**
|
||||
* scsi_nonblockable_ioctl() - Handle SG_SCSI_RESET
|
||||
* @sdev: scsi device receiving ioctl
|
||||
* @cmd: Must be SC_SCSI_RESET
|
||||
* @arg: pointer to int containing SG_SCSI_RESET_{DEVICE,BUS,HOST}
|
||||
* @ndelay: file mode O_NDELAY flag
|
||||
/*
|
||||
* We can process a reset even when a device isn't fully operable.
|
||||
*/
|
||||
int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
|
||||
void __user *arg, int ndelay)
|
||||
int scsi_ioctl_block_when_processing_errors(struct scsi_device *sdev, int cmd,
|
||||
bool ndelay)
|
||||
{
|
||||
int val, result;
|
||||
|
||||
/* The first set of iocts may be executed even if we're doing
|
||||
* error processing, as long as the device was opened
|
||||
* non-blocking */
|
||||
if (ndelay) {
|
||||
if (cmd == SG_SCSI_RESET && ndelay) {
|
||||
if (scsi_host_in_recovery(sdev->host))
|
||||
return -EAGAIN;
|
||||
} else {
|
||||
if (!scsi_block_when_processing_errors(sdev))
|
||||
return -ENODEV;
|
||||
} else if (!scsi_block_when_processing_errors(sdev))
|
||||
return -ENODEV;
|
||||
|
||||
switch (cmd) {
|
||||
case SG_SCSI_RESET:
|
||||
result = get_user(val, (int __user *)arg);
|
||||
if (result)
|
||||
return result;
|
||||
if (val == SG_SCSI_RESET_NOTHING)
|
||||
return 0;
|
||||
switch (val) {
|
||||
case SG_SCSI_RESET_DEVICE:
|
||||
val = SCSI_TRY_RESET_DEVICE;
|
||||
break;
|
||||
case SG_SCSI_RESET_TARGET:
|
||||
val = SCSI_TRY_RESET_TARGET;
|
||||
break;
|
||||
case SG_SCSI_RESET_BUS:
|
||||
val = SCSI_TRY_RESET_BUS;
|
||||
break;
|
||||
case SG_SCSI_RESET_HOST:
|
||||
val = SCSI_TRY_RESET_HOST;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
|
||||
return -EACCES;
|
||||
return (scsi_reset_provider(sdev, val) ==
|
||||
SUCCESS) ? 0 : -EIO;
|
||||
}
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_nonblockable_ioctl);
|
||||
EXPORT_SYMBOL_GPL(scsi_ioctl_block_when_processing_errors);
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/blk-mq.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
@ -47,7 +48,7 @@ struct scsi_host_sg_pool {
|
||||
mempool_t *pool;
|
||||
};
|
||||
|
||||
#define SP(x) { x, "sgpool-" __stringify(x) }
|
||||
#define SP(x) { .size = x, "sgpool-" __stringify(x) }
|
||||
#if (SCSI_MAX_SG_SEGMENTS < 32)
|
||||
#error SCSI_MAX_SG_SEGMENTS is too small (must be 32 or greater)
|
||||
#endif
|
||||
@ -542,17 +543,6 @@ static void scsi_requeue_command(struct request_queue *q, struct scsi_cmnd *cmd)
|
||||
put_device(&sdev->sdev_gendev);
|
||||
}
|
||||
|
||||
void scsi_next_command(struct scsi_cmnd *cmd)
|
||||
{
|
||||
struct scsi_device *sdev = cmd->device;
|
||||
struct request_queue *q = sdev->request_queue;
|
||||
|
||||
scsi_put_command(cmd);
|
||||
scsi_run_queue(q);
|
||||
|
||||
put_device(&sdev->sdev_gendev);
|
||||
}
|
||||
|
||||
void scsi_run_host_queues(struct Scsi_Host *shost)
|
||||
{
|
||||
struct scsi_device *sdev;
|
||||
@ -598,10 +588,10 @@ static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq)
|
||||
__sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free);
|
||||
}
|
||||
|
||||
static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents,
|
||||
gfp_t gfp_mask, bool mq)
|
||||
static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq)
|
||||
{
|
||||
struct scatterlist *first_chunk = NULL;
|
||||
gfp_t gfp_mask = mq ? GFP_NOIO : GFP_ATOMIC;
|
||||
int ret;
|
||||
|
||||
BUG_ON(!nents);
|
||||
@ -730,8 +720,6 @@ static bool scsi_end_request(struct request *req, int error,
|
||||
kblockd_schedule_work(&sdev->requeue_work);
|
||||
else
|
||||
blk_mq_start_stopped_hw_queues(q, true);
|
||||
|
||||
put_device(&sdev->sdev_gendev);
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
@ -743,9 +731,12 @@ static bool scsi_end_request(struct request *req, int error,
|
||||
spin_unlock_irqrestore(q->queue_lock, flags);
|
||||
|
||||
scsi_release_buffers(cmd);
|
||||
scsi_next_command(cmd);
|
||||
|
||||
scsi_put_command(cmd);
|
||||
scsi_run_queue(q);
|
||||
}
|
||||
|
||||
put_device(&sdev->sdev_gendev);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -831,8 +822,8 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
|
||||
struct request *req = cmd->request;
|
||||
int error = 0;
|
||||
struct scsi_sense_hdr sshdr;
|
||||
int sense_valid = 0;
|
||||
int sense_deferred = 0;
|
||||
bool sense_valid = false;
|
||||
int sense_deferred = 0, level = 0;
|
||||
enum {ACTION_FAIL, ACTION_REPREP, ACTION_RETRY,
|
||||
ACTION_DELAYED_RETRY} action;
|
||||
unsigned long wait_for = (cmd->allowed + 1) * req->timeout;
|
||||
@ -912,7 +903,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
|
||||
if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
|
||||
;
|
||||
else if (!(req->cmd_flags & REQ_QUIET))
|
||||
scsi_print_sense("", cmd);
|
||||
scsi_print_sense(cmd);
|
||||
result = 0;
|
||||
/* BLOCK_PC may have set error */
|
||||
error = 0;
|
||||
@ -1039,10 +1030,24 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
|
||||
case ACTION_FAIL:
|
||||
/* Give up and fail the remainder of the request */
|
||||
if (!(req->cmd_flags & REQ_QUIET)) {
|
||||
scsi_print_result(cmd);
|
||||
if (driver_byte(result) & DRIVER_SENSE)
|
||||
scsi_print_sense("", cmd);
|
||||
scsi_print_command(cmd);
|
||||
static DEFINE_RATELIMIT_STATE(_rs,
|
||||
DEFAULT_RATELIMIT_INTERVAL,
|
||||
DEFAULT_RATELIMIT_BURST);
|
||||
|
||||
if (unlikely(scsi_logging_level))
|
||||
level = SCSI_LOG_LEVEL(SCSI_LOG_MLCOMPLETE_SHIFT,
|
||||
SCSI_LOG_MLCOMPLETE_BITS);
|
||||
|
||||
/*
|
||||
* if logging is enabled the failure will be printed
|
||||
* in scsi_log_completion(), so avoid duplicate messages
|
||||
*/
|
||||
if (!level && __ratelimit(&_rs)) {
|
||||
scsi_print_result(cmd, NULL, FAILED);
|
||||
if (driver_byte(result) & DRIVER_SENSE)
|
||||
scsi_print_sense(cmd);
|
||||
scsi_print_command(cmd);
|
||||
}
|
||||
}
|
||||
if (!scsi_end_request(req, error, blk_rq_err_bytes(req), 0))
|
||||
return;
|
||||
@ -1072,8 +1077,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
|
||||
}
|
||||
}
|
||||
|
||||
static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
|
||||
gfp_t gfp_mask)
|
||||
static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb)
|
||||
{
|
||||
int count;
|
||||
|
||||
@ -1081,7 +1085,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
|
||||
* If sg table allocation fails, requeue request later.
|
||||
*/
|
||||
if (unlikely(scsi_alloc_sgtable(sdb, req->nr_phys_segments,
|
||||
gfp_mask, req->mq_ctx != NULL)))
|
||||
req->mq_ctx != NULL)))
|
||||
return BLKPREP_DEFER;
|
||||
|
||||
/*
|
||||
@ -1106,7 +1110,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
|
||||
* BLKPREP_DEFER if the failure is retryable
|
||||
* BLKPREP_KILL if the failure is fatal
|
||||
*/
|
||||
int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
|
||||
int scsi_init_io(struct scsi_cmnd *cmd)
|
||||
{
|
||||
struct scsi_device *sdev = cmd->device;
|
||||
struct request *rq = cmd->request;
|
||||
@ -1115,7 +1119,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
|
||||
|
||||
BUG_ON(!rq->nr_phys_segments);
|
||||
|
||||
error = scsi_init_sgtable(rq, &cmd->sdb, gfp_mask);
|
||||
error = scsi_init_sgtable(rq, &cmd->sdb);
|
||||
if (error)
|
||||
goto err_exit;
|
||||
|
||||
@ -1131,8 +1135,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
|
||||
rq->next_rq->special = bidi_sdb;
|
||||
}
|
||||
|
||||
error = scsi_init_sgtable(rq->next_rq, rq->next_rq->special,
|
||||
GFP_ATOMIC);
|
||||
error = scsi_init_sgtable(rq->next_rq, rq->next_rq->special);
|
||||
if (error)
|
||||
goto err_exit;
|
||||
}
|
||||
@ -1144,7 +1147,7 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)
|
||||
BUG_ON(prot_sdb == NULL);
|
||||
ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio);
|
||||
|
||||
if (scsi_alloc_sgtable(prot_sdb, ivecs, gfp_mask, is_mq)) {
|
||||
if (scsi_alloc_sgtable(prot_sdb, ivecs, is_mq)) {
|
||||
error = BLKPREP_DEFER;
|
||||
goto err_exit;
|
||||
}
|
||||
@ -1213,7 +1216,7 @@ static int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req)
|
||||
* submit a request without an attached bio.
|
||||
*/
|
||||
if (req->bio) {
|
||||
int ret = scsi_init_io(cmd, GFP_ATOMIC);
|
||||
int ret = scsi_init_io(cmd);
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
} else {
|
||||
@ -1637,6 +1640,87 @@ static void scsi_softirq_done(struct request *rq)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* scsi_dispatch_command - Dispatch a command to the low-level driver.
|
||||
* @cmd: command block we are dispatching.
|
||||
*
|
||||
* Return: nonzero return request was rejected and device's queue needs to be
|
||||
* plugged.
|
||||
*/
|
||||
static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
|
||||
{
|
||||
struct Scsi_Host *host = cmd->device->host;
|
||||
int rtn = 0;
|
||||
|
||||
atomic_inc(&cmd->device->iorequest_cnt);
|
||||
|
||||
/* check if the device is still usable */
|
||||
if (unlikely(cmd->device->sdev_state == SDEV_DEL)) {
|
||||
/* in SDEV_DEL we error all commands. DID_NO_CONNECT
|
||||
* returns an immediate error upwards, and signals
|
||||
* that the device is no longer present */
|
||||
cmd->result = DID_NO_CONNECT << 16;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Check to see if the scsi lld made this device blocked. */
|
||||
if (unlikely(scsi_device_blocked(cmd->device))) {
|
||||
/*
|
||||
* in blocked state, the command is just put back on
|
||||
* the device queue. The suspend state has already
|
||||
* blocked the queue so future requests should not
|
||||
* occur until the device transitions out of the
|
||||
* suspend state.
|
||||
*/
|
||||
SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
|
||||
"queuecommand : device blocked\n"));
|
||||
return SCSI_MLQUEUE_DEVICE_BUSY;
|
||||
}
|
||||
|
||||
/* Store the LUN value in cmnd, if needed. */
|
||||
if (cmd->device->lun_in_cdb)
|
||||
cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
|
||||
(cmd->device->lun << 5 & 0xe0);
|
||||
|
||||
scsi_log_send(cmd);
|
||||
|
||||
/*
|
||||
* Before we queue this command, check if the command
|
||||
* length exceeds what the host adapter can handle.
|
||||
*/
|
||||
if (cmd->cmd_len > cmd->device->host->max_cmd_len) {
|
||||
SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
|
||||
"queuecommand : command too long. "
|
||||
"cdb_size=%d host->max_cmd_len=%d\n",
|
||||
cmd->cmd_len, cmd->device->host->max_cmd_len));
|
||||
cmd->result = (DID_ABORT << 16);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (unlikely(host->shost_state == SHOST_DEL)) {
|
||||
cmd->result = (DID_NO_CONNECT << 16);
|
||||
goto done;
|
||||
|
||||
}
|
||||
|
||||
trace_scsi_dispatch_cmd_start(cmd);
|
||||
rtn = host->hostt->queuecommand(host, cmd);
|
||||
if (rtn) {
|
||||
trace_scsi_dispatch_cmd_error(cmd, rtn);
|
||||
if (rtn != SCSI_MLQUEUE_DEVICE_BUSY &&
|
||||
rtn != SCSI_MLQUEUE_TARGET_BUSY)
|
||||
rtn = SCSI_MLQUEUE_HOST_BUSY;
|
||||
|
||||
SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd,
|
||||
"queuecommand : request rejected\n"));
|
||||
}
|
||||
|
||||
return rtn;
|
||||
done:
|
||||
cmd->scsi_done(cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* scsi_done - Invoke completion on finished SCSI command.
|
||||
* @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
|
||||
@ -1725,7 +1809,7 @@ static void scsi_request_fn(struct request_queue *q)
|
||||
* we add the dev to the starved list so it eventually gets
|
||||
* a run when a tag is freed.
|
||||
*/
|
||||
if (blk_queue_tagged(q) && !blk_rq_tagged(req)) {
|
||||
if (blk_queue_tagged(q) && !(req->cmd_flags & REQ_QUEUED)) {
|
||||
spin_lock_irq(shost->host_lock);
|
||||
if (list_empty(&sdev->starved_entry))
|
||||
list_add_tail(&sdev->starved_entry,
|
||||
@ -1739,6 +1823,11 @@ static void scsi_request_fn(struct request_queue *q)
|
||||
|
||||
if (!scsi_host_queue_ready(q, shost, sdev))
|
||||
goto host_not_ready;
|
||||
|
||||
if (sdev->simple_tags)
|
||||
cmd->flags |= SCMD_TAGGED;
|
||||
else
|
||||
cmd->flags &= ~SCMD_TAGGED;
|
||||
|
||||
/*
|
||||
* Finally, initialize any error handling parameters, and set up
|
||||
@ -1893,10 +1982,10 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req,
|
||||
blk_mq_start_request(req);
|
||||
}
|
||||
|
||||
if (blk_queue_tagged(q))
|
||||
req->cmd_flags |= REQ_QUEUED;
|
||||
if (sdev->simple_tags)
|
||||
cmd->flags |= SCMD_TAGGED;
|
||||
else
|
||||
req->cmd_flags &= ~REQ_QUEUED;
|
||||
cmd->flags &= ~SCMD_TAGGED;
|
||||
|
||||
scsi_init_cmd_errh(cmd);
|
||||
cmd->scsi_done = scsi_mq_done;
|
||||
@ -2091,7 +2180,7 @@ int scsi_mq_setup_tags(struct Scsi_Host *shost)
|
||||
|
||||
memset(&shost->tag_set, 0, sizeof(shost->tag_set));
|
||||
shost->tag_set.ops = &scsi_mq_ops;
|
||||
shost->tag_set.nr_hw_queues = 1;
|
||||
shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1;
|
||||
shost->tag_set.queue_depth = shost->can_queue;
|
||||
shost->tag_set.cmd_size = cmd_size;
|
||||
shost->tag_set.numa_node = NUMA_NO_NODE;
|
||||
|
@ -51,6 +51,7 @@ do { \
|
||||
} while (0); \
|
||||
} while (0)
|
||||
#else
|
||||
#define SCSI_LOG_LEVEL(SHIFT, BITS) 0
|
||||
#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD)
|
||||
#endif /* CONFIG_SCSI_LOGGING */
|
||||
|
||||
|
@ -29,7 +29,6 @@ extern int scsi_init_hosts(void);
|
||||
extern void scsi_exit_hosts(void);
|
||||
|
||||
/* scsi.c */
|
||||
extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd);
|
||||
extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
|
||||
extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
|
||||
#ifdef CONFIG_SCSI_LOGGING
|
||||
@ -84,7 +83,6 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd);
|
||||
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
|
||||
extern void scsi_device_unbusy(struct scsi_device *sdev);
|
||||
extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
|
||||
extern void scsi_next_command(struct scsi_cmnd *cmd);
|
||||
extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
|
||||
extern void scsi_run_host_queues(struct Scsi_Host *shost);
|
||||
extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
|
||||
|
@ -286,7 +286,13 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
|
||||
}
|
||||
WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
|
||||
sdev->request_queue->queuedata = sdev;
|
||||
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
|
||||
|
||||
if (!shost_use_blk_mq(sdev->host) &&
|
||||
(shost->bqt || shost->hostt->use_blk_tags)) {
|
||||
blk_queue_init_tags(sdev->request_queue,
|
||||
sdev->host->cmd_per_lun, shost->bqt);
|
||||
}
|
||||
scsi_adjust_queue_depth(sdev, sdev->host->cmd_per_lun);
|
||||
|
||||
scsi_sysfs_device_initialize(sdev);
|
||||
|
||||
@ -874,8 +880,10 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
|
||||
(inq_result[3] & 0x0f) == 1 ? " CCS" : "");
|
||||
|
||||
if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) &&
|
||||
!(*bflags & BLIST_NOTQ))
|
||||
!(*bflags & BLIST_NOTQ)) {
|
||||
sdev->tagged_supported = 1;
|
||||
sdev->simple_tags = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Some devices (Texel CD ROM drives) have handshaking problems
|
||||
@ -1214,9 +1222,9 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
|
||||
sparse_lun = 0;
|
||||
|
||||
/*
|
||||
* If less than SCSI_1_CSS, and no special lun scaning, stop
|
||||
* If less than SCSI_1_CCS, and no special lun scanning, stop
|
||||
* scanning; this matches 2.4 behaviour, but could just be a bug
|
||||
* (to continue scanning a SCSI_1_CSS device).
|
||||
* (to continue scanning a SCSI_1_CCS device).
|
||||
*
|
||||
* This test is broken. We might not have any device on lun0 for
|
||||
* a sparselun device, and if that's the case then how would we
|
||||
@ -1585,16 +1593,15 @@ EXPORT_SYMBOL(scsi_add_device);
|
||||
|
||||
void scsi_rescan_device(struct device *dev)
|
||||
{
|
||||
struct scsi_driver *drv;
|
||||
|
||||
if (!dev->driver)
|
||||
return;
|
||||
|
||||
drv = to_scsi_driver(dev->driver);
|
||||
if (try_module_get(drv->owner)) {
|
||||
if (try_module_get(dev->driver->owner)) {
|
||||
struct scsi_driver *drv = to_scsi_driver(dev->driver);
|
||||
|
||||
if (drv->rescan)
|
||||
drv->rescan(dev);
|
||||
module_put(drv->owner);
|
||||
module_put(dev->driver->owner);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_rescan_device);
|
||||
@ -1727,7 +1734,7 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
|
||||
|
||||
if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) ||
|
||||
((id != SCAN_WILD_CARD) && (id >= shost->max_id)) ||
|
||||
((lun != SCAN_WILD_CARD) && (lun > shost->max_lun)))
|
||||
((lun != SCAN_WILD_CARD) && (lun >= shost->max_lun)))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&shost->scan_mutex);
|
||||
|
@ -727,9 +727,7 @@ show_queue_type_field(struct device *dev, struct device_attribute *attr,
|
||||
struct scsi_device *sdev = to_scsi_device(dev);
|
||||
const char *name = "none";
|
||||
|
||||
if (sdev->ordered_tags)
|
||||
name = "ordered";
|
||||
else if (sdev->simple_tags)
|
||||
if (sdev->simple_tags)
|
||||
name = "simple";
|
||||
|
||||
return snprintf(buf, 20, "%s\n", name);
|
||||
@ -747,9 +745,12 @@ store_queue_type_field(struct device *dev, struct device_attribute *attr,
|
||||
if (!sdev->tagged_supported || !sht->change_queue_type)
|
||||
return -EINVAL;
|
||||
|
||||
if (strncmp(buf, "ordered", 7) == 0)
|
||||
tag_type = MSG_ORDERED_TAG;
|
||||
else if (strncmp(buf, "simple", 6) == 0)
|
||||
/*
|
||||
* We're never issueing order tags these days, but allow the value
|
||||
* for backwards compatibility.
|
||||
*/
|
||||
if (strncmp(buf, "ordered", 7) == 0 ||
|
||||
strncmp(buf, "simple", 6) == 0)
|
||||
tag_type = MSG_SIMPLE_TAG;
|
||||
else if (strncmp(buf, "none", 4) != 0)
|
||||
return -EINVAL;
|
||||
|
@ -278,7 +278,7 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char *cdb, int len)
|
||||
return scsi_trace_rw16(p, cdb, len);
|
||||
case UNMAP:
|
||||
return scsi_trace_unmap(p, cdb, len);
|
||||
case SERVICE_ACTION_IN:
|
||||
case SERVICE_ACTION_IN_16:
|
||||
return scsi_trace_service_action_in(p, cdb, len);
|
||||
case VARIABLE_LENGTH_CMD:
|
||||
return scsi_trace_varlen(p, cdb, len);
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <scsi/scsi_host.h>
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
#include <scsi/scsi_eh.h>
|
||||
#include <scsi/scsi_tcq.h>
|
||||
#include <scsi/scsi_transport.h>
|
||||
#include <scsi/scsi_transport_spi.h>
|
||||
|
||||
@ -1207,6 +1208,28 @@ int spi_populate_ppr_msg(unsigned char *msg, int period, int offset,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(spi_populate_ppr_msg);
|
||||
|
||||
/**
|
||||
* spi_populate_tag_msg - place a tag message in a buffer
|
||||
* @msg: pointer to the area to place the tag
|
||||
* @cmd: pointer to the scsi command for the tag
|
||||
*
|
||||
* Notes:
|
||||
* designed to create the correct type of tag message for the
|
||||
* particular request. Returns the size of the tag message.
|
||||
* May return 0 if TCQ is disabled for this device.
|
||||
**/
|
||||
int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd)
|
||||
{
|
||||
if (cmd->flags & SCMD_TAGGED) {
|
||||
*msg++ = MSG_SIMPLE_TAG;
|
||||
*msg++ = cmd->request->tag;
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(spi_populate_tag_msg);
|
||||
|
||||
#ifdef CONFIG_SCSI_CONSTANTS
|
||||
static const char * const one_byte_msgs[] = {
|
||||
/* 0x00 */ "Task Complete", NULL /* Extended Message */, "Save Pointers",
|
||||
|
@ -163,8 +163,8 @@ int scsi_partsize(unsigned char *buf, unsigned long capacity,
|
||||
end_head * end_sector + end_sector;
|
||||
|
||||
/* This is the actual _sector_ number at the end */
|
||||
logical_end = get_unaligned(&largest->start_sect)
|
||||
+ get_unaligned(&largest->nr_sects);
|
||||
logical_end = get_unaligned_le32(&largest->start_sect)
|
||||
+ get_unaligned_le32(&largest->nr_sects);
|
||||
|
||||
/* This is for >1023 cylinders */
|
||||
ext_cyl = (logical_end - (end_head * end_sector + end_sector))
|
||||
|
@ -116,7 +116,7 @@ static int sd_eh_action(struct scsi_cmnd *, int);
|
||||
static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
|
||||
static void scsi_disk_release(struct device *cdev);
|
||||
static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
|
||||
static void sd_print_result(struct scsi_disk *, int);
|
||||
static void sd_print_result(const struct scsi_disk *, const char *, int);
|
||||
|
||||
static DEFINE_SPINLOCK(sd_index_lock);
|
||||
static DEFINE_IDA(sd_index_ida);
|
||||
@ -510,9 +510,9 @@ static const struct dev_pm_ops sd_pm_ops = {
|
||||
};
|
||||
|
||||
static struct scsi_driver sd_template = {
|
||||
.owner = THIS_MODULE,
|
||||
.gendrv = {
|
||||
.name = "sd",
|
||||
.owner = THIS_MODULE,
|
||||
.probe = sd_probe,
|
||||
.remove = sd_remove,
|
||||
.shutdown = sd_shutdown,
|
||||
@ -656,7 +656,7 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
|
||||
unsigned int logical_block_size = sdkp->device->sector_size;
|
||||
unsigned int max_blocks = 0;
|
||||
|
||||
q->limits.discard_zeroes_data = sdkp->lbprz;
|
||||
q->limits.discard_zeroes_data = 0;
|
||||
q->limits.discard_alignment = sdkp->unmap_alignment *
|
||||
logical_block_size;
|
||||
q->limits.discard_granularity =
|
||||
@ -680,11 +680,13 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
|
||||
case SD_LBP_WS16:
|
||||
max_blocks = min_not_zero(sdkp->max_ws_blocks,
|
||||
(u32)SD_MAX_WS16_BLOCKS);
|
||||
q->limits.discard_zeroes_data = sdkp->lbprz;
|
||||
break;
|
||||
|
||||
case SD_LBP_WS10:
|
||||
max_blocks = min_not_zero(sdkp->max_ws_blocks,
|
||||
(u32)SD_MAX_WS10_BLOCKS);
|
||||
q->limits.discard_zeroes_data = sdkp->lbprz;
|
||||
break;
|
||||
|
||||
case SD_LBP_ZERO:
|
||||
@ -784,7 +786,7 @@ static int sd_setup_discard_cmnd(struct scsi_cmnd *cmd)
|
||||
* amount of blocks described by the request.
|
||||
*/
|
||||
blk_add_request_payload(rq, page, len);
|
||||
ret = scsi_init_io(cmd, GFP_ATOMIC);
|
||||
ret = scsi_init_io(cmd);
|
||||
rq->__data_len = nr_bytes;
|
||||
|
||||
out:
|
||||
@ -878,7 +880,7 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
|
||||
* knows how much to actually write.
|
||||
*/
|
||||
rq->__data_len = sdp->sector_size;
|
||||
ret = scsi_init_io(cmd, GFP_ATOMIC);
|
||||
ret = scsi_init_io(cmd);
|
||||
rq->__data_len = nr_bytes;
|
||||
return ret;
|
||||
}
|
||||
@ -912,7 +914,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt)
|
||||
int ret;
|
||||
unsigned char protect;
|
||||
|
||||
ret = scsi_init_io(SCpnt, GFP_ATOMIC);
|
||||
ret = scsi_init_io(SCpnt);
|
||||
if (ret != BLKPREP_OK)
|
||||
goto out;
|
||||
SCpnt = rq->special;
|
||||
@ -1334,9 +1336,9 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
* may try and take the device offline, in which case all further
|
||||
* access to the device is prohibited.
|
||||
*/
|
||||
error = scsi_nonblockable_ioctl(sdp, cmd, p,
|
||||
(mode & FMODE_NDELAY) != 0);
|
||||
if (!scsi_block_when_processing_errors(sdp) || !error)
|
||||
error = scsi_ioctl_block_when_processing_errors(sdp, cmd,
|
||||
(mode & FMODE_NDELAY) != 0);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
@ -1492,7 +1494,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
|
||||
}
|
||||
|
||||
if (res) {
|
||||
sd_print_result(sdkp, res);
|
||||
sd_print_result(sdkp, "Synchronize Cache(10) failed", res);
|
||||
|
||||
if (driver_byte(res) & DRIVER_SENSE)
|
||||
sd_print_sense_hdr(sdkp, &sshdr);
|
||||
@ -1541,31 +1543,19 @@ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device;
|
||||
int ret;
|
||||
int error;
|
||||
|
||||
ret = scsi_verify_blk_ioctl(bdev, cmd);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* If we are in the middle of error recovery, don't let anyone
|
||||
* else try and use this device. Also, if error recovery fails, it
|
||||
* may try and take the device offline, in which case all further
|
||||
* access to the device is prohibited.
|
||||
*/
|
||||
if (!scsi_block_when_processing_errors(sdev))
|
||||
return -ENODEV;
|
||||
error = scsi_ioctl_block_when_processing_errors(sdev, cmd,
|
||||
(mode & FMODE_NDELAY) != 0);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (sdev->host->hostt->compat_ioctl) {
|
||||
ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Let the static ioctl translation table take care of it.
|
||||
*/
|
||||
return -ENOIOCTLCMD;
|
||||
if (!sdev->host->hostt->compat_ioctl)
|
||||
return -ENOIOCTLCMD;
|
||||
return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1713,17 +1703,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
|
||||
if (sense_valid)
|
||||
sense_deferred = scsi_sense_is_deferred(&sshdr);
|
||||
}
|
||||
#ifdef CONFIG_SCSI_LOGGING
|
||||
SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
|
||||
if (sense_valid) {
|
||||
SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
|
||||
"sd_done: sb[respc,sk,asc,"
|
||||
"ascq]=%x,%x,%x,%x\n",
|
||||
sshdr.response_code,
|
||||
sshdr.sense_key, sshdr.asc,
|
||||
sshdr.ascq));
|
||||
}
|
||||
#endif
|
||||
sdkp->medium_access_timed_out = 0;
|
||||
|
||||
if (driver_byte(result) != DRIVER_SENSE &&
|
||||
@ -1743,7 +1722,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
|
||||
* unknown amount of data was transferred so treat it as an
|
||||
* error.
|
||||
*/
|
||||
scsi_print_sense("sd", SCpnt);
|
||||
SCpnt->result = 0;
|
||||
memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
|
||||
break;
|
||||
@ -1779,6 +1757,10 @@ static int sd_done(struct scsi_cmnd *SCpnt)
|
||||
break;
|
||||
}
|
||||
out:
|
||||
SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
|
||||
"sd_done: completed %d of %d bytes\n",
|
||||
good_bytes, scsi_bufflen(SCpnt)));
|
||||
|
||||
if (rq_data_dir(SCpnt->request) == READ && scsi_prot_sg_count(SCpnt))
|
||||
sd_dif_complete(SCpnt, good_bytes);
|
||||
|
||||
@ -1834,12 +1816,12 @@ sd_spinup_disk(struct scsi_disk *sdkp)
|
||||
/* no sense, TUR either succeeded or failed
|
||||
* with a status error */
|
||||
if(!spintime && !scsi_status_is_good(the_result)) {
|
||||
sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n");
|
||||
sd_print_result(sdkp, the_result);
|
||||
sd_print_result(sdkp, "Test Unit Ready failed",
|
||||
the_result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The device does not want the automatic start to be issued.
|
||||
*/
|
||||
@ -1955,7 +1937,6 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp,
|
||||
struct scsi_sense_hdr *sshdr, int sense_valid,
|
||||
int the_result)
|
||||
{
|
||||
sd_print_result(sdkp, the_result);
|
||||
if (driver_byte(the_result) & DRIVER_SENSE)
|
||||
sd_print_sense_hdr(sdkp, sshdr);
|
||||
else
|
||||
@ -2001,7 +1982,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
|
||||
|
||||
do {
|
||||
memset(cmd, 0, 16);
|
||||
cmd[0] = SERVICE_ACTION_IN;
|
||||
cmd[0] = SERVICE_ACTION_IN_16;
|
||||
cmd[1] = SAI_READ_CAPACITY_16;
|
||||
cmd[13] = RC16_LEN;
|
||||
memset(buffer, 0, RC16_LEN);
|
||||
@ -2036,7 +2017,7 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
|
||||
} while (the_result && retries);
|
||||
|
||||
if (the_result) {
|
||||
sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY(16) failed\n");
|
||||
sd_print_result(sdkp, "Read Capacity(16) failed", the_result);
|
||||
read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -2118,7 +2099,7 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
|
||||
} while (the_result && retries);
|
||||
|
||||
if (the_result) {
|
||||
sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY failed\n");
|
||||
sd_print_result(sdkp, "Read Capacity(10) failed", the_result);
|
||||
read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -2643,12 +2624,12 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
|
||||
|
||||
} else { /* LBP VPD page tells us what to use */
|
||||
|
||||
if (sdkp->lbpu && sdkp->max_unmap_blocks)
|
||||
sd_config_discard(sdkp, SD_LBP_UNMAP);
|
||||
else if (sdkp->lbpws)
|
||||
if (sdkp->lbpws)
|
||||
sd_config_discard(sdkp, SD_LBP_WS16);
|
||||
else if (sdkp->lbpws10)
|
||||
sd_config_discard(sdkp, SD_LBP_WS10);
|
||||
else if (sdkp->lbpu && sdkp->max_unmap_blocks)
|
||||
sd_config_discard(sdkp, SD_LBP_UNMAP);
|
||||
else
|
||||
sd_config_discard(sdkp, SD_LBP_DISABLE);
|
||||
}
|
||||
@ -3142,8 +3123,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
|
||||
res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
|
||||
SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM);
|
||||
if (res) {
|
||||
sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
|
||||
sd_print_result(sdkp, res);
|
||||
sd_print_result(sdkp, "Start/Stop Unit failed", res);
|
||||
if (driver_byte(res) & DRIVER_SENSE)
|
||||
sd_print_sense_hdr(sdkp, &sshdr);
|
||||
if (scsi_sense_valid(&sshdr) &&
|
||||
@ -3337,15 +3317,27 @@ module_exit(exit_sd);
|
||||
static void sd_print_sense_hdr(struct scsi_disk *sdkp,
|
||||
struct scsi_sense_hdr *sshdr)
|
||||
{
|
||||
sd_printk(KERN_INFO, sdkp, " ");
|
||||
scsi_show_sense_hdr(sshdr);
|
||||
sd_printk(KERN_INFO, sdkp, " ");
|
||||
scsi_show_extd_sense(sshdr->asc, sshdr->ascq);
|
||||
scsi_show_sense_hdr(sdkp->device,
|
||||
sdkp->disk ? sdkp->disk->disk_name : NULL, sshdr);
|
||||
scsi_show_extd_sense(sdkp->device,
|
||||
sdkp->disk ? sdkp->disk->disk_name : NULL,
|
||||
sshdr->asc, sshdr->ascq);
|
||||
}
|
||||
|
||||
static void sd_print_result(struct scsi_disk *sdkp, int result)
|
||||
static void sd_print_result(const struct scsi_disk *sdkp, const char *msg,
|
||||
int result)
|
||||
{
|
||||
sd_printk(KERN_INFO, sdkp, " ");
|
||||
scsi_show_result(result);
|
||||
const char *hb_string = scsi_hostbyte_string(result);
|
||||
const char *db_string = scsi_driverbyte_string(result);
|
||||
|
||||
if (hb_string || db_string)
|
||||
sd_printk(KERN_INFO, sdkp,
|
||||
"%s: Result: hostbyte=%s driverbyte=%s\n", msg,
|
||||
hb_string ? hb_string : "invalid",
|
||||
db_string ? db_string : "invalid");
|
||||
else
|
||||
sd_printk(KERN_INFO, sdkp,
|
||||
"%s: Result: hostbyte=0x%02x driverbyte=0x%02x\n",
|
||||
msg, host_byte(result), driver_byte(result));
|
||||
}
|
||||
|
||||
|
@ -103,9 +103,9 @@ static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
|
||||
|
||||
#define sd_printk(prefix, sdsk, fmt, a...) \
|
||||
(sdsk)->disk ? \
|
||||
sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
|
||||
(sdsk)->disk->disk_name, ##a) : \
|
||||
sdev_printk(prefix, (sdsk)->device, fmt, ##a)
|
||||
sdev_prefix_printk(prefix, (sdsk)->device, \
|
||||
(sdsk)->disk->disk_name, fmt, ##a) : \
|
||||
sdev_printk(prefix, (sdsk)->device, fmt, ##a)
|
||||
|
||||
#define sd_first_printk(prefix, sdsk, fmt, a...) \
|
||||
do { \
|
||||
|
@ -693,9 +693,9 @@ static struct class_interface ses_interface = {
|
||||
};
|
||||
|
||||
static struct scsi_driver ses_template = {
|
||||
.owner = THIS_MODULE,
|
||||
.gendrv = {
|
||||
.name = "ses",
|
||||
.owner = THIS_MODULE,
|
||||
.probe = ses_probe,
|
||||
.remove = ses_remove,
|
||||
},
|
||||
|
@ -219,8 +219,8 @@ static void sg_device_destroy(struct kref *kref);
|
||||
#define SZ_SG_REQ_INFO sizeof(sg_req_info_t)
|
||||
|
||||
#define sg_printk(prefix, sdp, fmt, a...) \
|
||||
sdev_printk(prefix, (sdp)->device, "[%s] " fmt, \
|
||||
(sdp)->disk->disk_name, ##a)
|
||||
sdev_prefix_printk(prefix, (sdp)->device, \
|
||||
(sdp)->disk->disk_name, fmt, ##a)
|
||||
|
||||
static int sg_allow_access(struct file *filp, unsigned char *cmd)
|
||||
{
|
||||
@ -1071,39 +1071,6 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
||||
if (atomic_read(&sdp->detaching))
|
||||
return -ENODEV;
|
||||
return put_user(sdp->device->host->hostt->emulated, ip);
|
||||
case SG_SCSI_RESET:
|
||||
if (atomic_read(&sdp->detaching))
|
||||
return -ENODEV;
|
||||
if (filp->f_flags & O_NONBLOCK) {
|
||||
if (scsi_host_in_recovery(sdp->device->host))
|
||||
return -EBUSY;
|
||||
} else if (!scsi_block_when_processing_errors(sdp->device))
|
||||
return -EBUSY;
|
||||
result = get_user(val, ip);
|
||||
if (result)
|
||||
return result;
|
||||
if (SG_SCSI_RESET_NOTHING == val)
|
||||
return 0;
|
||||
switch (val) {
|
||||
case SG_SCSI_RESET_DEVICE:
|
||||
val = SCSI_TRY_RESET_DEVICE;
|
||||
break;
|
||||
case SG_SCSI_RESET_TARGET:
|
||||
val = SCSI_TRY_RESET_TARGET;
|
||||
break;
|
||||
case SG_SCSI_RESET_BUS:
|
||||
val = SCSI_TRY_RESET_BUS;
|
||||
break;
|
||||
case SG_SCSI_RESET_HOST:
|
||||
val = SCSI_TRY_RESET_HOST;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
|
||||
return -EACCES;
|
||||
return (scsi_reset_provider(sdp->device, val) ==
|
||||
SUCCESS) ? 0 : -EIO;
|
||||
case SCSI_IOCTL_SEND_COMMAND:
|
||||
if (atomic_read(&sdp->detaching))
|
||||
return -ENODEV;
|
||||
@ -1123,13 +1090,6 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
||||
return result;
|
||||
sdp->sgdebug = (char) val;
|
||||
return 0;
|
||||
case SCSI_IOCTL_GET_IDLUN:
|
||||
case SCSI_IOCTL_GET_BUS_NUMBER:
|
||||
case SCSI_IOCTL_PROBE_HOST:
|
||||
case SG_GET_TRANSFORM:
|
||||
if (atomic_read(&sdp->detaching))
|
||||
return -ENODEV;
|
||||
return scsi_ioctl(sdp->device, cmd_in, p);
|
||||
case BLKSECTGET:
|
||||
return put_user(max_sectors_bytes(sdp->device->request_queue),
|
||||
ip);
|
||||
@ -1145,11 +1105,25 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
|
||||
return blk_trace_startstop(sdp->device->request_queue, 0);
|
||||
case BLKTRACETEARDOWN:
|
||||
return blk_trace_remove(sdp->device->request_queue);
|
||||
case SCSI_IOCTL_GET_IDLUN:
|
||||
case SCSI_IOCTL_GET_BUS_NUMBER:
|
||||
case SCSI_IOCTL_PROBE_HOST:
|
||||
case SG_GET_TRANSFORM:
|
||||
case SG_SCSI_RESET:
|
||||
if (atomic_read(&sdp->detaching))
|
||||
return -ENODEV;
|
||||
break;
|
||||
default:
|
||||
if (read_only)
|
||||
return -EPERM; /* don't know so take safe approach */
|
||||
return scsi_ioctl(sdp->device, cmd_in, p);
|
||||
break;
|
||||
}
|
||||
|
||||
result = scsi_ioctl_block_when_processing_errors(sdp->device,
|
||||
cmd_in, filp->f_flags & O_NDELAY);
|
||||
if (result)
|
||||
return result;
|
||||
return scsi_ioctl(sdp->device, cmd_in, p);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
@ -1360,7 +1334,7 @@ sg_rq_end_io(struct request *rq, int uptodate)
|
||||
if ((sdp->sgdebug > 0) &&
|
||||
((CHECK_CONDITION == srp->header.masked_status) ||
|
||||
(COMMAND_TERMINATED == srp->header.masked_status)))
|
||||
__scsi_print_sense(__func__, sense,
|
||||
__scsi_print_sense(sdp->device, __func__, sense,
|
||||
SCSI_SENSE_BUFFERSIZE);
|
||||
|
||||
/* Following if statement is a patch supplied by Eric Youngdale */
|
||||
|
@ -88,9 +88,9 @@ static struct dev_pm_ops sr_pm_ops = {
|
||||
};
|
||||
|
||||
static struct scsi_driver sr_template = {
|
||||
.owner = THIS_MODULE,
|
||||
.gendrv = {
|
||||
.name = "sr",
|
||||
.owner = THIS_MODULE,
|
||||
.probe = sr_probe,
|
||||
.remove = sr_remove,
|
||||
.pm = &sr_pm_ops,
|
||||
@ -387,7 +387,7 @@ static int sr_init_command(struct scsi_cmnd *SCpnt)
|
||||
struct request *rq = SCpnt->request;
|
||||
int ret;
|
||||
|
||||
ret = scsi_init_io(SCpnt, GFP_ATOMIC);
|
||||
ret = scsi_init_io(SCpnt);
|
||||
if (ret != BLKPREP_OK)
|
||||
goto out;
|
||||
SCpnt = rq->special;
|
||||
@ -549,6 +549,11 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
|
||||
|
||||
mutex_lock(&sr_mutex);
|
||||
|
||||
ret = scsi_ioctl_block_when_processing_errors(sdev, cmd,
|
||||
(mode & FMODE_NDELAY) != 0);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Send SCSI addressing ioctls directly to mid level, send other
|
||||
* ioctls to cdrom/block level.
|
||||
@ -564,16 +569,6 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
|
||||
if (ret != -ENOSYS)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* ENODEV means that we didn't recognise the ioctl, or that we
|
||||
* cannot execute it in the current device state. In either
|
||||
* case fall through to scsi_ioctl, which will return ENDOEV again
|
||||
* if it doesn't recognise the ioctl
|
||||
*/
|
||||
ret = scsi_nonblockable_ioctl(sdev, cmd, argp,
|
||||
(mode & FMODE_NDELAY) != 0);
|
||||
if (ret != -ENODEV)
|
||||
goto out;
|
||||
ret = scsi_ioctl(sdev, cmd, argp);
|
||||
|
||||
out:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user