Skip to content

Commit

Permalink
Add support for Phy Rx Eye Opening Measurement Log
Browse files Browse the repository at this point in the history
This implements support for TP4119a, adding various fields and functions
to enable better handling of the new Physical Receiver Eye Opening
Measurement log page.

Signed-off-by: Brandon Paupore <[email protected]>
  • Loading branch information
bpaupore-wdc committed Sep 19, 2023
1 parent 5081b43 commit b514cbc
Show file tree
Hide file tree
Showing 6 changed files with 491 additions and 0 deletions.
28 changes: 28 additions & 0 deletions doc/rst/ioctl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,34 @@ The nvme command status if a response was received (see
:c:type:`enum nvme_status_field <nvme_status_field>`) or -1 with errno set otherwise
.. c:function:: int nvme_get_log_phy_rx_eom (int fd, __u8 lsp, __u16 controller, __u32 len, struct nvme_phy_rx_eom_log *log)
Retrieve Physical Interface Receiver Eye Opening Measurement Log
**Parameters**
``int fd``
File descriptor of nvme device
``__u8 lsp``
Log specific, controls action and measurement quality
``__u16 controller``
Log specific, controls action and measurement quality
``__u32 len``
The allocated size, minimum
struct nvme_phy_rx_eom_log
``struct nvme_phy_rx_eom_log *log``
User address to store the log page
**Return**
The nvme command status if a response was received (see
:c:type:`enum nvme_status_field <nvme_status_field>`) or -1 with errno set otherwise
.. c:function:: int nvme_get_log_discovery (int fd, bool rae, __u32 offset, __u32 len, void *log)
Retrieve Discovery log page
Expand Down
28 changes: 28 additions & 0 deletions doc/rst/mi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,34 @@ The nvme command status if a response was received (see
:c:type:`enum nvme_status_field <nvme_status_field>`) or -1 with errno set otherwise.
.. c:function:: int nvme_mi_admin_get_log_phy_rx_eom (nvme_mi_ctrl_t ctrl, __u8 lsp, __u16 controller, __u32 len, struct nvme_phy_rx_eom_log *log)
Retrieve Physical Interface Receiver Eye Opening Measurement Log
**Parameters**
``nvme_mi_ctrl_t ctrl``
Controller to query
``__u8 lsp``
Log specific, controls action and measurement quality
``__u16 controller``
Log specific, controls action and measurement quality
``__u32 len``
The allocated size, minimum
struct nvme_phy_rx_eom_log
``struct nvme_phy_rx_eom_log *log``
User address to store the log page
**Return**
The nvme command status if a response was received (see
:c:type:`enum nvme_status_field <nvme_status_field>`) or -1 with errno set otherwise
.. c:function:: int nvme_mi_admin_get_log_discovery (nvme_mi_ctrl_t ctrl, bool rae, __u32 offset, __u32 len, void *log)
Retrieve Discovery log page
Expand Down
235 changes: 235 additions & 0 deletions doc/rst/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5503,6 +5503,178 @@ bytes, in size. This log captures the controller’s internal state.



.. c:struct:: nvme_eom_lane_desc
Eye Opening Measurement Lane Descriptor

**Definition**

::

struct nvme_eom_lane_desc {
__u8 rsvd0;
__u8 mstatus;
__u8 lane;
__u8 eye;
__le16 top;
__le16 bottom;
__le16 left;
__le16 right;
__le16 nrows;
__le16 ncols;
__le16 edlen;
__u8 rsvd18[14];
__u8 desc[];
};

**Members**

``rsvd0``
Reserved

``mstatus``
Measurement Status

``lane``
Lane Number

``eye``
Eye Number

``top``
Absolute number of rows from center to top edge of eye

``bottom``
Absolute number of rows from center to bottom edge of eye

``left``
Absolute number of rows from center to left edge of eye

``right``
Absolute number of rows from center to right edge of eye

``nrows``
Number of Rows

``ncols``
Number of Columns

``edlen``
Eye Data Length

``rsvd18``
Reserved

``desc``
Printable Eye, Eye Data, and any Padding




.. c:struct:: nvme_phy_rx_eom_log
Physical Interface Receiver Eye Opening Measurement Log

**Definition**

::

