diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-12-20 18:08:40 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:06:11 -0800 |
commit | a2d0b50bc61442b471fe1a724d61d336af961e21 (patch) | |
tree | 2068abeeec45cdd2944e4186614b4d672ddae8af | |
parent | 93c1b176ca7ef9a62b903ce1d942b94185db8a7c (diff) | |
download | uhd-a2d0b50bc61442b471fe1a724d61d336af961e21.tar.gz uhd-a2d0b50bc61442b471fe1a724d61d336af961e21.tar.bz2 uhd-a2d0b50bc61442b471fe1a724d61d336af961e21.zip |
mpmd: Expose get_mtu() API to mpmd_mboard_impl and to prop tree
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_impl.cpp | 31 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_impl.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_mboard_impl.cpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_xport_mgr.cpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_xport_mgr.hpp | 6 |
5 files changed, 50 insertions, 12 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp index 911b57558..7b4ca5bc8 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_impl.cpp @@ -204,6 +204,25 @@ namespace { ; } + /*** MTUs ***********************************************************/ + tree->create<size_t>(mb_path / "mtu/recv") + .add_coerced_subscriber([](const size_t){ + throw uhd::runtime_error( + "Attempting to write read-only value (MTU)!"); + }) + .set_publisher([mb](){ + return mb->get_mtu(uhd::RX_DIRECTION); + }) + ; + tree->create<size_t>(mb_path / "mtu/send") + .add_coerced_subscriber([](const size_t){ + throw uhd::runtime_error( + "Attempting to write read-only value (MTU)!"); + }) + .set_publisher([mb](){ + return mb->get_mtu(uhd::TX_DIRECTION); + }) + ; } void reset_time_synchronized(uhd::property_tree::sptr tree) @@ -389,20 +408,8 @@ mpmd_mboard_impl::uptr mpmd_impl::setup_mb( _tree->create<std::string>(mb_path / "connection") .set(mb->device_info.get("connection", "remote")); - // Do real MTU discovery (something similar like X300 but with MPM) - - _tree->create<size_t>(mb_path / "mtu/recv").set(1500); - _tree->create<size_t>(mb_path / "mtu/send").set(1500); _tree->create<size_t>(mb_path / "link_max_rate").set(1e9 / 8); - // query more information about FPGA/MPM - - - // Query time/clock sources on mboards/dboards - // Throw rpc calls with boost bind into the property tree? - - - // implicit move return mb; } diff --git a/host/lib/usrp/mpmd/mpmd_impl.hpp b/host/lib/usrp/mpmd/mpmd_impl.hpp index fe98b0329..50f533c99 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.hpp +++ b/host/lib/usrp/mpmd/mpmd_impl.hpp @@ -100,6 +100,8 @@ class mpmd_mboard_impl const uhd::device_addr_t& args ); + size_t get_mtu(const uhd::direction_t dir) const; + uhd::device_addr_t get_rx_hints() const; uhd::device_addr_t get_tx_hints() const; diff --git a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp index 1038be26d..501f7f701 100644 --- a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp @@ -194,6 +194,11 @@ uhd::both_xports_t mpmd_mboard_impl::make_transport( return xports; } +size_t mpmd_mboard_impl::get_mtu(const uhd::direction_t dir) const +{ + return _xport_mgr->get_mtu(dir); +} + uhd::device_addr_t mpmd_mboard_impl::get_rx_hints() const { // TODO: See if we need to do anything here. get_rx_stream() might care. diff --git a/host/lib/usrp/mpmd/mpmd_xport_mgr.cpp b/host/lib/usrp/mpmd/mpmd_xport_mgr.cpp index 0ca77c740..3d999c1ad 100644 --- a/host/lib/usrp/mpmd/mpmd_xport_mgr.cpp +++ b/host/lib/usrp/mpmd/mpmd_xport_mgr.cpp @@ -68,6 +68,24 @@ public: ); } + size_t get_mtu( + const uhd::direction_t dir + ) const { + if (_xport_ctrls.empty()) { + UHD_LOG_WARNING("MPMD", + "Cannot determine MTU, no transport controls have been " + "established!"); + return 0; + } + + size_t mtu = ~size_t(0); + for (const auto &xport_ctrl_pair : _xport_ctrls) { + mtu = std::min(mtu, xport_ctrl_pair.second->get_mtu(dir)); + } + + return mtu; + } + private: /************************************************************************** diff --git a/host/lib/usrp/mpmd/mpmd_xport_mgr.hpp b/host/lib/usrp/mpmd/mpmd_xport_mgr.hpp index cdb082111..44906c872 100644 --- a/host/lib/usrp/mpmd/mpmd_xport_mgr.hpp +++ b/host/lib/usrp/mpmd/mpmd_xport_mgr.hpp @@ -99,6 +99,12 @@ public: const uhd::device_addr_t& xport_args, xport_info_t& xport_info_out ) = 0; + + /*! Return the path MTU for whatever this manager lets us do + */ + virtual size_t get_mtu( + const uhd::direction_t dir + ) const = 0; }; }}} /* namespace uhd::mpmd::xport */ |