|
MXL : Media eXchange Layer
MXL
|
#include "mxl/fabrics.h"#include <chrono>#include <cstdint>#include <cstdlib>#include <cstring>#include <memory>#include <optional>#include <stdexcept>#include <mxl-internal/FlowReader.hpp>#include <mxl-internal/Instance.hpp>#include <mxl-internal/JsonUtils.hpp>#include <mxl-internal/Logging.hpp>#include <picojson/picojson.h>#include <rdma/fabric.h>#include <mxl/mxl.h>#include "internal/Exception.hpp"#include "internal/FabricInstance.hpp"#include "internal/FabricInterfaceProbe.hpp"#include "internal/Initiator.hpp"#include "internal/Provider.hpp"#include "internal/Target.hpp"#include "internal/TargetInfo.hpp"#include "mxl/platform.h"#include "VariantUtils.hpp"
Go to the source code of this file.
Namespaces | |
| namespace | mxl |
| namespace | mxl::lib |
| namespace | mxl::lib::fabrics |
| namespace | mxl::lib::fabrics::ofi |
| MXL_EXPORT mxlStatus mxlFabricsCreateInitiator | ( | mxlFabricsInstance | in_fabricsInstance, |
| mxlFabricsInitiator * | out_initiator ) |
Create a fabrics initiator instance.
| in_fabricsInstance | A valid mxl fabrics instance |
| out_initiator | A valid fabrics initiator |
Definition at line 376 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsCreateInstance | ( | mxlInstance | in_instance, |
| char const * | options, | ||
| mxlFabricsInstance * | out_fabricsInstance ) |
Create a new mxl-fabrics from an mxl instance. Targets and initiators created from this mxl-fabrics instance will have access to the flows created in the supplied mxl instance.
| in_instance | An mxlInstance previously created with mxlCreateInstance(). |
| options | A json-formatted string with options. Currently not used. |
| out_fabricsInstance | Returns a pointer to the created mxlFabricsInstance. |
Definition at line 106 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsCreateTarget | ( | mxlFabricsInstance | in_fabricsInstance, |
| mxlFabricsTarget * | out_target ) |
Create a fabrics target. The target is the receiver of write operations from an initiator.
| in_fabricsInstance | A valid mxl fabrics instance |
| out_target | A valid fabrics target |
Definition at line 175 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsDestroyInitiator | ( | mxlFabricsInstance | in_fabricsInstance, |
| mxlFabricsInitiator | in_initiator ) |
Destroy a fabrics initiator instance.
| in_fabricsInstance | A valid mxl fabrics instance |
| in_initiator | A valid fabrics initiator |
Definition at line 395 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsDestroyInstance | ( | mxlFabricsInstance | in_instance | ) |
Destroy a mxlFabricsInstance.
| in_instance | The mxlFabricsInstance to destroy. |
Definition at line 126 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsDestroyTarget | ( | mxlFabricsInstance | in_fabricsInstance, |
| mxlFabricsTarget | in_target ) |
Destroy a fabrics target instance.
| in_fabricsInstance | A valid mxl fabrics instance |
| in_target | A valid fabrics target |
Definition at line 194 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsFreeInterfaceList | ( | mxlFabricsInterfaceList * | interfaceList | ) |
Free an interface list previously allocated by mxlFabricsGetInterfaces. This function will also free the character strings in each interface endpoint address struct that is part of the list.
| interfaceList | The list of interfaces to free. |
Definition at line 163 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsFreeTargetInfo | ( | mxlFabricsTargetInfo | in_info | ) |
Free a mxlFabricsTargetInfo object obtained from mxlFabricsTargetSetup() or mxlFabricsTargetInfoFromString().
| in_info | A mxlFabricsTargetInfo object |
Definition at line 669 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsGetInterfaces | ( | mxlFabricsInstance | in_instance, |
| mxlFabricsInterfaceConfig const * | in_query, | ||
| mxlFabricsInterfaceList ** | out_list ) |
Query a list of available providers, interfaces and their capabilities on this system.
| [in] | in_instance | A valid mxlFabricsInstance. |
| [in] | in_query | (Optional) Can be used to filter the items returned by this function. Only the provider and address fields are used for filtering; capability flags in the query are ignored. Use MXL_FABRICS_PROVIDER_ANY or NULL to list interfaces for all providers. |
| [out] | out_list | A list of interfaces available on the system. Each entry includes the detected capability flags for that interface. The whole list should be freed with mxlFabricsFreeInterfaceList(). This will also free the character arrays returned from this function. |
Definition at line 144 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsInitiatorAddTarget | ( | mxlFabricsInitiator | in_initiator, |
| mxlFabricsTargetInfo | in_targetInfo ) |
Add a target to the initiator. This will allow the initiator to send data to the target in subsequent calls to mxlFabricsInitiatorTransferGrain(). This function is always non-blocking. If additional connection setup is required by the underlying implementation, it will only happen during a call to mxlFabricsInitiatorMakeProgress*().
| in_initiator | A valid fabrics initiator |
| in_targetInfo | The target information. This should be the same as the one returned from "mxlFabricsTargetSetup". |
Definition at line 432 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsInitiatorMakeProgressBlocking | ( | mxlFabricsInitiator | in_initiator, |
| uint16_t | in_timeoutMs ) |
This function must be called regularly for the initiator to make progress on queued transfer operations, connection establishment operations and connection shutdown operations. If a connection fails, the target is connected again during a later call to this function or to a transfer function.
| in_initiator | The initiator that should make progress. |
| in_timeoutMs | The maximum time to wait for progress to be made (in milliseconds). |
Definition at line 529 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsInitiatorMakeProgressNonBlocking | ( | mxlFabricsInitiator | in_initiator | ) |
This function must be called regularly for the initiator to make progress on queued transfer operations, connection establishment operations and connection shutdown operations. If a connection fails, the target is connected again during a later call to this function or to a mxlFabricsInitiatorTransferGrain or mxlFabricsInitiatorTransferSamples function.
| in_initiator | The initiator that should make progress. |
Definition at line 506 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsInitiatorRemoveTarget | ( | mxlFabricsInitiator | in_initiator, |
| mxlFabricsTargetInfo | in_targetInfo ) |
Remove a target from the initiator. This function is always non-blocking. If any additional communication for a graceful shutdown is required it will happend during a call to mxlFabricsInitiatorMakeProgress*(). It is guaranteed that no new grain transfer operations will be queued for this target during calls to mxlFabricsInitiatorTransferGrain() after the target was removed, but it is only guaranteed that the connection shutdown has completed after mxlFabricsInitiatorMakeProgress*() no longer returns MXL_ERR_NOT_READY. If a connection oriented target closes its connection, for example because it was destroyed, it stays added until it is removed with this function. The initiator does not connect to it again, because a new target has new target information with new keys, and potentially a new port. The user needs to remove the old target and add the target information of the new one.
| in_initiator | A valid fabrics initiator |
| in_targetInfo | The target information. This should be the same as the one returned from "mxlFabricsTargetSetup". |
Definition at line 451 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsInitiatorSetup | ( | mxlFabricsInitiator | in_initiator, |
| mxlFabricsInitiatorConfig const * | in_config, | ||
| char const * | in_options ) |
Configure the initiator.
| in_initiator | A valid fabrics initiator |
| in_config | The initiator configuration. This will be used to create an endpoint and register a memory region. The memory region corresponds to the one that will be shared with targets. |
| in_options | An optional json-formatted string with options. May be NULL or empty. Recognized fields:
|
Definition at line 413 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsInitiatorTransferGrain | ( | mxlFabricsInitiator | in_initiator, |
| uint64_t | in_grainIndex, | ||
| uint16_t | in_startSlice, | ||
| uint16_t | in_endSlice ) |
Enqueue a transfer operation to all added targets. This function is always non-blocking. The transfer operation might be started right away, but is only guaranteed to have completed after mxlFabricsInitiatorMakeProgress*() no longer returns MXL_ERR_NOT_READY.
| in_initiator | A valid fabrics initiator |
| in_grainIndex | The grain index to transfer. The ordering was given when mxlFabricsRegions object were created. This is true for both local and remote memory regions. |
| in_startSlice | The start slice in the slice range to transfer. This is inclusive. |
| in_endSlice | The end slice in the slice range to transfer. This is exclusive. |
Definition at line 470 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsInitiatorTransferSamples | ( | mxlFabricsInitiator | in_initiator, |
| uint64_t | in_headIndex, | ||
| size_t | in_count ) |
Enqueue a transfer operation to all added targets. This function is always non-blocking. The transfer operation might be started right away, but is only guaranteed to have completed after mxlFabricsInitiatorMakeProgress*() no longer returns MXL_ERR_NOT_READY.
| in_initiator | A valid fabrics initiator |
| in_headIndex | The head index to transfer. |
| in_count | The number of samples per channel to transfer. |
Definition at line 488 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsProviderFromString | ( | char const * | in_string, |
| mxlFabricsProvider * | out_provider ) |
Convert a string to a fabrics provider enum value.
| in_string | A valid string to convert |
| out_provider | A valid fabrics provider to convert to |
Definition at line 552 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsProviderToString | ( | mxlFabricsProvider | in_provider, |
| char * | out_string, | ||
| size_t * | in_stringSize ) |
Convert a fabrics provider enum value to a string.
| in_provider | A valid fabrics provider to convert |
| out_string | A user supplied buffer of the correct size. Initially you can pass a NULL pointer to obtain the size of the string. |
| in_stringSize | The size of the output string. |
Definition at line 574 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsTargetInfoFromString | ( | char const * | in_string, |
| mxlFabricsTargetInfo * | out_targetInfo ) |
Parse a targetInfo object from its string representation.
| in_string | A valid string to deserialize |
| out_targetInfo | A valid target info to deserialize to |
Definition at line 617 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsTargetInfoToString | ( | mxlFabricsTargetInfo | in_targetInfo, |
| char * | out_string, | ||
| size_t * | in_stringSize ) |
Serialize a target info object obtained from mxlFabricsTargetSetup() into a string representation.
| in_targetInfo | A valid target info to serialize |
| out_string | A user supplied buffer of the correct size. Initially you can pass a NULL pointer to obtain the size of the string. |
| in_stringSize | The size of the output string. |
Definition at line 635 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsTargetReadGrain | ( | mxlFabricsTarget | in_target, |
| uint16_t | in_timeoutMs, | ||
| uint64_t * | out_entryIndex ) |
Blocking accessor for a flow grain.
| in_target | A valid fabrics target |
| out_grainIndex | The index of the grain that was written, if any. |
| in_timeoutMs | How long should we wait for the grain (in milliseconds) |
Definition at line 272 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsTargetReadGrainNonBlocking | ( | mxlFabricsTarget | in_target, |
| uint64_t * | out_grainIndex ) |
Non-blocking accessor for a flow grain.
| in_target | A valid fabrics target |
| out_grainIndex | The index of the grain that was written, if any. |
Definition at line 238 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsTargetReadSamples | ( | mxlFabricsTarget | in_target, |
| uint16_t | in_timeoutMs, | ||
| uint64_t * | out_headIndex, | ||
| size_t * | out_count ) |
Blocking accessor for a flow sample.
| in_target | A valid fabrics target |
| out_headIndex | The head index of the samples that were written, if any. |
| out_count | The number of samples per channel that were written, if any. |
| in_timeoutMs | How long should we wait for the samples (in milliseconds) |
Definition at line 341 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsTargetReadSamplesNonBlocking | ( | mxlFabricsTarget | in_target, |
| uint64_t * | out_headIndex, | ||
| size_t * | out_count ) |
Non-blocking accessor for a flow sample.
| in_target | A valid fabrics target |
| out_headIndex | The head index of the samples that were written, if any. |
| out_count | The number of samples per channel that were written, if any. |
Definition at line 306 of file fabrics.cpp.
| MXL_EXPORT mxlStatus mxlFabricsTargetSetup | ( | mxlFabricsTarget | in_target, |
| mxlFabricsTargetConfig const * | in_config, | ||
| char const * | in_options, | ||
| mxlFabricsTargetInfo * | out_info ) |
Configure the target. After the target has been configured, it is ready to receive transfers from an initiator. If additional connection setup is required by the underlying implementation it might not happen during the call to mxlFabricsTargetSetup, but be deferred until the first call to mxlFabricsTargetTryNewGrain().
| in_target | A valid fabrics target |
| in_config | The target configuration. This will be used to create an endpoint and register a memory region. The memory region corresponds to the one that will be written to by the initiator. |
| in_options | An optional json-formatted string with options. May be NULL or empty. Recognized fields:
|
| out_info | An mxlFabricsTargetInfo_t object which should be shared to a remote initiator which this target should receive data from. The object must be freed with mxlFabricsFreeTargetInfo(). |
Definition at line 215 of file fabrics.cpp.