aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2019-09-11 16:50:11 -0500
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:45 -0800
commitf312d827602fafa21625106dafe2f209e10a22b3 (patch)
treefc805bebde263da87da3d7ceeb133014156cba3f /host/lib/rfnoc
parent1a6368331bf441290b0d08ac233c9e5050021493 (diff)
downloaduhd-f312d827602fafa21625106dafe2f209e10a22b3.tar.gz
uhd-f312d827602fafa21625106dafe2f209e10a22b3.tar.bz2
uhd-f312d827602fafa21625106dafe2f209e10a22b3.zip
rfnoc: Fix transport buffer reservations
Change transports to reserve the number of frame buffers they actually need from the I/O service. Previously some I/O service clients reserved 0 buffers since they shared frame buffers with other clients, as we know the two clients do not use the links simultaneously. This is possible with the inline_io_service but not with a multithreaded I/O service which queues buffer for clients before they are requested.
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r--host/lib/rfnoc/chdr_ctrl_xport.cpp10
-rw-r--r--host/lib/rfnoc/chdr_rx_data_xport.cpp8
-rw-r--r--host/lib/rfnoc/mgmt_portal.cpp8
3 files changed, 16 insertions, 10 deletions
diff --git a/host/lib/rfnoc/chdr_ctrl_xport.cpp b/host/lib/rfnoc/chdr_ctrl_xport.cpp
index 929875dbd..f9f7c9e1b 100644
--- a/host/lib/rfnoc/chdr_ctrl_xport.cpp
+++ b/host/lib/rfnoc/chdr_ctrl_xport.cpp
@@ -74,9 +74,8 @@ chdr_ctrl_xport::chdr_ctrl_xport(io_service::sptr io_srv,
return false;
};
- // No additional frames reserved specifically for this virtual interface
_mgmt_recv_if = io_srv->make_recv_client(
- recv_link, 0, mgmt_recv_cb, send_link_if::sptr(), 0, release_cb);
+ recv_link, 1, mgmt_recv_cb, send_link_if::sptr(), 0, release_cb);
}
/*!
@@ -143,6 +142,13 @@ void chdr_ctrl_xport::release_recv_buff(frame_buff::uptr buff)
_ctrl_recv_if->release_recv_buff(std::move(buff));
}
+void chdr_ctrl_xport::release_mgmt_buff(frame_buff::uptr buff)
+{
+ // FIXME: Remove mutex when have threaded_io_service
+ std::lock_guard<std::mutex> lock(_mutex);
+ _mgmt_recv_if->release_recv_buff(std::move(buff));
+}
+
/*!
* Get this xport's EPID
*/
diff --git a/host/lib/rfnoc/chdr_rx_data_xport.cpp b/host/lib/rfnoc/chdr_rx_data_xport.cpp
index bcd9f7ea9..cdcd70393 100644
--- a/host/lib/rfnoc/chdr_rx_data_xport.cpp
+++ b/host/lib/rfnoc/chdr_rx_data_xport.cpp
@@ -143,10 +143,10 @@ chdr_rx_data_xport::fc_params_t chdr_rx_data_xport::configure_sep(io_service::sp
// Create a temporary recv_io to receive the strc init
auto recv_io = io_srv->make_recv_client(recv_link,
- /* num_recv_frames*/ 1,
+ 1, // num_recv_frames
recv_cb,
send_link,
- /* num_send_frames*/ 1,
+ 1, // num_send_frames
fc_cb);
// Create a control transport with the rx data links to send mgmt packets
@@ -157,8 +157,8 @@ chdr_rx_data_xport::fc_params_t chdr_rx_data_xport::configure_sep(io_service::sp
recv_link,
pkt_factory,
local_epid,
- 0, // num_send_frames
- 0); // num_recv_frames
+ 1, // num_send_frames
+ 1); // num_recv_frames
// Setup a route to the EPID
// Note that this may be gratuitous--The endpoint may already have been set up
diff --git a/host/lib/rfnoc/mgmt_portal.cpp b/host/lib/rfnoc/mgmt_portal.cpp
index 0e0997a36..1c6e2c608 100644
--- a/host/lib/rfnoc/mgmt_portal.cpp
+++ b/host/lib/rfnoc/mgmt_portal.cpp
@@ -1050,15 +1050,15 @@ private: // Functions
// Send the transaction over the wire
_send_mgmt_transaction(xport, send);
- auto recv_buff = xport.get_mgmt_buff(timeout * 1000);
- if (not recv_buff) {
+ auto mgmt_buff = xport.get_mgmt_buff(timeout * 1000);
+ if (not mgmt_buff) {
throw uhd::io_error("Timed out getting recv buff for management transaction");
}
- _recv_pkt->refresh(recv_buff->data());
+ _recv_pkt->refresh(mgmt_buff->data());
mgmt_payload recv;
recv.set_header(my_epid, _protover, _chdr_w);
_recv_pkt->fill_payload(recv);
- xport.release_recv_buff(std::move(recv_buff));
+ xport.release_mgmt_buff(std::move(mgmt_buff));
return recv;
}