From: Don Brace Date: Thu, 12 May 2016 18:13:07 +0000 (-0400) Subject: hpsa: add support for tagged queuing X-Git-Tag: v4.1.12-92~161^2~9 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b0498b304aae6b19178bfccbfe18284748fa6d48;p=users%2Fjedix%2Flinux-maple.git hpsa: add support for tagged queuing Signed-off-by: Don Brace Orabug: 23064595 Signed-off-by: Manjunath --- diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index edbecf84d79d..6239dddd41b6 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -1933,6 +1933,7 @@ static int hpsa_slave_alloc(struct scsi_device *sdev) 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); @@ -1954,9 +1955,18 @@ static int hpsa_slave_alloc(struct scsi_device *sdev) 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; } @@ -1964,7 +1974,7 @@ static int hpsa_slave_alloc(struct scsi_device *sdev) 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; @@ -5241,7 +5251,14 @@ static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd) /* 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) { @@ -5377,6 +5394,18 @@ static int hpsa_scsi_host_alloc(struct ctlr_info *h) 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;