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/usrp/x300/x300_eth_mgr.cpp | 74 +++++++++++++------------------------ 1 file changed, 26 insertions(+), 48 deletions(-) (limited to 'host/lib/usrp/x300/x300_eth_mgr.cpp') diff --git a/host/lib/usrp/x300/x300_eth_mgr.cpp b/host/lib/usrp/x300/x300_eth_mgr.cpp index 8ff63b050..7177032c6 100644 --- a/host/lib/usrp/x300/x300_eth_mgr.cpp +++ b/host/lib/usrp/x300/x300_eth_mgr.cpp @@ -19,8 +19,9 @@ #include #include #include -#include +#include #include +#include #include //#ifdef HAVE_DPDK //# include @@ -287,53 +288,32 @@ both_links_t eth_manager::get_links(link_type_t link_type, // Buffering is done in the socket buffers, so size them relative to // the link rate - default_buff_args.send_buff_size = conn.link_rate / 50; // 20ms - default_buff_args.recv_buff_size = std::max(conn.link_rate / 50, - ETH_MSG_NUM_FRAMES * ETH_MSG_FRAME_SIZE); // enough to hold greater of 20ms or - // number of msg frames + link_params_t default_link_params; // There is no need for more than 1 send and recv frame since the // buffering is done in the socket buffers - default_buff_args.num_send_frames = 1; // or 2? - default_buff_args.num_recv_frames = 1; - if (link_type == link_type_t::CTRL) { - // Increasing number of recv frames here because ctrl_iface uses it - // to determine how many control packets can be in flight before it - // must wait for an ACK - // FIXME this is no longer true, find a good value - default_buff_args.num_recv_frames = 85; // 256/3 - } else if (link_type == link_type_t::TX_DATA) { - size_t default_frame_size = conn.link_rate == MAX_RATE_1GIGE - ? GE_DATA_FRAME_SEND_SIZE - : XGE_DATA_FRAME_SEND_SIZE; - default_buff_args.send_frame_size = link_args.cast( - "send_frame_size", std::min(default_frame_size, send_mtu)); - default_buff_args.num_send_frames = link_args.cast( - "num_send_frames", default_buff_args.num_send_frames); - default_buff_args.send_buff_size = link_args.cast( - "send_buff_size", default_buff_args.send_buff_size); - } else if (link_type == link_type_t::RX_DATA) { - size_t default_frame_size = conn.link_rate == MAX_RATE_1GIGE - ? GE_DATA_FRAME_RECV_SIZE - : XGE_DATA_FRAME_RECV_SIZE; - default_buff_args.recv_frame_size = link_args.cast( - "recv_frame_size", std::min(default_frame_size, recv_mtu)); - // set some buffers so the offload thread actually offloads the - // socket I/O - default_buff_args.num_recv_frames = - link_args.cast("num_recv_frames", 2); - default_buff_args.recv_buff_size = link_args.cast( - "recv_buff_size", default_buff_args.recv_buff_size); - } + default_link_params.num_send_frames = 1; // or 2? + default_link_params.num_recv_frames = 2; + default_link_params.send_frame_size = conn.link_rate == MAX_RATE_1GIGE + ? GE_DATA_FRAME_SEND_SIZE + : XGE_DATA_FRAME_SEND_SIZE; + default_link_params.recv_frame_size = conn.link_rate == MAX_RATE_1GIGE + ? GE_DATA_FRAME_RECV_SIZE + : XGE_DATA_FRAME_RECV_SIZE; + default_link_params.send_buff_size = conn.link_rate / 50; + default_link_params.recv_buff_size = std::max(conn.link_rate / 50, + ETH_MSG_NUM_FRAMES * ETH_MSG_FRAME_SIZE); // enough to hold greater of 20 ms or + // number of msg frames + + link_params_t link_params = calculate_udp_link_params(link_type, + get_mtu(uhd::TX_DIRECTION), + get_mtu(uhd::RX_DIRECTION), + default_link_params, + _args.get_orig_args(), + link_args); - /* FIXME: Should have common infrastructure for creating I/O services */ - auto io_srv = uhd::transport::inline_io_service::make(); - link_params_t link_params; - link_params.num_recv_frames = default_buff_args.num_recv_frames; - link_params.num_send_frames = default_buff_args.num_send_frames; - link_params.recv_frame_size = default_buff_args.recv_frame_size; - link_params.send_frame_size = default_buff_args.send_frame_size; - link_params.recv_buff_size = default_buff_args.recv_buff_size; - link_params.send_buff_size = default_buff_args.send_buff_size; + // Enforce a minimum bound of the number of receive and send frames. + link_params.num_send_frames = std::max(uhd::rfnoc::MIN_NUM_FRAMES, link_params.num_send_frames); + link_params.num_recv_frames = std::max(uhd::rfnoc::MIN_NUM_FRAMES, link_params.num_recv_frames); size_t recv_buff_size, send_buff_size; auto link = uhd::transport::udp_boost_asio_link::make(conn.addr, @@ -341,9 +321,7 @@ both_links_t eth_manager::get_links(link_type_t link_type, link_params, recv_buff_size, send_buff_size); - io_srv->attach_send_link(link); - io_srv->attach_recv_link(link); - return std::make_tuple(io_srv, link, send_buff_size, link, recv_buff_size, true); + return std::make_tuple(link, send_buff_size, link, recv_buff_size, true); } /****************************************************************************** -- cgit v1.2.3