Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ioctl,types: telemetry log update based NVMe v2.1 #922

Merged
merged 1 commit into from
Dec 3, 2024
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
38 changes: 35 additions & 3 deletions src/nvme/ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1526,14 +1526,32 @@ static inline int nvme_get_log_device_self_test(int fd,
}

/**
* nvme_get_log_create_telemetry_host() - Create host telemetry 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
* @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_get_log_create_telemetry_host(int fd,
static inline int nvme_get_log_create_telemetry_host_mcda(int fd,
enum nvme_telemetry_da mcda,
struct nvme_telemetry_log *log)
{
struct nvme_get_log_args args = {
Expand All @@ -1548,14 +1566,28 @@ static inline int nvme_get_log_create_telemetry_host(int fd,
.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),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is the thing which 5.1.12.1.8 Telemetry Host-Initiated (Log Page Identifier 07h) talks about:

If the MCDAS bit (refer to Figure 215) is set to ‘1’ and a Get Log Page command with the Create Telemetry
Host-Initiated Data bit is set to ‘1’, then the maximum data area to be created in the Telemetry Host-Initiated
log page shall be less than or equal to the MCDA field in the Log Specific Parameter field in Command
Dword 10 (refer to Figure 213).

Is my understanding correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is

.uuidx = NVME_UUID_NONE,
.rae = false,
.ot = false,
};
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_get_log_create_telemetry_host() - Create host telemetry log
* @fd: File descriptor of nvme device
* @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_get_log_create_telemetry_host(int fd,
struct nvme_telemetry_log *log)
{
return nvme_get_log_create_telemetry_host_mcda(fd, NVME_TELEMETRY_DA_CTRL_DETERMINE, log);
}

/**
* nvme_get_log_telemetry_host() - Get Telemetry Host-Initiated log page
* @fd: File descriptor of nvme device
Expand Down
2 changes: 1 addition & 1 deletion src/nvme/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ int nvme_get_telemetry_log(int fd, bool create, bool ctrl, bool rae, size_t max_
} else {
lid = NVME_LOG_LID_TELEMETRY_HOST;
if (create)
err = nvme_get_log_create_telemetry_host(fd, log);
err = nvme_get_log_create_telemetry_host_mcda(fd, da, log);
else
err = nvme_get_log_telemetry_host(fd, 0, xfer, log);
}
Expand Down
14 changes: 0 additions & 14 deletions src/nvme/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@
int nvme_fw_download_seq(int fd, __u32 size, __u32 xfer, __u32 offset,
void *buf);

/**
* enum nvme_telemetry_da - Telemetry Log Data Area
* @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_1 = 1,
NVME_TELEMETRY_DA_2 = 2,
NVME_TELEMETRY_DA_3 = 3,
NVME_TELEMETRY_DA_4 = 4,
};

/**
* nvme_get_telemetry_max() - Get telemetry limits
* @fd: File descriptor of nvme device
Expand Down
20 changes: 13 additions & 7 deletions src/nvme/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3688,19 +3688,21 @@ enum nvme_cmd_get_log_telemetry_host_lsp {
* @rsvd1: Reserved
* @ieee: IEEE OUI Identifier is the Organization Unique Identifier (OUI)
* for the controller vendor that is able to interpret the data.
* @dalb1: Telemetry Controller-Initiated Data Area 1 Last Block is
* @dalb1: Telemetry Host/Controller Initiated Data Area 1 Last Block is
* the value of the last block in this area.
* @dalb2: Telemetry Controller-Initiated Data Area 1 Last Block is
* @dalb2: Telemetry Host/Controller Initiated Data Area 1 Last Block is
* the value of the last block in this area.
* @dalb3: Telemetry Controller-Initiated Data Area 1 Last Block is
* @dalb3: Telemetry Host/ControllerInitiated Data Area 1 Last Block is
* the value of the last block in this area.
* @rsvd14: Reserved
* @dalb4: Telemetry Controller-Initiated Data Area 4 Last Block is
* @dalb4: Telemetry Host/Controller Initiated Data Area 4 Last Block is
* the value of the last block in this area.
* @rsvd20: Reserved
* @ths: Telemetry Host-Initiated Scope
* @hostdgn: Telemetry Host-Initiated Data Generation Number is a
* value that is incremented each time the host initiates a
* capture of its internal controller state in the controller .
* capture of its internal controller state in the controller.
* @tcs: Telemetry Controller-Initiated Scope
* @ctrlavail: Telemetry Controller-Initiated Data Available, if cleared,
* then the controller telemetry log does not contain saved
* internal controller state. If this field is set to 1h, the
Expand Down Expand Up @@ -3728,8 +3730,12 @@ struct nvme_telemetry_log {
__le16 dalb3;
__u8 rsvd14[2];
__le32 dalb4;
__u8 rsvd20[361];
__u8 hostdgn;
__u8 rsvd20[360];
__u8 ths;
union { // [381]
__u8 hostdgn;
__u8 tcs;
};
__u8 ctrlavail;
__u8 ctrldgn;
__u8 rsnident[128];
Expand Down
Loading