From 2feb7a3b8c56e5fb26579fed7b507c37ac45e5d7 Mon Sep 17 00:00:00 2001 From: michael-west Date: Thu, 4 Nov 2021 13:55:59 -0700 Subject: multi_usrp_rfnoc: Reduce latency of get_time_now() Getting the time from the mb_controller is slow, so try to get the time from the Radio on the fast path first. Signed-off-by: michael-west --- host/lib/usrp/multi_usrp_rfnoc.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index d1d90ed4d..f09c79547 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -199,6 +199,10 @@ public: size_t musrp_tx_channel = 0; for (auto radio_id : radio_blk_ids) { auto radio_blk = _graph->get_block(radio_id); + + // Store radio blocks per mboard for quick retrieval + _radios[radio_id.get_device_no()].push_back(radio_blk); + for (size_t block_chan = 0; block_chan < radio_blk->get_num_output_ports(); ++block_chan) { // Create the RX chan @@ -717,7 +721,7 @@ public: time_spec_t get_time_now(size_t mboard = 0) override { - return _get_mbc(mboard)->get_timekeeper(0)->get_time_now(); + return _radios[mboard][0]->get_time_now(); } time_spec_t get_time_last_pps(size_t mboard = 0) override @@ -2097,10 +2101,7 @@ public: } uhd::rfnoc::radio_control::sptr radio = [bank, mboard, slot_name, this]() { - auto radio_blocks = _graph->find_blocks( - std::to_string(mboard) + "/Radio"); - for (auto radio_id : radio_blocks) { - auto radio = _graph->get_block(radio_id); + for (const auto& radio : _radios[mboard]) { if (slot_name.empty() || radio->get_slot_name() == slot_name) { return radio; } @@ -2125,11 +2126,8 @@ public: std::vector get_gpio_banks(const size_t mboard) override { - auto radio_blocks = _graph->find_blocks( - std::to_string(mboard) + "/Radio"); std::vector gpio_banks; - for (auto radio_id : radio_blocks) { - auto radio = _graph->get_block(radio_id); + for (const auto& radio : _radios[mboard]) { auto radio_banks = radio->get_gpio_banks(); for (const auto& bank : radio_banks) { gpio_banks.push_back(bank + radio->get_slot_name()); @@ -2520,6 +2518,8 @@ private: rfnoc_graph::sptr _graph; //! Reference to the prop tree property_tree::sptr _tree; + //! Mapping between device number and the radio blocks + std::unordered_map> _radios; //! Mapping between channel number and the RFNoC blocks in that RX chain std::unordered_map _rx_chans; //! Mapping between channel number and the RFNoC blocks in that TX chain -- cgit v1.2.3