aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2021-02-06 14:34:19 -0800
committerAaron Rossetto <aaron.rossetto@ni.com>2021-02-11 07:16:48 -0600
commit13f1dc28f162c74cc0eac6673d3c12d5195238d1 (patch)
tree84ebc1d923efe5d6d61e035e7d17c2f236d29fb8
parent910db73c9aa9446479f00a4e90521a213568bffa (diff)
downloaduhd-13f1dc28f162c74cc0eac6673d3c12d5195238d1.tar.gz
uhd-13f1dc28f162c74cc0eac6673d3c12d5195238d1.tar.bz2
uhd-13f1dc28f162c74cc0eac6673d3c12d5195238d1.zip
mpmd: Skip find if "resource" key is specified
MPM devices were being discovered when trying to locate PCIe connected devices. Adding filter to exclude them if the "resource" key is specified in the device address arguments. Replaces "lib: disable non pcie types in find with resource" to reduce impact to older devices and remove API change. Signed-off-by: michael-west <michael.west@ettus.com>
-rw-r--r--host/include/uhd/types/device_addr.hpp7
-rw-r--r--host/lib/types/device_addr.cpp9
-rw-r--r--host/lib/usrp/b100/b100_impl.cpp8
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp8
-rw-r--r--host/lib/usrp/mpmd/mpmd_find.cpp12
-rw-r--r--host/lib/usrp/usrp1/usrp1_impl.cpp10
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp5
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp6
-rw-r--r--host/lib/usrp_clock/octoclock/octoclock_impl.cpp5
9 files changed, 14 insertions, 56 deletions
diff --git a/host/include/uhd/types/device_addr.hpp b/host/include/uhd/types/device_addr.hpp
index 035715bf9..869f4a862 100644
--- a/host/include/uhd/types/device_addr.hpp
+++ b/host/include/uhd/types/device_addr.hpp
@@ -50,13 +50,6 @@ public:
device_addr_t(const std::map<std::string, std::string>& info);
/*!
- * Looks for any key that matches the prefix.
- * \param prefix string to compare keys to
- * \return a bool true if found else false
- */
- bool has_key_with_prefix(const std::string& prefix) const;
-
- /*!
* Convert a device address into a pretty print string.
* \return a printable string representing the device address
*/
diff --git a/host/lib/types/device_addr.cpp b/host/lib/types/device_addr.cpp
index 3a7f80ed9..d5e9ce0d4 100644
--- a/host/lib/types/device_addr.cpp
+++ b/host/lib/types/device_addr.cpp
@@ -9,7 +9,6 @@
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/tokenizer.hpp>
-#include <algorithm>
#include <regex>
#include <sstream>
#include <stdexcept>
@@ -52,14 +51,6 @@ device_addr_t::device_addr_t(const std::map<std::string, std::string>& info)
}
}
-bool device_addr_t::has_key_with_prefix(const std::string& prefix) const
-{
- auto dev_keys = this->keys();
- return std::any_of(dev_keys.begin(), dev_keys.end(), [prefix](const auto& key) {
- return key.substr(0, prefix.size()) == prefix;
- });
-}
-
std::string device_addr_t::to_pp_string(void) const
{
if (this->size() == 0)
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp
index 02a23ec38..4d72e4f04 100644
--- a/host/lib/usrp/b100/b100_impl.cpp
+++ b/host/lib/usrp/b100/b100_impl.cpp
@@ -44,15 +44,9 @@ static device_addrs_t b100_find(const device_addr_t& hint)
// Return an empty list of addresses when an address or resource is specified,
// since an address and resource is intended for a different, non-USB, device.
- if (hint.has_key("addr"))
+ if (hint.has_key("addr") || hint.has_key("resource"))
return b100_addrs;
- if (hint.has_key_with_prefix("resource")) {
- UHD_LOG_TRACE(
- "B100 FIND", "Returning early, PCIe is not supported with b100 devices.");
- return b100_addrs;
- }
-
uint16_t vid, pid;
if (hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type")
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 139dd9362..7f250fd42 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -182,14 +182,8 @@ static device_addrs_t b200_find(const device_addr_t& hint)
// Return an empty list of addresses when an address or resource is specified,
// since an address and resource is intended for a different, non-USB, device.
for (device_addr_t hint_i : separate_device_addr(hint)) {
- if (hint_i.has_key("addr"))
+ if (hint_i.has_key("addr") || hint_i.has_key("resource"))
return b200_addrs;
-
- if (hint.has_key_with_prefix("resource")) {
- UHD_LOG_TRACE(
- "B200 FIND", "Returning early, PCIe is not supported with b200 devices.");
- return b200_addrs;
- }
}
// Important note:
diff --git a/host/lib/usrp/mpmd/mpmd_find.cpp b/host/lib/usrp/mpmd/mpmd_find.cpp
index 77f7486dd..5d5aab1ba 100644
--- a/host/lib/usrp/mpmd/mpmd_find.cpp
+++ b/host/lib/usrp/mpmd/mpmd_find.cpp
@@ -139,6 +139,9 @@ device_addrs_t mpmd_find_with_addrs(const device_addrs_t& hints)
device_addrs_t found_devices;
found_devices.reserve(hints.size());
for (const auto& hint : hints) {
+ if (hint.has_key("resource")) {
+ continue;
+ }
if (not(hint.has_key(xport::FIRST_ADDR_KEY) or hint.has_key(MGMT_ADDR_KEY))) {
UHD_LOG_DEBUG("MPMD FIND", "No address given in hint " << hint.to_string());
continue;
@@ -169,6 +172,9 @@ device_addrs_t mpmd_find_with_addrs(const device_addrs_t& hints)
device_addrs_t mpmd_find_with_bcast(const device_addr_t& hint)
{
device_addrs_t addrs;
+ if (hint.has_key("resource")) {
+ return addrs;
+ }
UHD_LOG_TRACE(
"MPMD FIND", "Broadcasting on all available interfaces to find MPM devices.");
std::vector<std::future<device_addrs_t>> task_list;
@@ -224,12 +230,6 @@ device_addrs_t mpmd_find(const device_addr_t& hint_)
return {};
}
}
- if (hint_.has_key_with_prefix("resource")) {
- UHD_LOG_TRACE(
- "MPMD FIND", "Returning early, PCIe is not support with mpm devices.");
- return {};
- }
-
UHD_LOG_TRACE("MPMD FIND", "Finding with " << hints.size() << " different hint(s).");
// Scenario 1): User gave us at least one address
diff --git a/host/lib/usrp/usrp1/usrp1_impl.cpp b/host/lib/usrp/usrp1/usrp1_impl.cpp
index 37bd4a4a2..d86bf6d56 100644
--- a/host/lib/usrp/usrp1/usrp1_impl.cpp
+++ b/host/lib/usrp/usrp1/usrp1_impl.cpp
@@ -47,15 +47,9 @@ static device_addrs_t usrp1_find(const device_addr_t& hint)
// Return an empty list of addresses when an address or resource is specified,
// since an address and resource is intended for a different, non-USB, device.
- if (hint.has_key("addr"))
+ if (hint.has_key("addr") || hint.has_key("resource"))
return usrp1_addrs;
- if (hint.has_key_with_prefix("resource")) {
- UHD_LOG_TRACE(
- "USRP1 FIND", "Returning early, PCIe is not supported with usrp1 devices.");
- return usrp1_addrs;
- }
-
uint16_t vid, pid;
if (hint.has_key("vid") && hint.has_key("pid") && hint.has_key("type")
@@ -127,7 +121,7 @@ static device_addrs_t usrp1_find(const device_addr_t& hint)
// this is a found usrp1 when the hint serial and name match or blank
if ((not hint.has_key("name") or hint["name"] == new_addr["name"])
and (not hint.has_key("serial")
- or hint["serial"] == new_addr["serial"])) {
+ or hint["serial"] == new_addr["serial"])) {
usrp1_addrs.push_back(new_addr);
}
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 8ca503aa9..c2514ae02 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -68,11 +68,8 @@ device_addrs_t usrp2_find(const device_addr_t& hint_)
// Return an empty list of addresses when a resource is specified,
// since a resource is intended for a different, non-USB, device.
- if (hint.has_key_with_prefix("resource")) {
- UHD_LOG_TRACE(
- "USRP2 FIND", "Returning early, PCIe is not supported with usrp2 devices.");
+ if (hint.has_key("resource"))
return usrp2_addrs;
- }
// if no address was specified, send a broadcast on each interface
if (not hint.has_key("addr")) {
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index 663b951a1..fa8425fac 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -100,9 +100,7 @@ device_addrs_t x300_find(const device_addr_t& hint_)
return reply_addrs;
}
- bool has_resource_key = hint.has_key_with_prefix("resource");
-
- if (!has_resource_key) {
+ if (!hint.has_key("resource")) {
// otherwise, no address was specified, send a broadcast on each interface
for (const transport::if_addrs_t& if_addrs : transport::get_if_addrs()) {
// avoid the loopback device
@@ -137,7 +135,7 @@ device_addrs_t x300_find(const device_addr_t& hint_)
}
}
- device_addrs_t pcie_addrs = pcie_manager::find(hint, has_resource_key);
+ device_addrs_t pcie_addrs = pcie_manager::find(hint, hint.has_key("resource"));
if (not pcie_addrs.empty()) {
addrs.insert(addrs.end(), pcie_addrs.begin(), pcie_addrs.end());
}
diff --git a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
index 24032c33f..b4185eded 100644
--- a/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
+++ b/host/lib/usrp_clock/octoclock/octoclock_impl.cpp
@@ -71,11 +71,8 @@ device_addrs_t octoclock_find(const device_addr_t& hint)
// Return an empty list of addresses when a resource is specified,
// since a resource is intended for a different, non-USB, device.
- if (hint.has_key_with_prefix("resource")) {
- UHD_LOG_TRACE("OCTOCLOCK FIND",
- "Returning early, PCIe is not supported with octoclock devices.");
+ if (hint.has_key("resource"))
return octoclock_addrs;
- }
// If no address was specified, send a broadcast on each interface
if (not _hint.has_key("addr")) {