aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2021-11-04 13:55:59 -0700
committerAaron Rossetto <aaron.rossetto@ni.com>2021-11-17 14:04:34 -0800
commit2feb7a3b8c56e5fb26579fed7b507c37ac45e5d7 (patch)
tree1ea7ca1eb9db2f5c1f26abb4b9e42a2b86da0621 /host/lib
parent9b78da222fb5e51c1ad9ccd6887d1cf85c4c7926 (diff)
downloaduhd-2feb7a3b8c56e5fb26579fed7b507c37ac45e5d7.tar.gz
uhd-2feb7a3b8c56e5fb26579fed7b507c37ac45e5d7.tar.bz2
uhd-2feb7a3b8c56e5fb26579fed7b507c37ac45e5d7.zip
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 <michael.west@ettus.com>
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/rfnoc/radio_control_impl.cpp2
-rw-r--r--host/lib/usrp/multi_usrp_rfnoc.cpp18
2 files changed, 10 insertions, 10 deletions
diff --git a/host/lib/rfnoc/radio_control_impl.cpp b/host/lib/rfnoc/radio_control_impl.cpp
index 53117176b..5bc16f7cd 100644
--- a/host/lib/rfnoc/radio_control_impl.cpp
+++ b/host/lib/rfnoc/radio_control_impl.cpp
@@ -302,7 +302,7 @@ uint64_t radio_control_impl::get_ticks_now()
{
// Time registers added in 0.1
if (_fpga_compat < 1) {
- throw uhd::not_implemented_error("Radio does not support time readback");
+ return get_mb_controller()->get_timekeeper(0)->get_ticks_now();
}
return regs().peek64(regmap::REG_TIME_LO);
}
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<uhd::rfnoc::radio_control>(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<uhd::rfnoc::radio_control>(
- std::to_string(mboard) + "/Radio");
- for (auto radio_id : radio_blocks) {
- auto radio = _graph->get_block<uhd::rfnoc::radio_control>(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<std::string> get_gpio_banks(const size_t mboard) override
{
- auto radio_blocks = _graph->find_blocks<uhd::rfnoc::radio_control>(
- std::to_string(mboard) + "/Radio");
std::vector<std::string> gpio_banks;
- for (auto radio_id : radio_blocks) {
- auto radio = _graph->get_block<uhd::rfnoc::radio_control>(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<size_t, std::vector<uhd::rfnoc::radio_control::sptr>> _radios;
//! Mapping between channel number and the RFNoC blocks in that RX chain
std::unordered_map<size_t, rx_chan_t> _rx_chans;
//! Mapping between channel number and the RFNoC blocks in that TX chain