From 4582e5eceda465a7e5f332edb2b8bd6a99934f6c Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 25 Nov 2024 18:03:53 +0800 Subject: [PATCH 1/2] moninj: replace inject lock with async lock --- src/runtime/src/moninj.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/src/moninj.rs b/src/runtime/src/moninj.rs index a6b9bbe..425e480 100644 --- a/src/runtime/src/moninj.rs +++ b/src/runtime/src/moninj.rs @@ -79,7 +79,7 @@ mod remote_moninj { } pub async fn inject(aux_mutex: &Rc>, timer: GlobalTimer, linkno: u8, destination: u8, channel: i32, overrd: i8, value: i8) { - let _lock = aux_mutex.lock(); + let _lock = aux_mutex.async_lock().await; drtioaux_async::send(linkno, &drtioaux_async::Packet::InjectionRequest { destination: destination, channel: channel as _, -- 2.47.1 From 669fd967bbf5c165ed45cb17d6d312598170ebd8 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 25 Nov 2024 18:06:22 +0800 Subject: [PATCH 2/2] satman: stop waiting on reply from inject request --- src/satman/src/main.rs | 17 ++++++++++++++++- src/satman/src/repeater.rs | 6 +++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/satman/src/main.rs b/src/satman/src/main.rs index ceae24d..c451b50 100644 --- a/src/satman/src/main.rs +++ b/src/satman/src/main.rs @@ -227,7 +227,22 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater], }, drtioaux::Packet::InjectionRequest { destination: _destination, channel, overrd, value } => { - forward!(_routing_table, _destination, *_rank, _repeaters, &packet, timer); + #[cfg(has_drtio_routing)] + { + let hop = _routing_table.0[_destination as usize][*_rank as usize]; + if hop != 0 { + let repno = (hop - 1) as usize; + if repno < _repeaters.len() { + if _repeaters[repno].state != repeater::RepeaterState::Up { + return Err(drtioaux::Error::LinkDown); + } + return drtioaux::send(_repeaters[repno].auxno, &packet); + } else { + return Err(drtioaux::Error::RoutingError); + } + } + } + #[cfg(has_rtio_moninj)] unsafe { csr::rtio_moninj::inj_chan_sel_write(channel as _); diff --git a/src/satman/src/repeater.rs b/src/satman/src/repeater.rs index ed12365..159bcc0 100644 --- a/src/satman/src/repeater.rs +++ b/src/satman/src/repeater.rs @@ -18,7 +18,7 @@ fn rep_link_rx_up(repno: u8) -> bool { #[cfg(has_drtio_routing)] #[derive(Clone, Copy, PartialEq)] -enum RepeaterState { +pub enum RepeaterState { Down, SendPing { ping_count: u16 }, WaitPingReply { ping_count: u16, timeout: Milliseconds }, @@ -35,8 +35,8 @@ impl Default for RepeaterState { #[derive(Clone, Copy, Default)] pub struct Repeater { repno: u8, - auxno: u8, - state: RepeaterState + pub auxno: u8, + pub state: RepeaterState } #[cfg(has_drtio_routing)] -- 2.47.1