diff options
author | Arun Easi <arun.easi@qlogic.com> | 2010-07-23 06:28:38 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 10:06:18 -0400 |
commit | 0c470874858e0075f420dcfb3c3570b2057de275 (patch) | |
tree | fcf71bf85fa95567727187f32de29ff3ddb54827 /drivers/scsi | |
parent | 3dbe756a66afbec6487068d4213ecccc3a18807f (diff) |
[SCSI] qla2xxx: T10 DIF Type 2 support
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 2 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_iocb.c | 35 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mid.c | 5 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 7 |
4 files changed, 43 insertions, 6 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index d9b431d061b2..420238cc794e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -1758,8 +1758,10 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable) | |||
1758 | " protection.\n")); | 1758 | " protection.\n")); |
1759 | scsi_host_set_prot(vha->host, | 1759 | scsi_host_set_prot(vha->host, |
1760 | SHOST_DIF_TYPE1_PROTECTION | 1760 | SHOST_DIF_TYPE1_PROTECTION |
1761 | | SHOST_DIF_TYPE2_PROTECTION | ||
1761 | | SHOST_DIF_TYPE3_PROTECTION | 1762 | | SHOST_DIF_TYPE3_PROTECTION |
1762 | | SHOST_DIX_TYPE1_PROTECTION | 1763 | | SHOST_DIX_TYPE1_PROTECTION |
1764 | | SHOST_DIX_TYPE2_PROTECTION | ||
1763 | | SHOST_DIX_TYPE3_PROTECTION); | 1765 | | SHOST_DIX_TYPE3_PROTECTION); |
1764 | scsi_host_set_guard(vha->host, SHOST_DIX_GUARD_CRC); | 1766 | scsi_host_set_guard(vha->host, SHOST_DIX_GUARD_CRC); |
1765 | } else | 1767 | } else |
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index d2b299f2c503..4e4c21fafe3a 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -712,6 +712,25 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, | |||
712 | * match LBA in CDB + N | 712 | * match LBA in CDB + N |
713 | */ | 713 | */ |
714 | case SCSI_PROT_DIF_TYPE2: | 714 | case SCSI_PROT_DIF_TYPE2: |
715 | if (!ql2xenablehba_err_chk) | ||
716 | break; | ||
717 | |||
718 | if (scsi_prot_sg_count(cmd)) { | ||
719 | spt = page_address(sg_page(scsi_prot_sglist(cmd))) + | ||
720 | scsi_prot_sglist(cmd)[0].offset; | ||
721 | pkt->app_tag = swab32(spt->app_tag); | ||
722 | pkt->app_tag_mask[0] = 0xff; | ||
723 | pkt->app_tag_mask[1] = 0xff; | ||
724 | } | ||
725 | |||
726 | pkt->ref_tag = cpu_to_le32((uint32_t) | ||
727 | (0xffffffff & scsi_get_lba(cmd))); | ||
728 | |||
729 | /* enable ALL bytes of the ref tag */ | ||
730 | pkt->ref_tag_mask[0] = 0xff; | ||
731 | pkt->ref_tag_mask[1] = 0xff; | ||
732 | pkt->ref_tag_mask[2] = 0xff; | ||
733 | pkt->ref_tag_mask[3] = 0xff; | ||
715 | break; | 734 | break; |
716 | 735 | ||
717 | /* For Type 3 protection: 16 bit GUARD only */ | 736 | /* For Type 3 protection: 16 bit GUARD only */ |
@@ -1062,7 +1081,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
1062 | total_bytes = data_bytes; | 1081 | total_bytes = data_bytes; |
1063 | dif_bytes = 0; | 1082 | dif_bytes = 0; |
1064 | blk_size = cmd->device->sector_size; | 1083 | blk_size = cmd->device->sector_size; |
1065 | if (scsi_get_prot_type(cmd) == SCSI_PROT_DIF_TYPE1) { | 1084 | if (scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { |
1066 | dif_bytes = (data_bytes / blk_size) * 8; | 1085 | dif_bytes = (data_bytes / blk_size) * 8; |
1067 | total_bytes += dif_bytes; | 1086 | total_bytes += dif_bytes; |
1068 | } | 1087 | } |
@@ -1100,6 +1119,12 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, | |||
1100 | vha->host_no, dif_bytes, dif_bytes, total_bytes, total_bytes, | 1119 | vha->host_no, dif_bytes, dif_bytes, total_bytes, total_bytes, |
1101 | crc_ctx_pkt->blk_size, crc_ctx_pkt->blk_size)); | 1120 | crc_ctx_pkt->blk_size, crc_ctx_pkt->blk_size)); |
1102 | 1121 | ||
1122 | if (!data_bytes || cmd->sc_data_direction == DMA_NONE) { | ||
1123 | DEBUG18(printk(KERN_INFO "%s: Zero data bytes or DMA-NONE %d\n", | ||
1124 | __func__, data_bytes)); | ||
1125 | cmd_pkt->byte_count = __constant_cpu_to_le32(0); | ||
1126 | return QLA_SUCCESS; | ||
1127 | } | ||
1103 | /* Walks data segments */ | 1128 | /* Walks data segments */ |
1104 | 1129 | ||
1105 | cmd_pkt->control_flags |= | 1130 | cmd_pkt->control_flags |= |
@@ -1310,9 +1335,11 @@ qla24xx_dif_start_scsi(srb_t *sp) | |||
1310 | 1335 | ||
1311 | #define QDSS_GOT_Q_SPACE BIT_0 | 1336 | #define QDSS_GOT_Q_SPACE BIT_0 |
1312 | 1337 | ||
1313 | /* Only process protection in this routine */ | 1338 | /* Only process protection or >16 cdb in this routine */ |
1314 | if (scsi_get_prot_op(cmd) == SCSI_PROT_NORMAL) | 1339 | if (scsi_get_prot_op(cmd) == SCSI_PROT_NORMAL) { |
1315 | return qla24xx_start_scsi(sp); | 1340 | if (cmd->cmd_len <= 16) |
1341 | return qla24xx_start_scsi(sp); | ||
1342 | } | ||
1316 | 1343 | ||
1317 | /* Setup device pointers. */ | 1344 | /* Setup device pointers. */ |
1318 | 1345 | ||
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 9a82c34f6206..987c5b0ca78e 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -399,7 +399,10 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) | |||
399 | host->can_queue = base_vha->req->length + 128; | 399 | host->can_queue = base_vha->req->length + 128; |
400 | host->this_id = 255; | 400 | host->this_id = 255; |
401 | host->cmd_per_lun = 3; | 401 | host->cmd_per_lun = 3; |
402 | host->max_cmd_len = MAX_CMDSZ; | 402 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) |
403 | host->max_cmd_len = 32; | ||
404 | else | ||
405 | host->max_cmd_len = MAX_CMDSZ; | ||
403 | host->max_channel = MAX_BUSES - 1; | 406 | host->max_channel = MAX_BUSES - 1; |
404 | host->max_lun = MAX_LUNS; | 407 | host->max_lun = MAX_LUNS; |
405 | host->unique_id = host->host_no; | 408 | host->unique_id = host->host_no; |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index aeb2f1b504c4..ff2172da7c19 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -2147,7 +2147,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2147 | host->this_id = 255; | 2147 | host->this_id = 255; |
2148 | host->cmd_per_lun = 3; | 2148 | host->cmd_per_lun = 3; |
2149 | host->unique_id = host->host_no; | 2149 | host->unique_id = host->host_no; |
2150 | host->max_cmd_len = MAX_CMDSZ; | 2150 | if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) |
2151 | host->max_cmd_len = 32; | ||
2152 | else | ||
2153 | host->max_cmd_len = MAX_CMDSZ; | ||
2151 | host->max_channel = MAX_BUSES - 1; | 2154 | host->max_channel = MAX_BUSES - 1; |
2152 | host->max_lun = MAX_LUNS; | 2155 | host->max_lun = MAX_LUNS; |
2153 | host->transportt = qla2xxx_transport_template; | 2156 | host->transportt = qla2xxx_transport_template; |
@@ -2255,8 +2258,10 @@ skip_dpc: | |||
2255 | " protection.\n")); | 2258 | " protection.\n")); |
2256 | scsi_host_set_prot(host, | 2259 | scsi_host_set_prot(host, |
2257 | SHOST_DIF_TYPE1_PROTECTION | 2260 | SHOST_DIF_TYPE1_PROTECTION |
2261 | | SHOST_DIF_TYPE2_PROTECTION | ||
2258 | | SHOST_DIF_TYPE3_PROTECTION | 2262 | | SHOST_DIF_TYPE3_PROTECTION |
2259 | | SHOST_DIX_TYPE1_PROTECTION | 2263 | | SHOST_DIX_TYPE1_PROTECTION |
2264 | | SHOST_DIX_TYPE2_PROTECTION | ||
2260 | | SHOST_DIX_TYPE3_PROTECTION); | 2265 | | SHOST_DIX_TYPE3_PROTECTION); |
2261 | scsi_host_set_guard(host, SHOST_DIX_GUARD_CRC); | 2266 | scsi_host_set_guard(host, SHOST_DIX_GUARD_CRC); |
2262 | } else | 2267 | } else |