hw/nvme: save reftag when generating pi

Prepare nvme_dif_pract_generate_dif() and nvme_dif_check() to be
callable in smaller increments by making the reftag a pointer parameter
updated by the function.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
Klaus Jensen 2021-06-17 21:06:50 +02:00
parent d7d1474fd8
commit 0ca5c3ccac
3 changed files with 18 additions and 18 deletions

View file

@ -1968,7 +1968,7 @@ static void nvme_verify_cb(void *opaque, int ret)
req->status = nvme_dif_check(ns, ctx->data.bounce, ctx->data.iov.size,
ctx->mdata.bounce, ctx->mdata.iov.size,
ctrl, slba, apptag, appmask, reftag);
ctrl, slba, apptag, appmask, &reftag);
}
out:
@ -2204,7 +2204,7 @@ static void nvme_copy_in_complete(NvmeRequest *req)
reftag = le32_to_cpu(range->reftag);
status = nvme_dif_check(ns, buf, len, mbuf, mlen, prinfor, slba,
apptag, appmask, reftag);
apptag, appmask, &reftag);
if (status) {
goto invalid;
}
@ -2227,10 +2227,10 @@ static void nvme_copy_in_complete(NvmeRequest *req)
}
nvme_dif_pract_generate_dif(ns, ctx->bounce, len, ctx->mbounce,
mlen, apptag, reftag);
mlen, apptag, &reftag);
} else {
status = nvme_dif_check(ns, ctx->bounce, len, ctx->mbounce, mlen,
prinfow, sdlba, apptag, appmask, reftag);
prinfow, sdlba, apptag, appmask, &reftag);
if (status) {
goto invalid;
}
@ -2370,7 +2370,7 @@ static void nvme_compare_mdata_cb(void *opaque, int ret)
status = nvme_dif_check(ns, ctx->data.bounce, ctx->data.iov.size,
ctx->mdata.bounce, ctx->mdata.iov.size, ctrl,
slba, apptag, appmask, reftag);
slba, apptag, appmask, &reftag);
if (status) {
req->status = status;
goto out;