Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
[linux-2.6-block.git] / include / scsi / scsi_host.h
index 94844fc77b9759f20c6f51c6bcb16e008f2167b3..ba2034779961ae85fff76a46ffb8be75d7c38352 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/workqueue.h>
 #include <linux/mutex.h>
 #include <linux/seq_file.h>
+#include <linux/blk-mq.h>
 #include <scsi/scsi.h>
 
 struct request_queue;
@@ -131,27 +132,6 @@ struct scsi_host_template {
         */
        int (* queuecommand)(struct Scsi_Host *, struct scsi_cmnd *);
 
-       /*
-        * The transfer functions are used to queue a scsi command to
-        * the LLD. When the driver is finished processing the command
-        * the done callback is invoked.
-        *
-        * This is called to inform the LLD to transfer
-        * scsi_bufflen(cmd) bytes. scsi_sg_count(cmd) speciefies the
-        * number of scatterlist entried in the command and
-        * scsi_sglist(cmd) returns the scatterlist.
-        *
-        * return values: see queuecommand
-        *
-        * If the LLD accepts the cmd, it should set the result to an
-        * appropriate value when completed before calling the done function.
-        *
-        * STATUS: REQUIRED FOR TARGET DRIVERS
-        */
-       /* TODO: rename */
-       int (* transfer_response)(struct scsi_cmnd *,
-                                 void (*done)(struct scsi_cmnd *));
-
        /*
         * This is an error handling strategy routine.  You don't need to
         * define one of these if you don't want to - there is a default
@@ -408,7 +388,7 @@ struct scsi_host_template {
        /*
         * Set this if the host adapter has limitations beside segment count.
         */
-       unsigned short max_sectors;
+       unsigned int max_sectors;
 
        /*
         * DMA scatter gather segment boundary limit. A segment crossing this
@@ -531,6 +511,9 @@ struct scsi_host_template {
         */
        unsigned int cmd_size;
        struct scsi_host_cmd_pool *cmd_pool;
+
+       /* temporary flag to disable blk-mq I/O path */
+       bool disable_blk_mq;
 };
 
 /*
@@ -601,15 +584,16 @@ struct Scsi_Host {
         * Area to keep a shared tag map (if needed, will be
         * NULL if not).
         */
-       struct blk_queue_tag    *bqt;
+       union {
+               struct blk_queue_tag    *bqt;
+               struct blk_mq_tag_set   tag_set;
+       };
 
-       /*
-        * The following two fields are protected with host_lock;
-        * however, eh routines can safely access during eh processing
-        * without acquiring the lock.
-        */
-       unsigned int host_busy;            /* commands actually active on low-level */
-       unsigned int host_failed;          /* commands that failed. */
+       atomic_t host_busy;                /* commands actually active on low-level */
+       atomic_t host_blocked;
+
+       unsigned int host_failed;          /* commands that failed.
+                                             protected by host_lock */
        unsigned int host_eh_scheduled;    /* EH scheduled without command */
     
        unsigned int host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
@@ -623,11 +607,11 @@ struct Scsi_Host {
         * These three parameters can be used to allow for wide scsi,
         * and for host adapters that support multiple busses
         * The first two should be set to 1 more than the actual max id
-        * or lun (i.e. 8 for normal systems).
+        * or lun (e.g. 8 for SCSI parallel systems).
         */
-       unsigned int max_id;
-       unsigned int max_lun;
        unsigned int max_channel;
+       unsigned int max_id;
+       u64 max_lun;
 
        /*
         * This is a unique identifier that must be assigned so that we
@@ -652,7 +636,7 @@ struct Scsi_Host {
        short cmd_per_lun;
        short unsigned int sg_tablesize;
        short unsigned int sg_prot_tablesize;
-       short unsigned int max_sectors;
+       unsigned int max_sectors;
        unsigned long dma_boundary;
        /* 
         * Used to assign serial numbers to the cmds.
@@ -695,6 +679,8 @@ struct Scsi_Host {
        /* The controller does not support WRITE SAME */
        unsigned no_write_same:1;
 
+       unsigned use_blk_mq:1;
+
        /*
         * Optional work queue to be utilized by the transport
         */
@@ -706,11 +692,6 @@ struct Scsi_Host {
         */
        struct workqueue_struct *tmf_work_q;
 
-       /*
-        * Host has rejected a command because it was busy.
-        */
-       unsigned int host_blocked;
-
        /*
         * Value host_blocked counts down from
         */
@@ -800,6 +781,13 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost)
                shost->tmf_in_progress;
 }
 
+extern bool scsi_use_blk_mq;
+
+static inline bool shost_use_blk_mq(struct Scsi_Host *shost)
+{
+       return shost->use_blk_mq;
+}
+
 extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
 extern void scsi_flush_work(struct Scsi_Host *);
 
@@ -816,8 +804,6 @@ extern struct Scsi_Host *scsi_host_lookup(unsigned short);
 extern const char *scsi_host_state_name(enum scsi_host_state);
 extern void scsi_cmd_get_serial(struct Scsi_Host *, struct scsi_cmnd *);
 
-extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
-
 static inline int __must_check scsi_add_host(struct Scsi_Host *host,
                                             struct device *dev)
 {