aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2019-06-04 15:35:44 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:27 -0800
commit20baa413a08cdf42ec30d6bc0aeb0c665ee590fe (patch)
treefe0cc0baa5658688d0690c07d4cf9bfc2e6094b5 /host/lib/include
parent53477bfc7ffb2dc09143e1c9e8e431efc8ada957 (diff)
downloaduhd-20baa413a08cdf42ec30d6bc0aeb0c665ee590fe.tar.gz
uhd-20baa413a08cdf42ec30d6bc0aeb0c665ee590fe.tar.bz2
uhd-20baa413a08cdf42ec30d6bc0aeb0c665ee590fe.zip
rfnoc: Make a chdr_ctrl_xport using the new link APIs
These changes add APIs to instantiate the new transports. However, only the control/management transport is currently implemented. It uses the chdr_ctrl_xport. Also update the mgmt_portal to use an ephemeral reference to the shared transport, to indicate that it has no ownership of the transport's memory.
Diffstat (limited to 'host/lib/include')
-rw-r--r--host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp5
-rw-r--r--host/lib/include/uhdlib/rfnoc/link_stream_manager.hpp10
-rw-r--r--host/lib/include/uhdlib/rfnoc/mb_iface.hpp51
-rw-r--r--host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp28
-rw-r--r--host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp16
5 files changed, 76 insertions, 34 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp
index b3c3e0108..1281cc0ea 100644
--- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp
+++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp
@@ -7,6 +7,7 @@
#ifndef INCLUDED_LIBUHD_RFNOC_CHDR_CTRL_ENDPOINT_HPP
#define INCLUDED_LIBUHD_RFNOC_CHDR_CTRL_ENDPOINT_HPP
+#include <uhdlib/rfnoc/chdr_ctrl_xport.hpp>
#include <uhdlib/rfnoc/chdr_packet.hpp>
#include <uhdlib/rfnoc/ctrlport_endpoint.hpp>
#include <functional>
@@ -46,11 +47,11 @@ public:
//! Creates a control endpoint object
//
- // \param xports The transports used to send and recv packets
+ // \param xport The transport used to send and recv packets
// \param pkt_factor An instance of the CHDR packet factory
// \param my_epid The endpoint ID of this software endpoint
//
- static uptr make(const chdr_ctrl_xport_t& xports,
+ static uptr make(chdr_ctrl_xport::sptr xport,
const chdr::chdr_packet_factory& pkt_factory,
sep_id_t my_epid);
diff --git a/host/lib/include/uhdlib/rfnoc/link_stream_manager.hpp b/host/lib/include/uhdlib/rfnoc/link_stream_manager.hpp
index 4ff69bb3e..79121a498 100644
--- a/host/lib/include/uhdlib/rfnoc/link_stream_manager.hpp
+++ b/host/lib/include/uhdlib/rfnoc/link_stream_manager.hpp
@@ -17,8 +17,8 @@
namespace uhd { namespace rfnoc {
-/*! A class that is responsible managing all data endpoints, control endpoints and client
- * zero instances accessible via a logical link between the host device and
+/*! A class that is responsible for managing all data endpoints, control endpoints and
+ * client zero instances accessible via a logical link between the host device and
* motherboard.
*
* Note that each transport adapter on the host has its own set of streaming endpoints,
@@ -120,7 +120,8 @@ public:
* \param xport_args The transport arguments
* \return An transport instance
*/
- virtual chdr_data_xport_t create_host_to_device_data_stream(const sep_addr_t dst_addr,
+ virtual chdr_tx_data_xport::uptr create_host_to_device_data_stream(
+ const sep_addr_t dst_addr,
const bool lossy_xport,
const sw_buff_t pyld_buff_fmt,
const sw_buff_t mdata_buff_fmt,
@@ -139,7 +140,8 @@ public:
* \param xport_args The transport arguments
* \return An transport instance
*/
- virtual chdr_data_xport_t create_device_to_host_data_stream(const sep_addr_t src_addr,
+ virtual chdr_rx_data_xport::uptr create_device_to_host_data_stream(
+ const sep_addr_t src_addr,
const bool lossy_xport,
const sw_buff_t pyld_buff_fmt,
const sw_buff_t mdata_buff_fmt,
diff --git a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
index ce1106c4c..cca8dcab8 100644
--- a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
+++ b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
@@ -7,11 +7,20 @@
#ifndef INCLUDED_LIBUHD_MB_IFACE_HPP
#define INCLUDED_LIBUHD_MB_IFACE_HPP
+#include <uhdlib/rfnoc/chdr_ctrl_xport.hpp>
#include <uhdlib/rfnoc/rfnoc_common.hpp>
#include <memory>
namespace uhd { namespace rfnoc {
+// FIXME: Update this
+class chdr_rx_data_xport
+{
+public:
+ using uptr = std::unique_ptr<chdr_rx_data_xport>;
+};
+
+using chdr_tx_data_xport = chdr_rx_data_xport;
/*! Motherboard (backchannel) interface
*
@@ -59,14 +68,46 @@ public:
virtual void reset_network() = 0;
/*! Create a control transport
+ *
+ * This is usually called once per motherboard, since there is only one
+ * control transport required to talk to all the blocks on the control
+ * crossbar.
+ *
+ * \param local_device_id ID for the host transport adapter to use
+ * \param local_epid Host streaming endpoint ID
+ * \return A CHDR control transport
*/
- virtual chdr_ctrl_xport_t make_ctrl_transport(
- device_id_t local_device_id, const sep_id_t& src_epid) = 0;
+ virtual chdr_ctrl_xport::sptr make_ctrl_transport(
+ device_id_t local_device_id, const sep_id_t& local_epid) = 0;
- /*! Create a data transport
+ /*! Create an RX data transport
+ *
+ * This is typically called once per streaming channel.
+ *
+ * \param local_device_id ID for the host transport adapter to use
+ * \param local_epid Host (sink) streaming endpoint ID
+ * \param remote_epid Remote device (source) streaming endpoint ID
+ * \param xport_args Transport configuration args
+ * \return A CHDR RX data transport
+ */
+ virtual chdr_rx_data_xport::uptr make_rx_data_transport(device_id_t local_device_id,
+ const sep_id_t& local_epid,
+ const sep_id_t& remote_epid,
+ const device_addr_t& xport_args) = 0;
+
+ /*! Create an TX data transport
+ *
+ * This is typically called once per streaming channel.
+ *
+ * \param local_device_id ID for the host transport adapter to use
+ * \param local_epid Host (source) streaming endpoint ID
+ * \param remote_epid Remote device (sink) streaming endpoint ID
+ * \param xport_args Transport configuration args
+ * \return A CHDR TX data transport
*/
- virtual chdr_data_xport_t make_data_transport(device_id_t local_device_id,
- const sep_id_t& src_epid,
+ virtual chdr_tx_data_xport::uptr make_tx_data_transport(device_id_t local_device_id,
+ const sep_id_t& local_epid,
+ const sep_id_t& remote_epid,
const device_addr_t& xport_args) = 0;
};
diff --git a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp
index 1412d0e3d..ac72931bf 100644
--- a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp
+++ b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp
@@ -7,6 +7,7 @@
#ifndef INCLUDED_LIBUHD_MGMT_PORTAL_HPP
#define INCLUDED_LIBUHD_MGMT_PORTAL_HPP
+#include <uhdlib/rfnoc/chdr_ctrl_xport.hpp>
#include <uhdlib/rfnoc/chdr_types.hpp>
#include <memory>
#include <set>
@@ -54,10 +55,12 @@ public:
//! Initialize a stream endpoint and assign an endpoint ID to it
//
+ // \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
//
- virtual void initialize_endpoint(const sep_addr_t& addr, const sep_id_t& epid) = 0;
+ virtual void initialize_endpoint(
+ chdr_ctrl_xport& xport, const sep_addr_t& addr, const sep_id_t& epid) = 0;
//! Get information about a discovered (reachable) stream endpoint
//
@@ -77,9 +80,10 @@ public:
// destination simply by setting the DstEPID in the CHDR header to the specified
// dst_epid
//
+ // \param xport The host stream endpoint's CTRL transport
// \param dst_epid The endpoint ID of the destination
//
- virtual void setup_local_route(const sep_id_t& dst_epid) = 0;
+ virtual void setup_local_route(chdr_ctrl_xport& xport, const sep_id_t& dst_epid) = 0;
//! Can a route from between the source and destination endpoints be established?
//
@@ -95,11 +99,12 @@ public:
// to the destination simply by setting the DstEPID in the CHDR header to the
// specified dst_epid
//
+ // \param xport The host stream endpoint's CTRL transport
// \param dst_epid The endpoint ID of the destination
// \param src_epid The endpoint ID of the source
//
virtual void setup_remote_route(
- const sep_id_t& dst_epid, const sep_id_t& src_epid) = 0;
+ chdr_ctrl_xport& xport, const sep_id_t& dst_epid, const sep_id_t& src_epid) = 0;
//! Start configuring a flow controlled receive data stream from the endpoint with the
// specified ID to this SW mgmt portal.
@@ -108,6 +113,7 @@ public:
// control handler needs to acknoweledge the setup transaction then call the commit
// function below.
//
+ // \param xport The host stream endpoint's CTRL transport (same EPID as RX stream)
// \param epid The endpoint ID of the data source
// \param lossy_xport Is the transport lossy? (e.g. UDP, not liberio)
// \param pyld_buff_fmt Datatype of SW buffer that holds the data payload
@@ -116,7 +122,8 @@ public:
// \param fc_freq Flow control headroom parameters
// \param reset Reset ingress stream endpoint state
//
- virtual void config_local_rx_stream_start(const sep_id_t& epid,
+ virtual void config_local_rx_stream_start(chdr_ctrl_xport& xport,
+ const sep_id_t& epid,
const bool lossy_xport,
const sw_buff_t pyld_buff_fmt,
const sw_buff_t mdata_buff_fmt,
@@ -127,19 +134,22 @@ public:
//! Finish configuring a flow controlled receive data stream from the endpoint with
// the specified ID to this SW mgmt portal.
//
+ // \param xport The host stream endpoint's CTRL transport (same EPID as RX stream)
// \param epid The endpoint ID of the data source
//
virtual stream_buff_params_t config_local_rx_stream_commit(
- const sep_id_t& epid, const double timeout = 0.2) = 0;
+ chdr_ctrl_xport& xport, const sep_id_t& epid, const double timeout = 0.2) = 0;
//! Configure a flow controlled transmit data stream from this SW mgmt portal to the
// endpoint with the specified ID.
//
+ // \param xport The host stream endpoint's CTRL transport (same EPID as TX stream)
// \param pyld_buff_fmt Datatype of SW buffer that holds the data payload
// \param mdata_buff_fmt Datatype of SW buffer that holds the data metadata
// \param reset Reset ingress stream endpoint state
//
- virtual void config_local_tx_stream(const sep_id_t& epid,
+ virtual void config_local_tx_stream(chdr_ctrl_xport& xport,
+ const sep_id_t& epid,
const sw_buff_t pyld_buff_fmt,
const sw_buff_t mdata_buff_fmt,
const bool reset = false) = 0;
@@ -147,6 +157,7 @@ public:
//! Configure a flow controlled data stream from the endpoint with ID src_epid to the
// endpoint with ID dst_epid
//
+ // \param xport The host stream endpoint's CTRL transport
// \param dst_epid The endpoint ID of the destination
// \param src_epid The endpoint ID of the source
// \param lossy_xport Is the transport lossy?
@@ -155,7 +166,8 @@ public:
// \param fc_freq Flow control response frequency parameters
// \param fc_freq Flow control headroom parameters
//
- virtual stream_buff_params_t config_remote_stream(const sep_id_t& dst_epid,
+ virtual stream_buff_params_t config_remote_stream(chdr_ctrl_xport& xport,
+ const sep_id_t& dst_epid,
const sep_id_t& src_epid,
const bool lossy_xport,
const stream_buff_params_t& fc_freq,
@@ -176,7 +188,7 @@ public:
//! Create an endpoint manager object
//
- static uptr make(const chdr_ctrl_xport_t& xport,
+ static uptr make(chdr_ctrl_xport& xport,
const chdr::chdr_packet_factory& pkt_factory,
sep_addr_t my_sep_addr,
sep_id_t my_epid);
diff --git a/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp b/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp
index c08c8d74a..7ec1b7bb2 100644
--- a/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp
+++ b/host/lib/include/uhdlib/rfnoc/rfnoc_common.hpp
@@ -7,7 +7,7 @@
#ifndef INCLUDED_RFNOC_RFNOC_COMMON_HPP
#define INCLUDED_RFNOC_RFNOC_COMMON_HPP
-#include <uhd/transport/zero_copy.hpp>
+#include <uhdlib/transport/link_if.hpp>
#include <memory>
namespace uhd { namespace rfnoc {
@@ -66,20 +66,6 @@ struct stream_buff_params_t
//! The data type of the buffer used to capture/generate data
enum sw_buff_t { BUFF_U64 = 0, BUFF_U32 = 1, BUFF_U16 = 2, BUFF_U8 = 3 };
-// 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;
- stream_buff_params_t recv_buff_params{0, 0};
- stream_buff_params_t send_buff_params{0, 0};
- sep_id_t src_epid{0};
- sep_id_t dst_epid{0};
-};
-
-using chdr_data_xport_t = chdr_ctrl_xport_t;
-
//----------------------------------------------
// Constants
//----------------------------------------------