Skip to content

Commit 472292c

Browse files
Kanchan Joshiaxboe
authored andcommitted
nvme: add support for passing on the application tag
With user integrity buffer, there is a way to specify the app_tag. Set the corresponding protocol specific flags and send the app_tag down. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Anuj Gupta <[email protected]> Signed-off-by: Kanchan Joshi <[email protected]> Reviewed-by: Keith Busch <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2c0487d commit 472292c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/nvme/host/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,12 @@ static blk_status_t nvme_setup_discard(struct nvme_ns *ns, struct request *req,
885885
return BLK_STS_OK;
886886
}
887887

888+
static void nvme_set_app_tag(struct request *req, struct nvme_command *cmnd)
889+
{
890+
cmnd->rw.lbat = cpu_to_le16(bio_integrity(req->bio)->app_tag);
891+
cmnd->rw.lbatm = cpu_to_le16(0xffff);
892+
}
893+
888894
static void nvme_set_ref_tag(struct nvme_ns *ns, struct nvme_command *cmnd,
889895
struct request *req)
890896
{
@@ -1025,6 +1031,10 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
10251031
control |= NVME_RW_APPEND_PIREMAP;
10261032
nvme_set_ref_tag(ns, cmnd, req);
10271033
}
1034+
if (bio_integrity_flagged(req->bio, BIP_CHECK_APPTAG)) {
1035+
control |= NVME_RW_PRINFO_PRCHK_APP;
1036+
nvme_set_app_tag(req, cmnd);
1037+
}
10281038
}
10291039

10301040
cmnd->rw.control = cpu_to_le16(control);

0 commit comments

Comments
 (0)