struct nvme_phy_rx_eom_log {
__u8 lid;
__u8 eomip;
__le16 hsize;
__le32 rsize;
__u8 eomdgn;
__u8 lr;
__u8 odp;
__u8 lanes;
__u8 epl;
__u8 lspfc;
__u8 li;
__u8 rsvd15[3];
__le16 lsic;
__le32 dsize;
__le16 nd;
__le16 maxtb;
__le16 maxlr;
__le16 etgood;
__le16 etbetter;
__le16 etbest;
__u8 rsvd36[28];
struct nvme_eom_lane_desc descs[];
};

**Members**

``lid``
Log Identifier

``eomip``
EOM In Progress

``hsize``
Header Size

``rsize``
Result Size

``eomdgn``
EOM Data Generation Number

``lr``
Log Revision

``odp``
Optional Data Present

``lanes``
Number of Lanes

``epl``
Eyes Per Lane

``lspfc``
Log Specific Parameter Field Copy

``li``
Link Information

``rsvd15``
Reserved

``lsic``
Log Specific Identifier Copy

``dsize``
Descriptor Size

``nd``
Number of Descriptors

``maxtb``
Maximum Top Bottom

``maxlr``
Maximum Left Right

``etgood``
Estimated Time for Good Quality

``etbetter``
Estimated Time for Better Quality

``etbest``
Estimated Time for Best Quality

``rsvd36``
Reserved

``descs``
EOM Lane Descriptors




.. c:struct:: nvme_media_unit_stat_desc
Media Unit Status Descriptor
Expand Down Expand Up @@ -10508,6 +10680,9 @@ true if **status** is of the specified type and value
``NVME_LOG_LID_BOOT_PARTITION``
Boot Partition
``NVME_LOG_LID_PHY_RX_EOM``
Physical Interface Receiver Eye Opening Measurement
``NVME_LOG_LID_FDP_CONFIGS``
FDP Configurations
Expand Down Expand Up @@ -11219,6 +11394,66 @@ true if **status** is of the specified type and value
.. c:enum:: nvme_log_phy_rx_eom_action
Physical Interface Receiver Eye Opening Measurement Action
**Constants**
``NVME_LOG_PHY_RX_EOM_READ``
Read Log Data
``NVME_LOG_PHY_RX_EOM_START_READ``
Start Measurement and Read Log Data
``NVME_LOG_PHY_RX_EOM_ABORT_CLEAR``
Abort Measurement and Clear Log Data
.. c:enum:: nvme_log_phy_rx_eom_quality
Physical Interface Receiver Eye Opening Measurement Quality
**Constants**
``NVME_LOG_PHY_RX_EOM_GOOD``
<= Better Quality
``NVME_LOG_PHY_RX_EOM_BETTER``
<= Best Quality, >= Good Quality
``NVME_LOG_PHY_RX_EOM_BEST``
>= Better Quality
.. c:enum:: nvme_phy_rx_eom_progress
EOM In Progress Values
**Constants**
``NVME_PHY_RX_EOM_NOT_STARTED``
``NVME_PHY_RX_EOM_IN_PROGRESS``
``NVME_PHY_RX_EOM_COMPLETED``
.. c:enum:: nvme_eom_optional_data
EOM Optional Data Present Fields
**Constants**
``NVME_EOM_EYE_DATA_PRESENT``
``NVME_EOM_PRINTABLE_EYE_PRESENT``
.. c:enum:: nvme_pevent_log_action
Persistent Event Log - Action
Expand Down
35 changes: 35 additions & 0 deletions src/nvme/ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,41 @@ static inline int nvme_get_log_boot_partition(int fd, bool rae,
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_get_log_phy_rx_eom() - Retrieve Physical Interface Receiver Eye Opening Measurement Log
* @fd: File descriptor of nvme device
* @lsp: Log specific, controls action and measurement quality
* @controller: Target controller ID
* @len: The allocated size, minimum
* struct nvme_phy_rx_eom_log
* @log: User address to store the log page
*
* 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_phy_rx_eom(int fd, __u8 lsp, __u16 controller,
__u32 len, struct nvme_phy_rx_eom_log *log)
{
struct nvme_get_log_args args = {
.lpo = 0,
.result = NULL,
.log = log,
.args_size = sizeof(args),
.fd = fd,
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = NVME_LOG_LID_PHY_RX_EOM,
.len = len,
.nsid = NVME_NSID_NONE,
.csi = NVME_CSI_NVM,
.lsi = controller,
.lsp = lsp,
.uuidx = NVME_UUID_NONE,
.rae = false,
.ot = false,
};
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_get_log_discovery() - Retrieve Discovery log page
* @fd: File descriptor of nvme device
Expand Down
Loading

0 comments on commit b514cbc

Please sign in to comment.