diff mbox series

[06/15] scsi: zfcp: Use the proper SCSI midlayer interfaces for PI

Message ID 20210609033929.3815-7-martin.petersen@oracle.com
State New
Headers show
Series Subject: Protection information and block size cleanup | expand

Commit Message

Martin K. Petersen June 9, 2021, 3:39 a.m. UTC
Use scsi_prot_ref_tag() and scsi_prot_interval() instead
scsi_get_lba() and sector_size.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/s390/scsi/zfcp_fsf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Benjamin Block June 14, 2021, 2:33 p.m. UTC | #1
Hey Martin,

please set me and Steffen on CC next time for zfcp.

On Tue, Jun 08, 2021 at 11:39:20PM -0400, Martin K. Petersen wrote:
> Use scsi_prot_ref_tag() and scsi_prot_interval() instead

> scsi_get_lba() and sector_size.

> 

> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

> ---

>  drivers/s390/scsi/zfcp_fsf.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c

> index 2e4804ef2fb9..1990216cf289 100644

> --- a/drivers/s390/scsi/zfcp_fsf.c

> +++ b/drivers/s390/scsi/zfcp_fsf.c

> @@ -2599,8 +2599,8 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd)

>  	io->fcp_cmnd_length = FCP_CMND_LEN;

>  

>  	if (scsi_get_prot_op(scsi_cmnd) != SCSI_PROT_NORMAL) {

> -		io->data_block_length = scsi_cmnd->device->sector_size;

> -		io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF;

> +		io->data_block_length = scsi_prot_interval(scsi_cmnd);

> +		io->ref_tag_value = scsi_prot_ref_tag(scsi_cmnd);


Reviewed-by: Benjamin Block <bblock@linux.ibm.com>



Out of curiosity, do you have any idea whether there is any storage that
offers DIF with a different Logical Block Size than 512 (I haven't see
any, although, that doesn't say much)? Just re-read some parts of our
HBA specs and we probably would be in trouble, if it does, with how we do
things here.

-- 
Best Regards, Benjamin Block  / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH    /    https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen         /        Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Martin K. Petersen June 15, 2021, 2:27 a.m. UTC | #2
Benjamin,

> please set me and Steffen on CC next time for zfcp.


Sure.

> Out of curiosity, do you have any idea whether there is any storage

> that offers DIF with a different Logical Block Size than 512 (I

> haven't see any, although, that doesn't say much)? Just re-read some

> parts of our HBA specs and we probably would be in trouble, if it

> does, with how we do things here.


I have a few that are 4Kn+8. It wouldn't say these are very common, the
16-bit CRC isn't that great with 4K blocks.

To address the block size issue we defined a couple of new protection
formats in NVMe. These allow for 32 and 64-bit CRCs, larger reference
tags, etc. However, these enhancements have yet to percolate down into
SCSI/SBC.

-- 
Martin K. Petersen	Oracle Linux Engineering
Benjamin Block June 15, 2021, 9:31 a.m. UTC | #3
On Mon, Jun 14, 2021 at 10:27:57PM -0400, Martin K. Petersen wrote:
> > Out of curiosity, do you have any idea whether there is any storage

> > that offers DIF with a different Logical Block Size than 512 (I

> > haven't see any, although, that doesn't say much)? Just re-read some

> > parts of our HBA specs and we probably would be in trouble, if it

> > does, with how we do things here.

> 

> I have a few that are 4Kn+8. It wouldn't say these are very common, the

> 16-bit CRC isn't that great with 4K blocks.

> 

> To address the block size issue we defined a couple of new protection

> formats in NVMe. These allow for 32 and 64-bit CRCs, larger reference

> tags, etc. However, these enhancements have yet to percolate down into

> SCSI/SBC.


Oh, interesting. Thanks for sharing.

-- 
Best Regards, Benjamin Block  / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH    /    https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen         /        Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
diff mbox series

Patch

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 2e4804ef2fb9..1990216cf289 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2599,8 +2599,8 @@  int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd)
 	io->fcp_cmnd_length = FCP_CMND_LEN;
 
 	if (scsi_get_prot_op(scsi_cmnd) != SCSI_PROT_NORMAL) {
-		io->data_block_length = scsi_cmnd->device->sector_size;
-		io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF;
+		io->data_block_length = scsi_prot_interval(scsi_cmnd);
+		io->ref_tag_value = scsi_prot_ref_tag(scsi_cmnd);
 	}
 
 	if (zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction))