aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/x300
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/x300')
-rw-r--r--host/lib/usrp/x300/x300_eth_mgr.cpp74
-rw-r--r--host/lib/usrp/x300/x300_impl.hpp12
-rw-r--r--host/lib/usrp/x300/x300_mb_iface.cpp80
3 files changed, 96 insertions, 70 deletions
diff --git a/host/lib/usrp/x300/x300_eth_mgr.cpp b/host/lib/usrp/x300/x300_eth_mgr.cpp
index 8ff63b050..7177032c6 100644
--- a/host/lib/usrp/x300/x300_eth_mgr.cpp
+++ b/host/lib/usrp/x300/x300_eth_mgr.cpp
@@ -19,8 +19,9 @@
#include <uhd/transport/udp_zero_copy.hpp>
#include <uhd/utils/byteswap.hpp>
#include <uhdlib/rfnoc/device_id.hpp>
-#include <uhdlib/transport/inline_io_service.hpp>
+#include <uhdlib/rfnoc/rfnoc_common.hpp>
#include <uhdlib/transport/udp_boost_asio_link.hpp>
+#include <uhdlib/transport/udp_common.hpp>
#include <uhdlib/usrp/cores/i2c_core_100_wb32.hpp>
//#ifdef HAVE_DPDK
//# include <uhdlib/transport/dpdk_simple.hpp>
@@ -287,53 +288,32 @@ both_links_t eth_manager::get_links(link_type_t link_type,
// Buffering is done in the socket buffers, so size them relative to
// the link rate
- default_buff_args.send_buff_size = conn.link_rate / 50; // 20ms
- default_buff_args.recv_buff_size = std::max(conn.link_rate / 50,
- ETH_MSG_NUM_FRAMES * ETH_MSG_FRAME_SIZE); // enough to hold greater of 20ms or
- // number of msg frames
+ link_params_t default_link_params;
// There is no need for more than 1 send and recv frame since the
// buffering is done in the socket buffers
- default_buff_args.num_send_frames = 1; // or 2?
- default_buff_args.num_recv_frames = 1;
- if (link_type == link_type_t::CTRL) {
- // Increasing number of recv frames here because ctrl_iface uses it
- // to determine how many control packets can be in flight before it
- // must wait for an ACK
- // FIXME this is no longer true, find a good value
- default_buff_args.num_recv_frames = 85; // 256/3
- } else if (link_type == link_type_t::TX_DATA) {
- size_t default_frame_size = conn.link_rate == MAX_RATE_1GIGE
- ? GE_DATA_FRAME_SEND_SIZE
- : XGE_DATA_FRAME_SEND_SIZE;
- default_buff_args.send_frame_size = link_args.cast<size_t>(
- "send_frame_size", std::min(default_frame_size, send_mtu));
- default_buff_args.num_send_frames = link_args.cast<size_t>(
- "num_send_frames", default_buff_args.num_send_frames);
- default_buff_args.send_buff_size = link_args.cast<size_t>(
- "send_buff_size", default_buff_args.send_buff_size);
- } else if (link_type == link_type_t::RX_DATA) {
- size_t default_frame_size = conn.link_rate == MAX_RATE_1GIGE
- ? GE_DATA_FRAME_RECV_SIZE
- : XGE_DATA_FRAME_RECV_SIZE;
- default_buff_args.recv_frame_size = link_args.cast<size_t>(
- "recv_frame_size", std::min(default_frame_size, recv_mtu));
- // set some buffers so the offload thread actually offloads the
- // socket I/O
- default_buff_args.num_recv_frames =
- link_args.cast<size_t>("num_recv_frames", 2);
- default_buff_args.recv_buff_size = link_args.cast<size_t>(
- "recv_buff_size", default_buff_args.recv_buff_size);
- }
+ default_link_params.num_send_frames = 1; // or 2?
+ default_link_params.num_recv_frames = 2;
+ default_link_params.send_frame_size = conn.link_rate == MAX_RATE_1GIGE
+ ? GE_DATA_FRAME_SEND_SIZE
+ : XGE_DATA_FRAME_SEND_SIZE;
+ default_link_params.recv_frame_size = conn.link_rate == MAX_RATE_1GIGE
+ ? GE_DATA_FRAME_RECV_SIZE
+ : XGE_DATA_FRAME_RECV_SIZE;
+ default_link_params.send_buff_size = conn.link_rate / 50;
+ default_link_params.recv_buff_size = std::max(conn.link_rate / 50,
+ ETH_MSG_NUM_FRAMES * ETH_MSG_FRAME_SIZE); // enough to hold greater of 20 ms or
+ // number of msg frames
+
+ link_params_t link_params = calculate_udp_link_params(link_type,
+ get_mtu(uhd::TX_DIRECTION),
+ get_mtu(uhd::RX_DIRECTION),
+ default_link_params,
+ _args.get_orig_args(),
+ link_args);
- /* FIXME: Should have common infrastructure for creating I/O services */
- auto io_srv = uhd::transport::inline_io_service::make();
- link_params_t link_params;
- link_params.num_recv_frames = default_buff_args.num_recv_frames;
- link_params.num_send_frames = default_buff_args.num_send_frames;
- link_params.recv_frame_size = default_buff_args.recv_frame_size;
- link_params.send_frame_size = default_buff_args.send_frame_size;
- link_params.recv_buff_size = default_buff_args.recv_buff_size;
- link_params.send_buff_size = default_buff_args.send_buff_size;
+ // Enforce a minimum bound of the number of receive and send frames.
+ link_params.num_send_frames = std::max(uhd::rfnoc::MIN_NUM_FRAMES, link_params.num_send_frames);
+ link_params.num_recv_frames = std::max(uhd::rfnoc::MIN_NUM_FRAMES, link_params.num_recv_frames);
size_t recv_buff_size, send_buff_size;
auto link = uhd::transport::udp_boost_asio_link::make(conn.addr,
@@ -341,9 +321,7 @@ both_links_t eth_manager::get_links(link_type_t link_type,
link_params,
recv_buff_size,
send_buff_size);
- io_srv->attach_send_link(link);
- io_srv->attach_recv_link(link);
- return std::make_tuple(io_srv, link, send_buff_size, link, recv_buff_size, true);
+ return std::make_tuple(link, send_buff_size, link, recv_buff_size, true);
}
/******************************************************************************
diff --git a/host/lib/usrp/x300/x300_impl.hpp b/host/lib/usrp/x300/x300_impl.hpp
index 600d224a5..a3276152a 100644
--- a/host/lib/usrp/x300/x300_impl.hpp
+++ b/host/lib/usrp/x300/x300_impl.hpp
@@ -108,7 +108,8 @@ private:
uhd::endianness_t get_endianness(const uhd::rfnoc::device_id_t local_device_id);
uhd::rfnoc::device_id_t get_remote_device_id();
std::vector<uhd::rfnoc::device_id_t> get_local_device_ids();
- uhd::transport::adapter_id_t get_adapter_id(const uhd::rfnoc::device_id_t local_device_id);
+ uhd::transport::adapter_id_t get_adapter_id(
+ const uhd::rfnoc::device_id_t local_device_id);
void reset_network();
uhd::rfnoc::clock_iface::sptr get_clock_iface(const std::string& clock_name);
uhd::rfnoc::chdr_ctrl_xport::sptr make_ctrl_transport(
@@ -120,18 +121,21 @@ private:
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,
- const uhd::device_addr_t& xport_args);
+ const uhd::device_addr_t& xport_args,
+ const std::string& streamer_id);
uhd::rfnoc::chdr_tx_data_xport::uptr make_tx_data_transport(
uhd::rfnoc::mgmt::mgmt_portal& mgmt_portal,
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,
- const uhd::device_addr_t& xport_args);
+ const uhd::device_addr_t& xport_args,
+ const std::string& streamer_id);
private:
const uhd::rfnoc::device_id_t _remote_dev_id;
- std::unordered_map<uhd::rfnoc::device_id_t, uhd::transport::adapter_id_t> _adapter_map;
+ std::unordered_map<uhd::rfnoc::device_id_t, uhd::transport::adapter_id_t>
+ _adapter_map;
uhd::rfnoc::clock_iface::sptr _bus_clk;
uhd::rfnoc::clock_iface::sptr _radio_clk;
uhd::usrp::x300::conn_manager::sptr _conn_mgr;
diff --git a/host/lib/usrp/x300/x300_mb_iface.cpp b/host/lib/usrp/x300/x300_mb_iface.cpp
index 5642ffc98..5ba92f52c 100644
--- a/host/lib/usrp/x300/x300_mb_iface.cpp
+++ b/host/lib/usrp/x300/x300_mb_iface.cpp
@@ -10,6 +10,15 @@
using namespace uhd::rfnoc;
using uhd::transport::link_type_t;
+static uhd::usrp::io_service_args_t get_default_io_srv_args()
+{
+ // TODO: Need better defaults, taking into account the link type and ensuring
+ // that the number of frames is appropriate
+ uhd::usrp::io_service_args_t args;
+ args.recv_offload = false;
+ args.send_offload = false;
+ return args;
+}
x300_impl::x300_mb_iface::x300_mb_iface(uhd::usrp::x300::conn_manager::sptr conn_mgr,
const double radio_clk_freq,
@@ -84,10 +93,12 @@ uhd::rfnoc::clock_iface::sptr x300_impl::x300_mb_iface::get_clock_iface(
uhd::rfnoc::chdr_ctrl_xport::sptr x300_impl::x300_mb_iface::make_ctrl_transport(
uhd::rfnoc::device_id_t local_device_id, const uhd::rfnoc::sep_id_t& local_epid)
{
- uhd::transport::io_service::sptr io_srv;
- uhd::transport::send_link_if::sptr send_link;
- uhd::transport::recv_link_if::sptr recv_link;
- std::tie(io_srv, send_link, std::ignore, recv_link, std::ignore, std::ignore) =
+ using namespace uhd::transport;
+
+ send_link_if::sptr send_link;
+ recv_link_if::sptr recv_link;
+ bool lossy_xport;
+ std::tie(send_link, std::ignore, recv_link, std::ignore, lossy_xport) =
_conn_mgr->get_links(link_type_t::CTRL,
local_device_id,
local_epid,
@@ -97,7 +108,10 @@ uhd::rfnoc::chdr_ctrl_xport::sptr x300_impl::x300_mb_iface::make_ctrl_transport(
/* Associate local device ID with the adapter */
_adapter_map[local_device_id] = send_link->get_send_adapter_id();
- auto xport = uhd::rfnoc::chdr_ctrl_xport::make(io_srv,
+ auto io_srv =
+ get_io_srv_mgr()->connect_links(recv_link, send_link, link_type_t::CTRL);
+
+ auto xport = chdr_ctrl_xport::make(io_srv,
send_link,
recv_link,
_pkt_factory,
@@ -113,18 +127,20 @@ uhd::rfnoc::chdr_rx_data_xport::uptr x300_impl::x300_mb_iface::make_rx_data_tran
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,
- const uhd::device_addr_t& xport_args)
+ const uhd::device_addr_t& xport_args,
+ const std::string& streamer_id)
{
+ using namespace uhd::transport;
+
const uhd::rfnoc::sep_addr_t local_sep_addr = addrs.second;
const uhd::rfnoc::sep_id_t remote_epid = epids.first;
const uhd::rfnoc::sep_id_t local_epid = epids.second;
- uhd::transport::io_service::sptr io_srv;
- uhd::transport::send_link_if::sptr send_link;
- uhd::transport::recv_link_if::sptr recv_link;
+ send_link_if::sptr send_link;
+ recv_link_if::sptr recv_link;
size_t recv_buff_size;
bool lossy_xport;
- std::tie(io_srv, send_link, std::ignore, recv_link, recv_buff_size, lossy_xport) =
+ std::tie(send_link, std::ignore, recv_link, recv_buff_size, lossy_xport) =
_conn_mgr->get_links(link_type_t::RX_DATA,
local_sep_addr.first,
local_epid,
@@ -147,8 +163,10 @@ uhd::rfnoc::chdr_rx_data_xport::uptr x300_impl::x300_mb_iface::make_rx_data_tran
uhd::rfnoc::stream_buff_params_t fc_headroom = {0, 0};
- // Create the data transport
- auto fc_params = uhd::rfnoc::chdr_rx_data_xport::configure_sep(io_srv,
+ auto cfg_io_srv =
+ get_io_srv_mgr()->connect_links(recv_link, send_link, link_type_t::CTRL);
+
+ auto fc_params = uhd::rfnoc::chdr_rx_data_xport::configure_sep(cfg_io_srv,
recv_link,
send_link,
_pkt_factory,
@@ -161,6 +179,17 @@ uhd::rfnoc::chdr_rx_data_xport::uptr x300_impl::x300_mb_iface::make_rx_data_tran
fc_headroom,
lossy_xport);
+ get_io_srv_mgr()->disconnect_links(recv_link, send_link);
+ cfg_io_srv.reset();
+
+ // Connect the links to an I/O service
+ auto io_srv = get_io_srv_mgr()->connect_links(recv_link,
+ send_link,
+ link_type_t::RX_DATA,
+ uhd::usrp::read_io_service_args(xport_args, get_default_io_srv_args()),
+ streamer_id);
+
+ // Create the data transport
auto rx_xport = std::make_unique<uhd::rfnoc::chdr_rx_data_xport>(io_srv,
recv_link,
send_link,
@@ -178,17 +207,19 @@ uhd::rfnoc::chdr_tx_data_xport::uptr x300_impl::x300_mb_iface::make_tx_data_tran
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,
- const uhd::device_addr_t& xport_args)
+ const uhd::device_addr_t& xport_args,
+ const std::string& streamer_id)
{
+ using namespace uhd::transport;
+
const uhd::rfnoc::sep_addr_t local_sep_addr = addrs.first;
const uhd::rfnoc::sep_id_t remote_epid = epids.second;
const uhd::rfnoc::sep_id_t local_epid = epids.first;
- uhd::transport::io_service::sptr io_srv;
- uhd::transport::send_link_if::sptr send_link;
- uhd::transport::recv_link_if::sptr recv_link;
+ send_link_if::sptr send_link;
+ recv_link_if::sptr recv_link;
bool lossy_xport;
- std::tie(io_srv, send_link, std::ignore, recv_link, std::ignore, lossy_xport) =
+ std::tie(send_link, std::ignore, recv_link, std::ignore, lossy_xport) =
_conn_mgr->get_links(link_type_t::TX_DATA,
local_sep_addr.first,
local_epid,
@@ -202,7 +233,10 @@ uhd::rfnoc::chdr_tx_data_xport::uptr x300_impl::x300_mb_iface::make_tx_data_tran
const double fc_freq_ratio = 1.0 / 8;
const double fc_headroom_ratio = 0;
- const auto buff_capacity = chdr_tx_data_xport::configure_sep(io_srv,
+ auto cfg_io_srv =
+ get_io_srv_mgr()->connect_links(recv_link, send_link, link_type_t::CTRL);
+
+ const auto buff_capacity = chdr_tx_data_xport::configure_sep(cfg_io_srv,
recv_link,
send_link,
_pkt_factory,
@@ -213,6 +247,16 @@ uhd::rfnoc::chdr_tx_data_xport::uptr x300_impl::x300_mb_iface::make_tx_data_tran
fc_freq_ratio,
fc_headroom_ratio);
+ get_io_srv_mgr()->disconnect_links(recv_link, send_link);
+ cfg_io_srv.reset();
+
+ // Connect the links to an I/O service
+ auto io_srv = get_io_srv_mgr()->connect_links(recv_link,
+ send_link,
+ link_type_t::TX_DATA,
+ uhd::usrp::read_io_service_args(xport_args, get_default_io_srv_args()),
+ streamer_id);
+
// Create the data transport
auto tx_xport = std::make_unique<chdr_tx_data_xport>(io_srv,
recv_link,