aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp
diff options
context:
space:
mode:
authorSteven Koo <steven.koo@ni.com>2020-07-25 13:09:53 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2020-07-30 11:39:00 -0500
commit25a0e462ddc8ca737415dbae4feb90787e6a35b2 (patch)
tree2f4f7c57e57299e02a7e0f94e4ddb6ca1a6be6ee /host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp
parent80b79df60380990744f59137d313b1dd1db9ca92 (diff)
downloaduhd-25a0e462ddc8ca737415dbae4feb90787e6a35b2.tar.gz
uhd-25a0e462ddc8ca737415dbae4feb90787e6a35b2.tar.bz2
uhd-25a0e462ddc8ca737415dbae4feb90787e6a35b2.zip
mpm: Default virtual NIC CHDR IP selection
This change adds detection for setting the correct internal fpga CHDR IP address when using embedded mode.
Diffstat (limited to 'host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp')
-rw-r--r--host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp
index 7b41ac631..14b02765d 100644
--- a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp
+++ b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp
@@ -81,18 +81,34 @@ mpmd_link_if_ctrl_udp::udp_link_info_map get_udp_info_from_xport_info(
std::vector<std::string> get_addrs_from_mb_args(const uhd::device_addr_t& mb_args,
const mpmd_link_if_ctrl_udp::udp_link_info_map& link_info_list)
{
- // mb_args must always include addr
- if (not mb_args.has_key(FIRST_ADDR_KEY)) {
- UHD_LOG_WARNING("MPMD::XPORT::UDP",
- "The `" << FIRST_ADDR_KEY
- << "' key must be specified in "
- "device args to create an Ethernet transport to an RFNoC block");
- return {};
+ std::vector<std::string> addrs;
+ if(link_info_list.size() > 0 &&
+ link_info_list.begin()->second.link_type == "internal") {
+ // If link_type is "internal" we are local. In this case
+ // use this address always. MPM knows better than us.
+ addrs.push_back(link_info_list.begin()->first);
}
- std::vector<std::string> addrs{mb_args[FIRST_ADDR_KEY]};
- if (mb_args.has_key(SECOND_ADDR_KEY)) {
- addrs.push_back(mb_args[SECOND_ADDR_KEY]);
+ else {
+ if (mb_args.has_key(FIRST_ADDR_KEY)) {
+ addrs.push_back(mb_args[FIRST_ADDR_KEY]);
+ }
+ if (mb_args.has_key(SECOND_ADDR_KEY)) {
+ addrs.push_back(mb_args[SECOND_ADDR_KEY]);
+ }
}
+ if(addrs.empty()) {
+ if(link_info_list.size() > 0) {
+ addrs.push_back(link_info_list.begin()->first);
+ }
+ else {
+ UHD_LOG_WARNING("MPMD::XPORT::UDP",
+ "The `" << FIRST_ADDR_KEY
+ << "' key must be specified in "
+ "device args to create an Ethernet transport to an RFNoC block");
+ return {};
+ }
+ }
+
// This is where in UHD we encode the knowledge about what
// get_chdr_link_options() returns to us.
for (const auto& ip_addr : addrs) {