diff options
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r-- | host/lib/usrp/x300/x300_eth_mgr.cpp | 17 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_mb_iface.cpp | 70 | ||||
-rw-r--r-- | host/lib/usrp/x300/x300_pcie_mgr.cpp | 12 |
3 files changed, 69 insertions, 30 deletions
diff --git a/host/lib/usrp/x300/x300_eth_mgr.cpp b/host/lib/usrp/x300/x300_eth_mgr.cpp index f428fc98e..dcc8195ae 100644 --- a/host/lib/usrp/x300/x300_eth_mgr.cpp +++ b/host/lib/usrp/x300/x300_eth_mgr.cpp @@ -20,6 +20,7 @@ #include <uhd/transport/udp_zero_copy.hpp> #include <uhd/utils/algorithm.hpp> #include <uhd/utils/byteswap.hpp> +#include <uhd/utils/cast.hpp> #include <uhdlib/rfnoc/device_id.hpp> #include <uhdlib/rfnoc/rfnoc_common.hpp> #include <uhdlib/transport/udp_boost_asio_link.hpp> @@ -227,6 +228,10 @@ both_links_t eth_manager::get_links(link_type_t link_type, x300_eth_conn_t conn = eth_conns[local_device_id]; zero_copy_xport_params default_buff_args; + const bool enable_fc = not link_args.has_key("enable_fc") + || uhd::cast::from_str<bool>(link_args.get("enable_fc")); + const bool lossy_xport = enable_fc; + const size_t send_mtu = get_mtu(uhd::TX_DIRECTION); const size_t recv_mtu = get_mtu(uhd::RX_DIRECTION); @@ -278,8 +283,9 @@ both_links_t eth_manager::get_links(link_type_t link_type, link_params.send_buff_size, link, link_params.recv_buff_size, + lossy_xport, true, - true); + enable_fc); #else UHD_LOG_WARNING("X300", "Cannot create DPDK transport, falling back to UDP"); #endif @@ -289,8 +295,13 @@ both_links_t eth_manager::get_links(link_type_t link_type, link_params, link_params.recv_buff_size, link_params.send_buff_size); - return std::make_tuple( - link, link_params.send_buff_size, link, link_params.recv_buff_size, true, false); + return std::make_tuple(link, + link_params.send_buff_size, + link, + link_params.recv_buff_size, + lossy_xport, + false, + enable_fc); } /****************************************************************************** diff --git a/host/lib/usrp/x300/x300_mb_iface.cpp b/host/lib/usrp/x300/x300_mb_iface.cpp index c89374f82..a351864df 100644 --- a/host/lib/usrp/x300/x300_mb_iface.cpp +++ b/host/lib/usrp/x300/x300_mb_iface.cpp @@ -98,12 +98,17 @@ uhd::rfnoc::chdr_ctrl_xport::sptr x300_impl::x300_mb_iface::make_ctrl_transport( send_link_if::sptr send_link; recv_link_if::sptr recv_link; bool lossy_xport; - std::tie(send_link, std::ignore, recv_link, std::ignore, lossy_xport, std::ignore) = - _conn_mgr->get_links(link_type_t::CTRL, - local_device_id, - local_epid, - uhd::rfnoc::sep_id_t(), - uhd::device_addr_t()); + std::tie(send_link, + std::ignore, + recv_link, + std::ignore, + lossy_xport, + std::ignore, + std::ignore) = _conn_mgr->get_links(link_type_t::CTRL, + local_device_id, + local_epid, + uhd::rfnoc::sep_id_t(), + uhd::device_addr_t()); /* Associate local device ID with the adapter */ _adapter_map[local_device_id] = send_link->get_send_adapter_id(); @@ -142,13 +147,18 @@ uhd::rfnoc::chdr_rx_data_xport::uptr x300_impl::x300_mb_iface::make_rx_data_tran send_link_if::sptr send_link; recv_link_if::sptr recv_link; size_t recv_buff_size; - bool lossy_xport, packet_fc; - std::tie(send_link, std::ignore, recv_link, recv_buff_size, lossy_xport, packet_fc) = - _conn_mgr->get_links(link_type_t::RX_DATA, - local_sep_addr.first, - local_epid, - remote_epid, - xport_args); + bool lossy_xport, packet_fc, enable_fc; + std::tie(send_link, + std::ignore, + recv_link, + recv_buff_size, + lossy_xport, + packet_fc, + enable_fc) = _conn_mgr->get_links(link_type_t::RX_DATA, + local_sep_addr.first, + local_epid, + remote_epid, + xport_args); /* Associate local device ID with the adapter */ _adapter_map[local_sep_addr.first] = send_link->get_send_adapter_id(); @@ -159,14 +169,19 @@ uhd::rfnoc::chdr_rx_data_xport::uptr x300_impl::x300_mb_iface::make_rx_data_tran const double ratio = 1.0 / 32; - // Configure flow control frequency to use either bytes only or packets only uhd::rfnoc::stream_buff_params_t fc_freq; - if (packet_fc) { - fc_freq = {uhd::rfnoc::MAX_FC_FREQ_BYTES, - static_cast<uint32_t>(std::ceil(recv_link->get_num_recv_frames() * ratio))}; + if (enable_fc) { + // Configure flow control frequency to use either bytes only or packets only + if (packet_fc) { + fc_freq = {uhd::rfnoc::MAX_FC_FREQ_BYTES, + static_cast<uint32_t>( + std::ceil(recv_link->get_num_recv_frames() * ratio))}; + } else { + fc_freq = {static_cast<uint64_t>(std::ceil(double(recv_buff_size) * ratio)), + uhd::rfnoc::MAX_FC_FREQ_PKTS}; + } } else { - fc_freq = {static_cast<uint64_t>(std::ceil(double(recv_buff_size) * ratio)), - uhd::rfnoc::MAX_FC_FREQ_PKTS}; + fc_freq = {0, 0}; } uhd::rfnoc::stream_buff_params_t fc_headroom = {0, 0}; @@ -235,12 +250,17 @@ uhd::rfnoc::chdr_tx_data_xport::uptr x300_impl::x300_mb_iface::make_tx_data_tran send_link_if::sptr send_link; recv_link_if::sptr recv_link; bool lossy_xport; - std::tie(send_link, std::ignore, recv_link, std::ignore, lossy_xport, std::ignore) = - _conn_mgr->get_links(link_type_t::TX_DATA, - local_sep_addr.first, - local_epid, - remote_epid, - xport_args); + std::tie(send_link, + std::ignore, + recv_link, + std::ignore, + lossy_xport, + std::ignore, + std::ignore) = _conn_mgr->get_links(link_type_t::TX_DATA, + local_sep_addr.first, + local_epid, + remote_epid, + xport_args); /* Associate local device ID with the adapter */ _adapter_map[local_sep_addr.first] = send_link->get_send_adapter_id(); diff --git a/host/lib/usrp/x300/x300_pcie_mgr.cpp b/host/lib/usrp/x300/x300_pcie_mgr.cpp index 0ca918e3c..64ce5df55 100644 --- a/host/lib/usrp/x300/x300_pcie_mgr.cpp +++ b/host/lib/usrp/x300/x300_pcie_mgr.cpp @@ -347,6 +347,9 @@ both_links_t pcie_manager::get_links(link_type_t link_type, + ", no such device associated with this motherboard!"); } + const bool enable_fc = not link_args.has_key("enable_fc") + || uhd::cast::from_str<bool>(link_args.get("enable_fc")); + const uint32_t dma_channel_num = allocate_pcie_dma_chan(remote_epid, link_type); // Note: The nirio_link object's factory has a lot of code for sanity // checking the link params, and merging the link_args with the default @@ -358,6 +361,11 @@ both_links_t pcie_manager::get_links(link_type_t link_type, auto link = nirio_link::make(_rio_fpga_interface, dma_channel_num, link_params, link_args, recv_buff_size, send_buff_size); - return std::make_tuple( - link, send_buff_size, link, recv_buff_size, false /*not lossy*/, false); + return std::make_tuple(link, + send_buff_size, + link, + recv_buff_size, + false /*not lossy*/, + false, + enable_fc); } |