From 0bd233e64210c6605e8a6ec1424fa81f9ea8a681 Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Thu, 17 Oct 2019 08:44:11 -0500 Subject: uhd: Introduce I/O service manager - Implement I/O service detach link methods - The I/O service manager instantiates new I/O services or connects links to existing I/O services based on options provided by the user in stream_args. - Add a streamer ID parameter to methods to create transports so that the I/O service manager can group transports appropriately when using offload threads. - Change X300 and MPMD to use I/O service manager to connect links to I/O services. - There is now a single I/O service manager per rfnoc_graph (and it is also stored in the graph) - The I/O service manager now also knows the device args for the rfnoc_graph it was created with, and can make decisions based upon those (e.g, use a specific I/O service for DPDK, share cores between streamers, etc.) - The I/O Service Manager does not get any decision logic with this commit, though - The MB ifaces for mpmd and x300 now access this global I/O service manager - Add configuration of link parameters with overrides Co-Authored-By: Martin Braun Co-Authored-By: Aaron Rossetto --- host/lib/rfnoc/graph_stream_manager.cpp | 10 ++++++---- host/lib/rfnoc/link_stream_manager.cpp | 12 ++++++++---- host/lib/rfnoc/rfnoc_graph.cpp | 21 ++++++++++++++++++--- 3 files changed, 32 insertions(+), 11 deletions(-) (limited to 'host/lib/rfnoc') diff --git a/host/lib/rfnoc/graph_stream_manager.cpp b/host/lib/rfnoc/graph_stream_manager.cpp index dba913998..f8acab9f2 100644 --- a/host/lib/rfnoc/graph_stream_manager.cpp +++ b/host/lib/rfnoc/graph_stream_manager.cpp @@ -189,7 +189,8 @@ public: const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, const uhd::transport::adapter_id_t adapter, - const device_addr_t& xport_args) + const device_addr_t& xport_args, + const std::string& streamer_id) { device_id_t dev = _check_dst_and_find_src( src_addr, adapter, uhd::transport::link_type_t::RX_DATA); @@ -198,7 +199,7 @@ public: allocs.rx++; _alloc_map[chosen] = allocs; return _link_mgrs.at(dev)->create_device_to_host_data_stream( - src_addr, pyld_buff_fmt, mdata_buff_fmt, xport_args); + src_addr, pyld_buff_fmt, mdata_buff_fmt, xport_args, streamer_id); } virtual chdr_tx_data_xport::uptr create_host_to_device_data_stream( @@ -206,7 +207,8 @@ public: const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, const uhd::transport::adapter_id_t adapter, - const device_addr_t& xport_args) + const device_addr_t& xport_args, + const std::string& streamer_id) { device_id_t dev = _check_dst_and_find_src( dst_addr, adapter, uhd::transport::link_type_t::TX_DATA); @@ -215,7 +217,7 @@ public: allocs.tx++; _alloc_map[chosen] = allocs; return _link_mgrs.at(dev)->create_host_to_device_data_stream( - dst_addr, pyld_buff_fmt, mdata_buff_fmt, xport_args); + dst_addr, pyld_buff_fmt, mdata_buff_fmt, xport_args, streamer_id); } std::vector get_adapters(sep_addr_t addr) const diff --git a/host/lib/rfnoc/link_stream_manager.cpp b/host/lib/rfnoc/link_stream_manager.cpp index c0d79c519..59b80b59e 100644 --- a/host/lib/rfnoc/link_stream_manager.cpp +++ b/host/lib/rfnoc/link_stream_manager.cpp @@ -222,7 +222,8 @@ public: const sep_addr_t dst_addr, const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, - const device_addr_t& xport_args) + const device_addr_t& xport_args, + const std::string& streamer_id) { _ensure_ep_is_reachable(dst_addr); @@ -244,14 +245,16 @@ public: {src_epid, dst_epid}, pyld_buff_fmt, mdata_buff_fmt, - xport_args); + xport_args, + streamer_id); } virtual chdr_rx_data_xport::uptr create_device_to_host_data_stream( sep_addr_t src_addr, const sw_buff_t pyld_buff_fmt, const sw_buff_t mdata_buff_fmt, - const device_addr_t& xport_args) + const device_addr_t& xport_args, + const std::string& streamer_id) { _ensure_ep_is_reachable(src_addr); @@ -273,7 +276,8 @@ public: {src_epid, dst_epid}, pyld_buff_fmt, mdata_buff_fmt, - xport_args); + xport_args, + streamer_id); } private: diff --git a/host/lib/rfnoc/rfnoc_graph.cpp b/host/lib/rfnoc/rfnoc_graph.cpp index 929ce518d..6ebfe8612 100644 --- a/host/lib/rfnoc/rfnoc_graph.cpp +++ b/host/lib/rfnoc/rfnoc_graph.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,7 @@ public: _graph(std::make_unique()) { _mb_controllers.reserve(_num_mboards); // Now initialize all subsystems: + _init_io_srv_mgr(dev_addr); // Global I/O Service Manager _init_mb_controllers(); _init_gsm(); // Graph Stream Manager try { @@ -252,11 +254,12 @@ public: pyld_fmt, mdata_fmt, adapter_id, - rfnoc_streamer->get_stream_args().args); + rfnoc_streamer->get_stream_args().args, + rfnoc_streamer->get_unique_id()); rfnoc_streamer->connect_channel(strm_port, std::move(xport)); - //// If this worked, then also connect the streamer in the BGL graph + // If this worked, then also connect the streamer in the BGL graph auto dst = get_block(dst_blk); graph_edge_t edge_info(strm_port, dst_port, graph_edge_t::TX_STREAM, true); _graph->connect(rfnoc_streamer.get(), dst.get(), edge_info); @@ -308,7 +311,8 @@ public: pyld_fmt, mdata_fmt, adapter_id, - rfnoc_streamer->get_stream_args().args); + rfnoc_streamer->get_stream_args().args, + rfnoc_streamer->get_unique_id()); rfnoc_streamer->connect_channel(strm_port, std::move(xport)); @@ -457,6 +461,14 @@ private: /************************************************************************** * Device Setup *************************************************************************/ + void _init_io_srv_mgr(const uhd::device_addr_t& dev_addr) + { + _io_srv_mgr = usrp::io_service_mgr::make(dev_addr); + for (size_t mb_idx = 0; mb_idx < _num_mboards; mb_idx++) { + _device->get_mb_iface(mb_idx).set_io_srv_mgr(_io_srv_mgr); + } + } + void _init_mb_controllers() { UHD_LOG_TRACE(LOG_ID, "Initializing MB controllers..."); @@ -834,6 +846,9 @@ private: // easy lookups. size_t _num_mboards; + //! Reference to the global I/O Service Manager + uhd::usrp::io_service_mgr::sptr _io_srv_mgr; + //! Registry for the blocks (it's a separate class) std::unique_ptr _block_registry; -- cgit v1.2.3