aboutsummaryrefslogtreecommitdiff
path: root/hw/nvme/dif.h
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2022-02-14 09:29:01 +0100
committerKlaus Jensen <k.jensen@samsung.com>2022-03-03 09:28:49 +0100
commitac0b34c58d0de09ce692af0a6c9a00a4eed0f3cd (patch)
tree1ad169841ceda161510d8f0a0a5577553b1031b3 /hw/nvme/dif.h
parent763c05dfb08c5fff86275788de7f11e899167167 (diff)
hw/nvme: add pi tuple size helper
A subsequent patch will introduce a new tuple size; so add a helper and use that instead of sizeof() and magic numbers. Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Diffstat (limited to 'hw/nvme/dif.h')
-rw-r--r--hw/nvme/dif.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/nvme/dif.h b/hw/nvme/dif.h
index e36fea30e7..ab6dbb0946 100644
--- a/hw/nvme/dif.h
+++ b/hw/nvme/dif.h
@@ -37,6 +37,11 @@ static const uint16_t t10_dif_crc_table[256] = {
0xF0D8, 0x7B6F, 0x6C01, 0xE7B6, 0x42DD, 0xC96A, 0xDE04, 0x55B3
};
+static inline size_t nvme_pi_tuple_size(NvmeNamespace *ns)
+{
+ return sizeof(NvmeDifTuple);
+}
+
uint16_t nvme_check_prinfo(NvmeNamespace *ns, uint8_t prinfo, uint64_t slba,
uint32_t reftag);
uint16_t nvme_dif_mangle_mdata(NvmeNamespace *ns, uint8_t *mbuf, size_t mlen,