Skip to content

Commit

Permalink
engines:nvme: fill command fields as per pi check bits
Browse files Browse the repository at this point in the history
Fill the application and reference tag field for read and write
command only when pi_chk has the relevant bit set.

Signed-off-by: Ankit Kumar <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
ankit-sam authored and axboe committed Sep 11, 2023
1 parent ba342e5 commit e4a9812
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions engines/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,19 +415,24 @@ void fio_nvme_pi_fill(struct nvme_uring_cmd *cmd, struct io_u *io_u,
case NVME_NS_DPS_PI_TYPE2:
switch (data->guard_type) {
case NVME_NVM_NS_16B_GUARD:
cmd->cdw14 = (__u32)slba;
if (opts->io_flags & NVME_IO_PRINFO_PRCHK_REF)
cmd->cdw14 = (__u32)slba;
break;
case NVME_NVM_NS_64B_GUARD:
cmd->cdw14 = (__u32)slba;
cmd->cdw3 = ((slba >> 32) & 0xffff);
if (opts->io_flags & NVME_IO_PRINFO_PRCHK_REF) {
cmd->cdw14 = (__u32)slba;
cmd->cdw3 = ((slba >> 32) & 0xffff);
}
break;
default:
break;
}
cmd->cdw15 = (opts->apptag_mask << 16 | opts->apptag);
if (opts->io_flags & NVME_IO_PRINFO_PRCHK_APP)
cmd->cdw15 = (opts->apptag_mask << 16 | opts->apptag);
break;
case NVME_NS_DPS_PI_TYPE3:
cmd->cdw15 = (opts->apptag_mask << 16 | opts->apptag);
if (opts->io_flags & NVME_IO_PRINFO_PRCHK_APP)
cmd->cdw15 = (opts->apptag_mask << 16 | opts->apptag);
break;
case NVME_NS_DPS_PI_NONE:
break;
Expand Down

0 comments on commit e4a9812

Please sign in to comment.