aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mpmd/mpmd_mb_iface.cpp
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2019-12-12 10:29:11 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2019-12-20 16:32:22 -0800
commit691f191a1ea1a8d655976c9f7b9fdfe7b4b36a41 (patch)
treecfa48579158488852d8a7832da1cda14d7904373 /host/lib/usrp/mpmd/mpmd_mb_iface.cpp
parentcb400696bf2fbe82eea0f38d04a1771ccf6fd868 (diff)
downloaduhd-691f191a1ea1a8d655976c9f7b9fdfe7b4b36a41.tar.gz
uhd-691f191a1ea1a8d655976c9f7b9fdfe7b4b36a41.tar.bz2
uhd-691f191a1ea1a8d655976c9f7b9fdfe7b4b36a41.zip
transport,usrp: Make available packet-based flow control
DPDK provides a fixed number of fixed-size buffers for the receive window, so it needs packet-based flow control to avoid dropping packets. This change enables counting by packets. Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Diffstat (limited to 'host/lib/usrp/mpmd/mpmd_mb_iface.cpp')
-rw-r--r--host/lib/usrp/mpmd/mpmd_mb_iface.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_mb_iface.cpp b/host/lib/usrp/mpmd/mpmd_mb_iface.cpp
index cb779f635..b474dfdc3 100644
--- a/host/lib/usrp/mpmd/mpmd_mb_iface.cpp
+++ b/host/lib/usrp/mpmd/mpmd_mb_iface.cpp
@@ -167,7 +167,7 @@ uhd::rfnoc::chdr_ctrl_xport::sptr mpmd_mboard_impl::mpmd_mb_iface::make_ctrl_tra
const size_t link_idx = _local_device_id_map.at(local_device_id);
uhd::transport::send_link_if::sptr send_link;
uhd::transport::recv_link_if::sptr recv_link;
- std::tie(send_link, std::ignore, recv_link, std::ignore, std::ignore) =
+ std::tie(send_link, std::ignore, recv_link, std::ignore, std::ignore, std::ignore) =
_link_if_mgr->get_link(
link_idx, uhd::transport::link_type_t::CTRL, uhd::device_addr_t());
@@ -209,25 +209,30 @@ mpmd_mboard_impl::mpmd_mb_iface::make_rx_data_transport(
uhd::transport::send_link_if::sptr send_link;
uhd::transport::recv_link_if::sptr recv_link;
- bool lossy_xport;
+ bool lossy_xport, packet_fc;
size_t recv_buff_size;
- std::tie(send_link, std::ignore, recv_link, recv_buff_size, lossy_xport) =
+ std::tie(send_link, std::ignore, recv_link, recv_buff_size, lossy_xport, packet_fc) =
_link_if_mgr->get_link(
link_idx, uhd::transport::link_type_t::RX_DATA, xport_args);
/* Associate local device ID with the adapter */
_adapter_map[local_sep_addr.first] = send_link->get_send_adapter_id();
- // TODO: configure this based on the transport type
- const stream_buff_params_t recv_capacity = {
- recv_buff_size, uhd::rfnoc::MAX_FC_CAPACITY_PKTS};
+ const uhd::rfnoc::stream_buff_params_t recv_capacity = {recv_buff_size,
+ packet_fc ? static_cast<uint32_t>(recv_link->get_num_recv_frames())
+ : uhd::rfnoc::MAX_FC_CAPACITY_PKTS};
const double ratio = 1.0 / 32;
- // Configure flow control frequency to use bytes only for UDP
- stream_buff_params_t fc_freq = {
- static_cast<uint64_t>(std::ceil(double(recv_buff_size) * ratio)),
- uhd::rfnoc::MAX_FC_FREQ_PKTS};
+ // 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))};
+ } else {
+ fc_freq = {static_cast<uint64_t>(std::ceil(double(recv_buff_size) * ratio)),
+ uhd::rfnoc::MAX_FC_FREQ_PKTS};
+ }
stream_buff_params_t fc_headroom = {0, 0};
@@ -293,7 +298,7 @@ mpmd_mboard_impl::mpmd_mb_iface::make_tx_data_transport(
uhd::transport::send_link_if::sptr send_link;
uhd::transport::recv_link_if::sptr recv_link;
bool lossy_xport;
- std::tie(send_link, std::ignore, recv_link, std::ignore, lossy_xport) =
+ std::tie(send_link, std::ignore, recv_link, std::ignore, lossy_xport, std::ignore) =
_link_if_mgr->get_link(
link_idx, uhd::transport::link_type_t::TX_DATA, xport_args);