From 060ffe8dee801208f00bb4af08e564766b518ccb Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 24 Aug 2016 13:55:58 -0700 Subject: [PATCH] nvme/identify: fix max data transfer when MPSMIN != 0 Correctly calculate the maximum data transfer size as defined in the spec - MDTS is a power of two in units of the minimum memory page size. Change-Id: Ifd517d3051a28d404246c5a5d342147aa69ceedc Signed-off-by: Daniel Verkamp --- examples/nvme/identify/identify.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/nvme/identify/identify.c b/examples/nvme/identify/identify.c index 7d5fd1160..a5e0012d5 100644 --- a/examples/nvme/identify/identify.c +++ b/examples/nvme/identify/identify.c @@ -483,12 +483,11 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_device *pci_dev) printf("IEEE OUI Identifier: %02x %02x %02x\n", cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]); printf("Multi-path I/O: %02x\n", *(int *)&cdata->cmic); - /* TODO: Use CAP.MPSMIN to determine true memory page size. */ printf("Max Data Transfer Size: "); if (cdata->mdts == 0) printf("Unlimited\n"); else - printf("%d\n", 4096 * (1 << cdata->mdts)); + printf("%" PRIu64 "\n", (uint64_t)1 << (12 + cap.bits.mpsmin + cdata->mdts)); if (features[SPDK_NVME_FEAT_ERROR_RECOVERY].valid) { unsigned tler = features[SPDK_NVME_FEAT_ERROR_RECOVERY].result & 0xFFFF; printf("Error Recovery Timeout: ");