aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_cmnd.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/scsi_cmnd.h')
-rw-r--r--include/scsi/scsi_cmnd.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 66c944849d6b..402c1078d01c 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -77,6 +77,9 @@ struct scsi_cmnd {
77 int allowed; 77 int allowed;
78 int timeout_per_command; 78 int timeout_per_command;
79 79
80 unsigned char prot_op;
81 unsigned char prot_type;
82
80 unsigned short cmd_len; 83 unsigned short cmd_len;
81 enum dma_data_direction sc_data_direction; 84 enum dma_data_direction sc_data_direction;
82 85
@@ -208,4 +211,67 @@ static inline int scsi_sg_copy_to_buffer(struct scsi_cmnd *cmd,
208 buf, buflen); 211 buf, buflen);
209} 212}
210 213
214/*
215 * The operations below are hints that tell the controller driver how
216 * to handle I/Os with DIF or similar types of protection information.
217 */
218enum scsi_prot_operations {
219 /* Normal I/O */
220 SCSI_PROT_NORMAL = 0,
221
222 /* OS-HBA: Protected, HBA-Target: Unprotected */
223 SCSI_PROT_READ_INSERT,
224 SCSI_PROT_WRITE_STRIP,
225
226 /* OS-HBA: Unprotected, HBA-Target: Protected */
227 SCSI_PROT_READ_STRIP,
228 SCSI_PROT_WRITE_INSERT,
229
230 /* OS-HBA: Protected, HBA-Target: Protected */
231 SCSI_PROT_READ_PASS,
232 SCSI_PROT_WRITE_PASS,
233
234 /* OS-HBA: Protected, HBA-Target: Protected, checksum conversion */
235 SCSI_PROT_READ_CONVERT,
236 SCSI_PROT_WRITE_CONVERT,
237};
238
239static inline void scsi_set_prot_op(struct scsi_cmnd *scmd, unsigned char op)
240{
241 scmd->prot_op = op;
242}
243
244static inline unsigned char scsi_get_prot_op(struct scsi_cmnd *scmd)
245{
246 return scmd->prot_op;
247}
248
249/*
250 * The controller usually does not know anything about the target it
251 * is communicating with. However, when DIX is enabled the controller
252 * must be know target type so it can verify the protection
253 * information passed along with the I/O.
254 */
255enum scsi_prot_target_type {
256 SCSI_PROT_DIF_TYPE0 = 0,
257 SCSI_PROT_DIF_TYPE1,
258 SCSI_PROT_DIF_TYPE2,
259 SCSI_PROT_DIF_TYPE3,
260};
261
262static inline void scsi_set_prot_type(struct scsi_cmnd *scmd, unsigned char type)
263{
264 scmd->prot_type = type;
265}
266
267static inline unsigned char scsi_get_prot_type(struct scsi_cmnd *scmd)
268{
269 return scmd->prot_type;
270}
271
272static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
273{
274 return scmd->request->sector;
275}
276
211#endif /* _SCSI_SCSI_CMND_H */ 277#endif /* _SCSI_SCSI_CMND_H */