aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300
diff options
context:
space:
mode:
authorPaul David <paul.david@ettus.com>2017-02-02 14:49:53 -0500
committerAshish Chaudhari <ashish.chaudhari@ettus.com>2017-02-13 13:18:18 -0800
commitb107b4604cedd1ea91b45392c979d179a15d5738 (patch)
tree5e5ca964ce973589acec4433f7b79e3a42b0644f /host/lib/usrp/x300
parent4987ea710b2b95f1e1a8756b53997690f17e8fda (diff)
downloaduhd-b107b4604cedd1ea91b45392c979d179a15d5738.tar.gz
uhd-b107b4604cedd1ea91b45392c979d179a15d5738.tar.bz2
uhd-b107b4604cedd1ea91b45392c979d179a15d5738.zip
X3xx: Limit the number of USRPs that can initialize in parallel
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp22
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp3
2 files changed, 18 insertions, 7 deletions
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index 116e1e6eb..13d1d6adc 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -430,15 +430,23 @@ x300_impl::x300_impl(const uhd::device_addr_t &dev_addr)
uhd::msg::handler_t current_handler = uhd::msg::get_handler();
uhd::msg::register_handler(&thread_msg_handler);
- // Thread the initialization process
- boost::thread_group setup_threads;
- for (size_t i = 0; i < device_args.size(); i++)
+ // Initialize groups of USRPs in parallel
+ size_t total_usrps = device_args.size();
+ size_t num_usrps = 0;
+ while (num_usrps < total_usrps)
{
- setup_threads.create_thread(
- boost::bind(&x300_impl::setup_mb, this, i, device_args[i])
- );
+ size_t init_usrps = std::min(total_usrps - num_usrps, X300_MAX_INIT_THREADS);
+ boost::thread_group setup_threads;
+ for (size_t i = 0; i < init_usrps; i++)
+ {
+ size_t index = num_usrps + i;
+ setup_threads.create_thread(
+ boost::bind(&x300_impl::setup_mb, this, index, device_args[index])
+ );
+ }
+ setup_threads.join_all();
+ num_usrps += init_usrps;
}
- setup_threads.join_all();
// restore the original message handler
UHD_MSG(status) << thread_final_msg;
diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp
index d082ab76a..bfe98e7a3 100644
--- a/host/lib/usrp/x300/x300_impl.hpp
+++ b/host/lib/usrp/x300/x300_impl.hpp
@@ -73,6 +73,9 @@ static const size_t X300_ETH_MSG_NUM_FRAMES = 64;
static const size_t X300_ETH_DATA_NUM_FRAMES = 32;
static const double X300_DEFAULT_SYSREF_RATE = 10e6;
+// Limit the number of initialization threads
+static const size_t X300_MAX_INIT_THREADS = 10;
+
static const size_t X300_MAX_RATE_PCIE = 800000000; // bytes/s
static const size_t X300_MAX_RATE_10GIGE = (size_t)( // bytes/s
10e9 / 8 * // wire speed multiplied by percentage of packets that is sample data