From 91e01c484475600fcd659bb433ab86efa5146426 Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Tue, 6 Aug 2019 18:32:29 -0700 Subject: rfnoc: Centralize initialization state of SEPs to epid_allocator Because the initialization state of SEPs is a graph-wide property, link_stream_managers and mgmt_portals cannot rely on their private members to determine if they can reset an SEP. Move the call to init SEPs into the epid_allocator, and have it call into a mgmt_portal to gain access to the SEP. Thus, link_stream_managers only request that an epid_allocator ensure an SEP is numbered and initialized, and they provide a path to communicate with the SEP. The epid_allocator will ensure init only happens once, so a stream currently running on another link_stream_manager does not get interrupted. This could happen, for example, if the OSTRM went to one device, and the ISTRM came from another. In general, EPIDs should only be assigned once. --- host/lib/rfnoc/link_stream_manager.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'host/lib/rfnoc/link_stream_manager.cpp') diff --git a/host/lib/rfnoc/link_stream_manager.cpp b/host/lib/rfnoc/link_stream_manager.cpp index b0e864347..a85ad2b4b 100644 --- a/host/lib/rfnoc/link_stream_manager.cpp +++ b/host/lib/rfnoc/link_stream_manager.cpp @@ -98,7 +98,8 @@ public: _ensure_ep_is_reachable(dst_addr); // Allocate EPIDs - sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr); + sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal, + *_ctrl_xport); // Make sure that the software side of the endpoint is initialized and reachable if (_ctrl_ep == nullptr) { @@ -108,7 +109,6 @@ public: } // Setup a route to the EPID - _mgmt_portal->initialize_endpoint(*_ctrl_xport, dst_addr, dst_epid); _mgmt_portal->setup_local_route(*_ctrl_xport, dst_epid); if (!_mgmt_portal->get_endpoint_info(dst_epid).has_ctrl) { throw uhd::rfnoc_error( @@ -129,14 +129,13 @@ public: _ensure_ep_is_reachable(dst_addr); _ensure_ep_is_reachable(src_addr); - // Allocate EPIDs - sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr); - sep_id_t src_epid = _epid_alloc->allocate_epid(src_addr); - - // Initialize endpoints - _mgmt_portal->initialize_endpoint(*_ctrl_xport, dst_addr, dst_epid); - _mgmt_portal->initialize_endpoint(*_ctrl_xport, src_addr, src_epid); + // Allocate EPIDs and initialize endpoints + sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal, + *_ctrl_xport); + sep_id_t src_epid = _epid_alloc->allocate_epid(src_addr, *_mgmt_portal, + *_ctrl_xport); + // Set up routes _mgmt_portal->setup_remote_route(*_ctrl_xport, dst_epid, src_epid); return sep_id_pair_t(src_epid, dst_epid); @@ -221,8 +220,8 @@ public: _ensure_ep_is_reachable(dst_addr); // Generate a new destination (device) EPID instance - sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr); - _mgmt_portal->initialize_endpoint(*_ctrl_xport, dst_addr, dst_epid); + sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal, + *_ctrl_xport); if (!_mgmt_portal->get_endpoint_info(dst_epid).has_data) { throw uhd::rfnoc_error("Downstream endpoint does not support data traffic"); @@ -250,8 +249,8 @@ public: _ensure_ep_is_reachable(src_addr); // Generate a new source (device) EPID instance - sep_id_t src_epid = _epid_alloc->allocate_epid(src_addr); - _mgmt_portal->initialize_endpoint(*_ctrl_xport, src_addr, src_epid); + sep_id_t src_epid = _epid_alloc->allocate_epid(src_addr, *_mgmt_portal, + *_ctrl_xport); if (!_mgmt_portal->get_endpoint_info(src_epid).has_data) { throw uhd::rfnoc_error("Downstream endpoint does not support data traffic"); -- cgit v1.2.3