summaryrefslogtreecommitdiffstats
path: root/plugins/solidigm
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/solidigm')
-rw-r--r--plugins/solidigm/solidigm-garbage-collection.c4
-rw-r--r--plugins/solidigm/solidigm-latency-tracking.c4
-rw-r--r--plugins/solidigm/solidigm-log-page-dir.c74
-rw-r--r--plugins/solidigm/solidigm-nvme.h2
-rw-r--r--plugins/solidigm/solidigm-smart.c4
-rw-r--r--plugins/solidigm/solidigm-temp-stats.c34
-rw-r--r--plugins/solidigm/solidigm-util.c33
-rw-r--r--plugins/solidigm/solidigm-util.h5
8 files changed, 78 insertions, 82 deletions
diff --git a/plugins/solidigm/solidigm-garbage-collection.c b/plugins/solidigm/solidigm-garbage-collection.c
index a37e9c5..002b187 100644
--- a/plugins/solidigm/solidigm-garbage-collection.c
+++ b/plugins/solidigm/solidigm-garbage-collection.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2022 Solidigm.
+ * Copyright (c) 2022-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
@@ -97,7 +97,7 @@ int solidigm_get_garbage_collection_log(int argc, char **argv, struct command *c
return -EINVAL;
}
- uuid_index = solidigm_get_vu_uuid_index(dev);
+ sldgm_get_uuid_index(dev, &uuid_index);
struct garbage_control_collection_log gc_log;
const int solidigm_vu_gc_log_id = 0xfd;
diff --git a/plugins/solidigm/solidigm-latency-tracking.c b/plugins/solidigm/solidigm-latency-tracking.c
index 66f3c56..c6c3315 100644
--- a/plugins/solidigm/solidigm-latency-tracking.c
+++ b/plugins/solidigm/solidigm-latency-tracking.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2022 Solidigm.
+ * Copyright (c) 2022-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
@@ -430,7 +430,7 @@ int solidigm_get_latency_tracking_log(int argc, char **argv, struct command *cmd
return -EINVAL;
}
- lt.uuid_index = solidigm_get_vu_uuid_index(dev);
+ sldgm_get_uuid_index(dev, &lt.uuid_index);
err = latency_tracking_enable(&lt);
if (err) {
diff --git a/plugins/solidigm/solidigm-log-page-dir.c b/plugins/solidigm/solidigm-log-page-dir.c
index bf272f8..7d7c027 100644
--- a/plugins/solidigm/solidigm-log-page-dir.c
+++ b/plugins/solidigm/solidigm-log-page-dir.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2023 Solidigm.
+ * Copyright (c) 2023-2024 Solidigm.
*
* Author: karl.dedow@solidigm.com
*/
@@ -15,6 +15,7 @@
#include "nvme-print.h"
#include "plugins/ocp/ocp-utils.h"
+#include "solidigm-util.h"
#define MIN_VENDOR_LID 0xC0
#define SOLIDIGM_MAX_UUID 2
@@ -38,41 +39,9 @@ static void init_lid_dir(struct lid_dir *lid_dir)
}
}
-static bool is_invalid_uuid(const struct nvme_id_uuid_list_entry entry)
-{
- static const unsigned char ALL_ZERO_UUID[NVME_UUID_LEN] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- return memcmp(ALL_ZERO_UUID, entry.uuid, NVME_UUID_LEN) == 0;
-}
-
-static bool is_solidigm_uuid(const struct nvme_id_uuid_list_entry entry)
-{
- static const unsigned char SOLIDIGM_UUID[NVME_UUID_LEN] = {
- 0x96, 0x19, 0x58, 0x6e, 0xc1, 0x1b, 0x43, 0xad,
- 0xaa, 0xaa, 0x65, 0x41, 0x87, 0xf6, 0xbb, 0xb2
- };
-
- return memcmp(SOLIDIGM_UUID, entry.uuid, NVME_UUID_LEN) == 0;
-}
-
-static bool is_ocp_uuid(const struct nvme_id_uuid_list_entry entry)
-{
- static const unsigned char OCP_UUID[NVME_UUID_LEN] = {
- 0xc1, 0x94, 0xd5, 0x5b, 0xe0, 0x94, 0x47, 0x94,
- 0xa2, 0x1d, 0x29, 0x99, 0x8f, 0x56, 0xbe, 0x6f
- };
-
- return memcmp(OCP_UUID, entry.uuid, NVME_UUID_LEN) == 0;
-}
-
static int get_supported_log_pages_log(struct nvme_dev *dev, int uuid_index,
struct nvme_supported_log_pages *supported)
{
- static const __u8 LID;
-
memset(supported, 0, sizeof(*supported));
struct nvme_get_log_args args = {
.lpo = 0,
@@ -81,7 +50,7 @@ static int get_supported_log_pages_log(struct nvme_dev *dev, int uuid_index,
.args_size = sizeof(args),
.fd = dev_fd(dev),
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
- .lid = LID,
+ .lid = NVME_LOG_LID_SUPPORTED_LOG_PAGES,
.len = sizeof(*supported),
.nsid = NVME_NSID_ALL,
.csi = NVME_CSI_NVM,
@@ -101,8 +70,8 @@ static struct lid_dir *get_standard_lids(struct nvme_supported_log_pages *suppor
init_lid_dir(&standard_dir);
- for (int lid = 0; lid < NVME_LOG_SUPPORTED_LOG_PAGES_MAX; lid++) {
- if (!supported->lid_support[lid] || lid >= MIN_VENDOR_LID)
+ for (int lid = 0; lid < MIN_VENDOR_LID; lid++) {
+ if (!supported->lid_support[lid])
continue;
standard_dir.lid[lid].supported = true;
@@ -128,12 +97,15 @@ static struct lid_dir *get_solidigm_lids(struct nvme_supported_log_pages *suppor
static struct lid_dir solidigm_dir = { 0 };
init_lid_dir(&solidigm_dir);
+ solidigm_dir.lid[0xC0].str = "OCP SMART / Health Information Extended";
solidigm_dir.lid[0xC1].str = "Read Commands Latency Statistics";
solidigm_dir.lid[0xC2].str = "Write Commands Latency Statistics";
+ solidigm_dir.lid[0xC3].str = "OCP Latency Monitor";
solidigm_dir.lid[0xC4].str = "Endurance Manager Statistics";
solidigm_dir.lid[0xC5].str = "Temperature Statistics";
solidigm_dir.lid[0xCA].str = "SMART Attributes";
solidigm_dir.lid[0xCB].str = "VU NVMe IO Queue Metrics Log Page";
+ solidigm_dir.lid[0xD5].str = solidigm_dir.lid[0xC5].str;
solidigm_dir.lid[0xDD].str = "VU Marketing Description Log Page";
solidigm_dir.lid[0xEF].str = "Performance Rating and LBA Access Histogram";
solidigm_dir.lid[0xF2].str = "Get Power Usage Log Page";
@@ -222,7 +194,7 @@ int solidigm_get_log_page_directory_log(int argc, char **argv, struct command *c
OPT_END()
};
- struct nvme_dev *dev = NULL;
+ _cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
int err = parse_and_open(&dev, argc, argv, description, options);
if (err)
@@ -247,16 +219,21 @@ int solidigm_get_log_page_directory_log(int argc, char **argv, struct command *c
lid_dirs[NO_UUID_INDEX]->lid[lid] = solidigm_lid_dir->lid[lid];
}
} else {
- for (int uuid_index = 1; uuid_index <= SOLIDIGM_MAX_UUID; uuid_index++) {
- if (is_invalid_uuid(uuid_list.entry[uuid_index - 1]))
- break;
- else if (get_supported_log_pages_log(dev, uuid_index, &supported))
- continue;
-
- if (is_solidigm_uuid(uuid_list.entry[uuid_index - 1]))
- lid_dirs[uuid_index] = get_solidigm_lids(&supported);
- else if (is_ocp_uuid(uuid_list.entry[uuid_index - 1]))
- lid_dirs[uuid_index] = get_ocp_lids(&supported);
+ __u8 sldgm_idx;
+ __u8 ocp_idx;
+
+ sldgm_find_uuid_index(&uuid_list, &sldgm_idx);
+ ocp_find_uuid_index(&uuid_list, &ocp_idx);
+
+ if (sldgm_idx && (sldgm_idx <= SOLIDIGM_MAX_UUID)) {
+ err = get_supported_log_pages_log(dev, sldgm_idx, &supported);
+ if (!err)
+ lid_dirs[sldgm_idx] = get_solidigm_lids(&supported);
+ }
+ if (ocp_idx && (ocp_idx <= SOLIDIGM_MAX_UUID)) {
+ err = get_supported_log_pages_log(dev, ocp_idx, &supported);
+ if (!err)
+ lid_dirs[ocp_idx] = get_ocp_lids(&supported);
}
}
} else {
@@ -279,8 +256,5 @@ int solidigm_get_log_page_directory_log(int argc, char **argv, struct command *c
}
}
- /* Redundant close() to make static code analysis happy */
- close(dev->direct.fd);
- dev_close(dev);
return err;
}
diff --git a/plugins/solidigm/solidigm-nvme.h b/plugins/solidigm/solidigm-nvme.h
index bee8266..a639fd2 100644
--- a/plugins/solidigm/solidigm-nvme.h
+++ b/plugins/solidigm/solidigm-nvme.h
@@ -13,7 +13,7 @@
#include "cmd.h"
-#define SOLIDIGM_PLUGIN_VERSION "1.1"
+#define SOLIDIGM_PLUGIN_VERSION "1.2"
PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_VERSION),
COMMAND_LIST(
diff --git a/plugins/solidigm/solidigm-smart.c b/plugins/solidigm/solidigm-smart.c
index 62245fa..a97abe2 100644
--- a/plugins/solidigm/solidigm-smart.c
+++ b/plugins/solidigm/solidigm-smart.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2022 Solidigm.
+ * Copyright (c) 2022-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
@@ -229,7 +229,7 @@ int solidigm_get_additional_smart_log(int argc, char **argv, struct command *cmd
return err;
}
- uuid_index = solidigm_get_vu_uuid_index(dev);
+ sldgm_get_uuid_index(dev, &uuid_index);
struct nvme_get_log_args args = {
.lpo = 0,
diff --git a/plugins/solidigm/solidigm-temp-stats.c b/plugins/solidigm/solidigm-temp-stats.c
index 85a3c37..7f385db 100644
--- a/plugins/solidigm/solidigm-temp-stats.c
+++ b/plugins/solidigm/solidigm-temp-stats.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2023 Solidigm.
+ * Copyright (c) 2023-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
@@ -11,7 +11,8 @@
#include "nvme-print.h"
#include "solidigm-util.h"
-#define SLDGM_TEMP_STATS_LID 0xC5
+#define SLDGM_LEGACY_TEMP_STATS_LID 0xC5
+#define SLDGM_TEMP_STATS_LID 0xD5
struct temp_stats {
__le64 curr;
@@ -40,7 +41,7 @@ static void show_temp_stats(struct temp_stats *stats)
int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct plugin *plugin)
{
unsigned char buffer[4096] = {0};
- struct nvme_dev *dev;
+ _cleanup_nvme_dev_ struct nvme_dev *dev = NULL;
__u8 uuid_idx;
int err;
@@ -63,7 +64,7 @@ int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct
if (err)
return err;
- uuid_idx = solidigm_get_vu_uuid_index(dev);
+ sldgm_get_uuid_index(dev, &uuid_idx);
struct nvme_get_log_args args = {
.lpo = 0,
@@ -84,25 +85,26 @@ int sldgm_get_temp_stats_log(int argc, char **argv, struct command *cmd, struct
};
err = nvme_get_log(&args);
- if (!err) {
- uint64_t *guid = (uint64_t *)&buffer[4080];
+ if (err > 0) {
+ args.lid = SLDGM_LEGACY_TEMP_STATS_LID;
+ err = nvme_get_log(&args);
+ if (!err) {
+ uint64_t *guid = (uint64_t *)&buffer[4080];
- if (guid[1] == 0xC7BB98B7D0324863 && guid[0] == 0xBB2C23990E9C722F) {
- fprintf(stderr, "Error: Log page has 'OCP unsupported Requirements' GUID\n");
- err = -EBADMSG;
- goto closefd;
+ if (guid[1] == 0xC7BB98B7D0324863 && guid[0] == 0xBB2C23990E9C722F) {
+ fprintf(stderr,
+ "Error: Log page has OCP unsupported Requirements GUID\n");
+ return -EBADMSG;
+ }
}
+ }
+ if (!err) {
if (!cfg.raw_binary)
show_temp_stats((struct temp_stats *) buffer);
else
d_raw(buffer, sizeof(struct temp_stats));
- } else if (err > 0) {
+ } else if (err > 0)
nvme_show_status(err);
- }
-closefd:
- /* Redundant close() to make static code analysis happy */
- close(dev->direct.fd);
- dev_close(dev);
return err;
}
diff --git a/plugins/solidigm/solidigm-util.c b/plugins/solidigm/solidigm-util.c
index 0171a49..05d1537 100644
--- a/plugins/solidigm/solidigm-util.c
+++ b/plugins/solidigm/solidigm-util.c
@@ -1,20 +1,39 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
- * Copyright (c) 2023 Solidigm.
+ * Copyright (c) 2023-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
-#include "plugins/ocp/ocp-utils.h"
+#include <errno.h>
#include "solidigm-util.h"
-__u8 solidigm_get_vu_uuid_index(struct nvme_dev *dev)
+const unsigned char solidigm_uuid[NVME_UUID_LEN] = {
+ 0x96, 0x19, 0x58, 0x6e, 0xc1, 0x1b, 0x43, 0xad,
+ 0xaa, 0xaa, 0x65, 0x41, 0x87, 0xf6, 0xbb, 0xb2
+};
+
+int sldgm_find_uuid_index(struct nvme_id_uuid_list *uuid_list, __u8 *index)
{
- int ocp_uuid_index = 0;
+ int i = nvme_uuid_find(uuid_list, solidigm_uuid);
- if (ocp_get_uuid_index(dev, &ocp_uuid_index) == 0)
- if (ocp_uuid_index == 2)
- return 1;
+ *index = 0;
+ if (i > 0)
+ *index = i;
+ else
+ return -errno;
return 0;
}
+
+int sldgm_get_uuid_index(struct nvme_dev *dev, __u8 *index)
+{
+ struct nvme_id_uuid_list uuid_list;
+ int err = nvme_identify_uuid(dev_fd(dev), &uuid_list);
+
+ *index = 0;
+ if (err)
+ return err;
+
+ return sldgm_find_uuid_index(&uuid_list, index);
+}
diff --git a/plugins/solidigm/solidigm-util.h b/plugins/solidigm/solidigm-util.h
index fa5032f..ed7bf0f 100644
--- a/plugins/solidigm/solidigm-util.h
+++ b/plugins/solidigm/solidigm-util.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
- * Copyright (c) 2023 Solidigm.
+ * Copyright (c) 2023-2024 Solidigm.
*
* Author: leonardo.da.cunha@solidigm.com
*/
@@ -9,4 +9,5 @@
#define DRIVER_MAX_TX_256K (256 * 1024)
-__u8 solidigm_get_vu_uuid_index(struct nvme_dev *dev);
+int sldgm_find_uuid_index(struct nvme_id_uuid_list *uuid_list, __u8 *index);
+int sldgm_get_uuid_index(struct nvme_dev *dev, __u8 *index);