aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2019-10-26 18:40:01 -0500
committerMartin Braun <martin.braun@ettus.com>2019-11-26 12:21:33 -0800
commit10b9d2688b5bcb150eec786a9ef7473f1c1c28ac (patch)
tree17f45cc4c8d56bba84a6a54a0f6568703fe03e1e /host/lib/include
parent98a510d68e12751917dba29522c69de9964decf6 (diff)
downloaduhd-10b9d2688b5bcb150eec786a9ef7473f1c1c28ac.tar.gz
uhd-10b9d2688b5bcb150eec786a9ef7473f1c1c28ac.tar.bz2
uhd-10b9d2688b5bcb150eec786a9ef7473f1c1c28ac.zip
rfnoc: Make I/O services relinquish CPU while waiting
Diffstat (limited to 'host/lib/include')
-rw-r--r--host/lib/include/uhdlib/transport/inline_io_service.hpp13
-rw-r--r--host/lib/include/uhdlib/transport/offload_io_service_client.hpp44
2 files changed, 41 insertions, 16 deletions
diff --git a/host/lib/include/uhdlib/transport/inline_io_service.hpp b/host/lib/include/uhdlib/transport/inline_io_service.hpp
index fe41b96b6..d4a6dbbae 100644
--- a/host/lib/include/uhdlib/transport/inline_io_service.hpp
+++ b/host/lib/include/uhdlib/transport/inline_io_service.hpp
@@ -104,6 +104,19 @@ private:
frame_buff::uptr recv(
inline_recv_cb* recv_io_cb, recv_link_if* recv_link, int32_t timeout_ms);
+ /*
+ * Function to perform recv operations on a link, which is potentially
+ * muxed. This function is only called from send_io::release_send_buff, and
+ * always expects recv_io_cb to release its incoming buffer. Packets are
+ * forwarded to the appropriate mux or callback.
+ *
+ * \param recv_io_cb the callback+interface initiating the operation
+ * \param recv_link link to perform receive on
+ * \param timeout_ms timeout to wait for a buffer on the link
+ */
+ void recv_flow_ctrl(
+ inline_recv_cb* recv_io_cb, recv_link_if* recv_link, int32_t timeout_ms);
+
/* Track whether link is muxed and the callback */
std::unordered_map<recv_link_if*, std::tuple<inline_recv_mux*, inline_recv_cb*>>
_recv_tbl;
diff --git a/host/lib/include/uhdlib/transport/offload_io_service_client.hpp b/host/lib/include/uhdlib/transport/offload_io_service_client.hpp
index 620e796ef..2f606878c 100644
--- a/host/lib/include/uhdlib/transport/offload_io_service_client.hpp
+++ b/host/lib/include/uhdlib/transport/offload_io_service_client.hpp
@@ -50,7 +50,7 @@ static frame_buff::uptr client_get_buff(pop_func_t pop, const int32_t timeout_ms
/*!
* Recv I/O client for offload I/O service
*/
-template <typename io_service_t>
+template <typename io_service_t, bool polling>
class offload_recv_io : public recv_io_if
{
public:
@@ -75,13 +75,19 @@ public:
frame_buff::uptr get_recv_buff(int32_t timeout_ms)
{
- return detail::client_get_buff(
- [this]() {
- frame_buff* buff = _port->client_pop();
- _num_frames_in_use += buff ? 1 : 0;
- return buff;
- },
- timeout_ms);
+ if (polling) {
+ return detail::client_get_buff(
+ [this]() {
+ frame_buff* buff = _port->client_pop();
+ _num_frames_in_use += buff ? 1 : 0;
+ return buff;
+ },
+ timeout_ms);
+ } else {
+ frame_buff* buff = _port->client_pop(timeout_ms);
+ _num_frames_in_use += buff ? 1 : 0;
+ return frame_buff::uptr(buff);
+ }
}
void release_recv_buff(frame_buff::uptr buff)
@@ -103,7 +109,7 @@ private:
/*!
* Send I/O client for offload I/O service
*/
-template <typename io_service_t>
+template <typename io_service_t, bool polling>
class offload_send_io : public send_io_if
{
public:
@@ -128,13 +134,19 @@ public:
frame_buff::uptr get_send_buff(int32_t timeout_ms)
{
- return detail::client_get_buff(
- [this]() {
- frame_buff* buff = _port->client_pop();
- _num_frames_in_use += buff ? 1 : 0;
- return buff;
- },
- timeout_ms);
+ if (polling) {
+ return detail::client_get_buff(
+ [this]() {
+ frame_buff* buff = _port->client_pop();
+ _num_frames_in_use += buff ? 1 : 0;
+ return buff;
+ },
+ timeout_ms);
+ } else {
+ frame_buff* buff = _port->client_pop(timeout_ms);
+ _num_frames_in_use += buff ? 1 : 0;
+ return frame_buff::uptr(buff);
+ }
}
void release_send_buff(frame_buff::uptr buff)