summaryrefslogtreecommitdiffstats
path: root/plugins/solidigm
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/solidigm')
-rw-r--r--plugins/solidigm/meson.build1
-rw-r--r--plugins/solidigm/solidigm-garbage-collection.c32
-rw-r--r--plugins/solidigm/solidigm-latency-tracking.c22
-rw-r--r--plugins/solidigm/solidigm-nvme.c10
-rw-r--r--plugins/solidigm/solidigm-nvme.h3
-rw-r--r--plugins/solidigm/solidigm-smart.c34
-rw-r--r--plugins/solidigm/solidigm-telemetry.c2
-rw-r--r--plugins/solidigm/solidigm-telemetry/cod.c8
-rw-r--r--plugins/solidigm/solidigm-telemetry/config.c12
-rw-r--r--plugins/solidigm/solidigm-telemetry/config.h5
-rw-r--r--plugins/solidigm/solidigm-telemetry/data-area.c48
-rw-r--r--plugins/solidigm/solidigm-telemetry/header.c32
-rw-r--r--plugins/solidigm/solidigm-telemetry/telemetry-log.h6
-rw-r--r--plugins/solidigm/solidigm-util.c20
-rw-r--r--plugins/solidigm/solidigm-util.h10
15 files changed, 169 insertions, 76 deletions
diff --git a/plugins/solidigm/meson.build b/plugins/solidigm/meson.build
index bca13bb..526fb02 100644
--- a/plugins/solidigm/meson.build
+++ b/plugins/solidigm/meson.build
@@ -1,4 +1,5 @@
sources += [
+ 'plugins/solidigm/solidigm-util.c',
'plugins/solidigm/solidigm-smart.c',
'plugins/solidigm/solidigm-garbage-collection.c',
'plugins/solidigm/solidigm-latency-tracking.c',
diff --git a/plugins/solidigm/solidigm-garbage-collection.c b/plugins/solidigm/solidigm-garbage-collection.c
index 8e2eccc..3828b9e 100644
--- a/plugins/solidigm/solidigm-garbage-collection.c
+++ b/plugins/solidigm/solidigm-garbage-collection.c
@@ -19,6 +19,7 @@
#include "linux/types.h"
#include "nvme-print.h"
#include "solidigm-garbage-collection.h"
+#include "solidigm-util.h"
typedef struct __attribute__((packed)) gc_item {
__le32 timer_type;
@@ -49,9 +50,11 @@ static void vu_gc_log_show_json(garbage_control_collection_log_t *payload, const
json_free_object(gc_entries);
}
-static void vu_gc_log_show(garbage_control_collection_log_t *payload, const char *devname)
+static void vu_gc_log_show(garbage_control_collection_log_t *payload, const char *devname,
+ __u8 uuid_index)
{
- printf("Solidigm Garbage Collection Log for NVME device: %s\n", devname);
+ printf("Solidigm Garbage Collection Log for NVME device:%s UUID-idx:%d\n", devname,
+ uuid_index);
printf("Timestamp Timer Type\n");
for (int i = 0; i < VU_GC_MAX_ITEMS; i++) {
@@ -65,6 +68,7 @@ int solidigm_get_garbage_collection_log(int argc, char **argv, struct command *c
const char *desc = "Get and parse Solidigm vendor specific garbage collection event log.";
struct nvme_dev *dev;
int err;
+ __u8 uuid_index;
struct config {
char *output_format;
@@ -90,18 +94,36 @@ int solidigm_get_garbage_collection_log(int argc, char **argv, struct command *c
return EINVAL;
}
+ uuid_index = solidigm_get_vu_uuid_index(dev);
+
garbage_control_collection_log_t gc_log;
const int solidigm_vu_gc_log_id = 0xfd;
+ struct nvme_get_log_args args = {
+ .lpo = 0,
+ .result = NULL,
+ .log = &gc_log,
+ .args_size = sizeof(args),
+ .fd = dev_fd(dev),
+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
+ .lid = solidigm_vu_gc_log_id,
+ .len = sizeof(gc_log),
+ .nsid = NVME_NSID_ALL,
+ .csi = NVME_CSI_NVM,
+ .lsi = NVME_LOG_LSI_NONE,
+ .lsp = NVME_LOG_LSP_NONE,
+ .uuidx = uuid_index,
+ .rae = false,
+ .ot = false,
+ };
- err = nvme_get_log_simple(dev_fd(dev), solidigm_vu_gc_log_id,
- sizeof(gc_log), &gc_log);
+ err = nvme_get_log(&args);
if (!err) {
if (flags & BINARY) {
d_raw((unsigned char *)&gc_log, sizeof(gc_log));
} else if (flags & JSON) {
vu_gc_log_show_json(&gc_log, dev->name);
} else {
- vu_gc_log_show(&gc_log, dev->name);
+ vu_gc_log_show(&gc_log, dev->name, uuid_index);
}
}
else if (err > 0) {
diff --git a/plugins/solidigm/solidigm-latency-tracking.c b/plugins/solidigm/solidigm-latency-tracking.c
index 1013ae8..40edcfa 100644
--- a/plugins/solidigm/solidigm-latency-tracking.c
+++ b/plugins/solidigm/solidigm-latency-tracking.c
@@ -17,6 +17,7 @@
#include "plugin.h"
#include "linux/types.h"
#include "nvme-print.h"
+#include "solidigm-util.h"
#define BUCKET_LIST_SIZE_4_0 152
#define BUCKET_LIST_SIZE_4_1 1216
@@ -42,6 +43,7 @@ struct config {
struct latency_tracker {
int fd;
+ __u8 uuid_index;
struct config cfg;
enum nvme_print_flags print_flags;
struct latency_statistics stats;
@@ -213,6 +215,7 @@ static void latency_tracker_pre_parse(struct latency_tracker *lt)
if (lt->print_flags == NORMAL) {
printf("Solidigm IO %s Command Latency Tracking Statistics type %d\n",
lt->cfg.write ? "Write" : "Read", lt->cfg.type);
+ printf("UUID-idx: %d\n", lt->uuid_index);
printf("Major Revision: %u\nMinor Revision: %u\n",
le16_to_cpu(lt->stats.version_major), le16_to_cpu(lt->stats.version_minor));
if (lt->has_average_latency_field) {
@@ -276,12 +279,12 @@ static int latency_tracking_is_enable(struct latency_tracker *lt, __u32 * enable
{
struct nvme_get_features_args args_get = {
.args_size = sizeof(args_get),
- .fd = lt->fd,
+ .fd = lt->fd,
+ .uuidx = lt->uuid_index,
.fid = LATENCY_TRACKING_FID,
.nsid = 0,
.sel = 0,
.cdw11 = 0,
- .uuidx = 0,
.data_len = LATENCY_TRACKING_FID_DATA_LEN,
.data = NULL,
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
@@ -307,12 +310,12 @@ static int latency_tracking_enable(struct latency_tracker *lt)
struct nvme_set_features_args args_set = {
.args_size = sizeof(args_set),
.fd = lt->fd,
+ .uuidx = lt->uuid_index,
.fid = LATENCY_TRACKING_FID,
.nsid = 0,
.cdw11 = lt->cfg.enable,
.cdw12 = 0,
.save = 0,
- .uuidx = 0,
.cdw15 = 0,
.data_len = LATENCY_TRACKING_FID_DATA_LEN,
.data = NULL,
@@ -328,8 +331,8 @@ static int latency_tracking_enable(struct latency_tracker *lt)
fprintf(stderr, "Command failed while parsing.\n");
} else {
if (lt->print_flags == NORMAL) {
- printf("Successfully set enable bit for FID (0x%X) to %i.\n",
- LATENCY_TRACKING_FID, lt->cfg.enable);
+ printf("Successfully set enable bit for UUID-idx:%d FID:0x%X, to %i.\n",
+ lt->uuid_index, LATENCY_TRACKING_FID, lt->cfg.enable);
}
}
return err;
@@ -356,6 +359,7 @@ static int latency_tracker_get_log(struct latency_tracker *lt)
.log = &lt->stats,
.args_size = sizeof(args),
.fd = lt->fd,
+ .uuidx = lt->uuid_index,
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = lt->cfg.write ? WRITE_LOG_ID : READ_LOG_ID,
.len = sizeof(lt->stats),
@@ -363,7 +367,6 @@ static int latency_tracker_get_log(struct latency_tracker *lt)
.csi = NVME_CSI_NVM,
.lsi = NVME_LOG_LSI_NONE,
.lsp = lt->cfg.type,
- .uuidx = NVME_UUID_NONE,
.rae = false,
.ot = false,
};
@@ -390,6 +393,7 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd
int err;
struct latency_tracker lt = {
+ .uuid_index = 0,
.cfg = {
.output_format = "normal",
},
@@ -433,6 +437,8 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd
return EINVAL;
}
+ lt.uuid_index = solidigm_get_vu_uuid_index(dev);
+
err = latency_tracking_enable(&lt);
if (err){
dev_close(dev);
@@ -462,8 +468,8 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd
putchar(enabled);
} else {
printf(
- "Latency Statistics Tracking (FID 0x%X) is currently (%i).\n",
- LATENCY_TRACKING_FID, enabled);
+ "Latency Statistics Tracking (UUID-idx:%d, FID:0x%X) is currently %i.\n",
+ lt.uuid_index, LATENCY_TRACKING_FID, enabled);
}
} else {
fprintf(stderr, "Could not read feature id 0xE2.\n");
diff --git a/plugins/solidigm/solidigm-nvme.c b/plugins/solidigm/solidigm-nvme.c
index b547035..0e42bd6 100644
--- a/plugins/solidigm/solidigm-nvme.c
+++ b/plugins/solidigm/solidigm-nvme.c
@@ -14,7 +14,9 @@
#include "solidigm-garbage-collection.h"
#include "solidigm-latency-tracking.h"
#include "solidigm-telemetry.h"
+
#include "plugins/ocp/ocp-clear-fw-update-history.h"
+#include "plugins/ocp/ocp-smart-extended-log.h"
static int get_additional_smart_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)
{
@@ -37,7 +39,13 @@ static int get_telemetry_log(int argc, char **argv, struct command *cmd, struct
}
static int clear_fw_update_history(int argc, char **argv, struct command *cmd,
- struct plugin *plugin)
+ struct plugin *plugin)
{
return ocp_clear_fw_update_history(argc, argv, cmd, plugin);
}
+
+static int smart_cloud(int argc, char **argv, struct command *cmd,
+ struct plugin *plugin)
+{
+ return ocp_smart_add_log(argc, argv, cmd, plugin);
+}
diff --git a/plugins/solidigm/solidigm-nvme.h b/plugins/solidigm/solidigm-nvme.h
index 778dbf9..1fdc6a6 100644
--- a/plugins/solidigm/solidigm-nvme.h
+++ b/plugins/solidigm/solidigm-nvme.h
@@ -13,11 +13,12 @@
#include "cmd.h"
-#define SOLIDIGM_PLUGIN_VERSION "0.7"
+#define SOLIDIGM_PLUGIN_VERSION "0.8"
PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_VERSION),
COMMAND_LIST(
ENTRY("smart-log-add", "Retrieve Solidigm SMART Log", get_additional_smart_log)
+ ENTRY("vs-smart-add-log", "Get SMART / health extended log (redirects to ocp plug-in)", smart_cloud)
ENTRY("garbage-collect-log", "Retrieve Garbage Collection Log", get_garbage_collection_log)
ENTRY("latency-tracking-log", "Enable/Retrieve Latency tracking Log", get_latency_tracking_log)
ENTRY("parse-telemetry-log", "Parse Telemetry Log binary", get_telemetry_log)
diff --git a/plugins/solidigm/solidigm-smart.c b/plugins/solidigm/solidigm-smart.c
index 77c26ac..568d3ab 100644
--- a/plugins/solidigm/solidigm-smart.c
+++ b/plugins/solidigm/solidigm-smart.c
@@ -19,6 +19,7 @@
#include "nvme-print.h"
#include "solidigm-smart.h"
+#include "solidigm-util.h"
struct __attribute__((packed)) nvme_additional_smart_log_item {
__u8 id;
@@ -179,12 +180,13 @@ static void vu_smart_log_show_json(vu_smart_log_t *payload, unsigned int nsid, c
json_free_object(root);
}
-static void vu_smart_log_show(vu_smart_log_t *payload, unsigned int nsid, const char *devname)
+static void vu_smart_log_show(vu_smart_log_t *payload, unsigned int nsid, const char *devname,
+ __u8 uuid_index)
{
smart_log_item_t *item = payload->item;
- printf("Additional Smart Log for NVME device:%s namespace-id:%x\n",
- devname, nsid);
+ printf("Additional Smart Log for NVMe device:%s namespace-id:%x UUID-idx:%d\n",
+ devname, nsid, uuid_index);
printf("ID KEY Normalized Raw\n");
for (int i = 0; i < VU_SMART_MAX_ITEMS; i++) {
@@ -201,6 +203,7 @@ int solidigm_get_additional_smart_log(int argc, char **argv, struct command *cmd
enum nvme_print_flags flags;
struct nvme_dev *dev;
int err;
+ __u8 uuid_index;
struct config {
__u32 namespace_id;
@@ -229,8 +232,27 @@ int solidigm_get_additional_smart_log(int argc, char **argv, struct command *cmd
return flags;
}
- err = nvme_get_log_simple(dev_fd(dev), solidigm_vu_smart_log_id,
- sizeof(smart_log_payload), &smart_log_payload);
+ uuid_index = solidigm_get_vu_uuid_index(dev);
+
+ struct nvme_get_log_args args = {
+ .lpo = 0,
+ .result = NULL,
+ .log = &smart_log_payload,
+ .args_size = sizeof(args),
+ .fd = dev_fd(dev),
+ .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
+ .lid = solidigm_vu_smart_log_id,
+ .len = sizeof(smart_log_payload),
+ .nsid = NVME_NSID_ALL,
+ .csi = NVME_CSI_NVM,
+ .lsi = NVME_LOG_LSI_NONE,
+ .lsp = NVME_LOG_LSP_NONE,
+ .uuidx = uuid_index,
+ .rae = false,
+ .ot = false,
+ };
+
+ err = nvme_get_log(&args);
if (!err) {
if (flags & JSON) {
vu_smart_log_show_json(&smart_log_payload,
@@ -239,7 +261,7 @@ int solidigm_get_additional_smart_log(int argc, char **argv, struct command *cmd
d_raw((unsigned char *)&smart_log_payload, sizeof(smart_log_payload));
} else {
vu_smart_log_show(&smart_log_payload, cfg.namespace_id,
- dev->name);
+ dev->name, uuid_index);
}
} else if (err > 0) {
nvme_show_status(err);
diff --git a/plugins/solidigm/solidigm-telemetry.c b/plugins/solidigm/solidigm-telemetry.c
index 84a4e2a..9946991 100644
--- a/plugins/solidigm/solidigm-telemetry.c
+++ b/plugins/solidigm/solidigm-telemetry.c
@@ -121,7 +121,7 @@ int solidigm_get_telemetry_log(int argc, char **argv, struct command *cmd, struc
cfg.cfg_file, strerror(err));
goto close_fd;
}
- json_tokener * jstok = json_tokener_new();
+ struct json_tokener * jstok = json_tokener_new();
tl.configuration = json_tokener_parse_ex(jstok, conf_str, length);
if (jstok->err != json_tokener_success) {
diff --git a/plugins/solidigm/solidigm-telemetry/cod.c b/plugins/solidigm/solidigm-telemetry/cod.c
index be5685b..7accc53 100644
--- a/plugins/solidigm/solidigm-telemetry/cod.c
+++ b/plugins/solidigm/solidigm-telemetry/cod.c
@@ -110,9 +110,9 @@ void solidigm_telemetry_log_cod_parse(struct telemetry_log *tl)
UNKNOWN = 0xFF,
};
- json_object *telemetry_header = NULL;
- json_object *COD_offset = NULL;
- json_object *reason_id = NULL;
+ struct json_object *telemetry_header = NULL;
+ struct json_object *COD_offset = NULL;
+ struct json_object *reason_id = NULL;
if (!json_object_object_get_ex(tl->root, "telemetryHeader", &telemetry_header))
return;
@@ -144,7 +144,7 @@ void solidigm_telemetry_log_cod_parse(struct telemetry_log *tl)
return;
}
- json_object *cod = json_create_object();
+ struct json_object *cod = json_create_object();
json_object_object_add(tl->root, "cod", cod);
for (int i =0 ; i < data->header.EntryCount; i++) {
diff --git a/plugins/solidigm/solidigm-telemetry/config.c b/plugins/solidigm/solidigm-telemetry/config.c
index 781d786..5111703 100644
--- a/plugins/solidigm/solidigm-telemetry/config.c
+++ b/plugins/solidigm/solidigm-telemetry/config.c
@@ -11,15 +11,15 @@
// max 16 bit unsigned integer nummber 65535
#define MAX_16BIT_NUM_AS_STRING_SIZE 6
-static bool config_get_by_version(const json_object *obj, int version_major,
- int version_minor, json_object **value)
+static bool config_get_by_version(const struct json_object *obj, int version_major,
+ int version_minor, struct json_object **value)
{
char str_key[MAX_16BIT_NUM_AS_STRING_SIZE];
char str_subkey[MAX_16BIT_NUM_AS_STRING_SIZE];
snprintf(str_key, sizeof(str_key), "%d", version_major);
snprintf(str_subkey, sizeof(str_subkey), "%d", version_minor);
- json_object *major_obj = NULL;
+ struct json_object *major_obj = NULL;
if (!json_object_object_get_ex(obj, str_key, &major_obj))
return false;
@@ -28,11 +28,11 @@ static bool config_get_by_version(const json_object *obj, int version_major,
return value != NULL;
}
-bool solidigm_config_get_by_token_version(const json_object *obj, int token_id,
+bool solidigm_config_get_by_token_version(const struct json_object *obj, int token_id,
int version_major, int version_minor,
- json_object **value)
+ struct json_object **value)
{
- json_object *token_obj = NULL;
+ struct json_object *token_obj = NULL;
char str_key[MAX_16BIT_NUM_AS_STRING_SIZE];
snprintf(str_key, sizeof(str_key), "%d", token_id);
diff --git a/plugins/solidigm/solidigm-telemetry/config.h b/plugins/solidigm/solidigm-telemetry/config.h
index bea84fb..30e61ff 100644
--- a/plugins/solidigm/solidigm-telemetry/config.h
+++ b/plugins/solidigm/solidigm-telemetry/config.h
@@ -7,4 +7,7 @@
#include <stdbool.h>
#include "util/json.h"
-bool solidigm_config_get_by_token_version(const json_object *obj, int key, int subkey, int subsubkey, json_object **value);
+bool solidigm_config_get_by_token_version(const struct json_object *obj,
+ int key, int subkey,
+ int subsubkey,
+ struct json_object **value);
diff --git a/plugins/solidigm/solidigm-telemetry/data-area.c b/plugins/solidigm/solidigm-telemetry/data-area.c
index 7233e8f..2f18ea2 100644
--- a/plugins/solidigm/solidigm-telemetry/data-area.c
+++ b/plugins/solidigm/solidigm-telemetry/data-area.c
@@ -17,7 +17,7 @@
static bool telemetry_log_get_value(const struct telemetry_log *tl,
uint32_t offset_bit, uint32_t size_bit,
- bool is_signed, json_object **val_obj)
+ bool is_signed, struct json_object **val_obj)
{
uint32_t offset_bit_from_byte;
uint32_t additional_size_byte;
@@ -77,16 +77,16 @@ static bool telemetry_log_get_value(const struct telemetry_log *tl,
}
static int telemetry_log_structure_parse(const struct telemetry_log *tl,
- json_object *struct_def,
+ struct json_object *struct_def,
size_t parent_offset_bit,
- json_object *output,
- json_object *metadata)
+ struct json_object *output,
+ struct json_object *metadata)
{
- json_object *obj_arraySizeArray = NULL;
- json_object *obj = NULL;
- json_object *obj_memberList;
- json_object *major_dimension;
- json_object *sub_output;
+ struct json_object *obj_arraySizeArray = NULL;
+ struct json_object *obj = NULL;
+ struct json_object *obj_memberList;
+ struct json_object *major_dimension;
+ struct json_object *sub_output;
bool is_enumeration = false;
bool has_member_list;
const char *type = "";
@@ -155,7 +155,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
uint32_t array_size_dimension[array_rank];
for (size_t i = 0; i < array_rank; i++) {
- json_object *dimension = json_object_array_get_idx(obj_arraySizeArray, i);
+ struct json_object *dimension = json_object_array_get_idx(obj_arraySizeArray, i);
array_size_dimension[i] = json_object_get_uint64(dimension);
major_dimension = dimension;
@@ -163,7 +163,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
if (array_rank > 1) {
uint32_t linear_pos_per_index = array_size_dimension[0];
uint32_t prev_index_offset_bit = 0;
- json_object *dimension_output;
+ struct json_object *dimension_output;
for (int i = 1; i < (array_rank - 1); i++)
linear_pos_per_index *= array_size_dimension[i];
@@ -182,7 +182,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
json_object_array_del_idx(obj_arraySizeArray, array_rank - 1, 1);
for (int i = 0 ; i < array_size_dimension[0]; i++) {
- json_object *sub_array = json_create_array();
+ struct json_object *sub_array = json_create_array();
size_t offset;
offset = parent_offset_bit + prev_index_offset_bit;
@@ -213,7 +213,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
for (uint32_t j = 0; j < array_size_dimension[0]; j++) {
if (is_enumeration || !has_member_list) {
bool is_signed = !strncmp(type, SIGNED_INT_PREFIX, sizeof(SIGNED_INT_PREFIX)-1);
- json_object *val_obj;
+ struct json_object *val_obj;
size_t offset;
offset = parent_offset_bit + offset_bit + linear_array_pos_bit;
@@ -230,7 +230,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
json_free_object(val_obj);
}
} else {
- json_object *sub_sub_output = json_object_new_object();
+ struct json_object *sub_sub_output = json_create_object();
int num_members;
if (array_size_dimension[0] > 1)
@@ -240,7 +240,7 @@ static int telemetry_log_structure_parse(const struct telemetry_log *tl,
num_members = json_object_array_length(obj_memberList);
for (int k = 0; k < num_members; k++) {
- json_object *member = json_object_array_get_idx(obj_memberList, k);
+ struct json_object *member = json_object_array_get_idx(obj_memberList, k);
size_t offset;
offset = parent_offset_bit + offset_bit + linear_array_pos_bit;
@@ -322,8 +322,8 @@ struct telemetry_object_header {
static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
enum nvme_telemetry_da da,
- json_object *toc_array,
- json_object *tele_obj_array)
+ struct json_object *toc_array,
+ struct json_object *tele_obj_array)
{
const struct telemetry_object_header *header;
@@ -339,8 +339,8 @@ static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
payload = (char *) tl->log;
for (int i = 0; i < toc->header.TableOfContentsCount; i++) {
- json_object *structure_definition = NULL;
- json_object *toc_item;
+ struct json_object *structure_definition = NULL;
+ struct json_object *toc_item;
uint32_t obj_offset;
bool has_struct;
@@ -379,15 +379,15 @@ static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
&structure_definition);
if (has_struct) {
- json_object *tele_obj_item = json_create_object();
+ struct json_object *tele_obj_item = json_create_object();
json_object_array_add(tele_obj_array, tele_obj_item);
json_object_get(toc_item);
json_object_add_value_object(tele_obj_item, "metadata", toc_item);
- json_object *parsed_struct = json_object_new_object();
+ struct json_object *parsed_struct = json_create_object();
json_object_add_value_object(tele_obj_item, "objectData", parsed_struct);
- json_object *obj_hasTelemObjHdr = NULL;
+ struct json_object *obj_hasTelemObjHdr = NULL;
uint32_t header_offset = sizeof(const struct telemetry_object_header);
uint32_t file_offset;
@@ -411,8 +411,8 @@ static void telemetry_log_data_area_toc_parse(const struct telemetry_log *tl,
int solidigm_telemetry_log_data_areas_parse(const struct telemetry_log *tl,
enum nvme_telemetry_da last_da)
{
- json_object *tele_obj_array = json_create_array();
- json_object *toc_array = json_create_array();
+ struct json_object *tele_obj_array = json_create_array();
+ struct json_object *toc_array = json_create_array();
json_object_add_value_array(tl->root, "tableOfContents", toc_array);
json_object_add_value_array(tl->root, "telemetryObjects", tele_obj_array);
diff --git a/plugins/solidigm/solidigm-telemetry/header.c b/plugins/solidigm/solidigm-telemetry/header.c
index 72b2d97..d085c24 100644
--- a/plugins/solidigm/solidigm-telemetry/header.c
+++ b/plugins/solidigm/solidigm-telemetry/header.c
@@ -63,10 +63,10 @@ static_assert(sizeof(const struct reason_indentifier_1_2) ==
#pragma pack(pop, reason_indentifier)
static void telemetry_log_reason_id_parse1_0_ext(const struct telemetry_log *tl,
- json_object *reason_id)
+ struct json_object *reason_id)
{
const struct reason_indentifier_1_0 *ri;
- json_object *reserved;
+ struct json_object *reserved;
ri = (struct reason_indentifier_1_0 *) tl->log->rsnident;
json_object_object_add(reason_id, "FirmwareVersion", json_object_new_string_len(ri->FirmwareVersion, sizeof(ri->FirmwareVersion)));
@@ -76,16 +76,16 @@ static void telemetry_log_reason_id_parse1_0_ext(const struct telemetry_log *tl,
reserved = json_create_array();
json_object_add_value_array(reason_id, "Reserved", reserved);
for ( int i=0; i < sizeof(ri->Reserved); i++) {
- json_object *val = json_object_new_int(ri->Reserved[i]);
+ struct json_object *val = json_object_new_int(ri->Reserved[i]);
json_object_array_add(reserved, val);
}
}
static void telemetry_log_reason_id_parse1_1_ext(const struct telemetry_log *tl,
- json_object *reason_id)
+ struct json_object *reason_id)
{
const struct reason_indentifier_1_1 *ri;
- json_object *reserved;
+ struct json_object *reserved;
ri = (struct reason_indentifier_1_1 *) tl->log->rsnident;
json_object_object_add(reason_id, "FirmwareVersion", json_object_new_string_len(ri->FirmwareVersion, sizeof(ri->FirmwareVersion)));
@@ -98,17 +98,17 @@ static void telemetry_log_reason_id_parse1_1_ext(const struct telemetry_log *tl,
reserved = json_create_array();
json_object_add_value_array(reason_id, "Reserved", reserved);
for (int i = 0; i < sizeof(ri->Reserved); i++) {
- json_object *val = json_object_new_int(ri->Reserved[i]);
+ struct json_object *val = json_object_new_int(ri->Reserved[i]);
json_object_array_add(reserved, val);
}
}
static void telemetry_log_reason_id_parse1_2_ext(const struct telemetry_log *tl,
- json_object *reason_id)
+ struct json_object *reason_id)
{
const struct reason_indentifier_1_2 *ri;
- json_object *dp_reserved;
- json_object *reserved;
+ struct json_object *dp_reserved;
+ struct json_object *reserved;
ri = (struct reason_indentifier_1_2 *) tl->log->rsnident;
@@ -121,19 +121,19 @@ static void telemetry_log_reason_id_parse1_2_ext(const struct telemetry_log *tl,
reserved = json_create_array();
json_object_add_value_array(reason_id, "Reserved2", reserved);
for (int i = 0; i < sizeof(ri->Reserved2); i++) {
- json_object *val = json_object_new_int(ri->Reserved2[i]);
+ struct json_object *val = json_object_new_int(ri->Reserved2[i]);
json_object_array_add(reserved, val);
}
dp_reserved = json_create_array();
json_object_add_value_array(reason_id, "DualPortReserved", dp_reserved);
for (int i = 0; i < sizeof(ri->DualPortReserved); i++) {
- json_object *val = json_object_new_int(ri->DualPortReserved[i]);
+ struct json_object *val = json_object_new_int(ri->DualPortReserved[i]);
json_object_array_add(dp_reserved, val);
}
}
-static void solidigm_telemetry_log_reason_id_parse(const struct telemetry_log *tl, json_object *reason_id)
+static void solidigm_telemetry_log_reason_id_parse(const struct telemetry_log *tl, struct json_object *reason_id)
{
const struct reason_indentifier_1_0 *ri1_0 =
(struct reason_indentifier_1_0 *) tl->log->rsnident;
@@ -161,9 +161,9 @@ static void solidigm_telemetry_log_reason_id_parse(const struct telemetry_log *t
bool solidigm_telemetry_log_header_parse(const struct telemetry_log *tl)
{
const struct nvme_telemetry_log *log;
- json_object *ieee_oui_id;
- json_object *reason_id;
- json_object *header;
+ struct json_object *ieee_oui_id;
+ struct json_object *reason_id;
+ struct json_object *header;
if (tl->log_size < sizeof(const struct nvme_telemetry_log)) {
SOLIDIGM_LOG_WARNING("Telemetry log too short.");
@@ -180,7 +180,7 @@ bool solidigm_telemetry_log_header_parse(const struct telemetry_log *tl)
json_object_object_add(header, "ieeeOuiIdentifier", ieee_oui_id);
for (int i = 0; i < sizeof(log->ieee); i++) {
- json_object *val = json_object_new_int(log->ieee[i]);
+ struct json_object *val = json_object_new_int(log->ieee[i]);
json_object_array_add(ieee_oui_id, val);
}
diff --git a/plugins/solidigm/solidigm-telemetry/telemetry-log.h b/plugins/solidigm/solidigm-telemetry/telemetry-log.h
index ef4ec5d..e9eff73 100644
--- a/plugins/solidigm/solidigm-telemetry/telemetry-log.h
+++ b/plugins/solidigm/solidigm-telemetry/telemetry-log.h
@@ -24,8 +24,8 @@
struct telemetry_log {
struct nvme_telemetry_log *log;
size_t log_size;
- json_object *root;
- json_object *configuration;
+ struct json_object *root;
+ struct json_object *configuration;
};
-#endif /* _SOLIDIGM_TELEMETRY_LOG_H */ \ No newline at end of file
+#endif /* _SOLIDIGM_TELEMETRY_LOG_H */
diff --git a/plugins/solidigm/solidigm-util.c b/plugins/solidigm/solidigm-util.c
new file mode 100644
index 0000000..0171a49
--- /dev/null
+++ b/plugins/solidigm/solidigm-util.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023 Solidigm.
+ *
+ * Author: leonardo.da.cunha@solidigm.com
+ */
+
+#include "plugins/ocp/ocp-utils.h"
+#include "solidigm-util.h"
+
+__u8 solidigm_get_vu_uuid_index(struct nvme_dev *dev)
+{
+ int ocp_uuid_index = 0;
+
+ if (ocp_get_uuid_index(dev, &ocp_uuid_index) == 0)
+ if (ocp_uuid_index == 2)
+ return 1;
+
+ return 0;
+}
diff --git a/plugins/solidigm/solidigm-util.h b/plugins/solidigm/solidigm-util.h
new file mode 100644
index 0000000..3a18501
--- /dev/null
+++ b/plugins/solidigm/solidigm-util.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2023 Solidigm.
+ *
+ * Author: leonardo.da.cunha@solidigm.com
+ */
+
+#include "nvme.h"
+
+__u8 solidigm_get_vu_uuid_index(struct nvme_dev *dev);