Skip to content

Commit 1862350

Browse files
Anuj Guptaaxboe
authored andcommitted
scsi: add support for user-meta interface
Add support for sending user-meta buffer. Set tags to be checked using flags specified by user/block-layer. With this change, BIP_CTRL_NOCHECK becomes unused. Remove it. Signed-off-by: Anuj Gupta <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 472292c commit 1862350

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

drivers/scsi/sd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -814,14 +814,14 @@ static unsigned char sd_setup_protect_cmnd(struct scsi_cmnd *scmd,
814814
if (bio_integrity_flagged(bio, BIP_IP_CHECKSUM))
815815
scmd->prot_flags |= SCSI_PROT_IP_CHECKSUM;
816816

817-
if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false)
817+
if (bio_integrity_flagged(bio, BIP_CHECK_GUARD))
818818
scmd->prot_flags |= SCSI_PROT_GUARD_CHECK;
819819
}
820820

821821
if (dif != T10_PI_TYPE3_PROTECTION) { /* DIX/DIF Type 0, 1, 2 */
822822
scmd->prot_flags |= SCSI_PROT_REF_INCREMENT;
823823

824-
if (bio_integrity_flagged(bio, BIP_CTRL_NOCHECK) == false)
824+
if (bio_integrity_flagged(bio, BIP_CHECK_REFTAG))
825825
scmd->prot_flags |= SCSI_PROT_REF_CHECK;
826826
}
827827

include/linux/bio-integrity.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
enum bip_flags {
88
BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */
99
BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */
10-
BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */
11-
BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */
12-
BIP_IP_CHECKSUM = 1 << 4, /* IP checksum */
13-
BIP_COPY_USER = 1 << 5, /* Kernel bounce buffer in use */
14-
BIP_CHECK_GUARD = 1 << 6, /* guard check */
15-
BIP_CHECK_REFTAG = 1 << 7, /* reftag check */
16-
BIP_CHECK_APPTAG = 1 << 8, /* apptag check */
10+
BIP_DISK_NOCHECK = 1 << 2, /* disable disk integrity checking */
11+
BIP_IP_CHECKSUM = 1 << 3, /* IP checksum */
12+
BIP_COPY_USER = 1 << 4, /* Kernel bounce buffer in use */
13+
BIP_CHECK_GUARD = 1 << 5, /* guard check */
14+
BIP_CHECK_REFTAG = 1 << 6, /* reftag check */
15+
BIP_CHECK_APPTAG = 1 << 7, /* apptag check */
1716
};
1817

1918
struct bio_integrity_payload {
@@ -33,8 +32,7 @@ struct bio_integrity_payload {
3332
struct bio_vec bip_inline_vecs[];/* embedded bvec array */
3433
};
3534

36-
#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_CTRL_NOCHECK | \
37-
BIP_DISK_NOCHECK | BIP_IP_CHECKSUM | \
35+
#define BIP_CLONE_FLAGS (BIP_MAPPED_INTEGRITY | BIP_IP_CHECKSUM | \
3836
BIP_CHECK_GUARD | BIP_CHECK_REFTAG | BIP_CHECK_APPTAG)
3937

4038
#ifdef CONFIG_BLK_DEV_INTEGRITY

0 commit comments

Comments
 (0)