aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/usrp/common/io_service_args.hpp
diff options
context:
space:
mode:
authorAaron Rossetto <aaron.rossetto@ni.com>2019-10-17 08:44:11 -0500
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:32 -0800
commit0bd233e64210c6605e8a6ec1424fa81f9ea8a681 (patch)
treef97729a7bba21cdfc45ee756bee1ac0489358544 /host/lib/include/uhdlib/usrp/common/io_service_args.hpp
parent912ed28b3df13b9f9c33f2fa92867ec0ac7445fd (diff)
downloaduhd-0bd233e64210c6605e8a6ec1424fa81f9ea8a681.tar.gz
uhd-0bd233e64210c6605e8a6ec1424fa81f9ea8a681.tar.bz2
uhd-0bd233e64210c6605e8a6ec1424fa81f9ea8a681.zip
uhd: Introduce I/O service manager
- Implement I/O service detach link methods - The I/O service manager instantiates new I/O services or connects links to existing I/O services based on options provided by the user in stream_args. - Add a streamer ID parameter to methods to create transports so that the I/O service manager can group transports appropriately when using offload threads. - Change X300 and MPMD to use I/O service manager to connect links to I/O services. - There is now a single I/O service manager per rfnoc_graph (and it is also stored in the graph) - The I/O service manager now also knows the device args for the rfnoc_graph it was created with, and can make decisions based upon those (e.g, use a specific I/O service for DPDK, share cores between streamers, etc.) - The I/O Service Manager does not get any decision logic with this commit, though - The MB ifaces for mpmd and x300 now access this global I/O service manager - Add configuration of link parameters with overrides Co-Authored-By: Martin Braun <martin.braun@ettus.com> Co-Authored-By: Aaron Rossetto <aaron.rossetto@ni.com>
Diffstat (limited to 'host/lib/include/uhdlib/usrp/common/io_service_args.hpp')
-rw-r--r--host/lib/include/uhdlib/usrp/common/io_service_args.hpp93
1 files changed, 93 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/io_service_args.hpp b/host/lib/include/uhdlib/usrp/common/io_service_args.hpp
new file mode 100644
index 000000000..a783cc825
--- /dev/null
+++ b/host/lib/include/uhdlib/usrp/common/io_service_args.hpp
@@ -0,0 +1,93 @@
+//
+// Copyright 2019 Ettus Research, a National Instruments brand
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_LIBUHD_IO_SERVICE_ARGS_HPP
+#define INCLUDED_LIBUHD_IO_SERVICE_ARGS_HPP
+
+#include <uhd/types/device_addr.hpp>
+#include <boost/optional.hpp>
+
+namespace uhd { namespace usrp {
+
+/*! Struct containing user options for I/O services
+ *
+ * The I/O service manager supports the following args:
+ *
+ * recv_offload: set to "true" to use an offload thread for RX_DATA links, "false"
+ * to use an inline I/O service.
+ * send_offload: set to "true" to use an offload thread for TX_DATA links, "false"
+ * to use an inline I/O service.
+ * recv_offload_wait_mode: set to "poll" to use a polling strategy in the offload
+ * thread, set to "block" to use a blocking strategy.
+ * send_offload_wait_mode: set to "poll" to use a polling strategy in the offload
+ * thread, set to "block" to use a blocking strategy.
+ * num_poll_offload_threads: set to the total number of offload threads to use for
+ * RX_DATA and TX_DATA in this rfnoc_graph. New connections
+ * always go to the offload thread containing the fewest
+ * connections, with lowest numbered thread as a second
+ * criterion. The default is 1.
+ * recv_offload_cpu_<N>: an integer to specify cpu affinity of the offload thread.
+ * N indicates the thread instance, starting with 0 for each
+ * streamer and ending with the number of transport adapters
+ * minus one. Only used if the I/O service is configured to
+ * block.
+ * send_offload_cpu_<N>: an integer to specify cpu affinity of the offload thread.
+ * N indicates the thread instance, starting with 0 for each
+ * streamer and ending with the number of transport adapters
+ * minus one. Only used if the I/O service is configured to
+ * block.
+ * poll_offload_cpu_<N>: an integer to specify cpu affinity of the offload thread.
+ * N indicates the thread instance, starting with 0 and up to
+ * num_poll_offload_threads minus 1. Only used if the I/O
+ * service is configured to poll.
+ */
+struct io_service_args_t
+{
+ enum wait_mode_t { POLL, BLOCK };
+
+ //! Whether to offload streaming I/O to a worker thread
+ bool recv_offload = false;
+
+ //! Whether to offload streaming I/O to a worker thread
+ bool send_offload = false;
+
+ //! Whether the offload thread should poll or block
+ wait_mode_t recv_offload_wait_mode = BLOCK;
+
+ //! Whether the offload thread should poll or block
+ wait_mode_t send_offload_wait_mode = BLOCK;
+
+ //! Number of polling threads to use, if wait_mode is set to POLL
+ size_t num_poll_offload_threads = 1;
+
+ //! CPU affinity of offload threads, if wait_mode is set to BLOCK (one item
+ //! per thread)
+ std::vector<boost::optional<size_t>> recv_offload_thread_cpu;
+
+ //! CPU affinity of offload threads, if wait_mode is set to BLOCK (one item
+ //! per thread)
+ std::vector<boost::optional<size_t>> send_offload_thread_cpu;
+
+ //! CPU affinity of offload threads, if wait_mode is set to POLL (one item
+ //! per thread)
+ std::vector<boost::optional<size_t>> poll_offload_thread_cpu;
+};
+
+/*! Reads I/O service args from provided dictionary
+ *
+ * If an option is not specified in the dictionary, the default value of the
+ * struct above is returned.
+ *
+ * \param args The dictionary from which to read the I/O service args
+ * \param defaults Default values (not including boost::optional values)
+ * \return The I/O service args read
+ */
+io_service_args_t read_io_service_args(
+ const device_addr_t& args, const io_service_args_t& defaults);
+
+}} // namespace uhd::usrp
+
+#endif /* INCLUDED_LIBUHD_IO_SERVICE_ARGS_HPP */