Skip to contentSkip to conversation

NVMe: Using PRACT bit to generate and verify PI by controller

PATCH Superseded Alok Pandey 3 participants 5 messages Jul 28, 2015 – Aug 26, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 NVMe: Using PRACT bit to generate and verify PI by controller

This patch enables the PRCHK and reftag support when PRACT bit is set, and block layer integrity is disabled.

Signed-off-by Alok Pandey <pandey.alok at samsung.com>
---
 drivers/block/nvme-core.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/block/nvme-core.c +9 -6
index 7920c27..ede8fb6 100644
@@ -815,11 +815,10 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod,
 	cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
 	cmnd->rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
 
-	if (blk_integrity_rq(req)) {
-		cmnd->rw.metadata = cpu_to_le64(sg_dma_address(iod->meta_sg));
+	if (ns->ms) {
 		switch (ns->pi_type) {
 		case NVME_NS_DPS_PI_TYPE3:
-			control |= NVME_RW_PRINFO_PRCHK_GUARD;
+		control |= NVME_RW_PRINFO_PRCHK_GUARD;
 			break;
 		case NVME_NS_DPS_PI_TYPE1:
 		case NVME_NS_DPS_PI_TYPE2:
@@ -829,8 +828,12 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod,
 					nvme_block_nr(ns, blk_rq_pos(req)));
 			break;
 		}
-	} else if (ns->ms)
-		control |= NVME_RW_PRINFO_PRACT;
+		if (blk_integrity_rq(req))
+			cmnd->rw.metadata =
+				cpu_to_le64(sg_dma_address(iod->meta_sg));
+		else
+			control |= NVME_RW_PRINFO_PRACT;
+	}
 
 	cmnd->rw.control = cpu_to_le16(control);
 	cmnd->rw.dsmgmt = cpu_to_le32(dsmgmt);
@@ -1989,7 +1992,7 @@ static int nvme_revalidate_disk(struct gendisk *disk)
 								!ns->ext)
 		nvme_init_integrity(ns);
 
-	if (ns->ms && !blk_get_integrity(disk))
+	if (ns->ms && !(ns->ms == 8 && ns->pi_type) && !blk_get_integrity(disk))
 		set_capacity(disk, 0);
 	else
 		set_capacity(disk, le64_to_cpup(&id->nsze) << (ns->lba_shift - 9));
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 NVMe: Using PRACT bit to generate and verify PI by controller

Quoted 2 lines · Alok Pandey

This patch enables the PRCHK and reftag support when PRACT bit is set, and block layer integrity is disabled.

Thanks!

Reviewed-by Keith Busch <keith.busch at intel.com>
Quoted 4 lines
Signed-off-by Alok Pandey <pandey.alok at samsung.com>

---

drivers/block/nvme-core.c +0 -0
@@ -815,11 +815,10 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod,
 	cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));

drivers/block/nvme-core.c static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod, · line 822

Quoted 10 lines
drivers/block/nvme-core.c +2 -3
 	cmnd->rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
 
-	if (blk_integrity_rq(req)) {
-		cmnd->rw.metadata = cpu_to_le64(sg_dma_address(iod->meta_sg));
+	if (ns->ms) {
 		switch (ns->pi_type) {
 		case NVME_NS_DPS_PI_TYPE3:
-			control |= NVME_RW_PRINFO_PRCHK_GUARD;
+		control |= NVME_RW_PRINFO_PRCHK_GUARD;
 			break;

Though the tab change here must have been an accident.

author
#2 lore raw

PATCH v2 1/1 NVMe: Using PRACT bit to generate and verify PI by controller

Can it be picked up.

Thanks,
Alok

-----Original Message-----
From: Linux-nvme [mailto:[email protected]] On Behalf Of Keith Busch
Sent: Friday, July 31, 2015 1:30 AM
To: Alok Pandey
Cc: keith.busch at intel.com; linux-nvme at lists.infradead.org
Subject: Re: [PATCH V2] NVMe: Using PRACT bit to generate and verify PI by controller

Quoted 2 lines · Alok Pandey

This patch enables the PRCHK and reftag support when PRACT bit is set, and block layer integrity is disabled.

Thanks!

Reviewed-by Keith Busch <keith.busch at intel.com>

Review static int nvme_submit_iod(struct nvme_queue *nvmeq,

Quoted 3 lines
Signed-off-by Alok Pandey <pandey.alok at samsung.com>

---

(quoted diff) +0 -0
@@ -815,11 +815,10 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq,

struct nvme_iod *iod,

Review static int nvme_submit_iod(struct nvme_queue *nvmeq, · line 821

Quoted 7 lines
(quoted diff) +0 -2
 	cmnd->rw.slba = cpu_to_le64(nvme_block_nr(ns, blk_rq_pos(req)));
 	cmnd->rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) -
 
 1);
 
-	if (blk_integrity_rq(req)) {
-		cmnd->rw.metadata =

cpu_to_le64(sg_dma_address(iod->meta_sg));

drivers/block/nvme-core.c static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod, · line 822

Quoted 6 lines
drivers/block/nvme-core.c +2 -1
+	if (ns->ms) {
 		switch (ns->pi_type) {
 		case NVME_NS_DPS_PI_TYPE3:
-			control |= NVME_RW_PRINFO_PRCHK_GUARD;
+		control |= NVME_RW_PRINFO_PRCHK_GUARD;
 			break;

Though the tab change here must have been an accident.

_______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

maintainer
#4 lore raw

PATCH v2 1/1 NVMe: Using PRACT bit to generate and verify PI by controller

Quoted 11 lines · Jens Axboe
Quoted 1 line · Alok

Can it be picked up.

Applied for 4.3:

http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.3/drivers&id=e3f879bf1ea3e03f433d292b0114807785f0754b

Please double check the patch, I had to hand apply it due to conflicts. In the future, base patches for revision x.y of the kernel against for-x.y/drivers. Thanks!

Ooops, this is the right commit, of course:

http://git.kernel.dk/cgit/linux-block/commit/?h=for-4.3/drivers&id=e19b127f5b76ec03b9c52b64f117dc75bb39eda1

Signature · 1 line
Jens Axboe