2016-04-09 03:10:08

by Nicholas A. Bellinger

[permalink] [raw]
Subject: [PATCH] nvme/host: Add missing blk_integrity tag_size + flags assignments

From: Nicholas Bellinger <[email protected]>

While doing recent bring-up of nvme/host with target-core T10-PI,
I noticed /sys/block/nvme*/integrity/device_is_integrity_capable
was false, and /sys/block/nvme*/integrity/tag_size contained
a bogus value.

AFAICT outside of blk_integrity_compare() for DM + MD these
are informational values, but go ahead and add the missing
assignments for nvme/host to match what SCSI does within
sd_dif_config_host() for consistency's sake.

Cc: Keith Busch <[email protected]>
Cc: Jay Freyensee <[email protected]>
Cc: Martin K. Petersen <[email protected]>
Cc: Sagi Grimberg <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Jens Axboe <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
---
drivers/nvme/host/core.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b8e22fe..cbd08f8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -674,10 +674,14 @@ static void nvme_init_integrity(struct nvme_ns *ns)
switch (ns->pi_type) {
case NVME_NS_DPS_PI_TYPE3:
integrity.profile = &t10_pi_type3_crc;
+ integrity.tag_size = sizeof(u16) + sizeof(u32);
+ integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
break;
case NVME_NS_DPS_PI_TYPE1:
case NVME_NS_DPS_PI_TYPE2:
integrity.profile = &t10_pi_type1_crc;
+ integrity.tag_size = sizeof(u16);
+ integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
break;
default:
integrity.profile = NULL;
--
1.9.1


2016-04-10 14:59:34

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] nvme/host: Add missing blk_integrity tag_size + flags assignments

Does NVMe really force ATO=1? Sorry, didn't have much time to spend
with that part of the spec.

2016-04-11 20:28:58

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] nvme/host: Add missing blk_integrity tag_size + flags assignments

>>>>> "Christoph" == Christoph Hellwig <[email protected]> writes:

Christoph> Does NVMe really force ATO=1?

It does.

--
Martin K. Petersen Oracle Linux Engineering

2016-04-11 20:30:26

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH] nvme/host: Add missing blk_integrity tag_size + flags assignments

>>>>> "Nicholas" == Nicholas A Bellinger <[email protected]> writes:

Nicholas> While doing recent bring-up of nvme/host with target-core
Nicholas> T10-PI, I noticed
Nicholas> /sys/block/nvme*/integrity/device_is_integrity_capable was
Nicholas> false, and /sys/block/nvme*/integrity/tag_size contained a
Nicholas> bogus value.

Reviewed-by: Martin K. Petersen <[email protected]>

--
Martin K. Petersen Oracle Linux Engineering