aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/link_stream_manager.cpp
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2019-08-13 09:13:46 -0700
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:40 -0800
commita4274c19ebb42db112aa68a26fa499a52b9dd103 (patch)
tree5c29db76e72b00f5fc6247fce0752fae2abd2ddc /host/lib/rfnoc/link_stream_manager.cpp
parent81bd7896940dcd39181d0aee331e08abe4df1655 (diff)
downloaduhd-a4274c19ebb42db112aa68a26fa499a52b9dd103.tar.gz
uhd-a4274c19ebb42db112aa68a26fa499a52b9dd103.tar.bz2
uhd-a4274c19ebb42db112aa68a26fa499a52b9dd103.zip
rfnoc: Use adapter_id_t for balancing load across links
Since the mb_iface allocates local device IDs, also have it track the associated adapter IDs and provide a facility to retrieve them. Incorporate the adapter IDs in the user API to select the adapter for streamers.
Diffstat (limited to 'host/lib/rfnoc/link_stream_manager.cpp')
-rw-r--r--host/lib/rfnoc/link_stream_manager.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/host/lib/rfnoc/link_stream_manager.cpp b/host/lib/rfnoc/link_stream_manager.cpp
index 1c3ad407d..c0d79c519 100644
--- a/host/lib/rfnoc/link_stream_manager.cpp
+++ b/host/lib/rfnoc/link_stream_manager.cpp
@@ -65,6 +65,8 @@ public:
// TODO: This needs to be cleaned up. A muxed_zero_copy_if is excessive here
_ctrl_xport = _mb_iface.make_ctrl_transport(_my_device_id, _my_mgmt_ctrl_epid);
+ _my_adapter_id = _mb_iface.get_adapter_id(_my_device_id);
+
// Create management portal using one of the child transports
_mgmt_portal = mgmt_portal::make(
*_ctrl_xport, _pkt_factory, sep_addr_t(_my_device_id, SEP_INST_MGMT_CTRL));
@@ -82,6 +84,11 @@ public:
return _my_device_id;
}
+ virtual uhd::transport::adapter_id_t get_adapter_id() const
+ {
+ return _my_adapter_id;
+ }
+
virtual const std::set<sep_addr_t>& get_reachable_endpoints() const
{
return _mgmt_portal->get_reachable_endpoints();
@@ -98,8 +105,8 @@ public:
_ensure_ep_is_reachable(dst_addr);
// Allocate EPIDs
- sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal,
- *_ctrl_xport);
+ sep_id_t dst_epid =
+ _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal, *_ctrl_xport);
// Make sure that the software side of the endpoint is initialized and reachable
if (_ctrl_ep == nullptr) {
@@ -130,10 +137,10 @@ public:
_ensure_ep_is_reachable(src_addr);
// Allocate EPIDs and initialize endpoints
- sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal,
- *_ctrl_xport);
- sep_id_t src_epid = _epid_alloc->allocate_epid(src_addr, *_mgmt_portal,
- *_ctrl_xport);
+ sep_id_t dst_epid =
+ _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal, *_ctrl_xport);
+ sep_id_t src_epid =
+ _epid_alloc->allocate_epid(src_addr, *_mgmt_portal, *_ctrl_xport);
// Set up routes
_mgmt_portal->setup_remote_route(*_ctrl_xport, dst_epid, src_epid);
@@ -220,8 +227,8 @@ public:
_ensure_ep_is_reachable(dst_addr);
// Generate a new destination (device) EPID instance
- sep_id_t dst_epid = _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal,
- *_ctrl_xport);
+ sep_id_t dst_epid =
+ _epid_alloc->allocate_epid(dst_addr, *_mgmt_portal, *_ctrl_xport);
if (!_mgmt_portal->get_endpoint_info(dst_epid).has_data) {
throw uhd::rfnoc_error("Downstream endpoint does not support data traffic");
@@ -249,8 +256,8 @@ public:
_ensure_ep_is_reachable(src_addr);
// Generate a new source (device) EPID instance
- sep_id_t src_epid = _epid_alloc->allocate_epid(src_addr, *_mgmt_portal,
- *_ctrl_xport);
+ sep_id_t src_epid =
+ _epid_alloc->allocate_epid(src_addr, *_mgmt_portal, *_ctrl_xport);
if (!_mgmt_portal->get_endpoint_info(src_epid).has_data) {
throw uhd::rfnoc_error("Downstream endpoint does not support data traffic");
@@ -290,6 +297,8 @@ private:
const chdr::chdr_packet_factory& _pkt_factory;
// The device address of this software endpoint
const device_id_t _my_device_id;
+ // The host adapter ID associated with this software endpoint
+ adapter_id_t _my_adapter_id;
// Motherboard interface
mb_iface& _mb_iface;