]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugins/solidigm: Additional LID for temperature statistics.
authorLeonardo da Cunha <leonardo.da.cunha@solidigm.com>
Thu, 18 Apr 2024 20:33:01 +0000 (13:33 -0700)
committerDaniel Wagner <wagi@monom.org>
Tue, 30 Apr 2024 09:23:07 +0000 (11:23 +0200)
Temperature statistics log moved to different LID on some products.

Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
plugins/solidigm/solidigm-log-page-dir.c
plugins/solidigm/solidigm-nvme.h
plugins/solidigm/solidigm-temp-stats.c

index 7e7c0b9a717982d5ebfba8eff22bab2ce948ecce..7d7c027f3eee47efd4edd201124abc61050b5c44 100644 (file)
@@ -97,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";
index bee8266bef12c0559fbd02ac872e8be1b279dc6a..a639fd28042ed53e2bcbebc2b442f501f7d1bb42 100644 (file)
@@ -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(
index 922014e5c3f770254e4d2cb9d97e13501896a952..7f385db96b805a0ccfe2b2d6a026c6142e73c723 100644 (file)
@@ -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;
 
@@ -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;
 }