struct hpsa_scsi_dev_t *sd;
unsigned long flags;
struct ctlr_info *h;
+ int queue_depth;
h = sdev_to_hba(sdev);
spin_lock_irqsave(&h->devlock, flags);
if (sd && sd->expose_device) {
atomic_set(&sd->ioaccel_cmds_out, 0);
sdev->hostdata = sd;
- } else
+ } else {
sdev->hostdata = NULL;
+ }
+
+ if (sd)
+ queue_depth = sd->queue_depth != 0 ?
+ sd->queue_depth : sdev->host->can_queue;
+ else
+ queue_depth = sdev->host->can_queue;
+
spin_unlock_irqrestore(&h->devlock, flags);
+
return 0;
}
static int hpsa_slave_configure(struct scsi_device *sdev)
{
struct hpsa_scsi_dev_t *sd;
- int queue_depth;
+ int queue_depth = 0;
sd = sdev->hostdata;
sdev->no_uld_attach = !sd || !sd->expose_device;
/* Get the ptr to our adapter structure out of cmd->host. */
h = sdev_to_hba(cmd->device);
- BUG_ON(cmd->request->tag < 0);
+ if (cmd->request->tag < 0) {
+ dev_crit(&h->pdev->dev,
+ "sdev %p scmd %p: bad tag %d -- rejecting\n",
+ cmd->device, cmd, cmd->request->tag);
+ cmd->result = DID_NO_CONNECT << 16;
+ cmd->scsi_done(cmd);
+ return 0;
+ }
dev = cmd->device->hostdata;
if (!dev) {
sh->hostdata[0] = (unsigned long) h;
sh->irq = h->intr[h->intr_mode];
sh->unique_id = sh->irq;
+ if (!shost_use_blk_mq(sh)) {
+ int error;
+
+ error = scsi_init_shared_tag_map(sh, sh->can_queue);
+ if (error) {
+ dev_err(&h->pdev->dev,
+ "%s: scsi_init_shared_tag_map failed for ctlr %d\n",
+ __func__, h->ctlr);
+ scsi_host_put(sh);
+ return error;
+ }
+ }
h->scsi_host = sh;
return 0;