aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorBoaz Harrosh <bharrosh@panasas.com>2008-04-30 04:19:47 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-05-02 11:18:22 -0400
commit64a87b244b9297667ca80264aab849a36f494884 (patch)
tree554d78d1cfe594b92409a19b3ed1d32efcbd31cc /include/scsi
parent9f5de6b105bfa45911d46566df0b36720b648c42 (diff)
[SCSI] Let scsi_cmnd->cmnd use request->cmd buffer
- struct scsi_cmnd had a 16 bytes command buffer of its own. This is an unnecessary duplication and copy of request's cmd. It is probably left overs from the time that scsi_cmnd could function without a request attached. So clean that up. - Once above is done, few places, apart from scsi-ml, needed adjustments due to changing the data type of scsi_cmnd->cmnd. - Lots of drivers still use MAX_COMMAND_SIZE. So I have left that #define but equate it to BLK_MAX_CDB. The way I see it and is reflected in the patch below is. MAX_COMMAND_SIZE - means: The longest fixed-length (*) SCSI CDB as per the SCSI standard and is not related to the implementation. BLK_MAX_CDB. - The allocated space at the request level - I have audit all ISA drivers and made sure none use ->cmnd in a DMA Operation. Same audit was done by Andi Kleen. (*)fixed-length here means commands that their size can be determined by their opcode and the CDB does not carry a length specifier, (unlike the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly true and the SCSI standard also defines extended commands and vendor specific commands that can be bigger than 16 bytes. The kernel will support these using the same infrastructure used for VARLEN CDB's. So in effect MAX_COMMAND_SIZE means the maximum size command scsi-ml supports without specifying a cmd_len by ULD's Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_cmnd.h21
-rw-r--r--include/scsi/scsi_eh.h4
2 files changed, 21 insertions, 4 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 8d20e60a94b..7ed883c8e48 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -7,10 +7,28 @@
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/timer.h> 8#include <linux/timer.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <linux/blkdev.h>
10 11
11struct Scsi_Host; 12struct Scsi_Host;
12struct scsi_device; 13struct scsi_device;
13 14
15/*
16 * MAX_COMMAND_SIZE is:
17 * The longest fixed-length SCSI CDB as per the SCSI standard.
18 * fixed-length means: commands that their size can be determined
19 * by their opcode and the CDB does not carry a length specifier, (unlike
20 * the VARIABLE_LENGTH_CMD(0x7f) command). This is actually not exactly
21 * true and the SCSI standard also defines extended commands and
22 * vendor specific commands that can be bigger than 16 bytes. The kernel
23 * will support these using the same infrastructure used for VARLEN CDB's.
24 * So in effect MAX_COMMAND_SIZE means the maximum size command scsi-ml
25 * supports without specifying a cmd_len by ULD's
26 */
27#define MAX_COMMAND_SIZE 16
28#if (MAX_COMMAND_SIZE > BLK_MAX_CDB)
29# error MAX_COMMAND_SIZE can not be bigger than BLK_MAX_CDB
30#endif
31
14struct scsi_data_buffer { 32struct scsi_data_buffer {
15 struct sg_table table; 33 struct sg_table table;
16 unsigned length; 34 unsigned length;
@@ -64,8 +82,7 @@ struct scsi_cmnd {
64 enum dma_data_direction sc_data_direction; 82 enum dma_data_direction sc_data_direction;
65 83
66 /* These elements define the operation we are about to perform */ 84 /* These elements define the operation we are about to perform */
67#define MAX_COMMAND_SIZE 16 85 unsigned char *cmnd;
68 unsigned char cmnd[MAX_COMMAND_SIZE];
69 86
70 struct timer_list eh_timeout; /* Used to time out the command. */ 87 struct timer_list eh_timeout; /* Used to time out the command. */
71 88
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index d3a133b4a07..2a9add21267 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -75,11 +75,11 @@ struct scsi_eh_save {
75 int result; 75 int result;
76 enum dma_data_direction data_direction; 76 enum dma_data_direction data_direction;
77 unsigned char cmd_len; 77 unsigned char cmd_len;
78 unsigned char cmnd[MAX_COMMAND_SIZE]; 78 unsigned char *cmnd;
79 struct scsi_data_buffer sdb; 79 struct scsi_data_buffer sdb;
80 struct request *next_rq; 80 struct request *next_rq;
81
82 /* new command support */ 81 /* new command support */
82 unsigned char eh_cmnd[BLK_MAX_CDB];
83 struct scatterlist sense_sgl; 83 struct scatterlist sense_sgl;
84}; 84};
85 85