Skip to content

Commit 6c0ff9a

Browse files
committed
satman: fix targets without drtio routing
1 parent c9e3771 commit 6c0ff9a

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

artiq/firmware/satman/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,8 @@ pub extern fn main() -> i32 {
789789
}
790790

791791
kernelmgr.process_kern_requests(&mut router, &routing_table, rank, destination, &mut dma_manager);
792-
792+
793+
#[cfg(has_drtio_routing)]
793794
if let Some((repno, packet)) = router.get_downstream_packet() {
794795
if let Err(e) = repeaters[repno].aux_send(&packet) {
795796
warn!("[REP#{}] Error when sending packet to satellite ({:?})", repno, e)

artiq/firmware/satman/routing.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use alloc::{vec::Vec, collections::vec_deque::VecDeque};
22
use board_artiq::{drtioaux, drtio_routing};
3+
#[cfg(has_drtio_routing)]
34
use board_misoc::csr;
45
use core::cmp::min;
56
use proto_artiq::drtioaux_proto::PayloadStatus;
@@ -72,6 +73,7 @@ impl Sliceable {
7273
pub struct Router {
7374
upstream_queue: VecDeque<drtioaux::Packet>,
7475
local_queue: VecDeque<drtioaux::Packet>,
76+
#[cfg(has_drtio_routing)]
7577
downstream_queue: VecDeque<(usize, drtioaux::Packet)>,
7678
upstream_notified: bool,
7779
}
@@ -81,6 +83,7 @@ impl Router {
8183
Router {
8284
upstream_queue: VecDeque::new(),
8385
local_queue: VecDeque::new(),
86+
#[cfg(has_drtio_routing)]
8487
downstream_queue: VecDeque::new(),
8588
upstream_notified: false,
8689
}
@@ -90,14 +93,14 @@ impl Router {
9093
// messages are always buffered for both upstream and downstream
9194
pub fn route(&mut self, packet: drtioaux::Packet,
9295
_routing_table: &drtio_routing::RoutingTable, _rank: u8,
93-
_self_destination: u8
96+
self_destination: u8
9497
) {
98+
let destination = packet.routable_destination();
9599
#[cfg(has_drtio_routing)]
96100
{
97-
let destination = packet.routable_destination();
98101
if let Some(destination) = destination {
99102
let hop = _routing_table.0[destination as usize][_rank as usize] as usize;
100-
if destination == _self_destination {
103+
if destination == self_destination {
101104
self.local_queue.push_back(packet);
102105
} else if hop > 0 && hop < csr::DRTIOREP.len() {
103106
let repno = (hop - 1) as usize;
@@ -111,7 +114,11 @@ impl Router {
111114
}
112115
#[cfg(not(has_drtio_routing))]
113116
{
114-
self.upstream_queue.push_back(packet);
117+
if destination == Some(self_destination) {
118+
self.local_queue.push_back(packet);
119+
} else {
120+
self.upstream_queue.push_back(packet);
121+
}
115122
}
116123
}
117124

@@ -166,6 +173,7 @@ impl Router {
166173
packet
167174
}
168175

176+
#[cfg(has_drtio_routing)]
169177
pub fn get_downstream_packet(&mut self) -> Option<(usize, drtioaux::Packet)> {
170178
self.downstream_queue.pop_front()
171179
}

0 commit comments

Comments
 (0)