aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
committerJiri Kosina <jkosina@suse.cz>2014-11-20 08:42:02 -0500
commita02001086bbfb4da35d1228bebc2f1b442db455f (patch)
tree62ab47936cef06fd08657ca5b6cd1df98c19be57 /include/scsi
parenteff264efeeb0898408e8c9df72d8a32621035bed (diff)
parentfc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff)
Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/iscsi_if.h1
-rw-r--r--include/scsi/osd_initiator.h2
-rw-r--r--include/scsi/osd_ore.h2
-rw-r--r--include/scsi/osd_protocol.h4
-rw-r--r--include/scsi/osd_sec.h2
-rw-r--r--include/scsi/osd_sense.h2
-rw-r--r--include/scsi/osd_types.h2
-rw-r--r--include/scsi/scsi.h3
-rw-r--r--include/scsi/scsi_cmnd.h36
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_host.h6
-rw-r--r--include/scsi/scsi_tcq.h8
-rw-r--r--include/scsi/sg.h4
13 files changed, 49 insertions, 24 deletions
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index fd0421c6d40a..95ed9424a11a 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -527,6 +527,7 @@ enum iscsi_err {
527 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19, 527 ISCSI_ERR_XMIT_FAILED = ISCSI_ERR_BASE + 19,
528 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20, 528 ISCSI_ERR_TCP_CONN_CLOSE = ISCSI_ERR_BASE + 20,
529 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21, 529 ISCSI_ERR_SCSI_EH_SESSION_RST = ISCSI_ERR_BASE + 21,
530 ISCSI_ERR_NOP_TIMEDOUT = ISCSI_ERR_BASE + 22,
530}; 531};
531 532
532/* 533/*
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index b2e85fdd2ae0..a09cca829082 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/osd_ore.h b/include/scsi/osd_ore.h
index 6ca3265a4dca..7a8d2cd30328 100644
--- a/include/scsi/osd_ore.h
+++ b/include/scsi/osd_ore.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2011 2 * Copyright (C) 2011
3 * Boaz Harrosh <bharrosh@panasas.com> 3 * Boaz Harrosh <ooo@electrozaur.com>
4 * 4 *
5 * Public Declarations of the ORE API 5 * Public Declarations of the ORE API
6 * 6 *
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index a2594afe05c7..e0ca835e7bf7 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
@@ -496,7 +496,7 @@ struct osd_timestamp {
496 */ 496 */
497 497
498struct osd_key_identifier { 498struct osd_key_identifier {
499 u8 id[7]; /* if you know why 7 please email bharrosh@panasas.com */ 499 u8 id[7]; /* if you know why 7 please email ooo@electrozaur.com */
500} __packed; 500} __packed;
501 501
502/* for osd_capability.format */ 502/* for osd_capability.format */
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h
index f96151c9c9e8..7abeb0f0db30 100644
--- a/include/scsi/osd_sec.h
+++ b/include/scsi/osd_sec.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/osd_sense.h b/include/scsi/osd_sense.h
index 91db543a5502..d52aa93a0b2d 100644
--- a/include/scsi/osd_sense.h
+++ b/include/scsi/osd_sense.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/osd_types.h b/include/scsi/osd_types.h
index bd0be7ed4bcf..48e8a165e136 100644
--- a/include/scsi/osd_types.h
+++ b/include/scsi/osd_types.h
@@ -4,7 +4,7 @@
4 * Copyright (C) 2008 Panasas Inc. All rights reserved. 4 * Copyright (C) 2008 Panasas Inc. All rights reserved.
5 * 5 *
6 * Authors: 6 * Authors:
7 * Boaz Harrosh <bharrosh@panasas.com> 7 * Boaz Harrosh <ooo@electrozaur.com>
8 * Benny Halevy <bhalevy@panasas.com> 8 * Benny Halevy <bhalevy@panasas.com>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index e6df23cae7be..d17178e6fcdd 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -31,7 +31,7 @@ enum scsi_timeouts {
31 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit 31 * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit
32 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios. 32 * is totally arbitrary, a setting of 2048 will get you at least 8mb ios.
33 */ 33 */
34#ifdef ARCH_HAS_SG_CHAIN 34#ifdef CONFIG_ARCH_HAS_SG_CHAIN
35#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048 35#define SCSI_MAX_SG_CHAIN_SEGMENTS 2048
36#else 36#else
37#define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTS 37#define SCSI_MAX_SG_CHAIN_SEGMENTS SCSI_MAX_SG_SEGMENTS
@@ -333,6 +333,7 @@ static inline int scsi_status_is_good(int status)
333#define TYPE_RBC 0x0e 333#define TYPE_RBC 0x0e
334#define TYPE_OSD 0x11 334#define TYPE_OSD 0x11
335#define TYPE_ZBC 0x14 335#define TYPE_ZBC 0x14
336#define TYPE_WLUN 0x1e /* well-known logical unit */
336#define TYPE_NO_LUN 0x7f 337#define TYPE_NO_LUN 0x7f
337 338
338/* SCSI protocols; these are taken from SPC-3 section 7.5 */ 339/* SCSI protocols; these are taken from SPC-3 section 7.5 */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 73f349044941..522a5f27f553 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -10,9 +10,10 @@
10#include <scsi/scsi_device.h> 10#include <scsi/scsi_device.h>
11 11
12struct Scsi_Host; 12struct Scsi_Host;
13struct scsi_device;
14struct scsi_driver; 13struct scsi_driver;
15 14
15#include <scsi/scsi_device.h>
16
16/* 17/*
17 * MAX_COMMAND_SIZE is: 18 * MAX_COMMAND_SIZE is:
18 * The longest fixed-length SCSI CDB as per the SCSI standard. 19 * The longest fixed-length SCSI CDB as per the SCSI standard.
@@ -81,6 +82,7 @@ struct scsi_cmnd {
81 82
82 unsigned char prot_op; 83 unsigned char prot_op;
83 unsigned char prot_type; 84 unsigned char prot_type;
85 unsigned char prot_flags;
84 86
85 unsigned short cmd_len; 87 unsigned short cmd_len;
86 enum dma_data_direction sc_data_direction; 88 enum dma_data_direction sc_data_direction;
@@ -252,6 +254,14 @@ static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd)
252 return scmd->prot_op; 254 return scmd->prot_op;
253} 255}
254 256
257enum scsi_prot_flags {
258 SCSI_PROT_TRANSFER_PI = 1 << 0,
259 SCSI_PROT_GUARD_CHECK = 1 << 1,
260 SCSI_PROT_REF_CHECK = 1 << 2,
261 SCSI_PROT_REF_INCREMENT = 1 << 3,
262 SCSI_PROT_IP_CHECKSUM = 1 << 4,
263};
264
255/* 265/*
256 * The controller usually does not know anything about the target it 266 * The controller usually does not know anything about the target it
257 * is communicating with. However, when DIX is enabled the controller 267 * is communicating with. However, when DIX is enabled the controller
@@ -280,6 +290,17 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
280 return blk_rq_pos(scmd->request); 290 return blk_rq_pos(scmd->request);
281} 291}
282 292
293static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd)
294{
295 return scmd->device->sector_size;
296}
297
298static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd)
299{
300 return blk_rq_pos(scmd->request) >>
301 (ilog2(scsi_prot_interval(scmd)) - 9) & 0xffffffff;
302}
303
283static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd) 304static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd)
284{ 305{
285 return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0; 306 return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0;
@@ -316,17 +337,12 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
316static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) 337static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
317{ 338{
318 unsigned int xfer_len = scsi_out(scmd)->length; 339 unsigned int xfer_len = scsi_out(scmd)->length;
319 unsigned int prot_op = scsi_get_prot_op(scmd); 340 unsigned int prot_interval = scsi_prot_interval(scmd);
320 unsigned int sector_size = scmd->device->sector_size;
321 341
322 switch (prot_op) { 342 if (scmd->prot_flags & SCSI_PROT_TRANSFER_PI)
323 case SCSI_PROT_NORMAL: 343 xfer_len += (xfer_len >> ilog2(prot_interval)) * 8;
324 case SCSI_PROT_WRITE_STRIP:
325 case SCSI_PROT_READ_INSERT:
326 return xfer_len;
327 }
328 344
329 return xfer_len + (xfer_len >> ilog2(sector_size)) * 8; 345 return xfer_len;
330} 346}
331 347
332#endif /* _SCSI_SCSI_CMND_H */ 348#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 1a0d1842962e..27ecee73bd72 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -174,6 +174,7 @@ struct scsi_device {
174 unsigned wce_default_on:1; /* Cache is ON by default */ 174 unsigned wce_default_on:1; /* Cache is ON by default */
175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ 175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
176 unsigned broken_fua:1; /* Don't set FUA bit */ 176 unsigned broken_fua:1; /* Don't set FUA bit */
177 unsigned lun_in_cdb:1; /* Store LUN bits in CDB[1] */
177 178
178 atomic_t disk_events_disable_depth; /* disable depth for disk events */ 179 atomic_t disk_events_disable_depth; /* disable depth for disk events */
179 180
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b286b5787c85..00859c288bee 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -606,7 +606,7 @@ struct Scsi_Host {
606 /* 606 /*
607 * These three parameters can be used to allow for wide scsi, 607 * These three parameters can be used to allow for wide scsi,
608 * and for host adapters that support multiple busses 608 * and for host adapters that support multiple busses
609 * The first two should be set to 1 more than the actual max id 609 * The last two should be set to 1 more than the actual max id
610 * or lun (e.g. 8 for SCSI parallel systems). 610 * or lun (e.g. 8 for SCSI parallel systems).
611 */ 611 */
612 unsigned int max_channel; 612 unsigned int max_channel;
@@ -680,6 +680,7 @@ struct Scsi_Host {
680 unsigned no_write_same:1; 680 unsigned no_write_same:1;
681 681
682 unsigned use_blk_mq:1; 682 unsigned use_blk_mq:1;
683 unsigned use_cmd_list:1;
683 684
684 /* 685 /*
685 * Optional work queue to be utilized by the transport 686 * Optional work queue to be utilized by the transport
@@ -692,6 +693,9 @@ struct Scsi_Host {
692 */ 693 */
693 struct workqueue_struct *tmf_work_q; 694 struct workqueue_struct *tmf_work_q;
694 695
696 /* The transport requires the LUN bits NOT to be stored in CDB[1] */
697 unsigned no_scsi2_lun_in_cdb:1;
698
695 /* 699 /*
696 * Value host_blocked counts down from 700 * Value host_blocked counts down from
697 */ 701 */
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index cdcc90b07ecb..56ed843969ca 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
67 if (!sdev->tagged_supported) 67 if (!sdev->tagged_supported)
68 return; 68 return;
69 69
70 if (!shost_use_blk_mq(sdev->host) && 70 if (shost_use_blk_mq(sdev->host))
71 blk_queue_tagged(sdev->request_queue)) 71 queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
72 else if (!blk_queue_tagged(sdev->request_queue))
72 blk_queue_init_tags(sdev->request_queue, depth, 73 blk_queue_init_tags(sdev->request_queue, depth,
73 sdev->host->bqt); 74 sdev->host->bqt);
74 75
@@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
81 **/ 82 **/
82static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth) 83static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
83{ 84{
84 if (!shost_use_blk_mq(sdev->host) && 85 if (blk_queue_tagged(sdev->request_queue))
85 blk_queue_tagged(sdev->request_queue))
86 blk_queue_free_tags(sdev->request_queue); 86 blk_queue_free_tags(sdev->request_queue);
87 scsi_adjust_queue_depth(sdev, 0, depth); 87 scsi_adjust_queue_depth(sdev, 0, depth);
88} 88}
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index 9859355a7cf9..750e5db7c6bf 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -86,7 +86,9 @@ typedef struct sg_io_hdr
86#define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */ 86#define SG_FLAG_MMAP_IO 4 /* request memory mapped IO */
87#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ 87#define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */
88 /* user space (debug indirect IO) */ 88 /* user space (debug indirect IO) */
89#define SG_FLAG_Q_AT_TAIL 0x10 /* default is Q_AT_HEAD */ 89/* defaults:: for sg driver: Q_AT_HEAD; for block layer: Q_AT_TAIL */
90#define SG_FLAG_Q_AT_TAIL 0x10
91#define SG_FLAG_Q_AT_HEAD 0x20
90 92
91/* following 'info' values are "or"-ed together */ 93/* following 'info' values are "or"-ed together */
92#define SG_INFO_OK_MASK 0x1 94#define SG_INFO_OK_MASK 0x1