Skip to content

Commit cd4c95a

Browse files
jeff-lien-sndkigaw
authored andcommitted
wdc: Add support for the get-drive-status command to SN861
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>
1 parent 450d897 commit cd4c95a

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

plugins/wdc/wdc-nvme.c

+24-14
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,7 @@ static __u64 wdc_get_drive_capabilities(nvme_root_t r, struct nvme_dev *dev)
19211921
WDC_DRIVE_CAP_INFO |
19221922
WDC_DRIVE_CAP_CLOUD_SSD_VERSION |
19231923
WDC_DRIVE_CAP_LOG_PAGE_DIR |
1924+
WDC_DRIVE_CAP_DRIVE_STATUS |
19241925
WDC_DRIVE_CAP_SET_LATENCY_MONITOR);
19251926
break;
19261927

@@ -2450,23 +2451,32 @@ static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev,
24502451
uuid_index = index + 1;
24512452
}
24522453

2453-
if (!uuid_index && needs_c2_log_page_check(device_id)) {
2454-
/* In certain devices that don't support UUID lists, there are multiple
2455-
* definitions of the C2 logpage. In those cases, the code
2456-
* needs to try two UUID indexes and use an identification algorithm
2457-
* to determine which is returning the correct log page data.
2458-
*/
2459-
uuid_ix = 1;
2460-
}
2454+
if (uuid_present) {
2455+
/* use the uuid index found above */
2456+
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_index);
2457+
} else if (device_id == WDC_NVME_ZN350_DEV_ID || device_id == WDC_NVME_ZN350_DEV_ID_1) {
2458+
uuid_index = 0;
2459+
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_index);
2460+
} else {
2461+
if (!uuid_index && needs_c2_log_page_check(device_id)) {
2462+
/* In certain devices that don't support UUID lists, there are multiple
2463+
* definitions of the C2 logpage. In those cases, the code
2464+
* needs to try two UUID indexes and use an identification algorithm
2465+
* to determine which is returning the correct log page data.
2466+
*/
2467+
uuid_ix = 1;
2468+
}
24612469

2462-
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
2470+
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
24632471

2464-
if (!found) {
2465-
/* not found with uuid = 1 try with uuid = 0 */
2466-
uuid_ix = 0;
2467-
fprintf(stderr, "Not found, requesting log page with uuid_index %d\n", uuid_index);
2472+
if (!found) {
2473+
/* not found with uuid = 1 try with uuid = 0 */
2474+
uuid_ix = 0;
2475+
fprintf(stderr, "Not found, requesting log page with uuid_index %d\n",
2476+
uuid_index);
24682477

2469-
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
2478+
found = get_dev_mgmt_log_page_lid_data(dev, cbs_data, lid, log_id, uuid_ix);
2479+
}
24702480
}
24712481

24722482
return found;

plugins/wdc/wdc-nvme.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
66
#define WDC_NVME
77

8-
#define WDC_PLUGIN_VERSION "2.7.0"
8+
#define WDC_PLUGIN_VERSION "2.8.0"
99
#include "cmd.h"
1010

1111
PLUGIN(NAME("wdc", "Western Digital vendor specific extensions", WDC_PLUGIN_VERSION),

plugins/wdc/wdc-utils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,5 @@ bool wdc_CheckUuidListSupport(struct nvme_dev *dev, struct nvme_id_uuid_list *uu
192192

193193
bool wdc_UuidEqual(struct nvme_id_uuid_list_entry *entry1, struct nvme_id_uuid_list_entry *entry2)
194194
{
195-
return !memcmp(entry1, entry2, NVME_UUID_LEN);
195+
return !memcmp(entry1->uuid, entry2->uuid, NVME_UUID_LEN);
196196
}

0 commit comments

Comments
 (0)