Skip to content

better tooling for PRBS mode for transceiver qual#238

Open
Nieuwejaar wants to merge 2 commits intomainfrom
prbs
Open

better tooling for PRBS mode for transceiver qual#238
Nieuwejaar wants to merge 2 commits intomainfrom
prbs

Conversation

@Nieuwejaar
Copy link
Collaborator

Add support for monitoring PRBS error counts
Remove PRBS modes not supported by Tofino2
Reset PRBS state when deleting a link

@Nieuwejaar Nieuwejaar linked an issue Mar 11, 2026 that may be closed by this pull request
@Nieuwejaar Nieuwejaar requested a review from bnaecker March 11, 2026 16:20
Pass timing window to SDE's PRBS counter
Add support for more detailed FSM data from the SDE
Copy link
Contributor

@bnaecker bnaecker left a comment

Choose a reason for hiding this comment

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

This looks pretty good to me, thanks. I have a few suggestions, nothing major or structural.

#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum FsmType {
Port,
PortDfe,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure it's worth it, but you might want to make the port-specific variants within a second enum. Something like:

pub enum FsmType {
    Port(PortFsmType),
    ...
}

pub enum PortFsmType {
    An,
    Prbs,
    ....
}

}

impl FsmType {
pub fn is_port_fsm(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be simpler if you do the above suggestion, just something like matches!(self, FsmType::Port(_)).

let errors = unsafe {
bf_pm_port_prbs_mode_stats_get(dev, fp.ptr(), &mut stats, ms)
.check_error("bf_pm_port_prbs_stats_get")?;
stats
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be inside the unsafe block?

hdl: &Handle,
port_hdl: PortHdl,
ms: u32,
) -> AsicResult<Vec<u32>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we document what this return value actually is? It looks like the error counts for each lane, but would be nice to know that without reading the implementation.


fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"Mode31" | "mode31" | "31" => Ok(PortPrbsMode::Mode31),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these modes removed? Are they not actually implemented in the ASIC?

// | example for the next person.
// v
// (next_int, IDENT),
(11, PRBS_IMPROVEMENT),
Copy link
Contributor

Choose a reason for hiding this comment

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

Kind of a nit, but this is a little generic IMO. We might make many improvements :) Maybe something like ADD_PRBS_ERROR_COUNTS?

path: Path<LinkPath>,
) -> Result<HttpResponseOk<Ber>, HttpError>;

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Style nit, but we should probably use the same comment delimiter here, ///

&self,
port_id: PortId,
link_id: LinkId,
ms: u32,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to do any validation on this value of milliseconds? Someone could request both 0 and also u32::MAX here IIUC. That latter one especially seems bad.

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.

Want better tooling for PRBS mode for transceiver qual

2 participants