Skip to content

Commit

Permalink
wdc: Fix for Reading WDC C2 Vendor Unique Log Page
Browse files Browse the repository at this point in the history
In cases where nvme drives are connected via a PCIe
swtich, the pci vendor and device id are unable to
be read.  This causes a failure when reading values
in the WDC C2 log page needed for the get-drive-status
wdc plugin command.

Signed-off-by: jeff-lien-wdc <[email protected]>
  • Loading branch information
jeff-lien-wdc committed Oct 7, 2024
1 parent b4628c3 commit 91b41d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
24 changes: 10 additions & 14 deletions plugins/wdc/wdc-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2364,28 +2364,24 @@ static bool get_dev_mgmt_log_page_lid_data(struct nvme_dev *dev,
static bool get_dev_mgment_cbs_data(nvme_root_t r, struct nvme_dev *dev,
__u8 log_id, void **cbs_data)
{
int ret = -1;
bool found = false;
__u8 uuid_ix = 0;
__u8 lid = 0;
*cbs_data = NULL;
__u32 device_id, read_vendor_id;
__u32 device_id = 0, vendor_id = 0;
bool uuid_present = false;
int index = 0, uuid_index = 0;
struct nvme_id_uuid_list uuid_list;

ret = wdc_get_pci_ids(r, dev, &device_id, &read_vendor_id);
if (ret == 0) {
if (device_id == WDC_NVME_ZN350_DEV_ID || device_id == WDC_NVME_ZN350_DEV_ID_1) {
lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID_C8;
uuid_ix = 0;
} else {
lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID;
}
} else {
fprintf(stderr, "ERROR: WDC: get pci ids: %d\n", ret);
return false;
}
/* The wdc_get_pci_ids function could fail when drives are connected
* via a PCIe switch. Therefore, the return code is intentionally
* being ignored. The device_id and vendor_id variables have been
* initialized to 0 so the code can continue on without issue for
* both cases: wdc_get_pci_ids successful or failed.
*/
wdc_get_pci_ids(r, dev, &device_id, &vendor_id);

lid = WDC_NVME_GET_DEV_MGMNT_LOG_PAGE_ID;

typedef struct nvme_id_uuid_list_entry *uuid_list_entry;

Expand Down
2 changes: 1 addition & 1 deletion plugins/wdc/wdc-nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#if !defined(WDC_NVME) || defined(CMD_HEADER_MULTI_READ)
#define WDC_NVME

#define WDC_PLUGIN_VERSION "2.11.0"
#define WDC_PLUGIN_VERSION "2.11.1"
#include "cmd.h"

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

0 comments on commit 91b41d1

Please sign in to comment.