diff mbox

[v2] qla2xxx: use t10_pi_tuple

Message ID 20150712235425.00001970@localhost (mailing list archive)
State New, archived
Headers show

Commit Message

Sebastian Herbszt July 12, 2015, 9:54 p.m. UTC
Drop unused scsi_dif_tuple and use t10_pi_tuple instead of own sd_dif_tuple copy.
Also use sg_virt() instead of open coding it.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bart Van Assche July 13, 2015, 1:28 a.m. UTC | #1
On 07/12/15 14:54, Sebastian Herbszt wrote:
> Drop unused scsi_dif_tuple and use t10_pi_tuple instead of own sd_dif_tuple copy.
> Also use sg_virt() instead of open coding it.

Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Martin K. Petersen July 14, 2015, 1:28 a.m. UTC | #2
>>>>> "Sebastian" == Sebastian Herbszt <herbszt@gmx.de> writes:

Sebastian> Drop unused scsi_dif_tuple and use t10_pi_tuple instead of
Sebastian> own sd_dif_tuple copy.  Also use sg_virt() instead of open
Sebastian> coding it.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
diff mbox

Patch

diff -urp linux/drivers/scsi/qla2xxx-orig/qla_def.h linux/drivers/scsi/qla2xxx/qla_def.h
--- linux/drivers/scsi/qla2xxx-orig/qla_def.h	2015-04-15 06:18:24.681045138 +0200
+++ linux/drivers/scsi/qla2xxx/qla_def.h	2015-07-09 09:45:44.285703687 +0200
@@ -25,6 +25,7 @@ 
 #include <linux/firmware.h>
 #include <linux/aer.h>
 #include <linux/mutex.h>
+#include <linux/t10-pi.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
@@ -276,16 +277,6 @@ 
 struct req_que;
 
 /*
- * (sd.h is not exported, hence local inclusion)
- * Data Integrity Field tuple.
- */
-struct sd_dif_tuple {
-	__be16 guard_tag;	/* Checksum */
-	__be16 app_tag;		/* Opaque storage */
-	__be32 ref_tag;		/* Target LBA or indirect LBA */
-};
-
-/*
  * SCSI Request Block
  */
 struct srb_cmd {
diff -urp linux/drivers/scsi/qla2xxx-orig/qla_isr.c linux/drivers/scsi/qla2xxx/qla_isr.c
--- linux/drivers/scsi/qla2xxx-orig/qla_isr.c	2015-07-05 22:18:44.157739160 +0200
+++ linux/drivers/scsi/qla2xxx/qla_isr.c	2015-07-12 18:46:24.092536496 +0200
@@ -1711,12 +1711,6 @@  qla2x00_handle_sense(srb_t *sp, uint8_t
 	}
 }
 
-struct scsi_dif_tuple {
-	__be16 guard;       /* Checksum */
-	__be16 app_tag;         /* APPL identifier */
-	__be32 ref_tag;         /* Target LBA or indirect LBA */
-};
-
 /*
  * Checks the guard or meta-data for the type of error
  * detected by the HBA. In case of errors, we set the
@@ -1779,7 +1773,7 @@  qla2x00_handle_dif_error(srb_t *sp, stru
 		if (scsi_prot_sg_count(cmd)) {
 			uint32_t i, j = 0, k = 0, num_ent;
 			struct scatterlist *sg;
-			struct sd_dif_tuple *spt;
+			struct t10_pi_tuple *pi;
 
 			/* Patch the corresponding protection tags */
 			scsi_for_each_prot_sg(cmd, sg,
@@ -1801,12 +1795,12 @@  qla2x00_handle_dif_error(srb_t *sp, stru
 				return 1;
 			}
 
-			spt = page_address(sg_page(sg)) + sg->offset;
-			spt += j;
+			pi = sg_virt(sg);
+			pi += j;
 
-			spt->app_tag = 0xffff;
+			pi->app_tag = 0xffff;
 			if (scsi_get_prot_type(cmd) == SCSI_PROT_DIF_TYPE3)
-				spt->ref_tag = 0xffffffff;
+				pi->ref_tag = 0xffffffff;
 		}
 
 		return 0;
diff -urp linux/drivers/scsi/qla2xxx-orig/qla_target.c linux/drivers/scsi/qla2xxx/qla_target.c
--- linux/drivers/scsi/qla2xxx-orig/qla_target.c	2015-07-05 22:18:44.177739161 +0200
+++ linux/drivers/scsi/qla2xxx/qla_target.c	2015-07-12 18:46:46.080537498 +0200
@@ -2589,17 +2589,17 @@  qlt_handle_dif_error(struct scsi_qla_hos
 			}
 
 #if 0
-			struct sd_dif_tuple *spt;
+			struct t10_pi_tuple *pi;
 			/* TODO:
 			 * This section came from initiator. Is it valid here?
 			 * should ulp be override with actual val???
 			 */
-			spt = page_address(sg_page(sg)) + sg->offset;
-			spt += j;
+			pi = sg_virt(sg);
+			pi += j;
 
-			spt->app_tag = 0xffff;
+			pi->app_tag = 0xffff;
 			if (cmd->se_cmd.prot_type == SCSI_PROT_DIF_TYPE3)
-				spt->ref_tag = 0xffffffff;
+				pi->ref_tag = 0xffffffff;
 #endif
 		}