]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
hpsa: add support for tagged queuing
authorDon Brace <don.brace@pmcs.com>
Thu, 12 May 2016 18:13:07 +0000 (14:13 -0400)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 22 May 2016 21:50:21 +0000 (14:50 -0700)
Signed-off-by: Don Brace <don.brace@pmcs.com>
Orabug: 23064595
Signed-off-by: Manjunath <manjunath.govindashetty@oracle.com>
drivers/scsi/hpsa.c

index edbecf84d79d547e858bd1d1617e970c82147c55..6239dddd41b67bb85097f84adeb8b9ca0f96fe88 100644 (file)
@@ -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;