From 5815baf88b613757ae252850c342c9c44ed1243d Mon Sep 17 00:00:00 2001 From: newell Date: Fri, 15 Nov 2024 13:09:17 -0800 Subject: [PATCH] Reorder Status.get_link to check for higher speeds before slower. --- libboard_zynq/src/eth/phy/status.rs | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/libboard_zynq/src/eth/phy/status.rs b/libboard_zynq/src/eth/phy/status.rs index d39b080..551ecf2 100644 --- a/libboard_zynq/src/eth/phy/status.rs +++ b/libboard_zynq/src/eth/phy/status.rs @@ -55,12 +55,22 @@ impl Status { pub fn get_link(&self) -> Option { if ! self.link_status() { None - } else if self.cap_10base_t_half() { + } else if self.cap_100base_tx_full() { Some(Link { - speed: LinkSpeed::S10, + speed: LinkSpeed::S100, + duplex: LinkDuplex::Full, + }) + } else if self.cap_100base_tx_half() { + Some(Link { + speed: LinkSpeed::S100, duplex: LinkDuplex::Half, }) - } else if self.cap_10base_t_full() { + } else if self.cap_100base_t4() { + Some(Link { + speed: LinkSpeed::S100, + duplex: LinkDuplex::Half, + }) + } else if self.cap_10base_t2_full() { Some(Link { speed: LinkSpeed::S10, duplex: LinkDuplex::Full, @@ -70,26 +80,16 @@ impl Status { speed: LinkSpeed::S10, duplex: LinkDuplex::Half, }) - } else if self.cap_10base_t2_full() { + } else if self.cap_10base_t_full() { Some(Link { speed: LinkSpeed::S10, duplex: LinkDuplex::Full, }) - } else if self.cap_100base_t4() { + } else if self.cap_10base_t_half() { Some(Link { - speed: LinkSpeed::S100, + speed: LinkSpeed::S10, duplex: LinkDuplex::Half, }) - } else if self.cap_100base_tx_half() { - Some(Link { - speed: LinkSpeed::S100, - duplex: LinkDuplex::Half, - }) - } else if self.cap_100base_tx_full() { - Some(Link { - speed: LinkSpeed::S100, - duplex: LinkDuplex::Full, - }) } else { None }