forked from M-Labs/artiq
1
0
Fork 0

drtio: receive and print unsolicited aux packets

Helps with debugging and prevents the aux channel from getting stuck after packets arrive after the timeout.
This commit is contained in:
Sebastien Bourdeauducq 2018-09-12 22:57:21 +08:00
parent 0befec7d26
commit 5a9cc004f2
2 changed files with 20 additions and 2 deletions

View File

@ -172,6 +172,14 @@ pub mod drtio {
Ok(())
}
fn process_unsolicited_aux(linkno: u8) {
match drtioaux::recv_link(linkno) {
Ok(Some(packet)) => warn!("[LINK#{}] unsolicited aux packet: {:?}", linkno, packet),
Ok(None) => (),
Err(_) => warn!("[LINK#{}] aux packet error", linkno)
}
}
fn process_local_errors(linkno: u8) {
let errors;
let linkidx = linkno as usize;
@ -215,6 +223,7 @@ pub mod drtio {
if link_up(linkno) {
/* link was previously up */
if link_rx_up(linkno) {
process_unsolicited_aux(linkno);
process_local_errors(linkno);
process_aux_errors(&io, linkno);
} else {

View File

@ -40,7 +40,7 @@ impl Repeater {
}
pub fn service(&mut self, routing_table: &drtio_routing::RoutingTable, rank: u8) {
self.process_errors();
self.process_local_errors();
match self.state {
RepeaterState::Down => {
@ -97,6 +97,7 @@ impl Repeater {
}
}
RepeaterState::Up => {
self.process_unsolicited_aux();
if !rep_link_rx_up(self.repno) {
info!("[REP#{}] link is down", self.repno);
self.state = RepeaterState::Down;
@ -111,7 +112,15 @@ impl Repeater {
}
}
fn process_errors(&self) {
fn process_unsolicited_aux(&self) {
match drtioaux::recv_link(self.auxno) {
Ok(Some(packet)) => warn!("[REP#{}] unsolicited aux packet: {:?}", self.repno, packet),
Ok(None) => (),
Err(_) => warn!("[REP#{}] aux packet error", self.repno)
}
}
fn process_local_errors(&self) {
let repno = self.repno as usize;
let errors;
unsafe {