Skip to content

Commit

Permalink
mi: telemetry log update based NVMe v2.1
Browse files Browse the repository at this point in the history
MCDA added for Telemetry Host-Initiated Log creation

Signed-off-by: Steven Seungcheol Lee <[email protected]>
  • Loading branch information
sc108-lee authored and igaw committed Dec 3, 2024
1 parent 80775de commit 693e183
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
16 changes: 0 additions & 16 deletions src/nvme/ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1525,22 +1525,6 @@ static inline int nvme_get_log_device_self_test(int fd,
NVME_NSID_ALL, sizeof(*log), log);
}

/**
* enum nvme_telemetry_da - Telemetry Log Data Area
* @NVME_TELEMETRY_DA_CTRL_DETERMINE:
* @NVME_TELEMETRY_DA_1: Data Area 1
* @NVME_TELEMETRY_DA_2: Data Area 2
* @NVME_TELEMETRY_DA_3: Data Area 3
* @NVME_TELEMETRY_DA_4: Data Area 4
*/
enum nvme_telemetry_da {
NVME_TELEMETRY_DA_CTRL_DETERMINE = 0,
NVME_TELEMETRY_DA_1 = 1,
NVME_TELEMETRY_DA_2 = 2,
NVME_TELEMETRY_DA_3 = 3,
NVME_TELEMETRY_DA_4 = 4,
};

/**
* nvme_get_log_create_telemetry_host_mcda() - Create host telemetry log
* @fd: File descriptor of nvme device
Expand Down
22 changes: 19 additions & 3 deletions src/nvme/mi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1760,14 +1760,16 @@ static inline int nvme_mi_admin_get_log_device_self_test(nvme_mi_ctrl_t ctrl,
}

/**
* nvme_mi_admin_get_log_create_telemetry_host() - Create host telemetry log
* nvme_mi_admin_get_log_create_telemetry_host_mcda() - Create host telemetry log
* @ctrl: Controller to query
* @mcda: Maximum Created Data Area
* @log: Userspace address of the log payload
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
static inline int nvme_mi_admin_get_log_create_telemetry_host(nvme_mi_ctrl_t ctrl,
static inline int nvme_mi_admin_get_log_create_telemetry_host_mcda(nvme_mi_ctrl_t ctrl,
enum nvme_telemetry_da mcda,
struct nvme_telemetry_log *log)
{
struct nvme_get_log_args args = {
Expand All @@ -1780,14 +1782,28 @@ static inline int nvme_mi_admin_get_log_create_telemetry_host(nvme_mi_ctrl_t ctr
.nsid = NVME_NSID_NONE,
.csi = NVME_CSI_NVM,
.lsi = NVME_LOG_LSI_NONE,
.lsp = NVME_LOG_TELEM_HOST_LSP_CREATE,
.lsp = (__u8)((mcda << 1) | NVME_LOG_TELEM_HOST_LSP_CREATE),
.uuidx = NVME_UUID_NONE,
.rae = false,
.ot = false,
};
return nvme_mi_admin_get_log(ctrl, &args);
}

/**
* nvme_mi_admin_get_log_create_telemetry_host() - Create host telemetry log
* @ctrl: Controller to query
* @log: Userspace address of the log payload
*
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
static inline int nvme_mi_admin_get_log_create_telemetry_host(nvme_mi_ctrl_t ctrl,
struct nvme_telemetry_log *log)
{
return nvme_mi_admin_get_log_create_telemetry_host_mcda(ctrl, NVME_TELEMETRY_DA_CTRL_DETERMINE, log);
}

/**
* nvme_mi_admin_get_log_telemetry_host() - Get Telemetry Host-Initiated log
* page
Expand Down
16 changes: 16 additions & 0 deletions src/nvme/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3703,6 +3703,22 @@ enum nvme_cmd_get_log_telemetry_host_lsp {
NVME_LOG_TELEM_HOST_LSP_CREATE = 1,
};

/**
* enum nvme_telemetry_da - Telemetry Log Data Area
* @NVME_TELEMETRY_DA_CTRL_DETERMINE:
* @NVME_TELEMETRY_DA_1: Data Area 1
* @NVME_TELEMETRY_DA_2: Data Area 2
* @NVME_TELEMETRY_DA_3: Data Area 3
* @NVME_TELEMETRY_DA_4: Data Area 4
*/
enum nvme_telemetry_da {
NVME_TELEMETRY_DA_CTRL_DETERMINE = 0,
NVME_TELEMETRY_DA_1 = 1,
NVME_TELEMETRY_DA_2 = 2,
NVME_TELEMETRY_DA_3 = 3,
NVME_TELEMETRY_DA_4 = 4,
};

/**
* struct nvme_telemetry_log - Retrieve internal data specific to the
* manufacturer.
Expand Down

0 comments on commit 693e183

Please sign in to comment.