diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2010-09-10 14:50:10 -0400 |
---|---|---|
committer | Jens Axboe <axboe@carl.home.kernel.dk> | 2010-09-10 14:50:10 -0400 |
commit | 13f05c8d8e98bbdce89158bfdb2e380940695a88 (patch) | |
tree | 055215e7e2b1bdc684ead64daa61b30b35eaa3c5 /include/scsi | |
parent | c8bf1336824ebd698d37b71763e1c43190f2229a (diff) |
block/scsi: Provide a limit on the number of integrity segments
Some controllers have a hardware limit on the number of protection
information scatter-gather list segments they can handle.
Introduce a max_integrity_segments limit in the block layer and provide
a new scsi_host_template setting that allows HBA drivers to provide a
value suitable for the hardware.
Add support for honoring the integrity segment limit when merging both
bios and requests.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@carl.home.kernel.dk>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/scsi.h | 6 | ||||
-rw-r--r-- | include/scsi/scsi_host.h | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 8fcb6e0e9e72..d63533a4a59e 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -32,6 +32,12 @@ struct scsi_cmnd; | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * DIX-capable adapters effectively support infinite chaining for the | ||
36 | * protection information scatterlist | ||
37 | */ | ||
38 | #define SCSI_MAX_PROT_SG_SEGMENTS 0xFFFF | ||
39 | |||
40 | /* | ||
35 | * Special value for scanning to specify scanning or rescanning of all | 41 | * Special value for scanning to specify scanning or rescanning of all |
36 | * possible channels, (target) ids, or luns on a given shost. | 42 | * possible channels, (target) ids, or luns on a given shost. |
37 | */ | 43 | */ |
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index b7bdecb7b76e..d0a6a845f204 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -388,6 +388,7 @@ struct scsi_host_template { | |||
388 | * of scatter-gather. | 388 | * of scatter-gather. |
389 | */ | 389 | */ |
390 | unsigned short sg_tablesize; | 390 | unsigned short sg_tablesize; |
391 | unsigned short sg_prot_tablesize; | ||
391 | 392 | ||
392 | /* | 393 | /* |
393 | * Set this if the host adapter has limitations beside segment count. | 394 | * Set this if the host adapter has limitations beside segment count. |
@@ -599,6 +600,7 @@ struct Scsi_Host { | |||
599 | int can_queue; | 600 | int can_queue; |
600 | short cmd_per_lun; | 601 | short cmd_per_lun; |
601 | short unsigned int sg_tablesize; | 602 | short unsigned int sg_tablesize; |
603 | short unsigned int sg_prot_tablesize; | ||
602 | short unsigned int max_sectors; | 604 | short unsigned int max_sectors; |
603 | unsigned long dma_boundary; | 605 | unsigned long dma_boundary; |
604 | /* | 606 | /* |
@@ -823,6 +825,11 @@ static inline unsigned int scsi_host_get_prot(struct Scsi_Host *shost) | |||
823 | return shost->prot_capabilities; | 825 | return shost->prot_capabilities; |
824 | } | 826 | } |
825 | 827 | ||
828 | static inline int scsi_host_prot_dma(struct Scsi_Host *shost) | ||
829 | { | ||
830 | return shost->prot_capabilities >= SHOST_DIX_TYPE0_PROTECTION; | ||
831 | } | ||
832 | |||
826 | static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type) | 833 | static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type) |
827 | { | 834 | { |
828 | static unsigned char cap[] = { 0, | 835 | static unsigned char cap[] = { 0, |