aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/rfnoc
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2019-08-05 21:08:44 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:36 -0800
commit0fc57b99b9163d919cc4a470b3065ab4cf1c947d (patch)
treec82d635e9d8f7d65aae3b5211392aa0029231583 /host/lib/include/uhdlib/rfnoc
parent88aac58651ed8f632137e39964b5dd580be6016a (diff)
downloaduhd-0fc57b99b9163d919cc4a470b3065ab4cf1c947d.tar.gz
uhd-0fc57b99b9163d919cc4a470b3065ab4cf1c947d.tar.bz2
uhd-0fc57b99b9163d919cc4a470b3065ab4cf1c947d.zip
rfnoc: Use link_stream_manager's mgmt_portal for all mgmt packets
Change data transports to use the mgmt_portal from the link_stream_manager. The initialization state of a device's EPIDs needs to be shared amongst all the SEP users. Otherwise, an RX transport may attempt to do a full reset of the SEP while TX is streaming (for example). TODO: The code contained here is not sufficient to handle multiple links that can access the same SEPs, as those would have different link_stream_managers, and thus, different mgmt_portal instances and views of the SEP state.
Diffstat (limited to 'host/lib/include/uhdlib/rfnoc')
-rw-r--r--host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp11
-rw-r--r--host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp22
-rw-r--r--host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp49
-rw-r--r--host/lib/include/uhdlib/rfnoc/mb_iface.hpp8
-rw-r--r--host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp3
5 files changed, 36 insertions, 57 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp
index 3365dcb23..9cf2f305f 100644
--- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp
+++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_xport.hpp
@@ -45,8 +45,8 @@ public:
size_t num_send_frames,
size_t num_recv_frames)
{
- return std::make_shared<chdr_ctrl_xport>(io_srv, send_link, recv_link, my_epid,
- num_send_frames, num_recv_frames);
+ return std::make_shared<chdr_ctrl_xport>(
+ io_srv, send_link, recv_link, my_epid, num_send_frames, num_recv_frames);
}
/*!
@@ -111,6 +111,13 @@ public:
*/
void release_recv_buff(frame_buff::uptr buff);
+ /*!
+ * Get this xport's EPID
+ *
+ * \return the source EPID for this transport
+ */
+ sep_id_t get_epid() const;
+
private:
chdr_ctrl_xport(const chdr_ctrl_xport&) = delete;
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp
index 69dceebe1..41af766b4 100644
--- a/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp
+++ b/host/lib/include/uhdlib/rfnoc/chdr_rx_data_xport.hpp
@@ -125,7 +125,6 @@ public:
* \param recv_link The recv link, already attached to the I/O service
* \param send_link The send link, already attached to the I/O service
* \param pkt_factory Factory to create packets with the desired chdr_w and endianness
- * \param addrs Source and destination addresses
* \param epids Source and destination endpoint IDs
* \param pyld_buff_fmt Datatype of SW buffer that holds the data payload
* \param mdata_buff_fmt Datatype of SW buffer that holds the data metadata
@@ -138,8 +137,8 @@ public:
chdr_rx_data_xport(uhd::transport::io_service::sptr io_srv,
uhd::transport::recv_link_if::sptr recv_link,
uhd::transport::send_link_if::sptr send_link,
+ uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal,
const chdr::chdr_packet_factory& pkt_factory,
- const uhd::rfnoc::sep_addr_pair_t& addrs,
const uhd::rfnoc::sep_id_pair_t& epids,
const uhd::rfnoc::sw_buff_t pyld_buff_fmt,
const uhd::rfnoc::sw_buff_t mdata_buff_fmt,
@@ -150,8 +149,6 @@ public:
const bool lossy_xport)
: _fc_state(epids), _fc_sender(pkt_factory, epids), _epid(epids.second)
{
- const sep_addr_t remote_sep_addr = addrs.first;
- const sep_addr_t local_sep_addr = addrs.second;
const sep_id_t remote_epid = epids.first;
const sep_id_t local_epid = epids.second;
@@ -198,22 +195,14 @@ public:
0, // num_send_frames
0); // num_recv_frames
- // Create new temporary management portal with the transports used for this stream
- // TODO: This is a bit excessive. Maybe we can pare down the functionality of the
- // portal just for route setup purposes. Whatever we do, we *must* use xport in it
- // though otherwise the transport will not behave correctly.
- auto data_mgmt_portal = uhd::rfnoc::mgmt::mgmt_portal::make(
- *ctrl_xport, pkt_factory, local_sep_addr, local_epid);
-
// Setup a route to the EPID
// Note that this may be gratuitous--The endpoint may already have been set up
- data_mgmt_portal->initialize_endpoint(*ctrl_xport, remote_sep_addr, remote_epid);
- data_mgmt_portal->setup_local_route(*ctrl_xport, remote_epid);
+ mgmt_portal.setup_local_route(*ctrl_xport, remote_epid);
// Initialize flow control - management portal sends a stream command
// containing its requested flow control frequency, the rx transport
// responds with a stream status containing its buffer capacity.
- data_mgmt_portal->config_local_rx_stream_start(*ctrl_xport,
+ mgmt_portal.config_local_rx_stream_start(*ctrl_xport,
remote_epid,
lossy_xport,
pyld_buff_fmt,
@@ -221,7 +210,7 @@ public:
fc_freq,
fc_headroom);
- data_mgmt_portal->config_local_rx_stream_commit(*ctrl_xport, remote_epid);
+ mgmt_portal.config_local_rx_stream_commit(*ctrl_xport, remote_epid);
UHD_LOG_TRACE("XPORT::RX_DATA_XPORT",
"Stream endpoint was configured with:"
@@ -233,9 +222,8 @@ public:
<< "fc frequency bytes=" << fc_freq.bytes
<< ", packets=" << fc_freq.packets);
- // We no longer need the control xport and mgmt_portal, release them so
+ // We no longer need the control xport, release it so
// the control xport is no longer connected to the I/O service.
- data_mgmt_portal.reset();
ctrl_xport.reset();
}
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp b/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp
index 62b811bf5..0fb0ab5d1 100644
--- a/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp
+++ b/host/lib/include/uhdlib/rfnoc/chdr_tx_data_xport.hpp
@@ -121,7 +121,6 @@ public:
* \param recv_link The recv link, already attached to the I/O service
* \param send_link The send link, already attached to the I/O service
* \param pkt_factory Factory to create packets with the desired chdr_w and endianness
- * \param addrs Source and destination addresses
* \param epids Source and destination endpoint IDs
* \param pyld_buff_fmt Datatype of SW buffer that holds the data payload
* \param mdata_buff_fmt Datatype of SW buffer that holds the data metadata
@@ -132,8 +131,8 @@ public:
chdr_tx_data_xport(uhd::transport::io_service::sptr io_srv,
uhd::transport::recv_link_if::sptr recv_link,
uhd::transport::send_link_if::sptr send_link,
+ uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal,
const chdr::chdr_packet_factory& pkt_factory,
- const uhd::rfnoc::sep_addr_pair_t& addrs,
const uhd::rfnoc::sep_id_pair_t& epids,
const uhd::rfnoc::sw_buff_t pyld_buff_fmt,
const uhd::rfnoc::sw_buff_t mdata_buff_fmt,
@@ -142,8 +141,6 @@ public:
const double fc_headroom_ratio)
: _fc_sender(pkt_factory, epids), _epid(epids.first)
{
- const sep_addr_t remote_sep_addr = addrs.second;
- const sep_addr_t local_sep_addr = addrs.first;
const sep_id_t remote_epid = epids.second;
const sep_id_t local_epid = epids.first;
@@ -163,10 +160,8 @@ public:
_configure_sep(io_srv,
recv_link,
send_link,
- pkt_factory,
- local_sep_addr,
+ mgmt_portal,
local_epid,
- remote_sep_addr,
remote_epid,
pyld_buff_fmt,
mdata_buff_fmt);
@@ -236,8 +231,8 @@ public:
* \param info Information to include in the header
* \return A pointer to the payload data area and the packet size in bytes
*/
- std::pair<void*, size_t> write_packet_header(buff_t::uptr& buff,
- const packet_info_t& info)
+ std::pair<void*, size_t> write_packet_header(
+ buff_t::uptr& buff, const packet_info_t& info)
{
uint64_t tsf = 0;
@@ -254,8 +249,7 @@ public:
_send_packet->refresh(buff->data(), _send_header, tsf);
_send_packet->update_payload_size(info.payload_bytes);
- return std::make_pair(
- _send_packet->get_payload_ptr(),
+ return std::make_pair(_send_packet->get_payload_ptr(),
_send_packet->get_chdr_header().get_length());
}
@@ -289,8 +283,8 @@ private:
_recv_packet->get_payload_size() / sizeof(uint64_t),
_recv_packet->conv_to_host<uint64_t>());
- _fc_state.update_dest_recv_count({strs.xfer_count_bytes,
- static_cast<uint32_t>(strs.xfer_count_pkts)});
+ _fc_state.update_dest_recv_count(
+ {strs.xfer_count_bytes, static_cast<uint32_t>(strs.xfer_count_pkts)});
// TODO: check strs status here and push into async msg queue
@@ -339,10 +333,8 @@ private:
void _configure_sep(uhd::transport::io_service::sptr io_srv,
uhd::transport::recv_link_if::sptr recv_link,
uhd::transport::send_link_if::sptr send_link,
- const chdr::chdr_packet_factory& pkt_factory,
- const uhd::rfnoc::sep_addr_t& local_sep_addr,
+ uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal,
const uhd::rfnoc::sep_id_t& local_epid,
- const uhd::rfnoc::sep_addr_t& remote_sep_addr,
const uhd::rfnoc::sep_id_t& remote_epid,
const uhd::rfnoc::sw_buff_t pyld_buff_fmt,
const uhd::rfnoc::sw_buff_t mdata_buff_fmt)
@@ -356,23 +348,14 @@ private:
1, // num_send_frames
1); // num_recv_frames
- // Create new temporary management portal with the transports used for this stream
- // TODO: This is a bit excessive. Maybe we can pare down the functionality of the
- // portal just for route setup purposes. Whatever we do, we *must* use xport in it
- // though otherwise the transport will not behave correctly.
- auto data_mgmt_portal = uhd::rfnoc::mgmt::mgmt_portal::make(
- *ctrl_xport, pkt_factory, local_sep_addr, local_epid);
-
// Setup a route to the EPID
- data_mgmt_portal->initialize_endpoint(*ctrl_xport, remote_sep_addr, remote_epid);
- data_mgmt_portal->setup_local_route(*ctrl_xport, remote_epid);
+ mgmt_portal.setup_local_route(*ctrl_xport, remote_epid);
- data_mgmt_portal->config_local_tx_stream(
+ mgmt_portal.config_local_tx_stream(
*ctrl_xport, remote_epid, pyld_buff_fmt, mdata_buff_fmt);
- // We no longer need the control xport and mgmt_portal, release them so
+ // We no longer need the control xport, release it so
// the control xport is no longer connected to the I/O service.
- data_mgmt_portal.reset();
ctrl_xport.reset();
}
@@ -481,8 +464,7 @@ private:
recv_io->release_recv_buff(std::move(buff));
- return {strs.capacity_bytes,
- static_cast<uint32_t>(strs.capacity_pkts)};
+ return {strs.capacity_bytes, static_cast<uint32_t>(strs.capacity_pkts)};
};
// Send a strc init to get the buffer size
@@ -491,14 +473,13 @@ private:
_fc_state.set_dest_capacity(capacity);
UHD_LOG_TRACE("XPORT::TX_DATA_XPORT",
- "Received strs initializing buffer capacity to "
- << capacity.bytes << " bytes");
+ "Received strs initializing buffer capacity to " << capacity.bytes
+ << " bytes");
// Calculate the requested fc_freq parameters
uhd::rfnoc::stream_buff_params_t fc_freq = {
static_cast<uint64_t>(std::ceil(double(capacity.bytes) * fc_freq_ratio)),
- static_cast<uint32_t>(
- std::ceil(double(capacity.packets) * fc_freq_ratio))};
+ static_cast<uint32_t>(std::ceil(double(capacity.packets) * fc_freq_ratio))};
const size_t headroom_bytes =
static_cast<uint64_t>(std::ceil(double(capacity.bytes) * fc_headroom_ratio));
diff --git a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
index 840fcf709..1a06d44e2 100644
--- a/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
+++ b/host/lib/include/uhdlib/rfnoc/mb_iface.hpp
@@ -99,7 +99,9 @@ public:
* \param xport_args Transport configuration args
* \return A CHDR RX data transport
*/
- virtual chdr_rx_data_xport::uptr make_rx_data_transport(const sep_addr_pair_t& addrs,
+ virtual chdr_rx_data_xport::uptr make_rx_data_transport(
+ mgmt::mgmt_portal& mgmt_portal,
+ const sep_addr_pair_t& addrs,
const sep_id_pair_t& epids,
const sw_buff_t pyld_buff_fmt,
const sw_buff_t mdata_buff_fmt,
@@ -116,7 +118,9 @@ public:
* \param xport_args Transport configuration args
* \return A CHDR TX data transport
*/
- virtual chdr_tx_data_xport::uptr make_tx_data_transport(const sep_addr_pair_t& addrs,
+ virtual chdr_tx_data_xport::uptr make_tx_data_transport(
+ mgmt::mgmt_portal& mgmt_portal,
+ const sep_addr_pair_t& addrs,
const sep_id_pair_t& epids,
const uhd::rfnoc::sw_buff_t pyld_buff_fmt,
const uhd::rfnoc::sw_buff_t mdata_buff_fmt,
diff --git a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp
index ac72931bf..850cee460 100644
--- a/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp
+++ b/host/lib/include/uhdlib/rfnoc/mgmt_portal.hpp
@@ -190,8 +190,7 @@ public:
//
static uptr make(chdr_ctrl_xport& xport,
const chdr::chdr_packet_factory& pkt_factory,
- sep_addr_t my_sep_addr,
- sep_id_t my_epid);
+ sep_addr_t my_sep_addr);
};
}}} // namespace uhd::rfnoc::mgmt