json_print(o);
}
+static void json_id_iocs_iocsc(struct json_object *obj_iocsc, __u64 iocsc)
+{
+ __u8 cpncs = NVME_GET(iocsc, IOCS_IOCSC_CPNCS);
+ __u8 slmcs = NVME_GET(iocsc, IOCS_IOCSC_SLMCS);
+ __u8 znscs = NVME_GET(iocsc, IOCS_IOCSC_ZNSCS);
+ __u8 kvcs = NVME_GET(iocsc, IOCS_IOCSC_KVCS);
+ __u8 nvmcs = NVME_GET(iocsc, IOCS_IOCSC_NVMCS);
+
+ obj_add_str(obj_iocsc, "Computational Programs Namespace Command Set", cpncs ?
+ "Selected" : "Not selected");
+ obj_add_str(obj_iocsc, "Subsystem Local Memory Command Set", slmcs ?
+ "Selected" : "Not selected");
+ obj_add_str(obj_iocsc, "Zoned Namespace Command Set", znscs ? "Selected" : "Not selected");
+ obj_add_str(obj_iocsc, "Key Value Command Set", kvcs ? "Selected" : "Not selected");
+ obj_add_str(obj_iocsc, "NVM Command Set", nvmcs ? "Selected" : "Not selected");
+}
+
static void json_id_iocs(struct nvme_id_iocs *iocs)
{
struct json_object *r = json_create_object();
+ struct json_object *obj_iocsc;
char json_str[STR_LEN];
__u16 i;
if (iocs->iocsc[i]) {
sprintf(json_str, "I/O Command Set Combination[%u]", i);
obj_add_uint64(r, json_str, le64_to_cpu(iocs->iocsc[i]));
+
+ obj_iocsc = json_create_object();
+ sprintf(json_str, "IOCSC%u", i);
+ json_id_iocs_iocsc(obj_iocsc, le64_to_cpu(iocs->iocsc[i]));
+ obj_add_obj(r, json_str, obj_iocsc);
}
}
printf("[%4u]:%#x\n", i, le16_to_cpu(endgrp_list->identifier[i]));
}
+static void stdout_id_iocs_iocsc(__u64 iocsc)
+{
+ __u8 cpncs = NVME_GET(iocsc, IOCS_IOCSC_CPNCS);
+ __u8 slmcs = NVME_GET(iocsc, IOCS_IOCSC_SLMCS);
+ __u8 znscs = NVME_GET(iocsc, IOCS_IOCSC_ZNSCS);
+ __u8 kvcs = NVME_GET(iocsc, IOCS_IOCSC_KVCS);
+ __u8 nvmcs = NVME_GET(iocsc, IOCS_IOCSC_NVMCS);
+
+ printf(" [4:4] : %#x\tComputational Programs Namespace Command Set %sSelected\n",
+ cpncs, cpncs ? "" : "Not ");
+ printf(" [3:3] : %#x\tSubsystem Local Memory Command Set %sSelected\n", slmcs,
+ slmcs ? "" : "Not ");
+ printf(" [2:2] : %#x\tZoned Namespace Command Set %sSelected\n", znscs,
+ znscs ? "" : "Not ");
+ printf(" [1:1] : %#x\tKey Value Command Set %sSelected\n", kvcs, kvcs ? "" : "Not ");
+ printf(" [0:0] : %#x\tNVM Command Set %sSelected\n", nvmcs, nvmcs ? "" : "Not ");
+ printf("\n");
+}
+
static void stdout_id_iocs(struct nvme_id_iocs *iocs)
{
+ bool human = stdout_print_ops.flags & VERBOSE;
__u16 i;
- for (i = 0; i < ARRAY_SIZE(iocs->iocsc); i++)
- if (iocs->iocsc[i])
+ for (i = 0; i < ARRAY_SIZE(iocs->iocsc); i++) {
+ if (iocs->iocsc[i]) {
printf("I/O Command Set Combination[%u]:%"PRIx64"\n", i,
(uint64_t)le64_to_cpu(iocs->iocsc[i]));
+ if (human)
+ stdout_id_iocs_iocsc(le64_to_cpu(iocs->iocsc[i]));
+ }
+ }
}
static void stdout_error_log(struct nvme_error_log_page *err_log, int entries,
_cleanup_free_ struct nvme_id_iocs *iocs = NULL;
_cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
- int err;
nvme_print_flags_t flags;
+ int err;
struct config {
__u16 cntid;
return err;
}
+ if (argconfig_parse_seen(opts, "verbose"))
+ flags |= VERBOSE;
+
iocs = nvme_alloc(sizeof(*iocs));
if (!iocs)
return -ENOMEM;
err = nvme_identify_iocs(dev_fd(dev), cfg.cntid, iocs);
if (!err) {
printf("NVMe Identify I/O Command Set:\n");
- nvme_show_id_iocs(iocs, 0);
+ nvme_show_id_iocs(iocs, flags);
} else if (err > 0) {
nvme_show_status(err);
} else {