From 396fc4ba21ab350d2d728259380545bf241899ec Mon Sep 17 00:00:00 2001
From: Gopinath P/Gopinath P
Date: Wed, 17 Dec 2025 21:22:51 +0530
Subject: [PATCH] plugin/ocp: Added OCP 2.7 smart extended log changes Updated
the smart extended log page structure, json and stdout print ocp2.7
enhancement.
Reviewed-by: Karthik Balan
Reviewed-by: Arunpandian J
Signed-off-by: Gopinath P
---
plugins/ocp/ocp-print-json.c | 6 ++++++
plugins/ocp/ocp-print-stdout.c | 6 ++++++
plugins/ocp/ocp-smart-extended-log.c | 2 +-
plugins/ocp/ocp-smart-extended-log.h | 7 ++++---
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/plugins/ocp/ocp-print-json.c b/plugins/ocp/ocp-print-json.c
index a8c18ec18a..311b79e637 100644
--- a/plugins/ocp/ocp-print-json.c
+++ b/plugins/ocp/ocp-print-json.c
@@ -226,6 +226,12 @@ static void json_smart_extended_log_v1(struct ocp_smart_extended_log *log)
case 0 ... 1:
break;
default:
+ case 6:
+ json_object_add_value_uint(root, "Form factor",
+ log->form_factor);
+ json_object_add_value_uint(root, "Die in use bad nand block",
+ le64_to_cpu(log->die_in_use_bad_nand_block));
+ fallthrough;
case 5:
json_object_add_value_uint(root, "NVMe Over Pcie Errata Version",
log->nvme_over_pcie_errate_version);
diff --git a/plugins/ocp/ocp-print-stdout.c b/plugins/ocp/ocp-print-stdout.c
index 3c884c43a2..29fdf2a000 100644
--- a/plugins/ocp/ocp-print-stdout.c
+++ b/plugins/ocp/ocp-print-stdout.c
@@ -168,6 +168,12 @@ static void stdout_smart_extended_log(struct ocp_smart_extended_log *log, unsign
case 0 ... 1:
break;
default:
+ case 6:
+ printf(" Form factor %d\n",
+ log->form_factor);
+ printf(" Die in use bad nand block %"PRIu64"\n",
+ le64_to_cpu(log->die_in_use_bad_nand_block));
+ fallthrough;
case 5:
printf(" NVMe Over Pcie Errata Version %d\n",
log->nvme_over_pcie_errate_version);
diff --git a/plugins/ocp/ocp-smart-extended-log.c b/plugins/ocp/ocp-smart-extended-log.c
index 3eef14a9a7..da56b40ea1 100644
--- a/plugins/ocp/ocp-smart-extended-log.c
+++ b/plugins/ocp/ocp-smart-extended-log.c
@@ -42,7 +42,7 @@ static int get_c0_log_page(struct nvme_transport_handle *hdl, char *format,
return ret;
}
- data = malloc(sizeof(__u8) * C0_SMART_CLOUD_ATTR_LEN);
+ data = (struct ocp_smart_extended_log *) malloc(sizeof(__u8) * C0_SMART_CLOUD_ATTR_LEN);
if (!data) {
fprintf(stderr, "ERROR : OCP : malloc : %s\n", strerror(errno));
return -1;
diff --git a/plugins/ocp/ocp-smart-extended-log.h b/plugins/ocp/ocp-smart-extended-log.h
index 9ac52e508f..1eebf76634 100644
--- a/plugins/ocp/ocp-smart-extended-log.h
+++ b/plugins/ocp/ocp-smart-extended-log.h
@@ -128,7 +128,7 @@ struct ocp_smart_extended_log {
__le16 total_die_failure_tolerance; /* [219:218] */
__le16 media_dies_offline; /* [221:220] */
__u8 max_temperature_recorded; /* [222] */
- __u8 rsvd223; /* [223] */
+ __u8 form_factor; /* [223] */
__le64 nand_avg_erase_count; /* [231:224] */
__le32 command_timeouts; /* [235:232] */
__le32 sys_area_program_fail_count_raw; /* [239:236] */
@@ -145,8 +145,9 @@ struct ocp_smart_extended_log {
__u8 lifetime_power_consumed[6]; /* [269:264] */
__u8 dssd_firmware_revision[8]; /* [277:270] */
__u8 dssd_firmware_build_uuid[16]; /* [293:278] */
- __u8 dssd_firmware_build_label[64]; /* [375:294] */
- __u8 rsvd358[136]; /* [493:358] */
+ __u8 dssd_firmware_build_label[64]; /* [357:294] */
+ __le64 die_in_use_bad_nand_block; /* [365:358] */
+ __u8 rsvd358[128]; /* [493:358] */
__le16 log_page_version; /* [495:494] */
__u8 log_page_guid[16]; /* [511:496] */
};