]> git.karo-electronics.de Git - linux-beck.git/commitdiff
hpsa: reserve some commands for use by driver
authorStephen Cameron <stephenmcameron@gmail.com>
Fri, 23 Jan 2015 22:42:59 +0000 (16:42 -0600)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 2 Feb 2015 17:57:39 +0000 (09:57 -0800)
We need to reserve some commands for device rescans,
aborts, and the pass through ioctls, etc. so we cannot
give them all to the scsi mid layer.

This is in preparation for removing cmd_special_alloc and
cmd_special_free so that we can stop queuing commands internally
in the driver so that we can remove the locks thta protect the
queue that we will no longer have.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/hpsa.c
drivers/scsi/hpsa.h

index bee24b21c1c4a2beb3f6b40aa7871df9411fa351..99c32a0ea15be055b5982066919dc8d16f8e68e5 100644 (file)
@@ -4064,11 +4064,14 @@ static int hpsa_register_scsi(struct ctlr_info *h)
        sh->max_cmd_len = MAX_COMMAND_SIZE;
        sh->max_lun = HPSA_MAX_LUN;
        sh->max_id = HPSA_MAX_LUN;
-       sh->can_queue = h->nr_cmds;
+       sh->can_queue = h->nr_cmds -
+                       HPSA_CMDS_RESERVED_FOR_ABORTS -
+                       HPSA_CMDS_RESERVED_FOR_DRIVER -
+                       HPSA_MAX_CONCURRENT_PASSTHRUS;
        if (h->hba_mode_enabled)
                sh->cmd_per_lun = 7;
        else
-               sh->cmd_per_lun = h->nr_cmds;
+               sh->cmd_per_lun = sh->can_queue;
        sh->sg_tablesize = h->maxsgentries;
        h->scsi_host = sh;
        sh->hostdata[0] = (unsigned long) h;
index 8e06d9e280ec7dc033f3bf56e8c268393b6c3275..5ee6c6a73b0cdf85129031376591ae3284b82dda 100644 (file)
@@ -115,6 +115,8 @@ struct ctlr_info {
        void __iomem *vaddr;
        unsigned long paddr;
        int     nr_cmds; /* Number of commands allowed on this controller */
+#define HPSA_CMDS_RESERVED_FOR_ABORTS 2
+#define HPSA_CMDS_RESERVED_FOR_DRIVER 1
        struct CfgTable __iomem *cfgtable;
        int     interrupts_enabled;
        int     max_commands;