From ac025ebf40ad9ab6cb9945e25bad87016ae77128 Mon Sep 17 00:00:00 2001 From: michael-west Date: Wed, 30 Jan 2019 15:37:57 -0800 Subject: RFNoC: Limit number of control packets in flight Limit number of unacknowledged control packets to the number of receive frames in the transport to prevent the transport from getting locked up or being overrun by ACK packets. Signed-off-by: michael-west --- host/lib/usrp/x300/x300_impl.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp/x300') diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp index d912d66c3..24ce7abf4 100644 --- a/host/lib/usrp/x300/x300_impl.cpp +++ b/host/lib/usrp/x300/x300_impl.cpp @@ -1372,12 +1372,24 @@ uhd::both_xports_t x300_impl::make_transport(const uhd::sid_t& address, std::min(system_max_send_frame_size, x300::ETH_MSG_FRAME_SIZE); default_buff_args.recv_frame_size = std::min(system_max_recv_frame_size, x300::ETH_MSG_FRAME_SIZE); + // 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, x300::ETH_MSG_NUM_FRAMES * x300::ETH_MSG_FRAME_SIZE); // enough to hold greater of 20ms or number // of msg frames - if (xport_type == TX_DATA) { + // 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; + default_buff_args.num_recv_frames = 1; + if (xport_type == 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 + default_buff_args.num_recv_frames = + uhd::rfnoc::CMD_FIFO_SIZE / uhd::rfnoc::MAX_CMD_PKT_SIZE; + } else if (xport_type == TX_DATA) { size_t default_frame_size = conn.link_rate == x300::MAX_RATE_1GIGE ? x300::GE_DATA_FRAME_SEND_SIZE : x300::XGE_DATA_FRAME_SEND_SIZE; -- cgit v1.2.3