Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions plugins/sandisk/sandisk-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,27 @@
return ret;
}

static int sndk_get_default_telemetry_da(struct nvme_transport_handle *hdl,
int *data_area)
{
struct nvme_id_ctrl ctrl;
int err;

memset(&ctrl, 0, sizeof(struct nvme_id_ctrl));
err = nvme_identify_ctrl(hdl, &ctrl);
if (err) {
fprintf(stderr, "ERROR: SNDK: nvme_identify_ctrl() failed 0x%x\n", err);

Check failure on line 293 in plugins/sandisk/sandisk-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 88 exceeds 80 columns
return err;
}

if (ctrl.lpa & 0x40)
*data_area = 4;
else
*data_area = 3;

return 0;
}

static int sndk_vs_internal_fw_log(int argc, char **argv,
struct command *command,
struct plugin *plugin)
Expand Down Expand Up @@ -423,9 +444,11 @@
/* Supported through WDC plugin for non-telemetry */
if ((capabilities & SNDK_DRIVE_CAP_INTERNAL_LOG) &&
(telemetry_type != SNDK_TELEMETRY_TYPE_NONE)) {
/* Set the default DA to 3 if not specified */
if (!telemetry_data_area)
telemetry_data_area = 3;
if (sndk_get_default_telemetry_da(hdl, &telemetry_data_area)) {
fprintf(stderr, "%s: Error determining default telemetry data area\n",

Check failure on line 448 in plugins/sandisk/sandisk-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 94 exceeds 80 columns
__func__);
return -EINVAL;
}

ret = sndk_do_cap_telemetry_log(ctx, hdl, f, xfer_size,
telemetry_type, telemetry_data_area);
Expand All @@ -435,9 +458,11 @@
if (capabilities & SNDK_DRIVE_CAP_UDUI) {
if ((telemetry_type == SNDK_TELEMETRY_TYPE_HOST) ||
(telemetry_type == SNDK_TELEMETRY_TYPE_CONTROLLER)) {
/* Set the default DA to 3 if not specified */
if (!telemetry_data_area)
telemetry_data_area = 3;
if (sndk_get_default_telemetry_da(hdl, &telemetry_data_area)) {

Check failure on line 461 in plugins/sandisk/sandisk-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 87 exceeds 80 columns
fprintf(stderr, "%s: Error determining default telemetry data area\n",

Check failure on line 462 in plugins/sandisk/sandisk-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 102 exceeds 80 columns
__func__);
return -EINVAL;
}

ret = sndk_do_cap_telemetry_log(ctx, hdl, f, xfer_size,
telemetry_type, telemetry_data_area);
Expand Down
2 changes: 1 addition & 1 deletion plugins/sandisk/sandisk-nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#if !defined(SANDISK_NVME) || defined(CMD_HEADER_MULTI_READ)
#define SANDISK_NVME

#define SANDISK_PLUGIN_VERSION "3.0.8"
#define SANDISK_PLUGIN_VERSION "3.1.0"
#include "cmd.h"

PLUGIN(NAME("sndk", "Sandisk vendor specific extensions", SANDISK_PLUGIN_VERSION),
Expand Down
44 changes: 36 additions & 8 deletions plugins/wdc/wdc-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -4268,6 +4268,27 @@
return err;
}

static int wdc_get_default_telemetry_da(struct nvme_transport_handle *hdl,
int *data_area)
{
struct nvme_id_ctrl ctrl;
int err;

memset(&ctrl, 0, sizeof(struct nvme_id_ctrl));
err = nvme_identify_ctrl(hdl, &ctrl);
if (err) {
fprintf(stderr, "ERROR: WDC: nvme_identify_ctrl() failed 0x%x\n", err);

Check failure on line 4280 in plugins/wdc/wdc-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 87 exceeds 80 columns
return err;
}

if (ctrl.lpa & 0x40)
*data_area = 4;
else
*data_area = 3;

return 0;
}

static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *acmd,
struct plugin *plugin)
{
Expand Down Expand Up @@ -4451,9 +4472,11 @@
capabilities = wdc_get_drive_capabilities(ctx, hdl);
if ((capabilities & WDC_DRIVE_CAP_INTERNAL_LOG) == WDC_DRIVE_CAP_INTERNAL_LOG) {
if (!wdc_is_sn861(device_id)) {
/* Set the default DA to 3 if not specified */
if (!telemetry_data_area)
telemetry_data_area = 3;
if (wdc_get_default_telemetry_da(hdl, &telemetry_data_area)) {

Check failure on line 4475 in plugins/wdc/wdc-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns
fprintf(stderr, "%s: Error determining default telemetry data area\n",

Check failure on line 4476 in plugins/wdc/wdc-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 102 exceeds 80 columns
__func__);
return -EINVAL;
}

ret = wdc_do_cap_diag(ctx, hdl, f, xfer_size,
telemetry_type, telemetry_data_area);
Expand Down Expand Up @@ -4491,8 +4514,11 @@
if ((capabilities & WDC_DRIVE_CAP_DUI) == WDC_DRIVE_CAP_DUI) {
if ((telemetry_type == WDC_TELEMETRY_TYPE_HOST) ||
(telemetry_type == WDC_TELEMETRY_TYPE_CONTROLLER)) {
if (!telemetry_data_area)
telemetry_data_area = 3; /* Set the default DA to 3 if not specified */
if (wdc_get_default_telemetry_da(hdl, &telemetry_data_area)) {

Check failure on line 4517 in plugins/wdc/wdc-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns
fprintf(stderr, "%s: Error determining default telemetry data area\n",

Check failure on line 4518 in plugins/wdc/wdc-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 102 exceeds 80 columns
__func__);
return -EINVAL;
}
/* Get the desired telemetry log page */
ret = wdc_do_cap_telemetry_log(ctx, hdl, f, xfer_size,
telemetry_type, telemetry_data_area);
Expand All @@ -4514,9 +4540,11 @@
if ((capabilities & WDC_DRIVE_CAP_DUI_DATA) == WDC_DRIVE_CAP_DUI_DATA) {
if ((telemetry_type == WDC_TELEMETRY_TYPE_HOST) ||
(telemetry_type == WDC_TELEMETRY_TYPE_CONTROLLER)) {
if (!telemetry_data_area)
telemetry_data_area = 3; /* Set the default DA to 3 if not specified */
/* Get the desired telemetry log page */
if (wdc_get_default_telemetry_da(hdl, &telemetry_data_area)) {

Check failure on line 4543 in plugins/wdc/wdc-nvme.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 86 exceeds 80 columns
fprintf(stderr, "%s: Error determining default telemetry data area\n",
__func__);
return -EINVAL;
}
ret = wdc_do_cap_telemetry_log(ctx, hdl, f, xfer_size,
telemetry_type, telemetry_data_area);
goto out;
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.14.7"
#define WDC_PLUGIN_VERSION "2.15.0"
#include "cmd.h"

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