diff options
-rw-r--r-- | host/lib/include/uhdlib/transport/link_if.hpp | 18 | ||||
-rw-r--r-- | host/lib/include/uhdlib/transport/nirio_link.hpp | 18 | ||||
-rw-r--r-- | host/lib/usrp/common/io_service_mgr.cpp | 34 |
3 files changed, 69 insertions, 1 deletions
diff --git a/host/lib/include/uhdlib/transport/link_if.hpp b/host/lib/include/uhdlib/transport/link_if.hpp index 6f533603e..55755948c 100644 --- a/host/lib/include/uhdlib/transport/link_if.hpp +++ b/host/lib/include/uhdlib/transport/link_if.hpp @@ -57,6 +57,15 @@ public: */ virtual adapter_id_t get_send_adapter_id() const = 0; + /*! + * Returns whether this link type supports releasing the frame buffers + * in an order different from that in which they were acquired. + */ + virtual bool supports_send_buff_out_of_order() const + { + return true; + } + send_link_if() = default; send_link_if(const send_link_if&) = delete; send_link_if& operator=(const send_link_if&) = delete; @@ -102,6 +111,15 @@ public: */ virtual adapter_id_t get_recv_adapter_id() const = 0; + /*! + * Returns whether this link type supports releasing the frame buffers + * in an order different from that in which they were acquired. + */ + virtual bool supports_recv_buff_out_of_order() const + { + return true; + } + recv_link_if() = default; recv_link_if(const recv_link_if&) = delete; recv_link_if& operator=(const recv_link_if&) = delete; diff --git a/host/lib/include/uhdlib/transport/nirio_link.hpp b/host/lib/include/uhdlib/transport/nirio_link.hpp index 055874146..2335e311c 100644 --- a/host/lib/include/uhdlib/transport/nirio_link.hpp +++ b/host/lib/include/uhdlib/transport/nirio_link.hpp @@ -104,6 +104,24 @@ public: return _adapter_id; } + /*! + * Returns whether this link type supports releasing the frame buffers + * in an order different from that in which they were acquired. + */ + bool supports_send_buff_out_of_order() const + { + return false; + } + + /*! + * Returns whether this link type supports releasing the frame buffers + * in an order different from that in which they were acquired. + */ + bool supports_recv_buff_out_of_order() const + { + return false; + } + private: using recv_link_base_t = recv_link_base<nirio_link>; using send_link_base_t = send_link_base<nirio_link>; diff --git a/host/lib/usrp/common/io_service_mgr.cpp b/host/lib/usrp/common/io_service_mgr.cpp index c00f36a25..437d77423 100644 --- a/host/lib/usrp/common/io_service_mgr.cpp +++ b/host/lib/usrp/common/io_service_mgr.cpp @@ -435,6 +435,9 @@ private: }; using link_pair_t = std::pair<recv_link_if::sptr, send_link_if::sptr>; + bool _out_of_order_supported( + recv_link_if::sptr recv_link, send_link_if::sptr send_link) const; + const uhd::device_addr_t _args; inline_io_service_mgr _inline_io_srv_mgr; @@ -453,12 +456,19 @@ io_service_mgr::sptr io_service_mgr::make(const uhd::device_addr_t& args) io_service::sptr io_service_mgr_impl::connect_links(recv_link_if::sptr recv_link, send_link_if::sptr send_link, const link_type_t link_type, - const io_service_args_t& default_args, + const io_service_args_t& default_args_, const uhd::device_addr_t& stream_args, const std::string& streamer_id) { UHD_ASSERT_THROW(link_type != link_type_t::ASYNC_MSG); + io_service_args_t default_args = default_args_; + + if (!_out_of_order_supported(recv_link, send_link)) { + default_args.recv_offload = false; + default_args.send_offload = false; + } + const io_service_args_t args = read_io_service_args( merge_io_service_dev_args(_args, stream_args), default_args); @@ -498,6 +508,15 @@ io_service::sptr io_service_mgr_impl::connect_links(recv_link_if::sptr recv_link } } + // If the link doesn't support buffers out of order, then we can only use + // the inline I/O service. Warn if a different one was requested. + if (!_out_of_order_supported(recv_link, send_link)) { + if (io_srv_type != INLINE_IO_SRV) { + UHD_LOG_WARNING(LOG_ID, "Link type does not support send/recv offload, ignoring"); + } + io_srv_type = INLINE_IO_SRV; + } + switch (io_srv_type) { case INLINE_IO_SRV: io_srv = _inline_io_srv_mgr.connect_links(recv_link, send_link); @@ -541,4 +560,17 @@ void io_service_mgr_impl::disconnect_links( _link_info_map.erase(it); } +bool io_service_mgr_impl::_out_of_order_supported( + recv_link_if::sptr recv_link, send_link_if::sptr send_link) const +{ + bool supported = true; + if (recv_link) { + supported = recv_link->supports_recv_buff_out_of_order(); + } + if (send_link) { + supported = supported && send_link->supports_send_buff_out_of_order(); + } + return supported; +} + }} // namespace uhd::usrp |