aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-03-20 16:08:45 -0700
committerMartin Braun <martin.braun@ettus.com>2019-09-04 20:28:04 -0700
commit46c0e95a86f06a0ebed51afe10af53f2faa31c07 (patch)
tree227aaad109b35c6b68e95530ca699935a2cde523 /host
parent94592641f0647563bc4d2163805d5284a6796273 (diff)
downloaduhd-46c0e95a86f06a0ebed51afe10af53f2faa31c07.tar.gz
uhd-46c0e95a86f06a0ebed51afe10af53f2faa31c07.tar.bz2
uhd-46c0e95a86f06a0ebed51afe10af53f2faa31c07.zip
rfnoc: Read cmd FIFO size from blocks & configure ctrl_iface
This requires noc_shell compat number 6.0. It will allow sending as many command packets, but no more, than there is space. Updated FPGA images for devices: - X310/X300 - N300/N310/N320 - E310/E320
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/rfnoc/constants.hpp4
-rw-r--r--host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp11
-rw-r--r--host/lib/rfnoc/block_ctrl_base.cpp11
-rw-r--r--host/lib/rfnoc/ctrl_iface.cpp11
-rw-r--r--host/tests/common/mock_ctrl_iface_impl.hpp4
5 files changed, 34 insertions, 7 deletions
diff --git a/host/include/uhd/rfnoc/constants.hpp b/host/include/uhd/rfnoc/constants.hpp
index 2bef70a75..c3a638258 100644
--- a/host/include/uhd/rfnoc/constants.hpp
+++ b/host/include/uhd/rfnoc/constants.hpp
@@ -24,8 +24,8 @@ 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 = 5;
-static const size_t NOC_SHELL_COMPAT_MINOR = 1;
+static const size_t NOC_SHELL_COMPAT_MAJOR = 6;
+static const size_t NOC_SHELL_COMPAT_MINOR = 0;
static const size_t MAX_PACKET_SIZE = 8000; // bytes
static const size_t DEFAULT_PACKET_SIZE = 1456; // bytes
diff --git a/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp b/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp
index deb58f14c..29b2e73c0 100644
--- a/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp
+++ b/host/lib/include/uhdlib/rfnoc/ctrl_iface.hpp
@@ -59,6 +59,17 @@ public:
const bool readback=false,
const uint64_t timestamp=0
) = 0;
+
+ /*! Set the depth of the command FIFO size
+ *
+ * Note: This is not safe to call during operations. Call this during
+ * initialization.
+ *
+ * \param num_lines The number of lines of depth in the command FIFO. The
+ * function will calculate the number of packets that will
+ * fit into the command FIFO.
+ */
+ virtual void set_cmd_fifo_size(const size_t num_lines) = 0;
};
}} /* namespace uhd::rfnoc */
diff --git a/host/lib/rfnoc/block_ctrl_base.cpp b/host/lib/rfnoc/block_ctrl_base.cpp
index e70267b96..911f1a4e0 100644
--- a/host/lib/rfnoc/block_ctrl_base.cpp
+++ b/host/lib/rfnoc/block_ctrl_base.cpp
@@ -21,6 +21,7 @@
#include <boost/format.hpp>
#include <chrono>
#include <thread>
+
using namespace uhd;
using namespace uhd::rfnoc;
using std::string;
@@ -94,16 +95,20 @@ block_ctrl_base::block_ctrl_base(const make_args_t& make_args)
// Set source addresses:
sr_write(SR_BLOCK_SID, get_address(ctrl_port), ctrl_port);
// Set sink buffer sizes:
- settingsbus_reg_t reg_fifo = SR_READBACK_REG_FIFOSIZE;
- size_t buf_size_bytes = size_t(sr_read64(reg_fifo, ctrl_port));
- if (buf_size_bytes > 0)
+ const uint64_t fifo_size_reg = sr_read64(SR_READBACK_REG_FIFOSIZE, ctrl_port);
+ const size_t buf_size_bytes = size_t(fifo_size_reg & 0xFFFFFFFF);
+ if (buf_size_bytes > 0) {
n_valid_input_buffers++;
+ }
_tree->create<size_t>(_root_path / "input_buffer_size" / ctrl_port)
.set(buf_size_bytes);
// Set MTU size and convert to bytes:
settingsbus_reg_t reg_mtu = SR_READBACK_REG_MTU;
size_t mtu = 8 * (1 << size_t(sr_read64(reg_mtu, ctrl_port)));
_tree->create<size_t>(_root_path / "mtu" / ctrl_port).set(mtu);
+ // Set command FIFO size
+ const uint32_t cmd_fifo_size = (fifo_size_reg >> 32) & 0xFFFFFFFF;
+ _ctrl_ifaces[ctrl_port]->set_cmd_fifo_size(cmd_fifo_size);
// Set default destination SIDs
// Otherwise, the default is someone else's SID, which we don't want
sr_write(SR_RESP_IN_DST_SID, 0xFFFF, ctrl_port);
diff --git a/host/lib/rfnoc/ctrl_iface.cpp b/host/lib/rfnoc/ctrl_iface.cpp
index 377808eef..ee2a78df3 100644
--- a/host/lib/rfnoc/ctrl_iface.cpp
+++ b/host/lib/rfnoc/ctrl_iface.cpp
@@ -66,6 +66,15 @@ public:
readback, bool(timestamp != 0) ? MASSIVE_TIMEOUT : ACK_TIMEOUT);
}
+ void set_cmd_fifo_size(const size_t num_lines)
+ {
+ _max_outstanding_acks =
+ std::min(num_lines / 3, _xports.recv->get_num_recv_frames());
+ UHD_LOG_TRACE("RFNOC",
+ "[ctrl_iface " << _name << "] Changed cmd FIFO size to "
+ << _max_outstanding_acks);
+ }
+
private:
// This is the buffer type for response messages
struct resp_buff_type
@@ -216,7 +225,7 @@ private:
const std::string _name;
size_t _seq_out;
std::queue<size_t> _outstanding_seqs;
- const size_t _max_outstanding_acks;
+ size_t _max_outstanding_acks;
boost::mutex _mutex;
};
diff --git a/host/tests/common/mock_ctrl_iface_impl.hpp b/host/tests/common/mock_ctrl_iface_impl.hpp
index ad60d32ef..f20858b63 100644
--- a/host/tests/common/mock_ctrl_iface_impl.hpp
+++ b/host/tests/common/mock_ctrl_iface_impl.hpp
@@ -23,5 +23,7 @@ class mock_ctrl_iface_impl : public uhd::rfnoc::ctrl_iface
const size_t data,
const bool readback = false,
const uint64_t timestamp = 0);
+
+ void set_cmd_fifo_size(const size_t) {}
};
-#endif /* INCLUDED_MOCK_CTRL_IFACE_IMPL_HPP */ \ No newline at end of file
+#endif /* INCLUDED_MOCK_CTRL_IFACE_IMPL_HPP */