Commit 5cc82ca7 authored by Ezekiel Dohmen's avatar Ezekiel Dohmen
Browse files

A bit of work to support multiple adapters

parent ea6b5d28
......@@ -18,7 +18,7 @@ class Dolphin_SISCI_Resource
virtual ~Dolphin_SISCI_Resource();
DOLPHIN_ERROR_CODES connect_mc_segment(unsigned segment_id, unsigned segment_size);
DOLPHIN_ERROR_CODES connect_mc_segment(unsigned adapter_num, unsigned segment_id, unsigned segment_size);
int get_segment_id();
......@@ -30,13 +30,13 @@ class Dolphin_SISCI_Resource
//Static members
static unsigned _usage_count;
static std::mutex _data_mutex;
static const unsigned _local_adapter_num;
static unsigned _local_node_id; //Filled when we init the lib
//Instance members
sci_desc_t _v_dev;
unsigned _segment_id;
sci_local_segment_t _local_segment;
unsigned _local_adapter_num;
sci_remote_segment_t _remote_segment;
sci_map_t _local_map;
sci_map_t _remote_map;
......
......@@ -147,7 +147,9 @@ void DolphinNetlinkServer::handle_alloc_req( dolphin_mc_alloc_req * req_ptr )
if( !new_segments.back() ) return build_and_send_alloc_resp_error(DOLPHIN_ERROR_SEGMENT_SETUP_ERROR);
//Setup the multicast segment
status = new_segments.back()->connect_mc_segment(req_ptr->segment_ids[i], req_ptr->segment_sz_bytes);
status = new_segments.back()->connect_mc_segment(req_ptr->segments[i]->adapter_num,
req_ptr->segments[i]->segment_id,
req_ptr->segments[i]->segment_sz_bytes);
if( status != DOLPHIN_ERROR_OK ) return build_and_send_alloc_resp_error(status);
}
......
......@@ -11,8 +11,6 @@
unsigned Dolphin_SISCI_Resource::_usage_count = 0;
std::mutex Dolphin_SISCI_Resource::_data_mutex;
const unsigned Dolphin_SISCI_Resource::_local_adapter_num = 0;
unsigned Dolphin_SISCI_Resource::_local_node_id;
std::unique_ptr< Dolphin_SISCI_Resource > Dolphin_SISCI_Resource::create_instance()
{
......@@ -32,18 +30,6 @@ std::unique_ptr< Dolphin_SISCI_Resource > Dolphin_SISCI_Resource::create_instanc
return nullptr;
}
// Get local nodeId
SCIGetLocalNodeId(_local_adapter_num,
&_local_node_id,
NO_FLAGS,
&error);
if (error != SCI_ERR_OK) {
spdlog::error("Dolphin_SISCI_Resource::create_instance() - Could not find the local adapter {}", _local_adapter_num);
SCITerminate();
return nullptr;
}
}
++Dolphin_SISCI_Resource::_usage_count;
......@@ -82,10 +68,25 @@ Dolphin_SISCI_Resource::~Dolphin_SISCI_Resource()
}
DOLPHIN_ERROR_CODES Dolphin_SISCI_Resource::connect_mc_segment(unsigned segment_id, unsigned segment_size)
DOLPHIN_ERROR_CODES Dolphin_SISCI_Resource::connect_mc_segment(unsigned adapter_num, unsigned segment_id, unsigned segment_size)
{
sci_error_t error;
_local_adapter_num = adapter_num;
// Get local nodeId
SCIGetLocalNodeId(_local_adapter_num,
&_local_node_id,
NO_FLAGS,
&error);
if (error != SCI_ERR_OK) {
spdlog::error("Dolphin_SISCI_Resource::supports_multicast() - Could not find the local adapter {}", _local_adapter_num);
SCITerminate();
return nullptr;
}
if ( !supports_multicast() )
{
spdlog::error("Dolphin_SISCI_Resource::connect_mc_segment() - Called, but dolphin network does not support multicast.");
......@@ -176,6 +177,7 @@ bool Dolphin_SISCI_Resource::supports_multicast()
sci_error_t error;
unsigned int mcast_max_groups = 0;
queryAdapter.localAdapterNo = _local_adapter_num;
queryAdapter.subcommand = SCI_Q_ADAPTER_MCAST_MAX_GROUPS;
queryAdapter.data = &mcast_max_groups;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment