]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
wdc: Add support for the get-drive-status command to SN861
authorjeff-lien-wdc <jeff.lien@wdc.com>
Fri, 1 Mar 2024 22:01:40 +0000 (16:01 -0600)
committerDaniel Wagner <wagi@monom.org>
Tue, 5 Mar 2024 08:59:31 +0000 (09:59 +0100)
This change will use UUID lists to access the WD C2 log
page and retrieve the correct info needed to display the
drive status.

Signed-off-by: jeff-lien-wdc <jeff.lien@wdc.com>
plugins/wdc/wdc-nvme.c
plugins/wdc/wdc-nvme.h
plugins/wdc/wdc-utils.c

index 8cbcf2eab0a31cfbcecf298e45bafdc804a0dc3f..f90ecce65ad5f5c350b9a72d7f0d77bbbf88a3b3 100644 (file)
@@ -1921,6 +1921,7 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
                                WDC_DRIVE_CAP_INFO |
                                WDC_DRIVE_CAP_CLOUD_SSD_VERSION |
                                WDC_DRIVE_CAP_LOG_PAGE_DIR |
+                               WDC_DRIVE_CAP_DRIVE_STATUS |
                                WDC_DRIVE_CAP_SET_LATENCY_MONITOR);
                        break;
 
@@ -2450,23 +2451,32 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev,
                        uuid_index = index + 1;
        }
 
-       if (!uuid_index && needs_c2_log_page_check(device_id)) {
-               /* In certain devices that don't support UUID lists, there are multiple
-                * definitions of the C2 logpage. In those cases, the code
-                * needs to try two UUID indexes and use an identification algorithm
-                * to determine which is returning the correct log page data.
-                */
-               uuid_ix = 1;
-       }
+       if (uuid_present) {
+               /* use the uuid index found above */
+               found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_index);
+       } else if (device_id == WDC_NVME_ZN350_DEV_ID || device_id == WDC_NVME_ZN350_DEV_ID_1) {
+               uuid_index = 0;
+               found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_index);
+       } else {
+               if (!uuid_index && needs_c2_log_page_check(device_id)) {
+                       /* In certain devices that don't support UUID lists, there are multiple
+                        * definitions of the C2 logpage. In those cases, the code
+                        * needs to try two UUID indexes and use an identification algorithm
+                        * to determine which is returning the correct log page data.
+                        */
+                       uuid_ix = 1;
+               }
 
-       found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
+               found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
 
-       if (!found) {
-               /* not found with uuid = 1 try with uuid = 0 */
-               uuid_ix = 0;
-               fprintf(stderr, "Not found, requesting log page with uuid_index %d\n", uuid_index);
+               if (!found) {
+                       /* not found with uuid = 1 try with uuid = 0 */
+                       uuid_ix = 0;
+                       fprintf(stderr, "Not found, requesting log page with uuid_index %d\n",
+                                       uuid_index);
 
-               found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
+                       found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
+               }
        }
 
        return found;
index d3692bcc58e497171a13898ea1062aef2aa50656..d1f87406bd2303b7ff9da90b54470cb5e02857b3 100644 (file)
@@ -5,7 +5,7 @@
 #if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
 #define WDC_NVME
 
-#define WDC_PLUGIN_VERSION   "2.7.0"
+#define WDC_PLUGIN_VERSION   "2.8.0"
 #include "cmd.h"
 
 PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION),
index 414a06a64f78b0827f40250aae775214294710d9..1b52e7c04acdbcb3819a261e9d6b83bd58d79fa0 100644 (file)
@@ -192,5 +192,5 @@ bool wdc_CheckUuidListSupport(struct nvme_dev *dev, struct nvme_id_uuid_list *uu
 
 bool wdc_UuidEqual(struct nvme_id_uuid_list_entry *entry1, struct nvme_id_uuid_list_entry *entry2)
 {
-       return !memcmp(entry1, entry2, NVME_UUID_LEN);
+       return !memcmp(entry1->uuid, entry2->uuid, NVME_UUID_LEN);
 }