From b1ade5f7f973c521f47fb956511a44faf74fa548 Mon Sep 17 00:00:00 2001 From: Keith Busch Date: Fri, 26 Jun 2020 15:16:03 -0700 Subject: [PATCH] iocs fixes Remove bit fields. We can't rely on their byte order. Remove iocs feature payload, since there isn't one with this feature. The iocs profile points to an entry in the identify iocs array. Signed-off-by: Keith Busch --- linux/nvme.h | 14 ++------------ nvme-print.c | 21 ++++++--------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/linux/nvme.h b/linux/nvme.h index 08d5603c..86782ece 100644 --- a/linux/nvme.h +++ b/linux/nvme.h @@ -418,18 +418,8 @@ struct nvme_id_ns { __u8 vs[3712]; }; -struct nvme_iocs_vector { - union { - __le64 nvm : 1; - __le64 rsvd1 : 1; - __le64 zoned : 1; - __le64 rsvd3 : 61; - }; - __le64 a; -}; - struct nvme_id_iocs { - struct nvme_iocs_vector iocsc[512]; + __le64 iocs[512]; }; enum { @@ -1043,7 +1033,7 @@ enum { NVME_FEAT_PLM_WINDOW = 0x14, NVME_FEAT_HOST_BEHAVIOR = 0x16, NVME_FEAT_SANITIZE = 0x17, - NVME_FEAT_IOCS_SET_PROFILE = 0x19, + NVME_FEAT_IOCS_PROFILE = 0x19, NVME_FEAT_SW_PROGRESS = 0x80, NVME_FEAT_HOST_ID = 0x81, NVME_FEAT_RESV_MASK = 0x82, diff --git a/nvme-print.c b/nvme-print.c index f6827be2..2ca41f19 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -3386,12 +3386,10 @@ void nvme_show_id_iocs(struct nvme_id_iocs *iocs) { __u16 i; - for (i = 0; i < 512; i++) { - if (iocs->iocsc[i].nvm) { - printf("I/O Command Set Combination[%"PRIu16"] " - "NVM Command Set Supported\n", i); - } - } + for (i = 0; i < 512; i++) + if (iocs->iocs[i]) + printf("I/O Command Set Combination[%u]:%"PRIx64"\n", i, + (uint64_t)le64_to_cpu(iocs->iocs[i])); } static const char *nvme_trtype_to_string(__u8 trtype) @@ -3979,7 +3977,7 @@ const char *nvme_feature_to_string(int feature) case NVME_FEAT_RRL: return "Read Recovery Level"; case NVME_FEAT_PLM_CONFIG: return "Predicatable Latency Mode Config"; case NVME_FEAT_PLM_WINDOW: return "Predicatable Latency Mode Window"; - case NVME_FEAT_IOCS_SET_PROFILE: return "I/O Command Set Profile"; + case NVME_FEAT_IOCS_PROFILE: return "I/O Command Set Profile"; case NVME_FEAT_SW_PROGRESS: return "Software Progress"; case NVME_FEAT_HOST_ID: return "Host Identifier"; case NVME_FEAT_RESV_MASK: return "Reservation Notification Mask"; @@ -4470,12 +4468,6 @@ static void nvme_show_plm_config(struct nvme_plm_config *plmcfg) printf("\tDTWIN Time Threshold :%"PRIu64"\n", le64_to_cpu(plmcfg->dtwin_time_thresh)); } -static void nvme_show_iocs_vector(struct nvme_iocs_vector *iocs_vector) -{ - printf("\tNVM Command Set is selected: %s\n", iocs_vector->nvm ? "True":"False"); - printf("\tZoned Namespace Command Set is selected: %s\n", iocs_vector->zoned ? "True":"False"); -} - void nvme_feature_show_fields(__u32 fid, unsigned int result, unsigned char *buf) { __u8 field; @@ -4556,9 +4548,8 @@ void nvme_feature_show_fields(__u32 fid, unsigned int result, unsigned char *buf case NVME_FEAT_PLM_WINDOW: printf("\tWindow Select: %s", nvme_plm_window(result)); break; - case NVME_FEAT_IOCS_SET_PROFILE: + case NVME_FEAT_IOCS_PROFILE: printf("\tI/O Command Set Profile: %s\n", result & 0x1 ? "True":"False"); - nvme_show_iocs_vector((struct nvme_iocs_vector *)buf); break; case NVME_FEAT_HOST_ID: ull = buf[7]; ull <<= 8; ull |= buf[6]; ull <<= 8; ull |= buf[5]; ull <<= 8; -- 2.50.1