aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/usrp3
diff options
context:
space:
mode:
authorAshish Chaudhari <ashish@ettus.com>2016-01-13 11:27:31 -0800
committerAshish Chaudhari <ashish@ettus.com>2016-01-13 11:28:52 -0800
commit6626df371768dc6737726d0467459ba792eb55a4 (patch)
treeb6b14ac0a0d17e180adb8e9ab2db9f5923feea69 /firmware/usrp3
parentb9eb25bafc03ec18cbb6a122c5107774c365620c (diff)
downloaduhd-6626df371768dc6737726d0467459ba792eb55a4.tar.gz
uhd-6626df371768dc6737726d0467459ba792eb55a4.tar.bz2
uhd-6626df371768dc6737726d0467459ba792eb55a4.zip
n230: Made link state detection more accurate
Diffstat (limited to 'firmware/usrp3')
-rw-r--r--firmware/usrp3/n230/n230_eth_handlers.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/firmware/usrp3/n230/n230_eth_handlers.c b/firmware/usrp3/n230/n230_eth_handlers.c
index bb07be51b..e5b59c212 100644
--- a/firmware/usrp3/n230/n230_eth_handlers.c
+++ b/firmware/usrp3/n230/n230_eth_handlers.c
@@ -252,7 +252,7 @@ void n230_register_flash_comms_handler()
static bool links_up[N230_MAX_NUM_ETH_PORTS] = {};
static uint32_t packet_count[N230_MAX_NUM_ETH_PORTS] = {};
-void n230_poll_sfp_status(const uint32_t eth, bool force)
+void n230_poll_sfp_status(const uint32_t eth, bool force, bool* state_updated)
{
// Has MODDET/MODAbS changed since we last looked?
uint32_t rb = wb_peek32(SR_ADDR(WB_SBRB_BASE, (eth==0) ? RB_ZPU_SFP_STATUS0 : RB_ZPU_SFP_STATUS1));
@@ -296,6 +296,9 @@ void n230_poll_sfp_status(const uint32_t eth, bool force)
UHD_FW_TRACE_FSTR(INFO, "A new SFP+ module has been inserted into eth port %d.", eth);
}
}
+ *state_updated = true;
+ } else {
+ *state_updated = false;
}
}
@@ -312,13 +315,18 @@ void n230_update_link_act_state(soft_reg_t* led_reg)
poll_cnt = 0;
}
- //Check SFP status
- n230_poll_sfp_status(i, first_poll);
+ //Check SFP status and update links_up
+ bool link_state_from_sfp = false;
+ n230_poll_sfp_status(i, first_poll, &link_state_from_sfp);
//Check packet counters less frequently to keep the LED on for a visible duration
uint32_t cnt = wb_peek32(SR_ADDR(WB_SBRB_BASE, (i==0)?RB_ZPU_ETH0_PKT_CNT:RB_ZPU_ETH1_PKT_CNT));
activity[i] = (cnt != packet_count[i]);
packet_count[i] = cnt;
+
+ //Update links_up if there is activity only if the SFP
+ //handler has not updated it
+ if (activity[i] && !link_state_from_sfp) links_up[i] = true;
}
//TODO: Swap this when Ethernet port swap issues is fixed