Skip to content
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
15 changes: 14 additions & 1 deletion src/fec/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ pub(crate) fn parse_fec_nlas(
Ok(nlas)
}

#[derive(Debug, PartialEq, Eq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone, Default)]
pub enum EthtoolFecMode {
#[default]
None,
Rs,
Baser,
Expand Down Expand Up @@ -191,6 +192,18 @@ impl From<u32> for EthtoolFecMode {
}
}

impl From<EthtoolFecMode> for u32 {
fn from(v: EthtoolFecMode) -> u32 {
match v {
EthtoolFecMode::None => ETHTOOL_LINK_MODE_FEC_NONE_BIT,
EthtoolFecMode::Rs => ETHTOOL_LINK_MODE_FEC_RS_BIT,
EthtoolFecMode::Baser => ETHTOOL_LINK_MODE_FEC_BASER_BIT,
EthtoolFecMode::Llrs => ETHTOOL_LINK_MODE_FEC_LLRS_BIT,
EthtoolFecMode::Other(d, _) => d,
}
}
}

const ETHTOOL_A_FEC_STAT_CORRECTED: u16 = 2;
const ETHTOOL_A_FEC_STAT_UNCORR: u16 = 3;
const ETHTOOL_A_FEC_STAT_CORR_BITS: u16 = 4;
Expand Down
2 changes: 1 addition & 1 deletion src/fec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ mod get;
mod handle;

pub(crate) use self::attr::parse_fec_nlas;
pub use self::attr::EthtoolFecAttr;
pub use self::attr::{EthtoolFecAttr, EthtoolFecMode, EthtoolFecStat};
pub use self::get::EthtoolFecGetRequest;
pub use self::handle::EthtoolFecHandle;
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ mod pause;
mod ring;
mod tsinfo;

pub use self::fec::{EthtoolFecAttr, EthtoolFecGetRequest, EthtoolFecHandle};
pub use self::fec::{
EthtoolFecAttr, EthtoolFecGetRequest, EthtoolFecHandle, EthtoolFecMode,
EthtoolFecStat,
};
pub use coalesce::{
EthtoolCoalesceAttr, EthtoolCoalesceGetRequest, EthtoolCoalesceHandle,
};
Expand Down