diff options
Diffstat (limited to 'host/lib/usrp/mpmd')
| -rw-r--r-- | host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp | 36 | ||||
| -rw-r--r-- | host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp | 4 | 
2 files changed, 28 insertions, 12 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) { diff --git a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp index e4a0d7811..13d28e42b 100644 --- a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp +++ b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp @@ -9,9 +9,9 @@  #include "mpmd_link_if_ctrl_base.hpp"  #include "mpmd_link_if_mgr.hpp" +#include <map>  #include <uhd/types/device_addr.hpp>  #include <uhdlib/rfnoc/rfnoc_common.hpp> -#include <unordered_map>  namespace uhd { namespace mpmd { namespace xport { @@ -30,7 +30,7 @@ public:          size_t if_mtu;      }; -    using udp_link_info_map = std::unordered_map<std::string, udp_link_info_t>; +    using udp_link_info_map = std::map<std::string, udp_link_info_t>;      mpmd_link_if_ctrl_udp(const uhd::device_addr_t& mb_args,          const mpmd_link_if_mgr::xport_info_list_t& xport_info,  | 
