diff options
author | Ashish Chaudhari <ashish@ettus.com> | 2019-05-28 13:19:24 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:20 -0800 |
commit | 374b30cc0eb0842e567d01486d9be8155e361d9f (patch) | |
tree | 54b8f907015045cc7049717a8894ccc448155631 /host/lib/include/uhdlib | |
parent | b4bc85ac972b2e4f3e8e0b092947267f9f8aeee4 (diff) | |
download | uhd-374b30cc0eb0842e567d01486d9be8155e361d9f.tar.gz uhd-374b30cc0eb0842e567d01486d9be8155e361d9f.tar.bz2 uhd-374b30cc0eb0842e567d01486d9be8155e361d9f.zip |
rfnoc: API cleanup for ctrl/mgmt code
- chdr_ctrl_endpoint can manage multiple dest EPIDs
- Moved from both_xports_t to a special defs in rfnoc_common
- Changed data-structures where appropriate
Diffstat (limited to 'host/lib/include/uhdlib')
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp | 7 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_packet.hpp | 12 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp | 11 | ||||
-rw-r--r-- | host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp | 27 |
4 files changed, 44 insertions, 13 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp index b50e06d3c..b3c3e0108 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp @@ -9,7 +9,6 @@ #include <uhdlib/rfnoc/chdr_packet.hpp> #include <uhdlib/rfnoc/ctrlport_endpoint.hpp> -#include <uhdlib/rfnoc/xports.hpp> #include <functional> #include <memory> @@ -35,7 +34,8 @@ public: // \param ctrl_clk_freq Frequency of the clock driving the ctrlport logic // \param timebase_freq Frequency of the timebase (for timed commands) // - virtual ctrlport_endpoint::sptr get_ctrlport_ep(uint16_t port, + virtual ctrlport_endpoint::sptr get_ctrlport_ep(sep_id_t dst_epid, + uint16_t dst_port, size_t buff_capacity, size_t max_outstanding_async_msgs, const clock_iface& client_clk, @@ -50,9 +50,8 @@ public: // \param pkt_factor An instance of the CHDR packet factory // \param my_epid The endpoint ID of this software endpoint // - static uptr make(const both_xports_t& xports, + static uptr make(const chdr_ctrl_xport_t& xports, const chdr::chdr_packet_factory& pkt_factory, - sep_id_t dst_epid, sep_id_t my_epid); }; // class chdr_ctrl_endpoint diff --git a/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp b/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp index 89b33a66a..b20e24a93 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_packet.hpp @@ -286,6 +286,18 @@ public: chdr_mgmt_packet::uptr make_mgmt( size_t mtu_bytes = std::numeric_limits<size_t>::max()) const; + //! Get the CHDR width + inline chdr_w_t get_chdr_w() const + { + return _chdr_w; + } + + //! Get the protocol version for RFNoC and the CHDR format + inline uint16_t get_protover() const + { + return RFNOC_PROTO_VER; + } + private: const chdr_w_t _chdr_w; const endianness_t _endianness; diff --git a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp index 09a155fa0..12f40f172 100644 --- a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp +++ b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp @@ -8,7 +8,6 @@ #define INCLUDED_LIBUHD_MGMT_PORTAL_HPP #include <uhdlib/rfnoc/chdr_types.hpp> -#include <uhdlib/rfnoc/xports.hpp> #include <memory> namespace uhd { namespace rfnoc { namespace mgmt { @@ -60,7 +59,7 @@ public: // Note that the endpoints that are not physically connected/reachable from // the underlying transport will not be discovered. // - virtual const std::vector<sep_addr_t>& get_reachable_endpoints() const = 0; + virtual const std::set<sep_addr_t>& get_reachable_endpoints() const = 0; //! Initialize a stream endpoint and assign an endpoint ID to it // @@ -178,12 +177,10 @@ public: //! Create an endpoint manager object // - static uptr make(const both_xports_t& xports, + static uptr make(const chdr_ctrl_xport_t& xport, const chdr::chdr_packet_factory& pkt_factory, - uint16_t protover, - chdr_w_t chdr_w, - sep_id_t epid, - device_id_t device_id); + sep_addr_t my_sep_addr, + sep_id_t my_epid); }; }}} // namespace uhd::rfnoc::mgmt diff --git a/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp b/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp index 1fee0d40e..bac510f04 100644 --- a/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp +++ b/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp @@ -7,6 +7,7 @@ #ifndef INCLUDED_RFNOC_RFNOC_COMMON_HPP #define INCLUDED_RFNOC_RFNOC_COMMON_HPP +#include <uhd/transport/zero_copy.hpp> #include <memory> namespace uhd { namespace rfnoc { @@ -42,11 +43,33 @@ using sep_inst_t = uint16_t; using sep_addr_t = std::pair<device_id_t, sep_inst_t>; //! Stream Endpoint ID Type using sep_id_t = uint16_t; +//! Stream Endpoint pair Type (first = source, second = destination) +using sep_id_pair_t = std::pair<sep_id_t, sep_id_t>; +//! Stream Endpoint Virtual Channel Type +using sep_vc_t = uint8_t; -//! Type of data carried by the stream endpoint -enum class sep_type_t { CTRL, DATA }; +//! NULL/unassigned device ID +static constexpr device_id_t NULL_DEVICE_ID = 0; +//! NULL/unassigned device address +static constexpr sep_addr_t NULL_DEVICE_ADDR{NULL_DEVICE_ID, 0}; +//! NULL/unassigned stream endpoint ID +static constexpr sep_id_t NULL_EPID = 0; +// TODO: Update these +struct chdr_ctrl_xport_t +{ + chdr_ctrl_xport_t() = default; + uhd::transport::zero_copy_if::sptr recv; + uhd::transport::zero_copy_if::sptr send; + size_t recv_buff_size = 0; + size_t send_buff_size = 0; + sep_id_t src_epid = 0; + sep_id_t dst_epid = 0; +}; + +using chdr_data_xport_t = chdr_ctrl_xport_t; + //---------------------------------------------- // Constants //---------------------------------------------- |