aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-10-20 09:30:55 -0400
committerArnd Bergmann <arnd@arndb.de>2011-10-20 09:30:55 -0400
commit29ea35969b92a4be122a58c4aceea8c5e2c388d9 (patch)
tree8285c0e98e7bb03868d390b58180e3cab876a8db /drivers/scsi/qla2xxx
parent112d17d6f75b93e1dcaec2e2232a411148b3bf71 (diff)
parentb4cbb8a4e602ea77b0525d06eff89c6a6070dab3 (diff)
Merge branch 'imx/devel' into next/devel
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c36
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_fw.h5
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c3
-rw-r--r--drivers/scsi/qla2xxx/qla_inline.h29
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c282
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c109
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c25
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c30
-rw-r--r--drivers/scsi/qla2xxx/qla_version.h2
12 files changed, 415 insertions, 117 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 7836eb01c7fc..a31e05f3bfd4 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1786,13 +1786,16 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
1786 fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN); 1786 fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN);
1787 } 1787 }
1788 1788
1789 if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) { 1789 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) {
1790 if (ha->fw_attributes & BIT_4) { 1790 if (ha->fw_attributes & BIT_4) {
1791 int prot = 0;
1791 vha->flags.difdix_supported = 1; 1792 vha->flags.difdix_supported = 1;
1792 ql_dbg(ql_dbg_user, vha, 0x7082, 1793 ql_dbg(ql_dbg_user, vha, 0x7082,
1793 "Registered for DIF/DIX type 1 and 3 protection.\n"); 1794 "Registered for DIF/DIX type 1 and 3 protection.\n");
1795 if (ql2xenabledif == 1)
1796 prot = SHOST_DIX_TYPE0_PROTECTION;
1794 scsi_host_set_prot(vha->host, 1797 scsi_host_set_prot(vha->host,
1795 SHOST_DIF_TYPE1_PROTECTION 1798 prot | SHOST_DIF_TYPE1_PROTECTION
1796 | SHOST_DIF_TYPE2_PROTECTION 1799 | SHOST_DIF_TYPE2_PROTECTION
1797 | SHOST_DIF_TYPE3_PROTECTION 1800 | SHOST_DIF_TYPE3_PROTECTION
1798 | SHOST_DIX_TYPE1_PROTECTION 1801 | SHOST_DIX_TYPE1_PROTECTION
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 2155071f3100..d79cd8a5f831 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -8,24 +8,24 @@
8/* 8/*
9 * Table for showing the current message id in use for particular level 9 * Table for showing the current message id in use for particular level
10 * Change this table for addition of log/debug messages. 10 * Change this table for addition of log/debug messages.
11 * ----------------------------------------------------- 11 * ----------------------------------------------------------------------
12 * | Level | Last Value Used | 12 * | Level | Last Value Used | Holes |
13 * ----------------------------------------------------- 13 * ----------------------------------------------------------------------
14 * | Module Init and Probe | 0x0116 | 14 * | Module Init and Probe | 0x0116 | |
15 * | Mailbox commands | 0x111e | 15 * | Mailbox commands | 0x1126 | |
16 * | Device Discovery | 0x2083 | 16 * | Device Discovery | 0x2083 | |
17 * | Queue Command and IO tracing | 0x302e | 17 * | Queue Command and IO tracing | 0x302e | 0x3008 |
18 * | DPC Thread | 0x401c | 18 * | DPC Thread | 0x401c | |
19 * | Async Events | 0x5059 | 19 * | Async Events | 0x5059 | |
20 * | Timer Routines | 0x600d | 20 * | Timer Routines | 0x600d | |
21 * | User Space Interactions | 0x709c | 21 * | User Space Interactions | 0x709d | |
22 * | Task Management | 0x8043 | 22 * | Task Management | 0x8041 | |
23 * | AER/EEH | 0x900f | 23 * | AER/EEH | 0x900f | |
24 * | Virtual Port | 0xa007 | 24 * | Virtual Port | 0xa007 | |
25 * | ISP82XX Specific | 0xb027 | 25 * | ISP82XX Specific | 0xb04f | |
26 * | MultiQ | 0xc00b | 26 * | MultiQ | 0xc00b | |
27 * | Misc | 0xd00b | 27 * | Misc | 0xd00b | |
28 * ----------------------------------------------------- 28 * ----------------------------------------------------------------------
29 */ 29 */
30 30
31#include "qla_def.h" 31#include "qla_def.h"
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index cc5a79259d33..a03eaf40f377 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2529,6 +2529,7 @@ struct qla_hw_data {
2529#define DT_ISP8021 BIT_14 2529#define DT_ISP8021 BIT_14
2530#define DT_ISP_LAST (DT_ISP8021 << 1) 2530#define DT_ISP_LAST (DT_ISP8021 << 1)
2531 2531
2532#define DT_T10_PI BIT_25
2532#define DT_IIDMA BIT_26 2533#define DT_IIDMA BIT_26
2533#define DT_FWI2 BIT_27 2534#define DT_FWI2 BIT_27
2534#define DT_ZIO_SUPPORTED BIT_28 2535#define DT_ZIO_SUPPORTED BIT_28
@@ -2572,6 +2573,7 @@ struct qla_hw_data {
2572#define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha)) 2573#define IS_NOCACHE_VPD_TYPE(ha) (IS_QLA81XX(ha))
2573#define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha)) 2574#define IS_ALOGIO_CAPABLE(ha) (IS_QLA23XX(ha) || IS_FWI2_CAPABLE(ha))
2574 2575
2576#define IS_T10_PI_CAPABLE(ha) ((ha)->device_type & DT_T10_PI)
2575#define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA) 2577#define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA)
2576#define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2) 2578#define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2)
2577#define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED) 2579#define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED)
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index 691783abfb69..aa69486dc064 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -537,6 +537,11 @@ struct sts_entry_24xx {
537 /* 537 /*
538 * If DIF Error is set in comp_status, these additional fields are 538 * If DIF Error is set in comp_status, these additional fields are
539 * defined: 539 * defined:
540 *
541 * !!! NOTE: Firmware sends expected/actual DIF data in big endian
542 * format; but all of the "data" field gets swab32-d in the beginning
543 * of qla2x00_status_entry().
544 *
540 * &data[10] : uint8_t report_runt_bg[2]; - computed guard 545 * &data[10] : uint8_t report_runt_bg[2]; - computed guard
541 * &data[12] : uint8_t actual_dif[8]; - DIF Data received 546 * &data[12] : uint8_t actual_dif[8]; - DIF Data received
542 * &data[20] : uint8_t expected_dif[8]; - DIF Data computed 547 * &data[20] : uint8_t expected_dif[8]; - DIF Data computed
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index def694271bf7..37da04d3db26 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3838,15 +3838,12 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
3838 req = vha->req; 3838 req = vha->req;
3839 rsp = req->rsp; 3839 rsp = req->rsp;
3840 3840
3841 atomic_set(&vha->loop_state, LOOP_UPDATE);
3842 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); 3841 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
3843 if (vha->flags.online) { 3842 if (vha->flags.online) {
3844 if (!(rval = qla2x00_fw_ready(vha))) { 3843 if (!(rval = qla2x00_fw_ready(vha))) {
3845 /* Wait at most MAX_TARGET RSCNs for a stable link. */ 3844 /* Wait at most MAX_TARGET RSCNs for a stable link. */
3846 wait_time = 256; 3845 wait_time = 256;
3847 do { 3846 do {
3848 atomic_set(&vha->loop_state, LOOP_UPDATE);
3849
3850 /* Issue a marker after FW becomes ready. */ 3847 /* Issue a marker after FW becomes ready. */
3851 qla2x00_marker(vha, req, rsp, 0, 0, 3848 qla2x00_marker(vha, req, rsp, 0, 0,
3852 MK_SYNC_ALL); 3849 MK_SYNC_ALL);
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
index d2e904bc21c0..9902834e0b74 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -102,3 +102,32 @@ qla2x00_set_fcport_state(fc_port_t *fcport, int state)
102 fcport->d_id.b.al_pa); 102 fcport->d_id.b.al_pa);
103 } 103 }
104} 104}
105
106static inline int
107qla2x00_hba_err_chk_enabled(srb_t *sp)
108{
109 /*
110 * Uncomment when corresponding SCSI changes are done.
111 *
112 if (!sp->cmd->prot_chk)
113 return 0;
114 *
115 */
116
117 switch (scsi_get_prot_op(sp->cmd)) {
118 case SCSI_PROT_READ_STRIP:
119 case SCSI_PROT_WRITE_INSERT:
120 if (ql2xenablehba_err_chk >= 1)
121 return 1;
122 break;
123 case SCSI_PROT_READ_PASS:
124 case SCSI_PROT_WRITE_PASS:
125 if (ql2xenablehba_err_chk >= 2)
126 return 1;
127 break;
128 case SCSI_PROT_READ_INSERT:
129 case SCSI_PROT_WRITE_STRIP:
130 return 1;
131 }
132 return 0;
133}
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 49d6906af886..dbec89622a0f 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -709,20 +709,28 @@ struct fw_dif_context {
709 * 709 *
710 */ 710 */
711static inline void 711static inline void
712qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt, 712qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt,
713 unsigned int protcnt) 713 unsigned int protcnt)
714{ 714{
715 struct sd_dif_tuple *spt; 715 struct scsi_cmnd *cmd = sp->cmd;
716 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 716 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
717 unsigned char op = scsi_get_prot_op(cmd);
718 717
719 switch (scsi_get_prot_type(cmd)) { 718 switch (scsi_get_prot_type(cmd)) {
720 /* For TYPE 0 protection: no checking */
721 case SCSI_PROT_DIF_TYPE0: 719 case SCSI_PROT_DIF_TYPE0:
722 pkt->ref_tag_mask[0] = 0x00; 720 /*
723 pkt->ref_tag_mask[1] = 0x00; 721 * No check for ql2xenablehba_err_chk, as it would be an
724 pkt->ref_tag_mask[2] = 0x00; 722 * I/O error if hba tag generation is not done.
725 pkt->ref_tag_mask[3] = 0x00; 723 */
724 pkt->ref_tag = cpu_to_le32((uint32_t)
725 (0xffffffff & scsi_get_lba(cmd)));
726
727 if (!qla2x00_hba_err_chk_enabled(sp))
728 break;
729
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;
726 break; 734 break;
727 735
728 /* 736 /*
@@ -730,20 +738,16 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt,
730 * match LBA in CDB + N 738 * match LBA in CDB + N
731 */ 739 */
732 case SCSI_PROT_DIF_TYPE2: 740 case SCSI_PROT_DIF_TYPE2:
733 if (!ql2xenablehba_err_chk) 741 pkt->app_tag = __constant_cpu_to_le16(0);
734 break; 742 pkt->app_tag_mask[0] = 0x0;
735 743 pkt->app_tag_mask[1] = 0x0;
736 if (scsi_prot_sg_count(cmd)) {
737 spt = page_address(sg_page(scsi_prot_sglist(cmd))) +
738 scsi_prot_sglist(cmd)[0].offset;
739 pkt->app_tag = swab32(spt->app_tag);
740 pkt->app_tag_mask[0] = 0xff;
741 pkt->app_tag_mask[1] = 0xff;
742 }
743 744
744 pkt->ref_tag = cpu_to_le32((uint32_t) 745 pkt->ref_tag = cpu_to_le32((uint32_t)
745 (0xffffffff & scsi_get_lba(cmd))); 746 (0xffffffff & scsi_get_lba(cmd)));
746 747
748 if (!qla2x00_hba_err_chk_enabled(sp))
749 break;
750
747 /* enable ALL bytes of the ref tag */ 751 /* enable ALL bytes of the ref tag */
748 pkt->ref_tag_mask[0] = 0xff; 752 pkt->ref_tag_mask[0] = 0xff;
749 pkt->ref_tag_mask[1] = 0xff; 753 pkt->ref_tag_mask[1] = 0xff;
@@ -763,26 +767,15 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt,
763 * 16 bit app tag. 767 * 16 bit app tag.
764 */ 768 */
765 case SCSI_PROT_DIF_TYPE1: 769 case SCSI_PROT_DIF_TYPE1:
766 if (!ql2xenablehba_err_chk) 770 pkt->ref_tag = cpu_to_le32((uint32_t)
771 (0xffffffff & scsi_get_lba(cmd)));
772 pkt->app_tag = __constant_cpu_to_le16(0);
773 pkt->app_tag_mask[0] = 0x0;
774 pkt->app_tag_mask[1] = 0x0;
775
776 if (!qla2x00_hba_err_chk_enabled(sp))
767 break; 777 break;
768 778
769 if (protcnt && (op == SCSI_PROT_WRITE_STRIP ||
770 op == SCSI_PROT_WRITE_PASS)) {
771 spt = page_address(sg_page(scsi_prot_sglist(cmd))) +
772 scsi_prot_sglist(cmd)[0].offset;
773 ql_dbg(ql_dbg_io, vha, 0x3008,
774 "LBA from user %p, lba = 0x%x for cmd=%p.\n",
775 spt, (int)spt->ref_tag, cmd);
776 pkt->ref_tag = swab32(spt->ref_tag);
777 pkt->app_tag_mask[0] = 0x0;
778 pkt->app_tag_mask[1] = 0x0;
779 } else {
780 pkt->ref_tag = cpu_to_le32((uint32_t)
781 (0xffffffff & scsi_get_lba(cmd)));
782 pkt->app_tag = __constant_cpu_to_le16(0);
783 pkt->app_tag_mask[0] = 0x0;
784 pkt->app_tag_mask[1] = 0x0;
785 }
786 /* enable ALL bytes of the ref tag */ 779 /* enable ALL bytes of the ref tag */
787 pkt->ref_tag_mask[0] = 0xff; 780 pkt->ref_tag_mask[0] = 0xff;
788 pkt->ref_tag_mask[1] = 0xff; 781 pkt->ref_tag_mask[1] = 0xff;
@@ -798,8 +791,162 @@ qla24xx_set_t10dif_tags(struct scsi_cmnd *cmd, struct fw_dif_context *pkt,
798 scsi_get_prot_type(cmd), cmd); 791 scsi_get_prot_type(cmd), cmd);
799} 792}
800 793
794struct qla2_sgx {
795 dma_addr_t dma_addr; /* OUT */
796 uint32_t dma_len; /* OUT */
797
798 uint32_t tot_bytes; /* IN */
799 struct scatterlist *cur_sg; /* IN */
800
801 /* for book keeping, bzero on initial invocation */
802 uint32_t bytes_consumed;
803 uint32_t num_bytes;
804 uint32_t tot_partial;
805
806 /* for debugging */
807 uint32_t num_sg;
808 srb_t *sp;
809};
801 810
802static int 811static int
812qla24xx_get_one_block_sg(uint32_t blk_sz, struct qla2_sgx *sgx,
813 uint32_t *partial)
814{
815 struct scatterlist *sg;
816 uint32_t cumulative_partial, sg_len;
817 dma_addr_t sg_dma_addr;
818
819 if (sgx->num_bytes == sgx->tot_bytes)
820 return 0;
821
822 sg = sgx->cur_sg;
823 cumulative_partial = sgx->tot_partial;
824
825 sg_dma_addr = sg_dma_address(sg);
826 sg_len = sg_dma_len(sg);
827
828 sgx->dma_addr = sg_dma_addr + sgx->bytes_consumed;
829
830 if ((cumulative_partial + (sg_len - sgx->bytes_consumed)) >= blk_sz) {
831 sgx->dma_len = (blk_sz - cumulative_partial);
832 sgx->tot_partial = 0;
833 sgx->num_bytes += blk_sz;
834 *partial = 0;
835 } else {
836 sgx->dma_len = sg_len - sgx->bytes_consumed;
837 sgx->tot_partial += sgx->dma_len;
838 *partial = 1;
839 }
840
841 sgx->bytes_consumed += sgx->dma_len;
842
843 if (sg_len == sgx->bytes_consumed) {
844 sg = sg_next(sg);
845 sgx->num_sg++;
846 sgx->cur_sg = sg;
847 sgx->bytes_consumed = 0;
848 }
849
850 return 1;
851}
852
853static int
854qla24xx_walk_and_build_sglist_no_difb(struct qla_hw_data *ha, srb_t *sp,
855 uint32_t *dsd, uint16_t tot_dsds)
856{
857 void *next_dsd;
858 uint8_t avail_dsds = 0;
859 uint32_t dsd_list_len;
860 struct dsd_dma *dsd_ptr;
861 struct scatterlist *sg_prot;
862 uint32_t *cur_dsd = dsd;
863 uint16_t used_dsds = tot_dsds;
864
865 uint32_t prot_int;
866 uint32_t partial;
867 struct qla2_sgx sgx;
868 dma_addr_t sle_dma;
869 uint32_t sle_dma_len, tot_prot_dma_len = 0;
870 struct scsi_cmnd *cmd = sp->cmd;
871
872 prot_int = cmd->device->sector_size;
873
874 memset(&sgx, 0, sizeof(struct qla2_sgx));
875 sgx.tot_bytes = scsi_bufflen(sp->cmd);
876 sgx.cur_sg = scsi_sglist(sp->cmd);
877 sgx.sp = sp;
878
879 sg_prot = scsi_prot_sglist(sp->cmd);
880
881 while (qla24xx_get_one_block_sg(prot_int, &sgx, &partial)) {
882
883 sle_dma = sgx.dma_addr;
884 sle_dma_len = sgx.dma_len;
885alloc_and_fill:
886 /* Allocate additional continuation packets? */
887 if (avail_dsds == 0) {
888 avail_dsds = (used_dsds > QLA_DSDS_PER_IOCB) ?
889 QLA_DSDS_PER_IOCB : used_dsds;
890 dsd_list_len = (avail_dsds + 1) * 12;
891 used_dsds -= avail_dsds;
892
893 /* allocate tracking DS */
894 dsd_ptr = kzalloc(sizeof(struct dsd_dma), GFP_ATOMIC);
895 if (!dsd_ptr)
896 return 1;
897
898 /* allocate new list */
899 dsd_ptr->dsd_addr = next_dsd =
900 dma_pool_alloc(ha->dl_dma_pool, GFP_ATOMIC,
901 &dsd_ptr->dsd_list_dma);
902
903 if (!next_dsd) {
904 /*
905 * Need to cleanup only this dsd_ptr, rest
906 * will be done by sp_free_dma()
907 */
908 kfree(dsd_ptr);
909 return 1;
910 }
911
912 list_add_tail(&dsd_ptr->list,
913 &((struct crc_context *)sp->ctx)->dsd_list);
914
915 sp->flags |= SRB_CRC_CTX_DSD_VALID;
916
917 /* add new list to cmd iocb or last list */
918 *cur_dsd++ = cpu_to_le32(LSD(dsd_ptr->dsd_list_dma));
919 *cur_dsd++ = cpu_to_le32(MSD(dsd_ptr->dsd_list_dma));
920 *cur_dsd++ = dsd_list_len;
921 cur_dsd = (uint32_t *)next_dsd;
922 }
923 *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
924 *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
925 *cur_dsd++ = cpu_to_le32(sle_dma_len);
926 avail_dsds--;
927
928 if (partial == 0) {
929 /* Got a full protection interval */
930 sle_dma = sg_dma_address(sg_prot) + tot_prot_dma_len;
931 sle_dma_len = 8;
932
933 tot_prot_dma_len += sle_dma_len;
934 if (tot_prot_dma_len == sg_dma_len(sg_prot)) {
935 tot_prot_dma_len = 0;
936 sg_prot = sg_next(sg_prot);
937 }
938
939 partial = 1; /* So as to not re-enter this block */
940 goto alloc_and_fill;
941 }
942 }
943 /* Null termination */
944 *cur_dsd++ = 0;
945 *cur_dsd++ = 0;
946 *cur_dsd++ = 0;
947 return 0;
948}
949static int
803qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd, 950qla24xx_walk_and_build_sglist(struct qla_hw_data *ha, srb_t *sp, uint32_t *dsd,
804 uint16_t tot_dsds) 951 uint16_t tot_dsds)
805{ 952{
@@ -981,7 +1128,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
981 struct scsi_cmnd *cmd; 1128 struct scsi_cmnd *cmd;
982 struct scatterlist *cur_seg; 1129 struct scatterlist *cur_seg;
983 int sgc; 1130 int sgc;
984 uint32_t total_bytes; 1131 uint32_t total_bytes = 0;
985 uint32_t data_bytes; 1132 uint32_t data_bytes;
986 uint32_t dif_bytes; 1133 uint32_t dif_bytes;
987 uint8_t bundling = 1; 1134 uint8_t bundling = 1;
@@ -1023,8 +1170,10 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1023 __constant_cpu_to_le16(CF_READ_DATA); 1170 __constant_cpu_to_le16(CF_READ_DATA);
1024 } 1171 }
1025 1172
1026 tot_prot_dsds = scsi_prot_sg_count(cmd); 1173 if ((scsi_get_prot_op(sp->cmd) == SCSI_PROT_READ_INSERT) ||
1027 if (!tot_prot_dsds) 1174 (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_STRIP) ||
1175 (scsi_get_prot_op(sp->cmd) == SCSI_PROT_READ_STRIP) ||
1176 (scsi_get_prot_op(sp->cmd) == SCSI_PROT_WRITE_INSERT))
1028 bundling = 0; 1177 bundling = 0;
1029 1178
1030 /* Allocate CRC context from global pool */ 1179 /* Allocate CRC context from global pool */
@@ -1047,7 +1196,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1047 1196
1048 INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list); 1197 INIT_LIST_HEAD(&crc_ctx_pkt->dsd_list);
1049 1198
1050 qla24xx_set_t10dif_tags(cmd, (struct fw_dif_context *) 1199 qla24xx_set_t10dif_tags(sp, (struct fw_dif_context *)
1051 &crc_ctx_pkt->ref_tag, tot_prot_dsds); 1200 &crc_ctx_pkt->ref_tag, tot_prot_dsds);
1052 1201
1053 cmd_pkt->crc_context_address[0] = cpu_to_le32(LSD(crc_ctx_dma)); 1202 cmd_pkt->crc_context_address[0] = cpu_to_le32(LSD(crc_ctx_dma));
@@ -1076,7 +1225,6 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1076 fcp_cmnd->additional_cdb_len |= 2; 1225 fcp_cmnd->additional_cdb_len |= 2;
1077 1226
1078 int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); 1227 int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun);
1079 host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun));
1080 memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); 1228 memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len);
1081 cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); 1229 cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len);
1082 cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( 1230 cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32(
@@ -1107,15 +1255,28 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1107 cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */ 1255 cmd_pkt->fcp_rsp_dseg_len = 0; /* Let response come in status iocb */
1108 1256
1109 /* Compute dif len and adjust data len to incude protection */ 1257 /* Compute dif len and adjust data len to incude protection */
1110 total_bytes = data_bytes;
1111 dif_bytes = 0; 1258 dif_bytes = 0;
1112 blk_size = cmd->device->sector_size; 1259 blk_size = cmd->device->sector_size;
1113 if (scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) { 1260 dif_bytes = (data_bytes / blk_size) * 8;
1114 dif_bytes = (data_bytes / blk_size) * 8; 1261
1115 total_bytes += dif_bytes; 1262 switch (scsi_get_prot_op(sp->cmd)) {
1263 case SCSI_PROT_READ_INSERT:
1264 case SCSI_PROT_WRITE_STRIP:
1265 total_bytes = data_bytes;
1266 data_bytes += dif_bytes;
1267 break;
1268
1269 case SCSI_PROT_READ_STRIP:
1270 case SCSI_PROT_WRITE_INSERT:
1271 case SCSI_PROT_READ_PASS:
1272 case SCSI_PROT_WRITE_PASS:
1273 total_bytes = data_bytes + dif_bytes;
1274 break;
1275 default:
1276 BUG();
1116 } 1277 }
1117 1278
1118 if (!ql2xenablehba_err_chk) 1279 if (!qla2x00_hba_err_chk_enabled(sp))
1119 fw_prot_opts |= 0x10; /* Disable Guard tag checking */ 1280 fw_prot_opts |= 0x10; /* Disable Guard tag checking */
1120 1281
1121 if (!bundling) { 1282 if (!bundling) {
@@ -1151,7 +1312,12 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt,
1151 1312
1152 cmd_pkt->control_flags |= 1313 cmd_pkt->control_flags |=
1153 __constant_cpu_to_le16(CF_DATA_SEG_DESCR_ENABLE); 1314 __constant_cpu_to_le16(CF_DATA_SEG_DESCR_ENABLE);
1154 if (qla24xx_walk_and_build_sglist(ha, sp, cur_dsd, 1315
1316 if (!bundling && tot_prot_dsds) {
1317 if (qla24xx_walk_and_build_sglist_no_difb(ha, sp,
1318 cur_dsd, tot_dsds))
1319 goto crc_queuing_error;
1320 } else if (qla24xx_walk_and_build_sglist(ha, sp, cur_dsd,
1155 (tot_dsds - tot_prot_dsds))) 1321 (tot_dsds - tot_prot_dsds)))
1156 goto crc_queuing_error; 1322 goto crc_queuing_error;
1157 1323
@@ -1414,6 +1580,22 @@ qla24xx_dif_start_scsi(srb_t *sp)
1414 goto queuing_error; 1580 goto queuing_error;
1415 else 1581 else
1416 sp->flags |= SRB_DMA_VALID; 1582 sp->flags |= SRB_DMA_VALID;
1583
1584 if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) ||
1585 (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) {
1586 struct qla2_sgx sgx;
1587 uint32_t partial;
1588
1589 memset(&sgx, 0, sizeof(struct qla2_sgx));
1590 sgx.tot_bytes = scsi_bufflen(cmd);
1591 sgx.cur_sg = scsi_sglist(cmd);
1592 sgx.sp = sp;
1593
1594 nseg = 0;
1595 while (qla24xx_get_one_block_sg(
1596 cmd->device->sector_size, &sgx, &partial))
1597 nseg++;
1598 }
1417 } else 1599 } else
1418 nseg = 0; 1600 nseg = 0;
1419 1601
@@ -1428,6 +1610,11 @@ qla24xx_dif_start_scsi(srb_t *sp)
1428 goto queuing_error; 1610 goto queuing_error;
1429 else 1611 else
1430 sp->flags |= SRB_CRC_PROT_DMA_VALID; 1612 sp->flags |= SRB_CRC_PROT_DMA_VALID;
1613
1614 if ((scsi_get_prot_op(cmd) == SCSI_PROT_READ_INSERT) ||
1615 (scsi_get_prot_op(cmd) == SCSI_PROT_WRITE_STRIP)) {
1616 nseg = scsi_bufflen(cmd) / cmd->device->sector_size;
1617 }
1431 } else { 1618 } else {
1432 nseg = 0; 1619 nseg = 0;
1433 } 1620 }
@@ -1454,6 +1641,7 @@ qla24xx_dif_start_scsi(srb_t *sp)
1454 /* Build header part of command packet (excluding the OPCODE). */ 1641 /* Build header part of command packet (excluding the OPCODE). */
1455 req->current_outstanding_cmd = handle; 1642 req->current_outstanding_cmd = handle;
1456 req->outstanding_cmds[handle] = sp; 1643 req->outstanding_cmds[handle] = sp;
1644 sp->handle = handle;
1457 sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; 1645 sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle;
1458 req->cnt -= req_cnt; 1646 req->cnt -= req_cnt;
1459 1647
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index b16b7725dee0..8a7591f035e6 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -719,7 +719,6 @@ skip_rio:
719 vha->flags.rscn_queue_overflow = 1; 719 vha->flags.rscn_queue_overflow = 1;
720 } 720 }
721 721
722 atomic_set(&vha->loop_state, LOOP_UPDATE);
723 atomic_set(&vha->loop_down_timer, 0); 722 atomic_set(&vha->loop_down_timer, 0);
724 vha->flags.management_server_logged_in = 0; 723 vha->flags.management_server_logged_in = 0;
725 724
@@ -1435,25 +1434,27 @@ struct scsi_dif_tuple {
1435 * ASC/ASCQ fields in the sense buffer with ILLEGAL_REQUEST 1434 * ASC/ASCQ fields in the sense buffer with ILLEGAL_REQUEST
1436 * to indicate to the kernel that the HBA detected error. 1435 * to indicate to the kernel that the HBA detected error.
1437 */ 1436 */
1438static inline void 1437static inline int
1439qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24) 1438qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
1440{ 1439{
1441 struct scsi_qla_host *vha = sp->fcport->vha; 1440 struct scsi_qla_host *vha = sp->fcport->vha;
1442 struct scsi_cmnd *cmd = sp->cmd; 1441 struct scsi_cmnd *cmd = sp->cmd;
1443 struct scsi_dif_tuple *ep = 1442 uint8_t *ap = &sts24->data[12];
1444 (struct scsi_dif_tuple *)&sts24->data[20]; 1443 uint8_t *ep = &sts24->data[20];
1445 struct scsi_dif_tuple *ap =
1446 (struct scsi_dif_tuple *)&sts24->data[12];
1447 uint32_t e_ref_tag, a_ref_tag; 1444 uint32_t e_ref_tag, a_ref_tag;
1448 uint16_t e_app_tag, a_app_tag; 1445 uint16_t e_app_tag, a_app_tag;
1449 uint16_t e_guard, a_guard; 1446 uint16_t e_guard, a_guard;
1450 1447
1451 e_ref_tag = be32_to_cpu(ep->ref_tag); 1448 /*
1452 a_ref_tag = be32_to_cpu(ap->ref_tag); 1449 * swab32 of the "data" field in the beginning of qla2x00_status_entry()
1453 e_app_tag = be16_to_cpu(ep->app_tag); 1450 * would make guard field appear at offset 2
1454 a_app_tag = be16_to_cpu(ap->app_tag); 1451 */
1455 e_guard = be16_to_cpu(ep->guard); 1452 a_guard = le16_to_cpu(*(uint16_t *)(ap + 2));
1456 a_guard = be16_to_cpu(ap->guard); 1453 a_app_tag = le16_to_cpu(*(uint16_t *)(ap + 0));
1454 a_ref_tag = le32_to_cpu(*(uint32_t *)(ap + 4));
1455 e_guard = le16_to_cpu(*(uint16_t *)(ep + 2));
1456 e_app_tag = le16_to_cpu(*(uint16_t *)(ep + 0));
1457 e_ref_tag = le32_to_cpu(*(uint32_t *)(ep + 4));
1457 1458
1458 ql_dbg(ql_dbg_io, vha, 0x3023, 1459 ql_dbg(ql_dbg_io, vha, 0x3023,
1459 "iocb(s) %p Returned STATUS.\n", sts24); 1460 "iocb(s) %p Returned STATUS.\n", sts24);
@@ -1465,6 +1466,63 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
1465 cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag, 1466 cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag,
1466 a_app_tag, e_app_tag, a_guard, e_guard); 1467 a_app_tag, e_app_tag, a_guard, e_guard);
1467 1468
1469 /*
1470 * Ignore sector if:
1471 * For type 3: ref & app tag is all 'f's
1472 * For type 0,1,2: app tag is all 'f's
1473 */
1474 if ((a_app_tag == 0xffff) &&
1475 ((scsi_get_prot_type(cmd) != SCSI_PROT_DIF_TYPE3) ||
1476 (a_ref_tag == 0xffffffff))) {
1477 uint32_t blocks_done, resid;
1478 sector_t lba_s = scsi_get_lba(cmd);
1479
1480 /* 2TB boundary case covered automatically with this */
1481 blocks_done = e_ref_tag - (uint32_t)lba_s + 1;
1482
1483 resid = scsi_bufflen(cmd) - (blocks_done *
1484 cmd->device->sector_size);
1485
1486 scsi_set_resid(cmd, resid);
1487 cmd->result = DID_OK << 16;
1488
1489 /* Update protection tag */
1490 if (scsi_prot_sg_count(cmd)) {
1491 uint32_t i, j = 0, k = 0, num_ent;
1492 struct scatterlist *sg;
1493 struct sd_dif_tuple *spt;
1494
1495 /* Patch the corresponding protection tags */
1496 scsi_for_each_prot_sg(cmd, sg,
1497 scsi_prot_sg_count(cmd), i) {
1498 num_ent = sg_dma_len(sg) / 8;
1499 if (k + num_ent < blocks_done) {
1500 k += num_ent;
1501 continue;
1502 }
1503 j = blocks_done - k - 1;
1504 k = blocks_done;
1505 break;
1506 }
1507
1508 if (k != blocks_done) {
1509 qla_printk(KERN_WARNING, sp->fcport->vha->hw,
1510 "unexpected tag values tag:lba=%x:%llx)\n",
1511 e_ref_tag, (unsigned long long)lba_s);
1512 return 1;
1513 }
1514
1515 spt = page_address(sg_page(sg)) + sg->offset;
1516 spt += j;
1517
1518 spt->app_tag = 0xffff;
1519 if (scsi_get_prot_type(cmd) == SCSI_PROT_DIF_TYPE3)
1520 spt->ref_tag = 0xffffffff;
1521 }
1522
1523 return 0;
1524 }
1525
1468 /* check guard */ 1526 /* check guard */
1469 if (e_guard != a_guard) { 1527 if (e_guard != a_guard) {
1470 scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 1528 scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
@@ -1472,28 +1530,30 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
1472 set_driver_byte(cmd, DRIVER_SENSE); 1530 set_driver_byte(cmd, DRIVER_SENSE);
1473 set_host_byte(cmd, DID_ABORT); 1531 set_host_byte(cmd, DID_ABORT);
1474 cmd->result |= SAM_STAT_CHECK_CONDITION << 1; 1532 cmd->result |= SAM_STAT_CHECK_CONDITION << 1;
1475 return; 1533 return 1;
1476 } 1534 }
1477 1535
1478 /* check appl tag */ 1536 /* check ref tag */
1479 if (e_app_tag != a_app_tag) { 1537 if (e_ref_tag != a_ref_tag) {
1480 scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 1538 scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
1481 0x10, 0x2); 1539 0x10, 0x3);
1482 set_driver_byte(cmd, DRIVER_SENSE); 1540 set_driver_byte(cmd, DRIVER_SENSE);
1483 set_host_byte(cmd, DID_ABORT); 1541 set_host_byte(cmd, DID_ABORT);
1484 cmd->result |= SAM_STAT_CHECK_CONDITION << 1; 1542 cmd->result |= SAM_STAT_CHECK_CONDITION << 1;
1485 return; 1543 return 1;
1486 } 1544 }
1487 1545
1488 /* check ref tag */ 1546 /* check appl tag */
1489 if (e_ref_tag != a_ref_tag) { 1547 if (e_app_tag != a_app_tag) {
1490 scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST, 1548 scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
1491 0x10, 0x3); 1549 0x10, 0x2);
1492 set_driver_byte(cmd, DRIVER_SENSE); 1550 set_driver_byte(cmd, DRIVER_SENSE);
1493 set_host_byte(cmd, DID_ABORT); 1551 set_host_byte(cmd, DID_ABORT);
1494 cmd->result |= SAM_STAT_CHECK_CONDITION << 1; 1552 cmd->result |= SAM_STAT_CHECK_CONDITION << 1;
1495 return; 1553 return 1;
1496 } 1554 }
1555
1556 return 1;
1497} 1557}
1498 1558
1499/** 1559/**
@@ -1767,7 +1827,7 @@ check_scsi_status:
1767 break; 1827 break;
1768 1828
1769 case CS_DIF_ERROR: 1829 case CS_DIF_ERROR:
1770 qla2x00_handle_dif_error(sp, sts24); 1830 logit = qla2x00_handle_dif_error(sp, sts24);
1771 break; 1831 break;
1772 default: 1832 default:
1773 cp->result = DID_ERROR << 16; 1833 cp->result = DID_ERROR << 16;
@@ -2468,11 +2528,10 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
2468 goto skip_msi; 2528 goto skip_msi;
2469 } 2529 }
2470 2530
2471 if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX || 2531 if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX)) {
2472 !QLA_MSIX_FW_MODE_1(ha->fw_attributes))) {
2473 ql_log(ql_log_warn, vha, 0x0035, 2532 ql_log(ql_log_warn, vha, 0x0035,
2474 "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n", 2533 "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n",
2475 ha->pdev->revision, ha->fw_attributes); 2534 ha->pdev->revision, QLA_MSIX_CHIP_REV_24XX);
2476 goto skip_msix; 2535 goto skip_msix;
2477 } 2536 }
2478 2537
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index c706ed370000..f488cc69fc79 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -472,7 +472,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
472 host->can_queue = base_vha->req->length + 128; 472 host->can_queue = base_vha->req->length + 128;
473 host->this_id = 255; 473 host->this_id = 255;
474 host->cmd_per_lun = 3; 474 host->cmd_per_lun = 3;
475 if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) 475 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif)
476 host->max_cmd_len = 32; 476 host->max_cmd_len = 32;
477 else 477 else
478 host->max_cmd_len = MAX_CMDSZ; 478 host->max_cmd_len = MAX_CMDSZ;
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 5cbf33a50b14..049807cda419 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -2208,6 +2208,7 @@ qla82xx_msix_rsp_q(int irq, void *dev_id)
2208 struct qla_hw_data *ha; 2208 struct qla_hw_data *ha;
2209 struct rsp_que *rsp; 2209 struct rsp_que *rsp;
2210 struct device_reg_82xx __iomem *reg; 2210 struct device_reg_82xx __iomem *reg;
2211 unsigned long flags;
2211 2212
2212 rsp = (struct rsp_que *) dev_id; 2213 rsp = (struct rsp_que *) dev_id;
2213 if (!rsp) { 2214 if (!rsp) {
@@ -2218,11 +2219,11 @@ qla82xx_msix_rsp_q(int irq, void *dev_id)
2218 2219
2219 ha = rsp->hw; 2220 ha = rsp->hw;
2220 reg = &ha->iobase->isp82; 2221 reg = &ha->iobase->isp82;
2221 spin_lock_irq(&ha->hardware_lock); 2222 spin_lock_irqsave(&ha->hardware_lock, flags);
2222 vha = pci_get_drvdata(ha->pdev); 2223 vha = pci_get_drvdata(ha->pdev);
2223 qla24xx_process_response_queue(vha, rsp); 2224 qla24xx_process_response_queue(vha, rsp);
2224 WRT_REG_DWORD(&reg->host_int, 0); 2225 WRT_REG_DWORD(&reg->host_int, 0);
2225 spin_unlock_irq(&ha->hardware_lock); 2226 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2226 return IRQ_HANDLED; 2227 return IRQ_HANDLED;
2227} 2228}
2228 2229
@@ -2838,6 +2839,16 @@ sufficient_dsds:
2838 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); 2839 int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun);
2839 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); 2840 host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
2840 2841
2842 /* build FCP_CMND IU */
2843 memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
2844 int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun);
2845 ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;
2846
2847 if (cmd->sc_data_direction == DMA_TO_DEVICE)
2848 ctx->fcp_cmnd->additional_cdb_len |= 1;
2849 else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
2850 ctx->fcp_cmnd->additional_cdb_len |= 2;
2851
2841 /* 2852 /*
2842 * Update tagged queuing modifier -- default is TSK_SIMPLE (0). 2853 * Update tagged queuing modifier -- default is TSK_SIMPLE (0).
2843 */ 2854 */
@@ -2854,16 +2865,6 @@ sufficient_dsds:
2854 } 2865 }
2855 } 2866 }
2856 2867
2857 /* build FCP_CMND IU */
2858 memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
2859 int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun);
2860 ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;
2861
2862 if (cmd->sc_data_direction == DMA_TO_DEVICE)
2863 ctx->fcp_cmnd->additional_cdb_len |= 1;
2864 else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
2865 ctx->fcp_cmnd->additional_cdb_len |= 2;
2866
2867 memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); 2868 memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len);
2868 2869
2869 fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 + 2870 fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 +
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index e02df276804e..4cace3f20c04 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -106,17 +106,21 @@ MODULE_PARM_DESC(ql2xmaxqdepth,
106 "Maximum queue depth to report for target devices."); 106 "Maximum queue depth to report for target devices.");
107 107
108/* Do not change the value of this after module load */ 108/* Do not change the value of this after module load */
109int ql2xenabledif = 1; 109int ql2xenabledif = 0;
110module_param(ql2xenabledif, int, S_IRUGO|S_IWUSR); 110module_param(ql2xenabledif, int, S_IRUGO|S_IWUSR);
111MODULE_PARM_DESC(ql2xenabledif, 111MODULE_PARM_DESC(ql2xenabledif,
112 " Enable T10-CRC-DIF " 112 " Enable T10-CRC-DIF "
113 " Default is 0 - No DIF Support. 1 - Enable it"); 113 " Default is 0 - No DIF Support. 1 - Enable it"
114 ", 2 - Enable DIF for all types, except Type 0.");
114 115
115int ql2xenablehba_err_chk; 116int ql2xenablehba_err_chk = 2;
116module_param(ql2xenablehba_err_chk, int, S_IRUGO|S_IWUSR); 117module_param(ql2xenablehba_err_chk, int, S_IRUGO|S_IWUSR);
117MODULE_PARM_DESC(ql2xenablehba_err_chk, 118MODULE_PARM_DESC(ql2xenablehba_err_chk,
118 " Enable T10-CRC-DIF Error isolation by HBA" 119 " Enable T10-CRC-DIF Error isolation by HBA:\n"
119 " Default is 0 - Error isolation disabled, 1 - Enable it"); 120 " Default is 1.\n"
121 " 0 -- Error isolation disabled\n"
122 " 1 -- Error isolation enabled only for DIX Type 0\n"
123 " 2 -- Error isolation enabled for all Types\n");
120 124
121int ql2xiidmaenable=1; 125int ql2xiidmaenable=1;
122module_param(ql2xiidmaenable, int, S_IRUGO); 126module_param(ql2xiidmaenable, int, S_IRUGO);
@@ -909,7 +913,14 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
909 "Abort command mbx success.\n"); 913 "Abort command mbx success.\n");
910 wait = 1; 914 wait = 1;
911 } 915 }
916
917 spin_lock_irqsave(&ha->hardware_lock, flags);
912 qla2x00_sp_compl(ha, sp); 918 qla2x00_sp_compl(ha, sp);
919 spin_unlock_irqrestore(&ha->hardware_lock, flags);
920
921 /* Did the command return during mailbox execution? */
922 if (ret == FAILED && !CMD_SP(cmd))
923 ret = SUCCESS;
913 924
914 /* Wait for the command to be returned. */ 925 /* Wait for the command to be returned. */
915 if (wait) { 926 if (wait) {
@@ -2251,7 +2262,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
2251 host->this_id = 255; 2262 host->this_id = 255;
2252 host->cmd_per_lun = 3; 2263 host->cmd_per_lun = 3;
2253 host->unique_id = host->host_no; 2264 host->unique_id = host->host_no;
2254 if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) 2265 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif)
2255 host->max_cmd_len = 32; 2266 host->max_cmd_len = 32;
2256 else 2267 else
2257 host->max_cmd_len = MAX_CMDSZ; 2268 host->max_cmd_len = MAX_CMDSZ;
@@ -2378,13 +2389,16 @@ skip_dpc:
2378 "Detected hba at address=%p.\n", 2389 "Detected hba at address=%p.\n",
2379 ha); 2390 ha);
2380 2391
2381 if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && ql2xenabledif) { 2392 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) {
2382 if (ha->fw_attributes & BIT_4) { 2393 if (ha->fw_attributes & BIT_4) {
2394 int prot = 0;
2383 base_vha->flags.difdix_supported = 1; 2395 base_vha->flags.difdix_supported = 1;
2384 ql_dbg(ql_dbg_init, base_vha, 0x00f1, 2396 ql_dbg(ql_dbg_init, base_vha, 0x00f1,
2385 "Registering for DIF/DIX type 1 and 3 protection.\n"); 2397 "Registering for DIF/DIX type 1 and 3 protection.\n");
2398 if (ql2xenabledif == 1)
2399 prot = SHOST_DIX_TYPE0_PROTECTION;
2386 scsi_host_set_prot(host, 2400 scsi_host_set_prot(host,
2387 SHOST_DIF_TYPE1_PROTECTION 2401 prot | SHOST_DIF_TYPE1_PROTECTION
2388 | SHOST_DIF_TYPE2_PROTECTION 2402 | SHOST_DIF_TYPE2_PROTECTION
2389 | SHOST_DIF_TYPE3_PROTECTION 2403 | SHOST_DIF_TYPE3_PROTECTION
2390 | SHOST_DIX_TYPE1_PROTECTION 2404 | SHOST_DIX_TYPE1_PROTECTION
diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h
index 062c97bf62f5..13b6357c1fa2 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
7/* 7/*
8 * Driver version 8 * Driver version
9 */ 9 */
10#define QLA2XXX_VERSION "8.03.07.03-k" 10#define QLA2XXX_VERSION "8.03.07.07-k"
11 11
12#define QLA_DRIVER_MAJOR_VER 8 12#define QLA_DRIVER_MAJOR_VER 8
13#define QLA_DRIVER_MINOR_VER 3 13#define QLA_DRIVER_MINOR_VER 3