diff options
author | michael-west <michael.west@ettus.com> | 2019-01-18 18:42:36 -0800 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2019-01-21 16:53:03 -0800 |
commit | 86932606e3fe6b7ec89183e7f63252148047ad42 (patch) | |
tree | d87946fb0e297e379ea48f4eeb9b863d330f317b /host | |
parent | f25e807f7862b02ede02547424ee11d414279ed9 (diff) | |
download | uhd-86932606e3fe6b7ec89183e7f63252148047ad42.tar.gz uhd-86932606e3fe6b7ec89183e7f63252148047ad42.tar.bz2 uhd-86932606e3fe6b7ec89183e7f63252148047ad42.zip |
transport: muxed_zero_copy_if fixes
Changed muxed_zero_copy_if to make each stream buffer the same number
of frames as the underlying transport and changed the size of the
underlying control transport for X300 and MPMD devices to match the
size of the command FIFO in order to prevent starvation of any single
control transport. Added some constants to remove hard coded values.
Signed-off-by: michael-west <michael.west@ettus.com>
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/rfnoc/constants.hpp | 4 | ||||
-rw-r--r-- | host/lib/rfnoc/ctrl_iface.cpp | 2 | ||||
-rw-r--r-- | host/lib/transport/muxed_zero_copy_if.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/mpmd/mpmd_xport_ctrl_liberio.cpp | 37 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_impl.cpp | 4 |
5 files changed, 22 insertions, 29 deletions
diff --git a/host/include/uhd/rfnoc/constants.hpp b/host/include/uhd/rfnoc/constants.hpp index 53a4a01d8..3e67a3cae 100644 --- a/host/include/uhd/rfnoc/constants.hpp +++ b/host/include/uhd/rfnoc/constants.hpp @@ -83,12 +83,16 @@ static const uint32_t AXIS_CONFIG_BUS_TLAST = AXI_WRAPPER_BASE + 2; // tdata with tvalid & tlast asserted static const size_t CMD_FIFO_SIZE = 256; // Lines == multiples of 8 bytes +static const size_t MAX_CMD_PKT_SIZE = 3; // Lines == multiples of 8 bytes // Named settings registers static const uhd::dict<std::string, uint32_t> DEFAULT_NAMED_SR = boost::assign::map_list_of("AXIS_CONFIG_BUS", AXIS_CONFIG_BUS)( "AXIS_CONFIG_BUS_TLAST", AXIS_CONFIG_BUS_TLAST); +// Blocks +static const size_t MAX_NUM_BLOCKS = 16; + // Block ports static const size_t ANY_PORT = size_t(~0); static const size_t MAX_NUM_PORTS = 16; diff --git a/host/lib/rfnoc/ctrl_iface.cpp b/host/lib/rfnoc/ctrl_iface.cpp index 6204d81f4..e0fc03eab 100644 --- a/host/lib/rfnoc/ctrl_iface.cpp +++ b/host/lib/rfnoc/ctrl_iface.cpp @@ -36,7 +36,7 @@ public: , _name(name) , _seq_out(0) , _max_outstanding_acks( - uhd::rfnoc::CMD_FIFO_SIZE / 3) // Max command packet size is 3 lines + uhd::rfnoc::CMD_FIFO_SIZE / uhd::rfnoc::MAX_CMD_PKT_SIZE) { UHD_ASSERT_THROW(bool(_xports.send)); UHD_ASSERT_THROW(bool(_xports.recv)); diff --git a/host/lib/transport/muxed_zero_copy_if.cpp b/host/lib/transport/muxed_zero_copy_if.cpp index feaa43b70..a3ea4c40d 100644 --- a/host/lib/transport/muxed_zero_copy_if.cpp +++ b/host/lib/transport/muxed_zero_copy_if.cpp @@ -70,8 +70,8 @@ public: stream_impl::sptr stream = boost::make_shared<stream_impl>(this->shared_from_this(), stream_num, - _base_xport->get_num_send_frames() / _max_num_streams, - _base_xport->get_num_recv_frames() / _max_num_streams); + _base_xport->get_num_send_frames(), + _base_xport->get_num_recv_frames()); _streams[stream_num] = stream; return stream; } diff --git a/host/lib/usrp/mpmd/mpmd_xport_ctrl_liberio.cpp b/host/lib/usrp/mpmd/mpmd_xport_ctrl_liberio.cpp index 85d83abc1..d2f36bba3 100644 --- a/host/lib/usrp/mpmd/mpmd_xport_ctrl_liberio.cpp +++ b/host/lib/usrp/mpmd/mpmd_xport_ctrl_liberio.cpp @@ -8,6 +8,7 @@ #include "../transport/liberio_zero_copy.hpp" #include <uhd/transport/udp_zero_copy.hpp> #include <uhd/utils/byteswap.hpp> +#include <uhd/rfnoc/constants.hpp> using namespace uhd; using namespace uhd::mpmd::xport; @@ -61,6 +62,10 @@ uhd::both_xports_t mpmd_xport_ctrl_liberio::make_transport( if (xport_type == usrp::device3_impl::CTRL) { default_buff_args.send_frame_size = LIBERIO_CTRL_FRAME_MAX_SIZE; default_buff_args.recv_frame_size = LIBERIO_CTRL_FRAME_MAX_SIZE; + default_buff_args.num_recv_frames = uhd::rfnoc::CMD_FIFO_SIZE / + uhd::rfnoc::MAX_CMD_PKT_SIZE; + default_buff_args.num_send_frames = uhd::rfnoc::CMD_FIFO_SIZE / + uhd::rfnoc::MAX_CMD_PKT_SIZE; } else if (xport_type == usrp::device3_impl::ASYNC_MSG) { default_buff_args.send_frame_size = LIBERIO_ASYNC_FRAME_MAX_SIZE; default_buff_args.recv_frame_size = LIBERIO_ASYNC_FRAME_MAX_SIZE; @@ -78,25 +83,15 @@ uhd::both_xports_t mpmd_xport_ctrl_liberio::make_transport( xports.send_sid = sid_t(xport_info["send_sid"]); xports.recv_sid = xports.send_sid.reversed(); - // this is kinda ghetto: scale buffer for muxed xports since we share the - // buffer... - float divisor = 1; - if (xport_type == usrp::device3_impl::CTRL) - divisor = 16; - else if (xport_type == usrp::device3_impl::ASYNC_MSG) - divisor = 4; - - // if (xport_info["muxed"] == "True") { //// FIXME tbw //} if (xport_type == usrp::device3_impl::CTRL) { UHD_ASSERT_THROW(xport_info["muxed"] == "True"); if (not _ctrl_dma_xport) { - default_buff_args.send_frame_size = LIBERIO_CTRL_FRAME_MAX_SIZE; - default_buff_args.recv_frame_size = LIBERIO_CTRL_FRAME_MAX_SIZE; _ctrl_dma_xport = - make_muxed_liberio_xport(tx_dev, rx_dev, default_buff_args, int(divisor)); + make_muxed_liberio_xport(tx_dev, rx_dev, default_buff_args, + uhd::rfnoc::MAX_NUM_BLOCKS * uhd::rfnoc::MAX_NUM_PORTS); } UHD_LOGGER_TRACE("MPMD") @@ -105,10 +100,9 @@ uhd::both_xports_t mpmd_xport_ctrl_liberio::make_transport( } else if (xport_type == usrp::device3_impl::ASYNC_MSG) { UHD_ASSERT_THROW(xport_info["muxed"] == "True"); if (not _async_msg_dma_xport) { - default_buff_args.send_frame_size = LIBERIO_ASYNC_FRAME_MAX_SIZE; - default_buff_args.recv_frame_size = LIBERIO_ASYNC_FRAME_MAX_SIZE; _async_msg_dma_xport = - make_muxed_liberio_xport(tx_dev, rx_dev, default_buff_args, int(divisor)); + make_muxed_liberio_xport(tx_dev, rx_dev, default_buff_args, + uhd::rfnoc::MAX_NUM_BLOCKS * uhd::rfnoc::MAX_NUM_PORTS); } UHD_LOGGER_TRACE("MPMD") @@ -119,16 +113,11 @@ uhd::both_xports_t mpmd_xport_ctrl_liberio::make_transport( transport::liberio_zero_copy::make(tx_dev, rx_dev, default_buff_args); } - transport::udp_zero_copy::buff_params buff_params; - buff_params.recv_buff_size = float(default_buff_args.recv_frame_size) - * float(default_buff_args.num_recv_frames) / divisor; - buff_params.send_buff_size = float(default_buff_args.send_frame_size) - * float(default_buff_args.num_send_frames) / divisor; - - // Finish both_xports_t object and return: - xports.recv_buff_size = buff_params.recv_buff_size; - xports.send_buff_size = buff_params.send_buff_size; + xports.recv_buff_size = default_buff_args.recv_frame_size * + default_buff_args.num_recv_frames; + xports.send_buff_size = default_buff_args.send_frame_size * + default_buff_args.num_send_frames; xports.send = xports.recv; return xports; } diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index ed6678761..c42f8dece 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1256,8 +1256,8 @@ static uhd::transport::muxed_zero_copy_if::sptr make_muxed_pcie_msg_xport( zero_copy_xport_params buff_args; buff_args.send_frame_size = x300::PCIE_MSG_FRAME_SIZE; buff_args.recv_frame_size = x300::PCIE_MSG_FRAME_SIZE; - buff_args.num_send_frames = x300::PCIE_MSG_NUM_FRAMES * max_muxed_ports; - buff_args.num_recv_frames = x300::PCIE_MSG_NUM_FRAMES * max_muxed_ports; + buff_args.num_send_frames = x300::PCIE_MSG_NUM_FRAMES; + buff_args.num_recv_frames = x300::PCIE_MSG_NUM_FRAMES; zero_copy_if::sptr base_xport = nirio_zero_copy::make( rio_fpga_interface, dma_channel_num, buff_args, uhd::device_addr_t()); |