diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-25 20:19:08 -0500 |
commit | 9b73e76f3cf63379dcf45fcd4f112f5812418d0a (patch) | |
tree | 4e6bef87cd0cd6d848fc39a5ae25b981dbbe035b /include | |
parent | 50d9a126240f9961cfdd063336bbeb91f77a7dce (diff) | |
parent | 23c3e290fb9ce38cabc2822b47583fc8702411bf (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits)
[SCSI] usbstorage: use last_sector_bug flag universally
[SCSI] libsas: abstract STP task status into a function
[SCSI] ultrastor: clean up inline asm warnings
[SCSI] aic7xxx: fix firmware build
[SCSI] aacraid: fib context lock for management ioctls
[SCSI] ch: remove forward declarations
[SCSI] ch: fix device minor number management bug
[SCSI] ch: handle class_device_create failure properly
[SCSI] NCR5380: fix section mismatch
[SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices
[SCSI] IB/iSER: add logical unit reset support
[SCSI] don't use __GFP_DMA for sense buffers if not required
[SCSI] use dynamically allocated sense buffer
[SCSI] scsi.h: add macro for enclosure bit of inquiry data
[SCSI] sd: add fix for devices with last sector access problems
[SCSI] fix pcmcia compile problem
[SCSI] aacraid: add Voodoo Lite class of cards.
[SCSI] aacraid: add new driver features flags
[SCSI] qla2xxx: Update version number to 8.02.00-k7.
[SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/attribute_container.h | 1 | ||||
-rw-r--r-- | include/linux/blkdev.h | 1 | ||||
-rw-r--r-- | include/linux/sysfs.h | 2 | ||||
-rw-r--r-- | include/scsi/iscsi_if.h | 20 | ||||
-rw-r--r-- | include/scsi/iscsi_proto.h | 14 | ||||
-rw-r--r-- | include/scsi/libiscsi.h | 82 | ||||
-rw-r--r-- | include/scsi/libsas.h | 28 | ||||
-rw-r--r-- | include/scsi/sas.h | 13 | ||||
-rw-r--r-- | include/scsi/scsi_cmnd.h | 2 | ||||
-rw-r--r-- | include/scsi/scsi_device.h | 13 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 10 | ||||
-rw-r--r-- | include/scsi/scsi_transport_sas.h | 16 | ||||
-rw-r--r-- | include/scsi/sd.h | 1 |
13 files changed, 145 insertions, 58 deletions
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h index 8ff274933948..f5582332af04 100644 --- a/include/linux/attribute_container.h +++ b/include/linux/attribute_container.h | |||
@@ -17,6 +17,7 @@ struct attribute_container { | |||
17 | struct list_head node; | 17 | struct list_head node; |
18 | struct klist containers; | 18 | struct klist containers; |
19 | struct class *class; | 19 | struct class *class; |
20 | struct attribute_group *grp; | ||
20 | struct class_device_attribute **attrs; | 21 | struct class_device_attribute **attrs; |
21 | int (*match)(struct attribute_container *, struct device *); | 22 | int (*match)(struct attribute_container *, struct device *); |
22 | #define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 | 23 | #define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 40ee1706caa3..bd20a4e8663a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -765,6 +765,7 @@ extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); | |||
765 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); | 765 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); |
766 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); | 766 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); |
767 | extern void blk_queue_dma_alignment(struct request_queue *, int); | 767 | extern void blk_queue_dma_alignment(struct request_queue *, int); |
768 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); | ||
768 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); | 769 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); |
769 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 770 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
770 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); | 771 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 149ab62329e2..802710438a9e 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -32,6 +32,8 @@ struct attribute { | |||
32 | 32 | ||
33 | struct attribute_group { | 33 | struct attribute_group { |
34 | const char *name; | 34 | const char *name; |
35 | int (*is_visible)(struct kobject *, | ||
36 | struct attribute *, int); | ||
35 | struct attribute **attrs; | 37 | struct attribute **attrs; |
36 | }; | 38 | }; |
37 | 39 | ||
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 50e907f42048..e19e58423166 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h | |||
@@ -49,12 +49,15 @@ enum iscsi_uevent_e { | |||
49 | 49 | ||
50 | ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15, | 50 | ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15, |
51 | ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16, | 51 | ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16, |
52 | ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17, | ||
52 | 53 | ||
53 | /* up events */ | 54 | /* up events */ |
54 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, | 55 | ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, |
55 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, | 56 | ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2, |
56 | ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, | 57 | ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3, |
57 | ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4, | 58 | ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4, |
59 | ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5, | ||
60 | ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6, | ||
58 | }; | 61 | }; |
59 | 62 | ||
60 | enum iscsi_tgt_dscvr { | 63 | enum iscsi_tgt_dscvr { |
@@ -156,6 +159,10 @@ struct iscsi_uevent { | |||
156 | uint32_t sid; | 159 | uint32_t sid; |
157 | uint32_t cid; | 160 | uint32_t cid; |
158 | } c_conn_ret; | 161 | } c_conn_ret; |
162 | struct msg_unbind_session { | ||
163 | uint32_t sid; | ||
164 | uint32_t host_no; | ||
165 | } unbind_session; | ||
159 | struct msg_recv_req { | 166 | struct msg_recv_req { |
160 | uint32_t sid; | 167 | uint32_t sid; |
161 | uint32_t cid; | 168 | uint32_t cid; |
@@ -236,6 +243,13 @@ enum iscsi_param { | |||
236 | ISCSI_PARAM_PASSWORD, | 243 | ISCSI_PARAM_PASSWORD, |
237 | ISCSI_PARAM_PASSWORD_IN, | 244 | ISCSI_PARAM_PASSWORD_IN, |
238 | 245 | ||
246 | ISCSI_PARAM_FAST_ABORT, | ||
247 | ISCSI_PARAM_ABORT_TMO, | ||
248 | ISCSI_PARAM_LU_RESET_TMO, | ||
249 | ISCSI_PARAM_HOST_RESET_TMO, | ||
250 | |||
251 | ISCSI_PARAM_PING_TMO, | ||
252 | ISCSI_PARAM_RECV_TMO, | ||
239 | /* must always be last */ | 253 | /* must always be last */ |
240 | ISCSI_PARAM_MAX, | 254 | ISCSI_PARAM_MAX, |
241 | }; | 255 | }; |
@@ -266,6 +280,12 @@ enum iscsi_param { | |||
266 | #define ISCSI_USERNAME_IN (1 << ISCSI_PARAM_USERNAME_IN) | 280 | #define ISCSI_USERNAME_IN (1 << ISCSI_PARAM_USERNAME_IN) |
267 | #define ISCSI_PASSWORD (1 << ISCSI_PARAM_PASSWORD) | 281 | #define ISCSI_PASSWORD (1 << ISCSI_PARAM_PASSWORD) |
268 | #define ISCSI_PASSWORD_IN (1 << ISCSI_PARAM_PASSWORD_IN) | 282 | #define ISCSI_PASSWORD_IN (1 << ISCSI_PARAM_PASSWORD_IN) |
283 | #define ISCSI_FAST_ABORT (1 << ISCSI_PARAM_FAST_ABORT) | ||
284 | #define ISCSI_ABORT_TMO (1 << ISCSI_PARAM_ABORT_TMO) | ||
285 | #define ISCSI_LU_RESET_TMO (1 << ISCSI_PARAM_LU_RESET_TMO) | ||
286 | #define ISCSI_HOST_RESET_TMO (1 << ISCSI_PARAM_HOST_RESET_TMO) | ||
287 | #define ISCSI_PING_TMO (1 << ISCSI_PARAM_PING_TMO) | ||
288 | #define ISCSI_RECV_TMO (1 << ISCSI_PARAM_RECV_TMO) | ||
269 | 289 | ||
270 | /* iSCSI HBA params */ | 290 | /* iSCSI HBA params */ |
271 | enum iscsi_host_param { | 291 | enum iscsi_host_param { |
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index 8d1e4e8026fe..318a909e7ae1 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h | |||
@@ -21,13 +21,15 @@ | |||
21 | #ifndef ISCSI_PROTO_H | 21 | #ifndef ISCSI_PROTO_H |
22 | #define ISCSI_PROTO_H | 22 | #define ISCSI_PROTO_H |
23 | 23 | ||
24 | #include <linux/types.h> | ||
25 | |||
24 | #define ISCSI_DRAFT20_VERSION 0x00 | 26 | #define ISCSI_DRAFT20_VERSION 0x00 |
25 | 27 | ||
26 | /* default iSCSI listen port for incoming connections */ | 28 | /* default iSCSI listen port for incoming connections */ |
27 | #define ISCSI_LISTEN_PORT 3260 | 29 | #define ISCSI_LISTEN_PORT 3260 |
28 | 30 | ||
29 | /* Padding word length */ | 31 | /* Padding word length */ |
30 | #define PAD_WORD_LEN 4 | 32 | #define ISCSI_PAD_LEN 4 |
31 | 33 | ||
32 | /* | 34 | /* |
33 | * useful common(control and data pathes) macro | 35 | * useful common(control and data pathes) macro |
@@ -147,6 +149,14 @@ struct iscsi_rlength_ahdr { | |||
147 | __be32 read_length; | 149 | __be32 read_length; |
148 | }; | 150 | }; |
149 | 151 | ||
152 | /* Extended CDB AHS */ | ||
153 | struct iscsi_ecdb_ahdr { | ||
154 | __be16 ahslength; /* CDB length - 15, including reserved byte */ | ||
155 | uint8_t ahstype; | ||
156 | uint8_t reserved; | ||
157 | uint8_t ecdb[260 - 16]; /* 4-byte aligned extended CDB spillover */ | ||
158 | }; | ||
159 | |||
150 | /* SCSI Response Header */ | 160 | /* SCSI Response Header */ |
151 | struct iscsi_cmd_rsp { | 161 | struct iscsi_cmd_rsp { |
152 | uint8_t opcode; | 162 | uint8_t opcode; |
@@ -600,6 +610,8 @@ struct iscsi_reject { | |||
600 | #define ISCSI_MIN_MAX_BURST_LEN 512 | 610 | #define ISCSI_MIN_MAX_BURST_LEN 512 |
601 | #define ISCSI_MAX_MAX_BURST_LEN 16777215 | 611 | #define ISCSI_MAX_MAX_BURST_LEN 16777215 |
602 | 612 | ||
613 | #define ISCSI_DEF_TIME2WAIT 2 | ||
614 | |||
603 | /************************* RFC 3720 End *****************************/ | 615 | /************************* RFC 3720 End *****************************/ |
604 | 616 | ||
605 | #endif /* ISCSI_PROTO_H */ | 617 | #endif /* ISCSI_PROTO_H */ |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index b4b31132618b..889f51fabab9 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -57,11 +57,14 @@ struct iscsi_nopin; | |||
57 | #define ISCSI_MAX_CMD_PER_LUN 128 | 57 | #define ISCSI_MAX_CMD_PER_LUN 128 |
58 | 58 | ||
59 | /* Task Mgmt states */ | 59 | /* Task Mgmt states */ |
60 | #define TMABORT_INITIAL 0x0 | 60 | enum { |
61 | #define TMABORT_SUCCESS 0x1 | 61 | TMF_INITIAL, |
62 | #define TMABORT_FAILED 0x2 | 62 | TMF_QUEUED, |
63 | #define TMABORT_TIMEDOUT 0x3 | 63 | TMF_SUCCESS, |
64 | #define TMABORT_NOT_FOUND 0x4 | 64 | TMF_FAILED, |
65 | TMF_TIMEDOUT, | ||
66 | TMF_NOT_FOUND, | ||
67 | }; | ||
65 | 68 | ||
66 | /* Connection suspend "bit" */ | 69 | /* Connection suspend "bit" */ |
67 | #define ISCSI_SUSPEND_BIT 1 | 70 | #define ISCSI_SUSPEND_BIT 1 |
@@ -74,6 +77,13 @@ struct iscsi_nopin; | |||
74 | 77 | ||
75 | #define ISCSI_ADDRESS_BUF_LEN 64 | 78 | #define ISCSI_ADDRESS_BUF_LEN 64 |
76 | 79 | ||
80 | enum { | ||
81 | /* this is the maximum possible storage for AHSs */ | ||
82 | ISCSI_MAX_AHS_SIZE = sizeof(struct iscsi_ecdb_ahdr) + | ||
83 | sizeof(struct iscsi_rlength_ahdr), | ||
84 | ISCSI_DIGEST_SIZE = sizeof(__u32), | ||
85 | }; | ||
86 | |||
77 | struct iscsi_mgmt_task { | 87 | struct iscsi_mgmt_task { |
78 | /* | 88 | /* |
79 | * Becuae LLDs allocate their hdr differently, this is a pointer to | 89 | * Becuae LLDs allocate their hdr differently, this is a pointer to |
@@ -91,15 +101,17 @@ enum { | |||
91 | ISCSI_TASK_COMPLETED, | 101 | ISCSI_TASK_COMPLETED, |
92 | ISCSI_TASK_PENDING, | 102 | ISCSI_TASK_PENDING, |
93 | ISCSI_TASK_RUNNING, | 103 | ISCSI_TASK_RUNNING, |
94 | ISCSI_TASK_ABORTING, | ||
95 | }; | 104 | }; |
96 | 105 | ||
97 | struct iscsi_cmd_task { | 106 | struct iscsi_cmd_task { |
98 | /* | 107 | /* |
99 | * Becuae LLDs allocate their hdr differently, this is a pointer to | 108 | * Because LLDs allocate their hdr differently, this is a pointer |
100 | * that storage. It must be setup at session creation time. | 109 | * and length to that storage. It must be setup at session |
110 | * creation time. | ||
101 | */ | 111 | */ |
102 | struct iscsi_cmd *hdr; | 112 | struct iscsi_cmd *hdr; |
113 | unsigned short hdr_max; | ||
114 | unsigned short hdr_len; /* accumulated size of hdr used */ | ||
103 | int itt; /* this ITT */ | 115 | int itt; /* this ITT */ |
104 | 116 | ||
105 | uint32_t unsol_datasn; | 117 | uint32_t unsol_datasn; |
@@ -110,7 +122,6 @@ struct iscsi_cmd_task { | |||
110 | unsigned data_count; /* remaining Data-Out */ | 122 | unsigned data_count; /* remaining Data-Out */ |
111 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ | 123 | struct scsi_cmnd *sc; /* associated SCSI cmd*/ |
112 | struct iscsi_conn *conn; /* used connection */ | 124 | struct iscsi_conn *conn; /* used connection */ |
113 | struct iscsi_mgmt_task *mtask; /* tmf mtask in progr */ | ||
114 | 125 | ||
115 | /* state set/tested under session->lock */ | 126 | /* state set/tested under session->lock */ |
116 | int state; | 127 | int state; |
@@ -119,6 +130,11 @@ struct iscsi_cmd_task { | |||
119 | void *dd_data; /* driver/transport data */ | 130 | void *dd_data; /* driver/transport data */ |
120 | }; | 131 | }; |
121 | 132 | ||
133 | static inline void* iscsi_next_hdr(struct iscsi_cmd_task *ctask) | ||
134 | { | ||
135 | return (void*)ctask->hdr + ctask->hdr_len; | ||
136 | } | ||
137 | |||
122 | struct iscsi_conn { | 138 | struct iscsi_conn { |
123 | struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ | 139 | struct iscsi_cls_conn *cls_conn; /* ptr to class connection */ |
124 | void *dd_data; /* iscsi_transport data */ | 140 | void *dd_data; /* iscsi_transport data */ |
@@ -132,6 +148,12 @@ struct iscsi_conn { | |||
132 | * conn_stop() flag: stop to recover, stop to terminate | 148 | * conn_stop() flag: stop to recover, stop to terminate |
133 | */ | 149 | */ |
134 | int stop_stage; | 150 | int stop_stage; |
151 | struct timer_list transport_timer; | ||
152 | unsigned long last_recv; | ||
153 | unsigned long last_ping; | ||
154 | int ping_timeout; | ||
155 | int recv_timeout; | ||
156 | struct iscsi_mgmt_task *ping_mtask; | ||
135 | 157 | ||
136 | /* iSCSI connection-wide sequencing */ | 158 | /* iSCSI connection-wide sequencing */ |
137 | uint32_t exp_statsn; | 159 | uint32_t exp_statsn; |
@@ -152,10 +174,11 @@ struct iscsi_conn { | |||
152 | struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ | 174 | struct iscsi_cmd_task *ctask; /* xmit ctask in progress */ |
153 | 175 | ||
154 | /* xmit */ | 176 | /* xmit */ |
155 | struct kfifo *mgmtqueue; /* mgmt (control) xmit queue */ | 177 | struct list_head mgmtqueue; /* mgmt (control) xmit queue */ |
156 | struct list_head mgmt_run_list; /* list of control tasks */ | 178 | struct list_head mgmt_run_list; /* list of control tasks */ |
157 | struct list_head xmitqueue; /* data-path cmd queue */ | 179 | struct list_head xmitqueue; /* data-path cmd queue */ |
158 | struct list_head run_list; /* list of cmds in progress */ | 180 | struct list_head run_list; /* list of cmds in progress */ |
181 | struct list_head requeue; /* tasks needing another run */ | ||
159 | struct work_struct xmitwork; /* per-conn. xmit workqueue */ | 182 | struct work_struct xmitwork; /* per-conn. xmit workqueue */ |
160 | unsigned long suspend_tx; /* suspend Tx */ | 183 | unsigned long suspend_tx; /* suspend Tx */ |
161 | unsigned long suspend_rx; /* suspend Rx */ | 184 | unsigned long suspend_rx; /* suspend Rx */ |
@@ -163,8 +186,8 @@ struct iscsi_conn { | |||
163 | /* abort */ | 186 | /* abort */ |
164 | wait_queue_head_t ehwait; /* used in eh_abort() */ | 187 | wait_queue_head_t ehwait; /* used in eh_abort() */ |
165 | struct iscsi_tm tmhdr; | 188 | struct iscsi_tm tmhdr; |
166 | struct timer_list tmabort_timer; | 189 | struct timer_list tmf_timer; |
167 | int tmabort_state; /* see TMABORT_INITIAL, etc.*/ | 190 | int tmf_state; /* see TMF_INITIAL, etc.*/ |
168 | 191 | ||
169 | /* negotiated params */ | 192 | /* negotiated params */ |
170 | unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ | 193 | unsigned max_recv_dlength; /* initiator_max_recv_dsl*/ |
@@ -198,7 +221,7 @@ struct iscsi_conn { | |||
198 | uint32_t eh_abort_cnt; | 221 | uint32_t eh_abort_cnt; |
199 | }; | 222 | }; |
200 | 223 | ||
201 | struct iscsi_queue { | 224 | struct iscsi_pool { |
202 | struct kfifo *queue; /* FIFO Queue */ | 225 | struct kfifo *queue; /* FIFO Queue */ |
203 | void **pool; /* Pool of elements */ | 226 | void **pool; /* Pool of elements */ |
204 | int max; /* Max number of elements */ | 227 | int max; /* Max number of elements */ |
@@ -221,6 +244,8 @@ struct iscsi_session { | |||
221 | uint32_t queued_cmdsn; | 244 | uint32_t queued_cmdsn; |
222 | 245 | ||
223 | /* configuration */ | 246 | /* configuration */ |
247 | int abort_timeout; | ||
248 | int lu_reset_timeout; | ||
224 | int initial_r2t_en; | 249 | int initial_r2t_en; |
225 | unsigned max_r2t; | 250 | unsigned max_r2t; |
226 | int imm_data_en; | 251 | int imm_data_en; |
@@ -231,6 +256,7 @@ struct iscsi_session { | |||
231 | int pdu_inorder_en; | 256 | int pdu_inorder_en; |
232 | int dataseq_inorder_en; | 257 | int dataseq_inorder_en; |
233 | int erl; | 258 | int erl; |
259 | int fast_abort; | ||
234 | int tpgt; | 260 | int tpgt; |
235 | char *username; | 261 | char *username; |
236 | char *username_in; | 262 | char *username_in; |
@@ -256,10 +282,10 @@ struct iscsi_session { | |||
256 | 282 | ||
257 | int cmds_max; /* size of cmds array */ | 283 | int cmds_max; /* size of cmds array */ |
258 | struct iscsi_cmd_task **cmds; /* Original Cmds arr */ | 284 | struct iscsi_cmd_task **cmds; /* Original Cmds arr */ |
259 | struct iscsi_queue cmdpool; /* PDU's pool */ | 285 | struct iscsi_pool cmdpool; /* PDU's pool */ |
260 | int mgmtpool_max; /* size of mgmt array */ | 286 | int mgmtpool_max; /* size of mgmt array */ |
261 | struct iscsi_mgmt_task **mgmt_cmds; /* Original mgmt arr */ | 287 | struct iscsi_mgmt_task **mgmt_cmds; /* Original mgmt arr */ |
262 | struct iscsi_queue mgmtpool; /* Mgmt PDU's pool */ | 288 | struct iscsi_pool mgmtpool; /* Mgmt PDU's pool */ |
263 | }; | 289 | }; |
264 | 290 | ||
265 | /* | 291 | /* |
@@ -268,6 +294,7 @@ struct iscsi_session { | |||
268 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); | 294 | extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth); |
269 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); | 295 | extern int iscsi_eh_abort(struct scsi_cmnd *sc); |
270 | extern int iscsi_eh_host_reset(struct scsi_cmnd *sc); | 296 | extern int iscsi_eh_host_reset(struct scsi_cmnd *sc); |
297 | extern int iscsi_eh_device_reset(struct scsi_cmnd *sc); | ||
271 | extern int iscsi_queuecommand(struct scsi_cmnd *sc, | 298 | extern int iscsi_queuecommand(struct scsi_cmnd *sc, |
272 | void (*done)(struct scsi_cmnd *)); | 299 | void (*done)(struct scsi_cmnd *)); |
273 | 300 | ||
@@ -326,11 +353,32 @@ extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *, | |||
326 | char *, int); | 353 | char *, int); |
327 | extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *, | 354 | extern int iscsi_verify_itt(struct iscsi_conn *, struct iscsi_hdr *, |
328 | uint32_t *); | 355 | uint32_t *); |
356 | extern void iscsi_requeue_ctask(struct iscsi_cmd_task *ctask); | ||
357 | extern void iscsi_free_mgmt_task(struct iscsi_conn *conn, | ||
358 | struct iscsi_mgmt_task *mtask); | ||
329 | 359 | ||
330 | /* | 360 | /* |
331 | * generic helpers | 361 | * generic helpers |
332 | */ | 362 | */ |
333 | extern void iscsi_pool_free(struct iscsi_queue *, void **); | 363 | extern void iscsi_pool_free(struct iscsi_pool *); |
334 | extern int iscsi_pool_init(struct iscsi_queue *, int, void ***, int); | 364 | extern int iscsi_pool_init(struct iscsi_pool *, int, void ***, int); |
365 | |||
366 | /* | ||
367 | * inline functions to deal with padding. | ||
368 | */ | ||
369 | static inline unsigned int | ||
370 | iscsi_padded(unsigned int len) | ||
371 | { | ||
372 | return (len + ISCSI_PAD_LEN - 1) & ~(ISCSI_PAD_LEN - 1); | ||
373 | } | ||
374 | |||
375 | static inline unsigned int | ||
376 | iscsi_padding(unsigned int len) | ||
377 | { | ||
378 | len &= (ISCSI_PAD_LEN - 1); | ||
379 | if (len) | ||
380 | len = ISCSI_PAD_LEN - len; | ||
381 | return len; | ||
382 | } | ||
335 | 383 | ||
336 | #endif | 384 | #endif |
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h index a466c2cb8955..3ffd6b582a97 100644 --- a/include/scsi/libsas.h +++ b/include/scsi/libsas.h | |||
@@ -91,8 +91,6 @@ enum discover_event { | |||
91 | 91 | ||
92 | /* ---------- Expander Devices ---------- */ | 92 | /* ---------- Expander Devices ---------- */ |
93 | 93 | ||
94 | #define ETASK 0xFA | ||
95 | |||
96 | #define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj) | 94 | #define to_dom_device(_obj) container_of(_obj, struct domain_device, dev_obj) |
97 | #define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\ | 95 | #define to_dev_attr(_attr) container_of(_attr, struct domain_dev_attribute,\ |
98 | attr) | 96 | attr) |
@@ -122,8 +120,8 @@ struct ex_phy { | |||
122 | u8 attached_sata_dev:1; | 120 | u8 attached_sata_dev:1; |
123 | u8 attached_sata_ps:1; | 121 | u8 attached_sata_ps:1; |
124 | 122 | ||
125 | enum sas_proto attached_tproto; | 123 | enum sas_protocol attached_tproto; |
126 | enum sas_proto attached_iproto; | 124 | enum sas_protocol attached_iproto; |
127 | 125 | ||
128 | u8 attached_sas_addr[SAS_ADDR_SIZE]; | 126 | u8 attached_sas_addr[SAS_ADDR_SIZE]; |
129 | u8 attached_phy_id; | 127 | u8 attached_phy_id; |
@@ -191,8 +189,8 @@ struct domain_device { | |||
191 | 189 | ||
192 | struct list_head dev_list_node; | 190 | struct list_head dev_list_node; |
193 | 191 | ||
194 | enum sas_proto iproto; | 192 | enum sas_protocol iproto; |
195 | enum sas_proto tproto; | 193 | enum sas_protocol tproto; |
196 | 194 | ||
197 | struct sas_rphy *rphy; | 195 | struct sas_rphy *rphy; |
198 | 196 | ||
@@ -245,8 +243,8 @@ struct asd_sas_port { | |||
245 | enum sas_class class; | 243 | enum sas_class class; |
246 | u8 sas_addr[SAS_ADDR_SIZE]; | 244 | u8 sas_addr[SAS_ADDR_SIZE]; |
247 | u8 attached_sas_addr[SAS_ADDR_SIZE]; | 245 | u8 attached_sas_addr[SAS_ADDR_SIZE]; |
248 | enum sas_proto iproto; | 246 | enum sas_protocol iproto; |
249 | enum sas_proto tproto; | 247 | enum sas_protocol tproto; |
250 | 248 | ||
251 | enum sas_oob_mode oob_mode; | 249 | enum sas_oob_mode oob_mode; |
252 | 250 | ||
@@ -289,8 +287,8 @@ struct asd_sas_phy { | |||
289 | 287 | ||
290 | int id; /* must be set */ | 288 | int id; /* must be set */ |
291 | enum sas_class class; | 289 | enum sas_class class; |
292 | enum sas_proto iproto; | 290 | enum sas_protocol iproto; |
293 | enum sas_proto tproto; | 291 | enum sas_protocol tproto; |
294 | 292 | ||
295 | enum sas_phy_type type; | 293 | enum sas_phy_type type; |
296 | enum sas_phy_role role; | 294 | enum sas_phy_role role; |
@@ -537,7 +535,7 @@ struct sas_task { | |||
537 | spinlock_t task_state_lock; | 535 | spinlock_t task_state_lock; |
538 | unsigned task_state_flags; | 536 | unsigned task_state_flags; |
539 | 537 | ||
540 | enum sas_proto task_proto; | 538 | enum sas_protocol task_proto; |
541 | 539 | ||
542 | /* Used by the discovery code. */ | 540 | /* Used by the discovery code. */ |
543 | struct timer_list timer; | 541 | struct timer_list timer; |
@@ -563,7 +561,7 @@ struct sas_task { | |||
563 | struct work_struct abort_work; | 561 | struct work_struct abort_work; |
564 | }; | 562 | }; |
565 | 563 | ||
566 | 564 | extern struct kmem_cache *sas_task_cache; | |
567 | 565 | ||
568 | #define SAS_TASK_STATE_PENDING 1 | 566 | #define SAS_TASK_STATE_PENDING 1 |
569 | #define SAS_TASK_STATE_DONE 2 | 567 | #define SAS_TASK_STATE_DONE 2 |
@@ -573,7 +571,6 @@ struct sas_task { | |||
573 | 571 | ||
574 | static inline struct sas_task *sas_alloc_task(gfp_t flags) | 572 | static inline struct sas_task *sas_alloc_task(gfp_t flags) |
575 | { | 573 | { |
576 | extern struct kmem_cache *sas_task_cache; | ||
577 | struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags); | 574 | struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags); |
578 | 575 | ||
579 | if (task) { | 576 | if (task) { |
@@ -590,7 +587,6 @@ static inline struct sas_task *sas_alloc_task(gfp_t flags) | |||
590 | static inline void sas_free_task(struct sas_task *task) | 587 | static inline void sas_free_task(struct sas_task *task) |
591 | { | 588 | { |
592 | if (task) { | 589 | if (task) { |
593 | extern struct kmem_cache *sas_task_cache; | ||
594 | BUG_ON(!list_empty(&task->list)); | 590 | BUG_ON(!list_empty(&task->list)); |
595 | kmem_cache_free(sas_task_cache, task); | 591 | kmem_cache_free(sas_task_cache, task); |
596 | } | 592 | } |
@@ -676,4 +672,8 @@ extern int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg); | |||
676 | 672 | ||
677 | extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | 673 | extern int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, |
678 | struct request *req); | 674 | struct request *req); |
675 | |||
676 | extern void sas_ssp_task_response(struct device *dev, struct sas_task *task, | ||
677 | struct ssp_response_iu *iu); | ||
678 | |||
679 | #endif /* _SASLIB_H_ */ | 679 | #endif /* _SASLIB_H_ */ |
diff --git a/include/scsi/sas.h b/include/scsi/sas.h index 2f4b6afa34fc..e9fd02281381 100644 --- a/include/scsi/sas.h +++ b/include/scsi/sas.h | |||
@@ -102,13 +102,12 @@ enum sas_dev_type { | |||
102 | SATA_PM_PORT= 8, | 102 | SATA_PM_PORT= 8, |
103 | }; | 103 | }; |
104 | 104 | ||
105 | /* Partly from IDENTIFY address frame. */ | 105 | enum sas_protocol { |
106 | enum sas_proto { | 106 | SAS_PROTOCOL_SATA = 0x01, |
107 | SATA_PROTO = 1, | 107 | SAS_PROTOCOL_SMP = 0x02, |
108 | SAS_PROTO_SMP = 2, /* protocol */ | 108 | SAS_PROTOCOL_STP = 0x04, |
109 | SAS_PROTO_STP = 4, /* protocol */ | 109 | SAS_PROTOCOL_SSP = 0x08, |
110 | SAS_PROTO_SSP = 8, /* protocol */ | 110 | SAS_PROTOCOL_ALL = 0x0E, |
111 | SAS_PROTO_ALL = 0xE, | ||
112 | }; | 111 | }; |
113 | 112 | ||
114 | /* From the spec; local phys only */ | 113 | /* From the spec; local phys only */ |
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 3f47e522a1ec..abd7479ff452 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -88,7 +88,7 @@ struct scsi_cmnd { | |||
88 | working on */ | 88 | working on */ |
89 | 89 | ||
90 | #define SCSI_SENSE_BUFFERSIZE 96 | 90 | #define SCSI_SENSE_BUFFERSIZE 96 |
91 | unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE]; | 91 | unsigned char *sense_buffer; |
92 | /* obtained by REQUEST SENSE when | 92 | /* obtained by REQUEST SENSE when |
93 | * CHECK CONDITION is received on original | 93 | * CHECK CONDITION is received on original |
94 | * command (auto-sense) */ | 94 | * command (auto-sense) */ |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 6c2d80b36aa1..ab7acbe80960 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -122,9 +122,6 @@ struct scsi_device { | |||
122 | unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */ | 122 | unsigned tagged_supported:1; /* Supports SCSI-II tagged queuing */ |
123 | unsigned simple_tags:1; /* simple queue tag messages are enabled */ | 123 | unsigned simple_tags:1; /* simple queue tag messages are enabled */ |
124 | unsigned ordered_tags:1;/* ordered queue tag messages are enabled */ | 124 | unsigned ordered_tags:1;/* ordered queue tag messages are enabled */ |
125 | unsigned single_lun:1; /* Indicates we should only allow I/O to | ||
126 | * one of the luns for the device at a | ||
127 | * time. */ | ||
128 | unsigned was_reset:1; /* There was a bus reset on the bus for | 125 | unsigned was_reset:1; /* There was a bus reset on the bus for |
129 | * this device */ | 126 | * this device */ |
130 | unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN | 127 | unsigned expecting_cc_ua:1; /* Expecting a CHECK_CONDITION/UNIT_ATTN |
@@ -142,6 +139,7 @@ struct scsi_device { | |||
142 | unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ | 139 | unsigned fix_capacity:1; /* READ_CAPACITY is too high by 1 */ |
143 | unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ | 140 | unsigned guess_capacity:1; /* READ_CAPACITY might be too high by 1 */ |
144 | unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ | 141 | unsigned retry_hwerror:1; /* Retry HARDWARE_ERROR */ |
142 | unsigned last_sector_bug:1; /* Always read last sector in a 1 sector read */ | ||
145 | 143 | ||
146 | DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ | 144 | DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ |
147 | struct list_head event_list; /* asserted events */ | 145 | struct list_head event_list; /* asserted events */ |
@@ -202,6 +200,9 @@ struct scsi_target { | |||
202 | unsigned int id; /* target id ... replace | 200 | unsigned int id; /* target id ... replace |
203 | * scsi_device.id eventually */ | 201 | * scsi_device.id eventually */ |
204 | unsigned int create:1; /* signal that it needs to be added */ | 202 | unsigned int create:1; /* signal that it needs to be added */ |
203 | unsigned int single_lun:1; /* Indicates we should only | ||
204 | * allow I/O to one of the luns | ||
205 | * for the device at a time. */ | ||
205 | unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ | 206 | unsigned int pdt_1f_for_no_lun; /* PDT = 0x1f */ |
206 | /* means no lun present */ | 207 | /* means no lun present */ |
207 | 208 | ||
@@ -295,7 +296,7 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp, | |||
295 | struct scsi_mode_data *data, | 296 | struct scsi_mode_data *data, |
296 | struct scsi_sense_hdr *); | 297 | struct scsi_sense_hdr *); |
297 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, | 298 | extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, |
298 | int retries); | 299 | int retries, struct scsi_sense_hdr *sshdr); |
299 | extern int scsi_device_set_state(struct scsi_device *sdev, | 300 | extern int scsi_device_set_state(struct scsi_device *sdev, |
300 | enum scsi_device_state state); | 301 | enum scsi_device_state state); |
301 | extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, | 302 | extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, |
@@ -386,6 +387,10 @@ static inline int scsi_device_qas(struct scsi_device *sdev) | |||
386 | return 0; | 387 | return 0; |
387 | return sdev->inquiry[56] & 0x02; | 388 | return sdev->inquiry[56] & 0x02; |
388 | } | 389 | } |
390 | static inline int scsi_device_enclosure(struct scsi_device *sdev) | ||
391 | { | ||
392 | return sdev->inquiry[6] & (1<<6); | ||
393 | } | ||
389 | 394 | ||
390 | #define MODULE_ALIAS_SCSI_DEVICE(type) \ | 395 | #define MODULE_ALIAS_SCSI_DEVICE(type) \ |
391 | MODULE_ALIAS("scsi:t-" __stringify(type) "*") | 396 | MODULE_ALIAS("scsi:t-" __stringify(type) "*") |
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 7ff6199cbd55..404f11d331d6 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -118,7 +118,7 @@ struct iscsi_transport { | |||
118 | char *data, uint32_t data_size); | 118 | char *data, uint32_t data_size); |
119 | void (*get_stats) (struct iscsi_cls_conn *conn, | 119 | void (*get_stats) (struct iscsi_cls_conn *conn, |
120 | struct iscsi_stats *stats); | 120 | struct iscsi_stats *stats); |
121 | void (*init_cmd_task) (struct iscsi_cmd_task *ctask); | 121 | int (*init_cmd_task) (struct iscsi_cmd_task *ctask); |
122 | void (*init_mgmt_task) (struct iscsi_conn *conn, | 122 | void (*init_mgmt_task) (struct iscsi_conn *conn, |
123 | struct iscsi_mgmt_task *mtask); | 123 | struct iscsi_mgmt_task *mtask); |
124 | int (*xmit_cmd_task) (struct iscsi_conn *conn, | 124 | int (*xmit_cmd_task) (struct iscsi_conn *conn, |
@@ -176,6 +176,7 @@ struct iscsi_cls_conn { | |||
176 | #define ISCSI_STATE_TERMINATE 4 | 176 | #define ISCSI_STATE_TERMINATE 4 |
177 | #define ISCSI_STATE_IN_RECOVERY 5 | 177 | #define ISCSI_STATE_IN_RECOVERY 5 |
178 | #define ISCSI_STATE_RECOVERY_FAILED 6 | 178 | #define ISCSI_STATE_RECOVERY_FAILED 6 |
179 | #define ISCSI_STATE_LOGGING_OUT 7 | ||
179 | 180 | ||
180 | struct iscsi_cls_session { | 181 | struct iscsi_cls_session { |
181 | struct list_head sess_list; /* item in session_list */ | 182 | struct list_head sess_list; /* item in session_list */ |
@@ -185,6 +186,7 @@ struct iscsi_cls_session { | |||
185 | /* recovery fields */ | 186 | /* recovery fields */ |
186 | int recovery_tmo; | 187 | int recovery_tmo; |
187 | struct delayed_work recovery_work; | 188 | struct delayed_work recovery_work; |
189 | struct work_struct unbind_work; | ||
188 | 190 | ||
189 | int target_id; | 191 | int target_id; |
190 | 192 | ||
@@ -205,6 +207,8 @@ struct iscsi_cls_session { | |||
205 | struct iscsi_host { | 207 | struct iscsi_host { |
206 | struct list_head sessions; | 208 | struct list_head sessions; |
207 | struct mutex mutex; | 209 | struct mutex mutex; |
210 | struct workqueue_struct *unbind_workq; | ||
211 | char unbind_workq_name[KOBJ_NAME_LEN]; | ||
208 | }; | 212 | }; |
209 | 213 | ||
210 | /* | 214 | /* |
@@ -214,8 +218,8 @@ extern struct iscsi_cls_session *iscsi_alloc_session(struct Scsi_Host *shost, | |||
214 | struct iscsi_transport *transport); | 218 | struct iscsi_transport *transport); |
215 | extern int iscsi_add_session(struct iscsi_cls_session *session, | 219 | extern int iscsi_add_session(struct iscsi_cls_session *session, |
216 | unsigned int target_id); | 220 | unsigned int target_id); |
217 | extern int iscsi_if_create_session_done(struct iscsi_cls_conn *conn); | 221 | extern int iscsi_session_event(struct iscsi_cls_session *session, |
218 | extern int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn); | 222 | enum iscsi_uevent_e event); |
219 | extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, | 223 | extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost, |
220 | struct iscsi_transport *t, | 224 | struct iscsi_transport *t, |
221 | unsigned int target_id); | 225 | unsigned int target_id); |
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h index abdfd2e27dd7..09125fa95b93 100644 --- a/include/scsi/scsi_transport_sas.h +++ b/include/scsi/scsi_transport_sas.h | |||
@@ -4,23 +4,17 @@ | |||
4 | #include <linux/transport_class.h> | 4 | #include <linux/transport_class.h> |
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/mutex.h> | 6 | #include <linux/mutex.h> |
7 | #include <scsi/sas.h> | ||
7 | 8 | ||
8 | struct scsi_transport_template; | 9 | struct scsi_transport_template; |
9 | struct sas_rphy; | 10 | struct sas_rphy; |
10 | struct request; | 11 | struct request; |
11 | 12 | ||
12 | enum sas_device_type { | 13 | enum sas_device_type { |
13 | SAS_PHY_UNUSED, | 14 | SAS_PHY_UNUSED = 0, |
14 | SAS_END_DEVICE, | 15 | SAS_END_DEVICE = 1, |
15 | SAS_EDGE_EXPANDER_DEVICE, | 16 | SAS_EDGE_EXPANDER_DEVICE = 2, |
16 | SAS_FANOUT_EXPANDER_DEVICE, | 17 | SAS_FANOUT_EXPANDER_DEVICE = 3, |
17 | }; | ||
18 | |||
19 | enum sas_protocol { | ||
20 | SAS_PROTOCOL_SATA = 0x01, | ||
21 | SAS_PROTOCOL_SMP = 0x02, | ||
22 | SAS_PROTOCOL_STP = 0x04, | ||
23 | SAS_PROTOCOL_SSP = 0x08, | ||
24 | }; | 18 | }; |
25 | 19 | ||
26 | static inline int sas_protocol_ata(enum sas_protocol proto) | 20 | static inline int sas_protocol_ata(enum sas_protocol proto) |
diff --git a/include/scsi/sd.h b/include/scsi/sd.h index f7513313ef0d..8ea9f7358ac1 100644 --- a/include/scsi/sd.h +++ b/include/scsi/sd.h | |||
@@ -41,6 +41,7 @@ struct scsi_disk { | |||
41 | u32 index; | 41 | u32 index; |
42 | u8 media_present; | 42 | u8 media_present; |
43 | u8 write_prot; | 43 | u8 write_prot; |
44 | unsigned previous_state : 1; | ||
44 | unsigned WCE : 1; /* state of disk WCE bit */ | 45 | unsigned WCE : 1; /* state of disk WCE bit */ |
45 | unsigned RCD : 1; /* state of disk RCD bit, unused */ | 46 | unsigned RCD : 1; /* state of disk RCD bit, unused */ |
46 | unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ | 47 | unsigned DPOFUA : 1; /* state of disk DPOFUA bit */ |