Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
Anish == Anish Bhatt an...@chelsio.com writes: Anish, Just a heads up that we've got some changes due to land shortly that'll provide interfaces for you to get the correct transfer lengths, size of the protection interval, etc. Your patch should be rebased on top of those changes. -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
Thanks for the heads up, will wait for those. Please cc me/Manoj on the patches -Anish From: Martin K. Petersen [martin.peter...@oracle.com] Sent: Thursday, August 21, 2014 2:47 PM To: Anish Bhatt Cc: linux-scsi@vger.kernel.org; h...@infradead.org; jbottom...@parallels.com; micha...@cs.wisc.edu; Karen Xie; Manoj Malviya Subject: Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support Anish == Anish Bhatt an...@chelsio.com writes: Anish, Just a heads up that we've got some changes due to land shortly that'll provide interfaces for you to get the correct transfer lengths, size of the protection interval, etc. Your patch should be rebased on top of those changes. -- Martin K. Petersen Oracle Linux Engineering -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
On 8/7/2014 1:37 AM, Anish Bhatt wrote: Signed-off-by: Anish Bhatt an...@chelsio.com Signed-off by: Manoj Malvia manojmalv...@chelsio.com Signed-off by: Karen Xie k...@chelsio.com --- drivers/scsi/libiscsi.c | 61 +++-- drivers/scsi/libiscsi_tcp.c | 296 include/scsi/libiscsi.h | 6 + include/scsi/libiscsi_tcp.h | 22 4 files changed, 349 insertions(+), 36 deletions(-) Hey Anish, Against what target did you guys test this stuff? Sagi. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
We tested against a Sanblaze target. -Anish From: Sagi Grimberg [sa...@dev.mellanox.co.il] Sent: Thursday, August 14, 2014 2:25 AM To: Anish Bhatt Cc: linux-scsi@vger.kernel.org; h...@infradead.org; jbottom...@parallels.com; micha...@cs.wisc.edu; Karen Xie; Manoj Malviya Subject: Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support On 8/7/2014 1:37 AM, Anish Bhatt wrote: Signed-off-by: Anish Bhatt an...@chelsio.com Signed-off by: Manoj Malvia manojmalv...@chelsio.com Signed-off by: Karen Xie k...@chelsio.com --- drivers/scsi/libiscsi.c | 61 +++-- drivers/scsi/libiscsi_tcp.c | 296 include/scsi/libiscsi.h | 6 + include/scsi/libiscsi_tcp.h | 22 4 files changed, 349 insertions(+), 36 deletions(-) Hey Anish, Against what target did you guys test this stuff? Sagi. -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
Mike, I presume you meant the 8846bab scsi_cmnd: Introduce scsi_transfer_length helper d77e653 libiscsi, iser: Adjust data_length to include protection information Martin's fix after that 5616b0 use the scsi data buffer length to extract transfer size I see the commits in the branches, but not in master. Do the patches need to be rebased onto drivers-for-3.17 then ? -Anish From: Anish Bhatt Sent: Wednesday, August 06, 2014 7:35 PM To: Mike Christie Cc: linux-scsi@vger.kernel.org; h...@infradead.org; jbottom...@parallels.com; Karen Xie; Manoj Malviya Subject: RE: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support This patch was made over scsi-devel/master, I'll rebase it to Christoph's tree -Anish From: Mike Christie [micha...@cs.wisc.edu] Sent: Wednesday, August 06, 2014 7:25 PM To: Anish Bhatt Cc: linux-scsi@vger.kernel.org; h...@infradead.org; jbottom...@parallels.com; Karen Xie; Manoj Malviya Subject: Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support On 08/06/2014 05:37 PM, Anish Bhatt wrote @@ -436,12 +473,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) /* No unsolicit Data-Out's */ hdr-flags |= ISCSI_FLAG_CMD_FINAL; } else { + unsigned in_len = iscsi_scsi_in_total_length(sc); hdr-flags |= ISCSI_FLAG_CMD_FINAL; zero_data(hdr-dlength); - hdr-data_length = cpu_to_be32(scsi_in(sc)-length); - if (sc-sc_data_direction == DMA_FROM_DEVICE) hdr-flags |= ISCSI_FLAG_CMD_READ; + hdr-data_length = cpu_to_be32(in_len); } What tree and branch did you make these over? Have you seen the patches from Sagi for iser and libiscsi support? Could you rebuild this over Christoph's tree which has his patches: git://git.infradead.org/users/hch/scsi-queue.git -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
Signed-off-by: Anish Bhatt an...@chelsio.com Signed-off by: Manoj Malvia manojmalv...@chelsio.com Signed-off by: Karen Xie k...@chelsio.com --- drivers/scsi/libiscsi.c | 61 +++-- drivers/scsi/libiscsi_tcp.c | 296 include/scsi/libiscsi.h | 6 + include/scsi/libiscsi_tcp.h | 22 4 files changed, 349 insertions(+), 36 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 26dc005b..8cfecec 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -233,7 +233,7 @@ static int iscsi_prep_bidi_ahs(struct iscsi_task *task) sizeof(rlen_ahdr-reserved)); rlen_ahdr-ahstype = ISCSI_AHSTYPE_RLENGTH; rlen_ahdr-reserved = 0; - rlen_ahdr-read_length = cpu_to_be32(scsi_in(sc)-length); + rlen_ahdr-read_length = cpu_to_be32(iscsi_scsi_in_total_length(sc)); ISCSI_DBG_SESSION(task-conn-session, bidi-in rlen_ahdr-read_length(%d) @@ -325,6 +325,32 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode) return 0; } +inline int iscsi_scsi_out_total_length(struct scsi_cmnd *sc) +{ + int sector_size = sc-device-sector_size; + int len = scsi_out(sc)-length; + + if ((scsi_get_prot_op(sc) == SCSI_PROT_WRITE_INSERT) || + (scsi_get_prot_op(sc) == SCSI_PROT_WRITE_PASS)) + len += (len / sector_size) ISCSI_PI_LEN_PER_SECTOR_SHIFT; + + return len; +} +EXPORT_SYMBOL_GPL(iscsi_scsi_out_total_length); + +inline int iscsi_scsi_in_total_length(struct scsi_cmnd *sc) +{ + int sector_size = sc-device-sector_size; + int len = scsi_in(sc)-length; + + if ((scsi_get_prot_op(sc) == SCSI_PROT_READ_STRIP) || + (scsi_get_prot_op(sc) == SCSI_PROT_READ_PASS)) + len += (len / sector_size) ISCSI_PI_LEN_PER_SECTOR_SHIFT; + + return len; +} +EXPORT_SYMBOL_GPL(iscsi_scsi_in_total_length); + /** * iscsi_prep_scsi_cmd_pdu - prep iscsi scsi cmd pdu * @task: iscsi task @@ -392,8 +418,11 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) task-protected = true; if (sc-sc_data_direction == DMA_TO_DEVICE) { - unsigned out_len = scsi_out(sc)-length; + unsigned out_len = iscsi_scsi_out_total_length(sc); struct iscsi_r2t_info *r2t = task-unsol_r2t; + unsigned int pi_sector_size = sc-device-sector_size + + ((scsi_get_prot_op(sc) == SCSI_PROT_WRITE_STRIP) ? + 0 : ISCSI_PI_LEN_PER_SECTOR); hdr-data_length = cpu_to_be32(out_len); hdr-flags |= ISCSI_FLAG_CMD_WRITE; @@ -420,6 +449,10 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) else task-imm_count = min(out_len, conn-max_xmit_dlength); + if (scsi_get_prot_op(sc)) + task-imm_count = + (task-imm_count/pi_sector_size) * + pi_sector_size; hton24(hdr-dlength, task-imm_count); } else zero_data(hdr-dlength); @@ -428,6 +461,10 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) r2t-data_length = min(session-first_burst, out_len) - task-imm_count; r2t-data_offset = task-imm_count; + if (scsi_get_prot_op(sc)) + r2t-data_length = + (r2t-data_length/pi_sector_size) * + pi_sector_size; r2t-ttt = cpu_to_be32(ISCSI_RESERVED_TAG); r2t-exp_statsn = cpu_to_be32(conn-exp_statsn); } @@ -436,12 +473,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) /* No unsolicit Data-Out's */ hdr-flags |= ISCSI_FLAG_CMD_FINAL; } else { + unsigned in_len = iscsi_scsi_in_total_length(sc); hdr-flags |= ISCSI_FLAG_CMD_FINAL; zero_data(hdr-dlength); - hdr-data_length = cpu_to_be32(scsi_in(sc)-length); - if (sc-sc_data_direction == DMA_FROM_DEVICE) hdr-flags |= ISCSI_FLAG_CMD_READ; + hdr-data_length = cpu_to_be32(in_len); } /* calculate size of additional header segments (AHSs) */ @@ -467,8 +504,8 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) sc-sc_data_direction == DMA_TO_DEVICE ? write : read, conn-id, sc, sc-cmnd[0], task-itt,
Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
On 08/06/2014 05:37 PM, Anish Bhatt wrote @@ -436,12 +473,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) /* No unsolicit Data-Out's */ hdr-flags |= ISCSI_FLAG_CMD_FINAL; } else { + unsigned in_len = iscsi_scsi_in_total_length(sc); hdr-flags |= ISCSI_FLAG_CMD_FINAL; zero_data(hdr-dlength); - hdr-data_length = cpu_to_be32(scsi_in(sc)-length); - if (sc-sc_data_direction == DMA_FROM_DEVICE) hdr-flags |= ISCSI_FLAG_CMD_READ; + hdr-data_length = cpu_to_be32(in_len); } What tree and branch did you make these over? Have you seen the patches from Sagi for iser and libiscsi support? Could you rebuild this over Christoph's tree which has his patches: git://git.infradead.org/users/hch/scsi-queue.git -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support
This patch was made over scsi-devel/master, I'll rebase it to Christoph's tree -Anish From: Mike Christie [micha...@cs.wisc.edu] Sent: Wednesday, August 06, 2014 7:25 PM To: Anish Bhatt Cc: linux-scsi@vger.kernel.org; h...@infradead.org; jbottom...@parallels.com; Karen Xie; Manoj Malviya Subject: Re: [PATCH scsi 1/1] libiscsi : Add T10 Data Integrity Feature support On 08/06/2014 05:37 PM, Anish Bhatt wrote @@ -436,12 +473,12 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) /* No unsolicit Data-Out's */ hdr-flags |= ISCSI_FLAG_CMD_FINAL; } else { + unsigned in_len = iscsi_scsi_in_total_length(sc); hdr-flags |= ISCSI_FLAG_CMD_FINAL; zero_data(hdr-dlength); - hdr-data_length = cpu_to_be32(scsi_in(sc)-length); - if (sc-sc_data_direction == DMA_FROM_DEVICE) hdr-flags |= ISCSI_FLAG_CMD_READ; + hdr-data_length = cpu_to_be32(in_len); } What tree and branch did you make these over? Have you seen the patches from Sagi for iser and libiscsi support? Could you rebuild this over Christoph's tree which has his patches: git://git.infradead.org/users/hch/scsi-queue.git -- To unsubscribe from this list: send the line unsubscribe linux-scsi in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html