Commit e19b127f authored by Alok Pandey's avatar Alok Pandey Committed by Jens Axboe

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: default avatarAlok Pandey <pandey.alok@samsung.com>
Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent e3f879bf
...@@ -813,8 +813,7 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod, ...@@ -813,8 +813,7 @@ 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.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); cmnd.rw.length = cpu_to_le16((blk_rq_bytes(req) >> ns->lba_shift) - 1);
if (blk_integrity_rq(req)) { if (ns->ms) {
cmnd.rw.metadata = cpu_to_le64(sg_dma_address(iod->meta_sg));
switch (ns->pi_type) { switch (ns->pi_type) {
case NVME_NS_DPS_PI_TYPE3: case NVME_NS_DPS_PI_TYPE3:
control |= NVME_RW_PRINFO_PRCHK_GUARD; control |= NVME_RW_PRINFO_PRCHK_GUARD;
...@@ -827,8 +826,12 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod, ...@@ -827,8 +826,12 @@ static int nvme_submit_iod(struct nvme_queue *nvmeq, struct nvme_iod *iod,
nvme_block_nr(ns, blk_rq_pos(req))); nvme_block_nr(ns, blk_rq_pos(req)));
break; break;
} }
} else if (ns->ms) if (blk_integrity_rq(req))
cmnd.rw.metadata =
cpu_to_le64(sg_dma_address(iod->meta_sg));
else
control |= NVME_RW_PRINFO_PRACT; control |= NVME_RW_PRINFO_PRACT;
}
cmnd.rw.control = cpu_to_le16(control); cmnd.rw.control = cpu_to_le16(control);
cmnd.rw.dsmgmt = cpu_to_le32(dsmgmt); cmnd.rw.dsmgmt = cpu_to_le32(dsmgmt);
...@@ -2037,7 +2040,7 @@ static int nvme_revalidate_disk(struct gendisk *disk) ...@@ -2037,7 +2040,7 @@ static int nvme_revalidate_disk(struct gendisk *disk)
!ns->ext) !ns->ext)
nvme_init_integrity(ns); 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); set_capacity(disk, 0);
else else
set_capacity(disk, le64_to_cpup(&id->nsze) << (ns->lba_shift - 9)); set_capacity(disk, le64_to_cpup(&id->nsze) << (ns->lba_shift - 9));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment