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

Changes for supporting some PHY Diagnostics #1527

Merged
merged 5 commits into from
Aug 4, 2022
Merged

Changes for supporting some PHY Diagnostics #1527

merged 5 commits into from
Aug 4, 2022

Conversation

harshitgulati18
Copy link
Contributor

This change includes support for reading the following PHY layer diagnostics in SAI -

  1. Per PMD Lane Rx Signal Detect
  2. Per PMD Lane Rx Lock Status (aka CDR status)
  3. PCS Rx Link Status
  4. Per FEC Lane Alignment Marker Lock

These are some useful diagnostics for debugging a link down or a link flap issue.

All of these diagnostics support a 'current' status and a 'changed' flag and therefore common helper types have been added that are shared by these 4 diagnostics. The current status indicates the status at the time of the read by NOS. The 'changed' flag indicates if the status changed at least once since the last read by NOS.

Following is an example sequence that demonstrates what a NOS will receive when it tries to read the rx signal detect with hardware state changes happening in the background. 'read_rx_signal_detect' is used to depict a read by the NOS.

1. Initial Hardware State : RX_SIGNAL_DETECT = false
2. read_rx_signal_detect -> {current=false, changed=false}
3. Hardware State : RX_SIGNAL_DETECT = true
4. read_rx_signal_detect -> {current=true, changed=true}
5. read_rx_signal_detect -> {current=true, changed=false} // Changed flag resets because no hardware state changes since last read
6. Hardware State : RX_SIGNAL_DETECT = false
7. read_rx_signal_detect -> {current=false, changed=true}
8. Hardware State : RX_SIGNAL_DETECT = true
9. Hardware State : RX_SIGNAL_DETECT = false
10. read_rx_signal_detect -> {current=false, changed=true} // Changed is true because the hardware state changed to at least once since the last read

Following is an example code for how a NOS can read these diagnostics

sai_attribute_t rx_signal_detect_attr;
rx_signal_detect_attr.id = SAI_PORT_ATTR_RX_SIGNAL_DETECT;
sai_port_api_t* port_api;
port_api->get_port_attribute(port_id, 1, &rx_signal_detect_attr);
// Assuming just one PMD lane
sai_current_and_changed_status_t signal_detect_lane1 = rx_signal_detect_attr.value. portboolcurrentandchangedstatuslist.list[0].value;
printf("{current=%d, changed=%d}", signal_detect_lane1.current, signal_detect_lane1.changed);

Signed-off-by: harshitgulati18 <hgulati@fb.com>
@harshitgulati18 harshitgulati18 marked this pull request as ready for review July 11, 2022 01:38
meta/saisanitycheck.c Outdated Show resolved Hide resolved
meta/saisanitycheck.c Outdated Show resolved Hide resolved
inc/saitypes.h Outdated

/** Indicates that the status changed at least once since the last read */
bool changed;
} sai_bool_current_and_changed_status_t;
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this struct have more meaningful name rather than names and types of fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the name of the struct. Please check the new revision

inc/saitypes.h Outdated
{
uint32_t lane;
sai_bool_current_and_changed_status_t value;
} sai_port_lane_bool_current_and_changed_status_t;
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this struct have more meaningful name rather than names and types of fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the name of the struct. Please check the new revision

Copy link
Collaborator

@kcudnik kcudnik left a comment

Choose a reason for hiding this comment

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

please address comments

@abdosi abdosi merged commit e47b9e0 into opencomputeproject:master Aug 4, 2022
chrispsommers pushed a commit to chrispsommers/SAI that referenced this pull request Aug 4, 2022
This change includes support for reading the following PHY layer diagnostics in SAI -

Per PMD Lane Rx Signal Detect
Per PMD Lane Rx Lock Status (aka CDR status)
PCS Rx Link Status
Per FEC Lane Alignment Marker Lock

Signed-off-by: Chris Sommers <chrispsommers@gmail.com>
@rlhui rlhui mentioned this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants