#define TRIM 1
#define RESERVED 0
-struct __attribute__((__packed__)) ssd_latency_monitor_log {
+struct __packed ssd_latency_monitor_log {
__u8 feature_status; /* 0x00 */
__u8 rsvd1; /* 0x01 */
__le16 active_bucket_timer; /* 0x02 */
__u8 log_page_guid[0x10]; /* 0x1F0 */
};
-struct __attribute__((__packed__)) feature_latency_monitor {
+struct __packed feature_latency_monitor {
__u16 active_bucket_timer_threshold;
__u8 active_threshold_a;
__u8 active_threshold_b;
le16_to_cpu(log_data->static_latency_stamp_units));
printf(" Debug Log Trigger Enable %d\n",
le16_to_cpu(log_data->debug_log_trigger_enable));
- printf(" Debug Log Measured Latency %d \n",
+ printf(" Debug Log Measured Latency %d\n",
le16_to_cpu(log_data->debug_log_measured_latency));
if (le64_to_cpu(log_data->debug_log_latency_stamp) == -1) {
- printf(" Debug Log Latency Time Stamp N/A \n");
+ printf(" Debug Log Latency Time Stamp N/A\n");
} else {
- convert_ts(le64_to_cpu(log_data->debug_log_latency_stamp), ts_buf);
- printf(" Debug Log Latency Time Stamp %s \n", ts_buf);
+ convert_ts(le64_to_cpu(log_data->debug_log_latency_stamp), ts_buf);
+ printf(" Debug Log Latency Time Stamp %s\n", ts_buf);
}
- printf(" Debug Log Pointer %d \n",
+ printf(" Debug Log Pointer %d\n",
le16_to_cpu(log_data->debug_log_ptr));
- printf(" Debug Counter Trigger Source %d \n",
+ printf(" Debug Counter Trigger Source %d\n",
le16_to_cpu(log_data->debug_log_counter_trigger));
- printf(" Debug Log Stamp Units %d \n",
+ printf(" Debug Log Stamp Units %d\n",
le16_to_cpu(log_data->debug_log_stamp_units));
- printf(" Log Page Version %d \n",
+ printf(" Log Page Version %d\n",
le16_to_cpu(log_data->log_page_version));
char guid[(C3_GUID_LENGTH * 2) + 1];
char *ptr = &guid[0];
- for (i = C3_GUID_LENGTH - 1; i >= 0; i--) {
+
+ for (i = C3_GUID_LENGTH - 1; i >= 0; i--)
ptr += sprintf(ptr, "%02X", log_data->log_page_guid[i]);
- }
- printf(" Log Page GUID %s \n", guid);
+
+ printf(" Log Page GUID %s\n", guid);
printf("\n");
- printf(" Read Write Deallocate/Trim \n");
+ printf(" Read Write Deallocate/Trim\n");
for (i = 0; i < C3_BUCKET_NUM; i++) {
printf(" Active Latency Mode: Bucket %d %27d %27d %27d\n",
i,
}
for (i = 0; i < C3_BUCKET_NUM; i++) {
- printf(" Active Bucket Counter: Bucket %d %27d %27d %27d \n",
+ printf(" Active Bucket Counter: Bucket %d %27d %27d %27d\n",
i,
le32_to_cpu(log_data->active_bucket_counter[i][READ]),
le32_to_cpu(log_data->active_bucket_counter[i][WRITE]),
}
for (i = 0; i < C3_BUCKET_NUM; i++) {
- printf(" Static Measured Latency: Bucket %d %27d ms %27d ms %27d ms \n",
+ printf(" Static Measured Latency: Bucket %d %27d ms %27d ms %27d ms\n",
i,
le16_to_cpu(log_data->static_measured_latency[i][READ-1]),
le16_to_cpu(log_data->static_measured_latency[i][WRITE-1]),
le16_to_cpu(log_data->debug_log_stamp_units));
json_object_add_value_uint(root, "Log Page Version",
le16_to_cpu(log_data->log_page_version));
+
char guid[(C3_GUID_LENGTH * 2) + 1];
char *ptr = &guid[0];
+
for (i = C3_GUID_LENGTH - 1; i >= 0; i--)
ptr += sprintf(ptr, "%02X", log_data->log_page_guid[i]);
+
json_object_add_value_string(root, "Log Page GUID", guid);
json_print_object(root, NULL);
C3_LATENCY_MON_LOG_BUF_LEN, data);
if (strcmp(format, "json"))
- fprintf(stderr,
- "NVMe Status:%s(%x)\n",
- nvme_status_to_string(ret, false),
- ret);
+ fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret, false), ret);
- if (ret == 0) {
+ if (!ret) {
log_data = (struct ssd_latency_monitor_log *)data;
/* check log page version */
fprintf(stderr, "ERROR : OCP : Unknown GUID in C3 Log Page data\n");
fprintf(stderr, "ERROR : OCP : Expected GUID: 0x");
- for (j = 0; j < 16; j++) {
+ for (j = 0; j < 16; j++)
fprintf(stderr, "%x", lat_mon_guid[j]);
- }
fprintf(stderr, "\nERROR : OCP : Actual GUID: 0x");
- for (j = 0; j < 16; j++) {
+ for (j = 0; j < 16; j++)
fprintf(stderr, "%x", log_data->log_page_guid[j]);
- }
fprintf(stderr, "\n");
ret = -1;
if (err < 0) {
perror("set-feature");
} else if (!err) {
- printf("NVME_FEAT_OCP_LATENCY_MONITOR: 0x%02x \n", NVME_FEAT_OCP_LATENCY_MONITOR);
- printf("active bucket timer threshold: 0x%x \n", buf.active_bucket_timer_threshold);
- printf("active threshold a: 0x%x \n", buf.active_threshold_a);
- printf("active threshold b: 0x%x \n", buf.active_threshold_b);
- printf("active threshold c: 0x%x \n", buf.active_threshold_c);
- printf("active threshold d: 0x%x \n", buf.active_threshold_d);
- printf("active latency config: 0x%x \n", buf.active_latency_config);
- printf("active latency minimum window: 0x%x \n", buf.active_latency_minimum_window);
- printf("debug log trigger enable: 0x%x \n", buf.debug_log_trigger_enable);
- printf("discard debug log: 0x%x \n", buf.discard_debug_log);
- printf("latency monitor feature enable: 0x%x \n", buf.latency_monitor_feature_enable);
+ printf("NVME_FEAT_OCP_LATENCY_MONITOR: 0x%02x\n", NVME_FEAT_OCP_LATENCY_MONITOR);
+ printf("active bucket timer threshold: 0x%x\n", buf.active_bucket_timer_threshold);
+ printf("active threshold a: 0x%x\n", buf.active_threshold_a);
+ printf("active threshold b: 0x%x\n", buf.active_threshold_b);
+ printf("active threshold c: 0x%x\n", buf.active_threshold_c);
+ printf("active threshold d: 0x%x\n", buf.active_threshold_d);
+ printf("active latency config: 0x%x\n", buf.active_latency_config);
+ printf("active latency minimum window: 0x%x\n", buf.active_latency_minimum_window);
+ printf("debug log trigger enable: 0x%x\n", buf.debug_log_trigger_enable);
+ printf("discard debug log: 0x%x\n", buf.discard_debug_log);
+ printf("latency monitor feature enable: 0x%x\n", buf.latency_monitor_feature_enable);
} else if (err > 0) {
fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(err, false), err);
}
static int eol_plp_failure_mode(int argc, char **argv, struct command *cmd,
struct plugin *plugin)
{
- const char *desc = "Define EOL or PLP circuitry failure mode.\n"\
+ const char *desc = "Define EOL or PLP circuitry failure mode.\n"
"No argument prints current mode.";
const char *mode = "[0-3]: default/rom/wtm/normal";
const char *save = "Specifies that the controller shall save the attribute";
static void print_telemetry_header(struct telemetry_initiated_log *logheader,
int tele_type)
{
- if (logheader != NULL) {
+ if (logheader) {
unsigned int i = 0, j = 0;
if (tele_type == TELEMETRY_TYPE_HOST)
int total_loop_cnt = dumpsize / transfersize;
int last_xfer_size = dumpsize % transfersize;
- if (last_xfer_size != 0)
+ if (last_xfer_size)
total_loop_cnt++;
else
last_xfer_size = transfersize;
}
if (i != total_loop_cnt - 1) {
- if (i == 0) {
+ if (!i) {
output = open(filepath, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (output < 0) {
err = -13;
}
static int get_telemetry_dump(struct nvme_dev *dev, char *filename, char *sn,
- enum TELEMETRY_TYPE tele_type, int data_area, bool header_print)
+ enum TELEMETRY_TYPE tele_type, int data_area, bool header_print)
{
__u32 err = 0, nsid = 0;
__u8 lsp = 0, rae = 0;
-
- char data[TELEMETRY_TRANSFER_SIZE] = {0,};
+ char data[TELEMETRY_TRANSFER_SIZE] = { 0 };
char *featurename = 0;
+ struct telemetry_initiated_log *logheader = (struct telemetry_initiated_log *)data;
+ __u64 offset = 0, size = 0;
+ char dumpname[FILE_NAME_SIZE] = { 0 };
if (tele_type == TELEMETRY_TYPE_HOST_0) {
featurename = "Host(0)";
if (err)
return err;
- struct telemetry_initiated_log *logheader = (struct telemetry_initiated_log *)data;
-
if (header_print)
print_telemetry_header(logheader, tele_type);
- __u64 offset = 0, size = 0;
-
switch (data_area) {
case 1:
offset = TELEMETRY_HEADER_SIZE;
break;
}
- if (size == 0) {
+ if (!size) {
printf("Telemetry %s Area %d is empty.\n", featurename, data_area);
return err;
}
- char dumpname[FILE_NAME_SIZE] = {0,};
-
snprintf(dumpname, FILE_NAME_SIZE,
"Telemetry_%s_Area_%d", featurename, data_area);
err = extract_dump_get_log(dev, dumpname, filename, sn, size * TELEMETRY_BYTE_PER_BLOCK,
}
err = nvme_identify_ctrl(dev_fd(dev), &ctrl);
- if (err != 0) {
+ if (err)
return err;
- }
get_serial_number(&ctrl, sn);
if ((tele_area != 1 && tele_area != 3) ||
(tele_type == TELEMETRY_TYPE_CONTROLLER && tele_area != 3)) {
printf("\nUnsupported parameters entered.\n");
- printf("Possible combinations; {'host0',1}, {'host0',3}, "
- "{'host1',1}, {'host1',3}, {'controller',3}\n");
+ printf("Possible combinations; {'host0',1}, {'host0',3}, {'host1',1}, {'host1',3}, {'controller',3}\n");
return err;
}
} else {
- printf("\nShould provide these all; 'telemetry_type' "
- "and 'telemetry_data_area'\n");
+ printf("\nShould provide these all; 'telemetry_type' and 'telemetry_data_area'\n");
return err;
}
err = get_telemetry_dump(dev, cfg.file, sn,
TELEMETRY_TYPE_HOST_0, 1, true);
- if (err != 0)
+ if (err)
fprintf(stderr, "NVMe Status: %s(%x)\n", nvme_status_to_string(err, false), err);
printf("\n-------------------------------------------------------------\n");
err = get_telemetry_dump(dev, cfg.file, sn,
TELEMETRY_TYPE_HOST_0, 3, false);
- if (err != 0)
+ if (err)
fprintf(stderr, "NVMe Status: %s(%x)\n", nvme_status_to_string(err, false), err);
printf("\n-------------------------------------------------------------\n");
err = get_telemetry_dump(dev, cfg.file, sn,
TELEMETRY_TYPE_HOST_1, 1, true);
- if (err != 0)
+ if (err)
fprintf(stderr, "NVMe Status: %s(%x)\n", nvme_status_to_string(err, false), err);
printf("\n-------------------------------------------------------------\n");
err = get_telemetry_dump(dev, cfg.file, sn,
TELEMETRY_TYPE_HOST_1, 3, false);
- if (err != 0)
+ if (err)
fprintf(stderr, "NVMe Status: %s(%x)\n", nvme_status_to_string(err, false), err);
printf("\n-------------------------------------------------------------\n");
if (is_support_telemetry_controller == true) {
err = get_telemetry_dump(dev, cfg.file, sn,
TELEMETRY_TYPE_CONTROLLER, 3, true);
- if (err != 0)
+ if (err)
fprintf(stderr, "NVMe Status: %s(%x)\n", nvme_status_to_string(err, false), err);
}
if (is_support_telemetry_controller == true) {
err = get_telemetry_dump(dev, cfg.file, sn, tele_type, tele_area, true);
- if (err != 0)
+ if (err)
fprintf(stderr, "NVMe Status: %s(%x)\n", nvme_status_to_string(err, false), err);
}
} else {
(tele_type == TELEMETRY_TYPE_HOST_0) ? 0 : 1, tele_area);
err = get_telemetry_dump(dev, cfg.file, sn, tele_type, tele_area, true);
- if (err != 0)
+ if (err)
fprintf(stderr, "NVMe Status: %s(%x)\n", nvme_status_to_string(err, false), err);
}
* @log_page_version: indicates the version of the mapping this log page uses.
* Shall be set to 0001h
* @log_page_guid: Shall be set to C7BB98B7D0324863BB2C23990E9C722Fh.
-*/
-struct __attribute__((__packed__)) unsupported_requirement_log {
+ */
+struct __packed unsupported_requirement_log {
__le16 unsupported_count;
__u8 rsvd1[14];
__u8 unsupported_req_list[C5_NUM_UNSUPPORTED_REQ_ENTRIES][16];
__u8 log_page_guid[C5_GUID_LENGTH];
};
-/*Function declaration for unsupported requirement log page(LID:C5h)*/
+/* Function declaration for unsupported requirement log page (LID:C5h) */
static int ocp_unsupported_requirements_log(int argc, char **argv, struct command *cmd,
struct plugin *plugin);
struct unsupported_requirement_log *log_data)
{
int j;
- printf("Unsupported Requirement-C5 Log Page Data- \n");
- printf(" Number Unsupported Req IDs : 0x%x \n", le16_to_cpu(log_data->unsupported_count));
+ printf("Unsupported Requirement-C5 Log Page Data-\n");
- for (j = 0; j < le16_to_cpu(log_data->unsupported_count); j++) {
- printf(" Unsupported Requirement List %d : %s \n", j, log_data->unsupported_req_list[j]);
- }
+ printf(" Number Unsupported Req IDs : 0x%x\n", le16_to_cpu(log_data->unsupported_count));
+
+ for (j = 0; j < le16_to_cpu(log_data->unsupported_count); j++)
+ printf(" Unsupported Requirement List %d : %s\n", j, log_data->unsupported_req_list[j]);
- printf(" Log Page Version : 0x%x \n", le16_to_cpu(log_data->log_page_version));
+ printf(" Log Page Version : 0x%x\n", le16_to_cpu(log_data->log_page_version));
printf(" Log page GUID : 0x");
- for (j = C5_GUID_LENGTH - 1; j >= 0; j--) {
+ for (j = C5_GUID_LENGTH - 1; j >= 0; j--)
printf("%x", log_data->log_page_guid[j]);
- }
printf("\n");
return 0;
{
int j;
struct json_object *root;
+ char unsup_req_list_str[40];
+ char guid_buf[C5_GUID_LENGTH];
+ char *guid = guid_buf;
+
root = json_create_object();
json_object_add_value_int(root, "Number Unsupported Req IDs", le16_to_cpu(log_data->unsupported_count));
- char unsup_req_list_str[40];
memset((void *)unsup_req_list_str, 0, 40);
for (j = 0; j < le16_to_cpu(log_data->unsupported_count); j++) {
sprintf((char *)unsup_req_list_str, "Unsupported Requirement List %d", j);
}
json_object_add_value_int(root, "Log Page Version", le16_to_cpu(log_data->log_page_version));
- char guid_buf[C5_GUID_LENGTH];
- char *guid = guid_buf;
+
memset((void *)guid, 0, C5_GUID_LENGTH);
for (j = C5_GUID_LENGTH - 1; j >= 0; j--)
guid += sprintf(guid, "%02x", log_data->log_page_guid[j]);
__u8 *data;
int i;
struct unsupported_requirement_log *log_data;
+ int j;
fmt = validate_output_format(format);
if (fmt < 0) {
for (i = 0; i < 16; i++) {
if (unsupported_req_guid[i] != log_data->log_page_guid[i]) {
fprintf(stderr, "ERROR : OCP : Unknown GUID in C5 Log Page data\n");
- int j;
fprintf(stderr, "ERROR : OCP : Expected GUID: 0x");
for (j = 0; j < 16; j++)
fprintf(stderr, "%x", unsupported_req_guid[j]);
/**
* struct ocp_error_recovery_log_page - Error Recovery Log Page
- * @panic_reset_wait_time: Panic Reset Wait Time
- * @panic_reset_action: Panic Reset Action
- * @device_recover_action_1: Device Recovery Action 1
- * @panic_id: Panic ID
- * @device_capabilities: Device Capabilities
- * @vendor_specific_recovery_opcode: Vendor Specific Recovery Opcode
- * @reserved: Reserved
- * @vendor_specific_command_cdw12: Vendor Specific Command CDW12
- * @vendor_specific_command_cdw13: Vendor Specific Command CDW13
+ * @panic_reset_wait_time: Panic Reset Wait Time
+ * @panic_reset_action: Panic Reset Action
+ * @device_recover_action_1: Device Recovery Action 1
+ * @panic_id: Panic ID
+ * @device_capabilities: Device Capabilities
+ * @vendor_specific_recovery_opcode: Vendor Specific Recovery Opcode
+ * @reserved: Reserved
+ * @vendor_specific_command_cdw12: Vendor Specific Command CDW12
+ * @vendor_specific_command_cdw13: Vendor Specific Command CDW13
* @vendor_specific_command_timeout: Vendor Specific Command Timeout
- * @device_recover_action_2: Device Recovery Action 2
+ * @device_recover_action_2: Device Recovery Action 2
* @device_recover_action_2_timeout: Device Recovery Action 2 Timeout
- * @reserved2: Reserved
- * @log_page_version: Log Page Version
- * @log_page_guid: Log Page GUID
+ * @reserved2: Reserved
+ * @log_page_version: Log Page Version
+ * @log_page_guid: Log Page GUID
*/
-struct __attribute__((__packed__)) ocp_error_recovery_log_page {
+struct __packed ocp_error_recovery_log_page {
__le16 panic_reset_wait_time; /* 2 bytes - 0x00 - 0x01 */
__u8 panic_reset_action; /* 1 byte - 0x02 */
__u8 device_recover_action_1; /* 1 byte - 0x03 */
static void ocp_print_c1_log_normal(struct ocp_error_recovery_log_page *log_data)
{
int i;
- printf(" Error Recovery/C1 Log Page Data \n");
- printf(" Panic Reset Wait Time : 0x%x \n", le16_to_cpu(log_data->panic_reset_wait_time));
- printf(" Panic Reset Action : 0x%x \n", log_data->panic_reset_action);
- printf(" Device Recovery Action 1 : 0x%x \n", log_data->device_recover_action_1);
- printf(" Panic ID : 0x%x \n", le32_to_cpu(log_data->panic_id));
- printf(" Device Capabilities : 0x%x \n", le32_to_cpu(log_data->device_capabilities));
- printf(" Vendor Specific Recovery Opcode : 0x%x \n", log_data->vendor_specific_recovery_opcode);
- printf(" Vendor Specific Command CDW12 : 0x%x \n", le32_to_cpu(log_data->vendor_specific_command_cdw12));
- printf(" Vendor Specific Command CDW13 : 0x%x \n", le32_to_cpu(log_data->vendor_specific_command_cdw13));
- printf(" Vendor Specific Command Timeout : 0x%x \n", log_data->vendor_specific_command_timeout);
- printf(" Device Recovery Action 2 : 0x%x \n", log_data->device_recover_action_2);
- printf(" Device Recovery Action 2 Timeout : 0x%x \n", log_data->device_recover_action_2_timeout);
- printf(" Log Page Version : 0x%x \n", le16_to_cpu(log_data->log_page_version));
+
+ printf(" Error Recovery/C1 Log Page Data\n");
+ printf(" Panic Reset Wait Time : 0x%x\n", le16_to_cpu(log_data->panic_reset_wait_time));
+ printf(" Panic Reset Action : 0x%x\n", log_data->panic_reset_action);
+ printf(" Device Recovery Action 1 : 0x%x\n", log_data->device_recover_action_1);
+ printf(" Panic ID : 0x%x\n", le32_to_cpu(log_data->panic_id));
+ printf(" Device Capabilities : 0x%x\n", le32_to_cpu(log_data->device_capabilities));
+ printf(" Vendor Specific Recovery Opcode : 0x%x\n", log_data->vendor_specific_recovery_opcode);
+ printf(" Vendor Specific Command CDW12 : 0x%x\n", le32_to_cpu(log_data->vendor_specific_command_cdw12));
+ printf(" Vendor Specific Command CDW13 : 0x%x\n", le32_to_cpu(log_data->vendor_specific_command_cdw13));
+ printf(" Vendor Specific Command Timeout : 0x%x\n", log_data->vendor_specific_command_timeout);
+ printf(" Device Recovery Action 2 : 0x%x\n", log_data->device_recover_action_2);
+ printf(" Device Recovery Action 2 Timeout : 0x%x\n", log_data->device_recover_action_2_timeout);
+ printf(" Log Page Version : 0x%x\n", le16_to_cpu(log_data->log_page_version));
printf(" Log page GUID : 0x");
- for (i = C1_GUID_LENGTH - 1; i >= 0; i--) {
- printf("%x", log_data->log_page_guid[i]);
- }
+ for (i = C1_GUID_LENGTH - 1; i >= 0; i--)
+ printf("%x", log_data->log_page_guid[i]);
printf("\n");
}
static void ocp_print_c1_log_json(struct ocp_error_recovery_log_page *log_data)
{
struct json_object *root;
+
root = json_create_object();
char guid[64];
static void ocp_print_c1_log_binary(struct ocp_error_recovery_log_page *log_data)
{
- return d_raw((unsigned char *)log_data, sizeof(*log_data));
+ return d_raw((unsigned char *)log_data, sizeof(*log_data));
}
static int get_c1_log_page(struct nvme_dev *dev, char *format)
static int ocp_error_recovery_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)
{
- const char *desc = "Retrieve C1h Error Recovery Log data.";
+ const char *desc = "Retrieve C1h Error Recovery Log data.";
struct nvme_dev *dev;
int ret = 0;
* @log_page_version: Log Page Version
* @log_page_guid: Log Page GUID
*/
-struct __attribute__((__packed__)) ocp_device_capabilities_log_page {
+struct __packed ocp_device_capabilities_log_page {
__le16 pcie_exp_port;
__le16 oob_management_support;
__le16 wz_cmd_support;
static void ocp_print_c4_log_normal(struct ocp_device_capabilities_log_page *log_data)
{
int i;
- printf(" Device Capability/C4 Log Page Data \n");
- printf(" PCI Express Ports : 0x%x \n", le16_to_cpu(log_data->pcie_exp_port));
- printf(" OOB Management Support : 0x%x \n", le16_to_cpu(log_data->oob_management_support));
- printf(" Write Zeroes Command Support : 0x%x \n", le16_to_cpu(log_data->wz_cmd_support));
- printf(" Sanitize Command Support : 0x%x \n", le16_to_cpu(log_data->sanitize_cmd_support));
- printf(" Dataset Management Command Support : 0x%x \n", le16_to_cpu(log_data->dsm_cmd_support));
- printf(" Write Uncorrectable Command Support : 0x%x \n", le16_to_cpu(log_data->wu_cmd_support));
- printf(" Fused Operation Support : 0x%x \n", le16_to_cpu(log_data->fused_operation_support));
- printf(" Minimum Valid DSSD Power State : 0x%x \n", le16_to_cpu(log_data->min_valid_dssd_pwr_state));
+
+ printf(" Device Capability/C4 Log Page Data\n");
+ printf(" PCI Express Ports : 0x%x\n", le16_to_cpu(log_data->pcie_exp_port));
+ printf(" OOB Management Support : 0x%x\n", le16_to_cpu(log_data->oob_management_support));
+ printf(" Write Zeroes Command Support : 0x%x\n", le16_to_cpu(log_data->wz_cmd_support));
+ printf(" Sanitize Command Support : 0x%x\n", le16_to_cpu(log_data->sanitize_cmd_support));
+ printf(" Dataset Management Command Support : 0x%x\n", le16_to_cpu(log_data->dsm_cmd_support));
+ printf(" Write Uncorrectable Command Support : 0x%x\n", le16_to_cpu(log_data->wu_cmd_support));
+ printf(" Fused Operation Support : 0x%x\n", le16_to_cpu(log_data->fused_operation_support));
+ printf(" Minimum Valid DSSD Power State : 0x%x\n", le16_to_cpu(log_data->min_valid_dssd_pwr_state));
printf(" DSSD Power State Descriptors : 0x");
- for (i = 0; i <= 127; i++) {
+ for (i = 0; i <= 127; i++)
printf("%x", log_data->dssd_pwr_state_desc[i]);
- }
printf("\n");
- printf(" Log Page Version : 0x%x \n", le16_to_cpu(log_data->log_page_version));
+ printf(" Log Page Version : 0x%x\n", le16_to_cpu(log_data->log_page_version));
printf(" Log page GUID : 0x");
- for (i = C4_GUID_LENGTH - 1; i >= 0; i--) {
+ for (i = C4_GUID_LENGTH - 1; i >= 0; i--)
printf("%x", log_data->log_page_guid[i]);
- }
printf("\n");
}
static void ocp_print_c4_log_json(struct ocp_device_capabilities_log_page *log_data)
{
- struct json_object *root;
- root = json_create_object();
+ struct json_object *root = json_create_object();
char guid[64];
int i;
json_object_add_value_int(root, "Write Uncorrectable Command Support", le16_to_cpu(log_data->wu_cmd_support));
json_object_add_value_int(root, "Fused Operation Support", le16_to_cpu(log_data->fused_operation_support));
json_object_add_value_int(root, "Minimum Valid DSSD Power State", le16_to_cpu(log_data->min_valid_dssd_pwr_state));
- for (i = 0; i <= 127; i++) {
+ for (i = 0; i <= 127; i++)
json_object_add_value_int(root, "DSSD Power State Descriptors", log_data->dssd_pwr_state_desc[i]);
- }
json_object_add_value_int(root, "Log Page Version", le16_to_cpu(log_data->log_page_version));
memset((void *)guid, 0, 64);
static void ocp_print_c4_log_binary(struct ocp_device_capabilities_log_page *log_data)
{
- return d_raw((unsigned char *)log_data, sizeof(*log_data));
+ return d_raw((unsigned char *)log_data, sizeof(*log_data));
}
static int get_c4_log_page(struct nvme_dev *dev, char *format)
fprintf(stderr, "ERROR : OCP : malloc : %s\n", strerror(errno));
return -1;
}
- memset(data, 0, sizeof (__u8) * C4_DEV_CAP_REQ_LEN);
+ memset(data, 0, sizeof(__u8) * C4_DEV_CAP_REQ_LEN);
ret = nvme_get_log_simple(dev_fd(dev), C4_DEV_CAP_REQ_OPCODE, C4_DEV_CAP_REQ_LEN, data);
static int ocp_device_capabilities_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)
{
- const char *desc = "Retrieve C4h Device Capabilities Log data.";
+ const char *desc = "Retrieve C4h Device Capabilities Log data.";
struct nvme_dev *dev;
int ret = 0;