aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2020-01-28 15:50:32 -0800
committerAaron Rossetto <aaron.rossetto@ni.com>2020-07-16 10:00:12 -0500
commit419d7dafa5c840b8aa9f056690007164de046a1d (patch)
tree7681659a80e585d3ee63f28eb7eea1780e1a708a
parenteadbc21982d6a12bc52300e6855af368b7917574 (diff)
downloaduhd-419d7dafa5c840b8aa9f056690007164de046a1d.tar.gz
uhd-419d7dafa5c840b8aa9f056690007164de046a1d.tar.bz2
uhd-419d7dafa5c840b8aa9f056690007164de046a1d.zip
mpm,mpmd: Add iface type and mtu info for UDP links
This changes MTU handling for the "internal" UDP type. Because MPM echo packets will not be returned for internal NICs, use the iface's programmed MTU instead.
-rw-r--r--host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp15
-rw-r--r--host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp2
-rw-r--r--mpm/python/usrp_mpm/sys_utils/net.py1
-rw-r--r--mpm/python/usrp_mpm/xports/xportmgr_udp.py4
4 files changed, 19 insertions, 3 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 bdf088025..7b41ac631 100644
--- a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp
+++ b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.cpp
@@ -68,8 +68,11 @@ mpmd_link_if_ctrl_udp::udp_link_info_map get_udp_info_from_xport_info(
const size_t link_rate = link_info.count("link_rate")
? std::stoul(link_info.at("link_rate"))
: MAX_RATE_1GIGE;
+ const std::string link_type = link_info.at("type");
+ const size_t if_mtu = std::stoul(link_info.at("mtu"));
result.emplace(link_info.at("ipv4"),
- mpmd_link_if_ctrl_udp::udp_link_info_t{udp_port, link_rate});
+ mpmd_link_if_ctrl_udp::udp_link_info_t{
+ udp_port, link_rate, link_type, if_mtu});
}
return result;
@@ -238,7 +241,15 @@ mpmd_link_if_ctrl_udp::mpmd_link_if_ctrl_udp(const uhd::device_addr_t& mb_args,
try {
// If MTU discovery fails, we gracefully recover, but declare that
// link invalid.
- _mtu = std::min(_mtu, discover_mtu_for_ip(ip_addr));
+ auto& info = _udp_info.at(ip_addr);
+ if (info.link_type == "internal") {
+ UHD_LOG_TRACE("MPMD::XPORT::UDP",
+ "MTU for internal interface " << ip_addr << " is "
+ << std::to_string(info.if_mtu));
+ _mtu = std::min(_mtu, info.if_mtu);
+ } else {
+ _mtu = std::min(_mtu, discover_mtu_for_ip(ip_addr));
+ }
_available_addrs.push_back(ip_addr);
} catch (const uhd::exception& ex) {
UHD_LOG_WARNING("MPMD::XPORT::UDP",
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 ebe4f5db2..e4a0d7811 100644
--- a/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp
+++ b/host/lib/usrp/mpmd/mpmd_link_if_ctrl_udp.hpp
@@ -26,6 +26,8 @@ public:
{
std::string udp_port;
size_t link_rate;
+ std::string link_type;
+ size_t if_mtu;
};
using udp_link_info_map = std::unordered_map<std::string, udp_link_info_t>;
diff --git a/mpm/python/usrp_mpm/sys_utils/net.py b/mpm/python/usrp_mpm/sys_utils/net.py
index 56448c6c4..42eb9de62 100644
--- a/mpm/python/usrp_mpm/sys_utils/net.py
+++ b/mpm/python/usrp_mpm/sys_utils/net.py
@@ -71,6 +71,7 @@ def get_iface_info(ifname):
'ip_addrs': ip_addrs,
'link_speed': link_speed,
'bridge': is_bridge(link_info.get_attr('IFLA_LINKINFO')),
+ 'mtu': link_info.get_attr('IFLA_MTU'),
}
diff --git a/mpm/python/usrp_mpm/xports/xportmgr_udp.py b/mpm/python/usrp_mpm/xports/xportmgr_udp.py
index 365e73e5d..e9168e898 100644
--- a/mpm/python/usrp_mpm/xports/xportmgr_udp.py
+++ b/mpm/python/usrp_mpm/xports/xportmgr_udp.py
@@ -186,7 +186,9 @@ class XportMgrUDP:
{
'ipv4': str(iface_info['ip_addr']),
'port': str(self.chdr_port),
- 'link_rate': str(int(iface_info['link_speed'] * 1e6 / 8))
+ 'link_rate': str(int(iface_info['link_speed'] * 1e6 / 8)),
+ 'type': str(self.iface_config[iface_name]['type']),
+ 'mtu': str(iface_info['mtu'])
}
for iface_name, iface_info in iteritems(self._chdr_ifaces)
]