aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-11-14 14:30:34 -0800
committerMartin Braun <martin.braun@ettus.com>2018-07-25 15:34:03 -0700
commit988515ab19a715773086a7a8c023ddb8249c7e37 (patch)
tree71c861c3a1d0a5e295dad5939358dd30e0a33f3b /host/include
parent8b16ab706fb4768f802ddb65a81fc26e1562cb0d (diff)
downloaduhd-988515ab19a715773086a7a8c023ddb8249c7e37.tar.gz
uhd-988515ab19a715773086a7a8c023ddb8249c7e37.tar.bz2
uhd-988515ab19a715773086a7a8c023ddb8249c7e37.zip
Device3: Change packet-based flow control to byte-based flow control
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/rfnoc/constants.hpp10
-rw-r--r--host/include/uhd/rfnoc/graph.hpp4
-rw-r--r--host/include/uhd/rfnoc/sink_block_ctrl_base.hpp13
-rw-r--r--host/include/uhd/rfnoc/source_block_ctrl_base.hpp16
-rw-r--r--host/include/uhd/transport/CMakeLists.txt1
-rw-r--r--host/include/uhd/transport/vrt_if_packet.hpp4
6 files changed, 28 insertions, 20 deletions
diff --git a/host/include/uhd/rfnoc/constants.hpp b/host/include/uhd/rfnoc/constants.hpp
index 6df4c535f..bda4c6440 100644
--- a/host/include/uhd/rfnoc/constants.hpp
+++ b/host/include/uhd/rfnoc/constants.hpp
@@ -25,7 +25,7 @@ static const std::string XML_PATH_ENV = "UHD_RFNOC_DIR";
//! If the block name can't be automatically detected, this name is used
static const std::string DEFAULT_BLOCK_NAME = "Block";
static const uint64_t DEFAULT_NOC_ID = 0xFFFFFFFFFFFFFFFF;
-static const size_t NOC_SHELL_COMPAT_MAJOR = 3;
+static const size_t NOC_SHELL_COMPAT_MAJOR = 4;
static const size_t NOC_SHELL_COMPAT_MINOR = 0;
static const size_t MAX_PACKET_SIZE = 8000; // bytes
@@ -35,7 +35,7 @@ static const size_t DEFAULT_PACKET_SIZE = 1456; // bytes
static const size_t BYTES_PER_LINE = 8;
//! For flow control within a single crossbar
-static const size_t DEFAULT_FC_XBAR_PKTS_PER_ACK = 2;
+static const size_t DEFAULT_FC_XBAR_RESPONSE_FREQ = 8;
//! For flow control when data is flowing from device to host (rx)
static const size_t DEFAULT_FC_RX_RESPONSE_FREQ = 64; // ACKs per flow control window
//! For flow control when data is flowing from host to device (tx)
@@ -48,15 +48,15 @@ static const size_t DEFAULT_FC_TX_RESPONSE_FREQ = 8; // ACKs per flow control wi
static const double DEFAULT_FC_RX_SW_BUFF_FULL_FACTOR = 0.80;
// Common settings registers.
-static const uint32_t SR_FLOW_CTRL_CYCS_PER_ACK = 0;
-static const uint32_t SR_FLOW_CTRL_PKTS_PER_ACK = 1;
+static const uint32_t SR_FLOW_CTRL_BYTES_PER_ACK = 1;
static const uint32_t SR_FLOW_CTRL_WINDOW_SIZE = 2;
-static const uint32_t SR_FLOW_CTRL_WINDOW_EN = 3;
+static const uint32_t SR_FLOW_CTRL_EN = 3;
static const uint32_t SR_ERROR_POLICY = 4;
static const uint32_t SR_BLOCK_SID = 5; // TODO rename to SRC_SID
static const uint32_t SR_NEXT_DST_SID = 6;
static const uint32_t SR_RESP_IN_DST_SID = 7;
static const uint32_t SR_RESP_OUT_DST_SID = 8;
+static const uint32_t SR_FLOW_CTRL_PKT_LIMIT = 9;
static const uint32_t SR_READBACK_ADDR = 124;
static const uint32_t SR_READBACK = 127;
diff --git a/host/include/uhd/rfnoc/graph.hpp b/host/include/uhd/rfnoc/graph.hpp
index f92e6b528..d7b7cc43e 100644
--- a/host/include/uhd/rfnoc/graph.hpp
+++ b/host/include/uhd/rfnoc/graph.hpp
@@ -67,12 +67,12 @@ public:
*
* \param sink_block Sink block ID
* \param dst_block_port Destination (sink) block port
- * \param pkts_per_ack Flow controlf frequency in packets
+ * \param bytes_per_ack Flow control frequency in bytes
*/
virtual void connect_sink(
const block_id_t &sink_block,
const size_t dst_block_port,
- const size_t pkts_per_ack
+ const size_t bytes_per_ack
) = 0;
virtual std::string get_name() const = 0;
diff --git a/host/include/uhd/rfnoc/sink_block_ctrl_base.hpp b/host/include/uhd/rfnoc/sink_block_ctrl_base.hpp
index ec3f28e32..f90361cf1 100644
--- a/host/include/uhd/rfnoc/sink_block_ctrl_base.hpp
+++ b/host/include/uhd/rfnoc/sink_block_ctrl_base.hpp
@@ -70,20 +70,17 @@ public:
* send out ACKs, telling the upstream block which packets have been consumed,
* so the upstream block can increase his flow control credit.
*
- * In the default implementation, this just sets registers
- * SR_FLOW_CTRL_CYCS_PER_ACK and SR_FLOW_CTRL_PKTS_PER_ACK accordingly.
+ * In the default implementation, this just sets register SR_FLOW_CTRL_PKTS_PER_ACK
+ * accordingly.
*
* Override this function if your block has port-specific flow control settings.
*
- * \param cycles Send an ACK after this many clock cycles.
- * Setting this to zero disables this type of flow control acknowledgement.
- * \param packets Send an ACK after this many packets have been consumed.
- * Setting this to zero disables this type of flow control acknowledgement.
+ * \param bytes Send an ACK after this many bytes have been consumed.
+ * Setting this to zero disables flow control acknowledgement.
* \param block_port Set up flow control for a stream coming in on this particular block port.
*/
virtual void configure_flow_control_in(
- size_t cycles,
- size_t packets,
+ size_t bytes,
size_t block_port=0
);
diff --git a/host/include/uhd/rfnoc/source_block_ctrl_base.hpp b/host/include/uhd/rfnoc/source_block_ctrl_base.hpp
index 7d0a65107..39e7411f3 100644
--- a/host/include/uhd/rfnoc/source_block_ctrl_base.hpp
+++ b/host/include/uhd/rfnoc/source_block_ctrl_base.hpp
@@ -97,15 +97,23 @@ public:
*
* Override this function if your block has port-specific flow control settings.
*
- * \param buf_size_pkts The size of the downstream block's input FIFO size in number of packets. Setting
- * this to zero disables flow control. The block will then produce data as fast as it can.
- * \b Warning: This can cause head-of-line blocking, and potentially lock up your device!
+ * \param enable_output Enable flow control module's output. If disabled, no packets will be output
+ * regardless of flow control state.
+ * \param buf_size_bytes The size of the downstream block's input FIFO size in number of bytes. Setting
+ * this to zero disables byte based flow control. If both byte based flow control and
+ * the packet limit are set to zero, the block will then produce data as fast as it can.
+ * \b Warning: This can cause head-of-line blocking, and potentially lock up your device!
+ * \param pkt_limit Limit the maximum number of packets in flight. Setting this to zero disables packet limiting.
+ * Usually kept disabled except for special case connections (such as DMA) that support only
+ * a finite number of packets in flight.
* \param block_port Specify on which outgoing port this setting is valid.
* \param sid The SID for which this is valid. This is meant for cases where the outgoing block port is
* not sufficient to set the flow control, and as such is rarely used.
*/
virtual void configure_flow_control_out(
- size_t buf_size_pkts,
+ bool enable_output,
+ size_t buf_size_bytes,
+ size_t pkt_limit=0,
size_t block_port=0,
const uhd::sid_t &sid=uhd::sid_t()
);
diff --git a/host/include/uhd/transport/CMakeLists.txt b/host/include/uhd/transport/CMakeLists.txt
index 3ce06b5b1..785e2d53d 100644
--- a/host/include/uhd/transport/CMakeLists.txt
+++ b/host/include/uhd/transport/CMakeLists.txt
@@ -20,6 +20,7 @@ UHD_INSTALL(FILES
usb_device_handle.hpp
vrt_if_packet.hpp
zero_copy.hpp
+ zero_copy_flow_ctrl.hpp
DESTINATION ${INCLUDE_DIR}/uhd/transport
COMPONENT headers
)
diff --git a/host/include/uhd/transport/vrt_if_packet.hpp b/host/include/uhd/transport/vrt_if_packet.hpp
index 579ac77d2..07792f13f 100644
--- a/host/include/uhd/transport/vrt_if_packet.hpp
+++ b/host/include/uhd/transport/vrt_if_packet.hpp
@@ -68,6 +68,8 @@ namespace vrt{
bool sob, eob;
//! This is asserted for command responses that are errors (CHDR only)
bool error;
+ //! This is asserted for flow control packets are ACKS (CHDR only)
+ bool fc_ack;
//optional fields
//! Stream ID (SID). See uhd::sid_t
@@ -185,7 +187,7 @@ namespace vrt{
num_packet_words32(0),
packet_count(0),
sob(false), eob(false),
- error(false),
+ error(false), fc_ack(false),
has_sid(false), sid(0),
has_cid(false), cid(0),
has_tsi(false), tsi(0),