diff options
author | Alex Williams <alex.williams@ni.com> | 2019-08-06 18:32:29 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:36 -0800 |
commit | 91e01c484475600fcd659bb433ab86efa5146426 (patch) | |
tree | b551507190e7b230c9c81c4145283966b9a99a9a /host/lib/include/uhdlib | |
parent | 0fc57b99b9163d919cc4a470b3065ab4cf1c947d (diff) | |
download | uhd-91e01c484475600fcd659bb433ab86efa5146426.tar.gz uhd-91e01c484475600fcd659bb433ab86efa5146426.tar.bz2 uhd-91e01c484475600fcd659bb433ab86efa5146426.zip |
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.
Diffstat (limited to 'host/lib/include/uhdlib')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_types.hpp | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/epid_allocator.hpp | 13 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp | 15 |
3 files changed, 28 insertions, 2 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_types.hpp b/host/lib/include/uhdlib/rfnoc/chdr_types.hpp index 1f14ea7d0..b5725710b 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_types.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_types.hpp @@ -802,7 +802,7 @@ public: const std::string to_string() const; //! Return the source EPID for this transaction - inline const sep_id_t get_src_epid() const + inline sep_id_t get_src_epid() const { return _src_epid; } diff --git a/host/lib/include/uhdlib/rfnoc/epid_allocator.hpp b/host/lib/include/uhdlib/rfnoc/epid_allocator.hpp index ec23dcb50..8306b98a4 100644 --- a/host/lib/include/uhdlib/rfnoc/epid_allocator.hpp +++ b/host/lib/include/uhdlib/rfnoc/epid_allocator.hpp @@ -7,6 +7,7 @@ #ifndef INCLUDED_LIBUHD_EPID_ALLOCATOR_HPP #define INCLUDED_LIBUHD_EPID_ALLOCATOR_HPP +#include <uhdlib/rfnoc/mgmt_portal.hpp> #include <uhdlib/rfnoc/rfnoc_common.hpp> #include <map> #include <memory> @@ -27,12 +28,24 @@ public: epid_allocator(epid_allocator&& rhs) = delete; /*! \brief Allocate an EPID for the specified endpoint. + * Does not initialize the specified endpoint (ideal for SW endpoints). * * \param addr The physical address (device, instance) of the stream endpoint * \return The allocated EPID */ sep_id_t allocate_epid(const sep_addr_t& addr); + /*! \brief Allocate an EPID for the specified endpoint. + * Also initialize the specified endpoint. + * + * \param addr The physical address (device, instance) of the stream endpoint + * \param mgmt_portal The management portal to use for initializing the SEP/EPID + * \param chdr_ctrl_xport The ctrl xport to use for initializing the SEP/EPID + * \return The allocated EPID + */ + sep_id_t allocate_epid(const sep_addr_t& addr, mgmt::mgmt_portal& mgmt_portal, + chdr_ctrl_xport& xport); + /*! \brief Get a pre-allocated EPID. Throws an exception is not allocated * * \param addr The physical address (device, instance) of the stream endpoint diff --git a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp index 850cee460..9251634bd 100644 --- a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp +++ b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp @@ -8,6 +8,7 @@ #define INCLUDED_LIBUHD_MGMT_PORTAL_HPP #include <uhdlib/rfnoc/chdr_ctrl_xport.hpp> +#include <uhdlib/rfnoc/chdr_packet.hpp> #include <uhdlib/rfnoc/chdr_types.hpp> #include <memory> #include <set> @@ -55,6 +56,8 @@ public: //! Initialize a stream endpoint and assign an endpoint ID to it // + // This should only be called by the epid_allocator + // // \param xport The host stream endpoint's CTRL transport // \param addr The physical address of the stream endpoint // \param epid The endpoint ID to assign to this endpoint @@ -62,11 +65,21 @@ public: virtual void initialize_endpoint( chdr_ctrl_xport& xport, const sep_addr_t& addr, const sep_id_t& epid) = 0; + //! Register an already-initialized stream endpoint's endpoint ID + // + // This should only be called by the epid_allocator + // + // \param addr The physical address of the stream endpoint + // \param epid The endpoint ID to assign to this endpoint + // + virtual void register_endpoint( + const sep_addr_t& addr, const sep_id_t& epid) = 0; + //! Get information about a discovered (reachable) stream endpoint // // \param epid The endpoint ID of the endpoint to lookup // - virtual bool is_endpoint_initialized(const sep_id_t& epid) const = 0; + virtual bool is_endpoint_registered(const sep_id_t& epid) const = 0; //! Get information about a discovered (reachable) stream endpoint // |