aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/chdr_rx_data_xport.cpp
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2020-07-07 13:37:25 -0700
committerAaron Rossetto <aaron.rossetto@ni.com>2020-08-04 15:41:07 -0500
commitd7c64eb4b13670dbc5728f994e70dca60616af63 (patch)
tree706844126fe06450e8f262ef1b48dedbe14680de /host/lib/rfnoc/chdr_rx_data_xport.cpp
parent6d4c07d09ad54155df7ed374e7fbfebd9d40758b (diff)
downloaduhd-d7c64eb4b13670dbc5728f994e70dca60616af63.tar.gz
uhd-d7c64eb4b13670dbc5728f994e70dca60616af63.tar.bz2
uhd-d7c64eb4b13670dbc5728f994e70dca60616af63.zip
RFNoC: Add xport disconnect callbacks
Transports were not disconnecting their links from the I/O service upon destruction, leaving behind inaccessible send and recv links used by nothing. This led to I/O errors after creating several transports. Added callbacks to transports to automatically disconnect their links from the I/O service when the transport is destroyed. Updated all callers to supply a disconnect callback. Signed-off-by: michael-west <michael.west@ettus.com>
Diffstat (limited to 'host/lib/rfnoc/chdr_rx_data_xport.cpp')
-rw-r--r--host/lib/rfnoc/chdr_rx_data_xport.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/host/lib/rfnoc/chdr_rx_data_xport.cpp b/host/lib/rfnoc/chdr_rx_data_xport.cpp
index d4476d54f..74b310fa1 100644
--- a/host/lib/rfnoc/chdr_rx_data_xport.cpp
+++ b/host/lib/rfnoc/chdr_rx_data_xport.cpp
@@ -36,11 +36,13 @@ chdr_rx_data_xport::chdr_rx_data_xport(uhd::transport::io_service::sptr io_srv,
const chdr::chdr_packet_factory& pkt_factory,
const uhd::rfnoc::sep_id_pair_t& epids,
const size_t num_recv_frames,
- const fc_params_t& fc_params)
+ const fc_params_t& fc_params,
+ disconnect_callback_t disconnect)
: _fc_state(epids, fc_params.freq)
, _fc_sender(pkt_factory, epids)
, _epid(epids.second)
, _chdr_w_bytes(chdr_w_to_bits(pkt_factory.get_chdr_w()) / 8)
+ , _disconnect(disconnect)
{
UHD_LOG_TRACE("XPORT::RX_DATA_XPORT",
"Creating rx xport with local epid=" << epids.second
@@ -87,6 +89,9 @@ chdr_rx_data_xport::~chdr_rx_data_xport()
{
// Release recv_io before allowing members needed by callbacks be destroyed
_recv_io.reset();
+
+ // Disconnect the links
+ _disconnect();
}
chdr_rx_data_xport::fc_params_t chdr_rx_data_xport::configure_sep(io_service::sptr io_srv,
@@ -100,7 +105,8 @@ chdr_rx_data_xport::fc_params_t chdr_rx_data_xport::configure_sep(io_service::sp
const stream_buff_params_t& recv_capacity,
const stream_buff_params_t& fc_freq,
const stream_buff_params_t& fc_headroom,
- const bool lossy_xport)
+ const bool lossy_xport,
+ disconnect_callback_t disconnect)
{
const sep_id_t remote_epid = epids.first;
const sep_id_t local_epid = epids.second;
@@ -166,7 +172,8 @@ chdr_rx_data_xport::fc_params_t chdr_rx_data_xport::configure_sep(io_service::sp
pkt_factory,
local_epid,
1, // num_send_frames
- 1); // num_recv_frames
+ 1, // num_recv_frames
+ disconnect);
// Setup a route to the EPID
// Note that this may be gratuitous--The endpoint may already have been set up