6#include <rdma/fabric.h>
7#include <rdma/fi_errno.h>
18 FabricInfo::FabricInfo(::fi_info*
raw) noexcept
28 FabricInfo FabricInfo::clone(::fi_info
const* info)
noexcept
34 FabricInfo FabricInfo::own(::fi_info* info)
noexcept
45 FabricInfo::~FabricInfo() noexcept
50 FabricInfo::FabricInfo(
FabricInfo const& other) noexcept
51 :
_raw(::fi_dupinfo(other._raw))
54 void FabricInfo::operator=(
FabricInfo const& other)
noexcept
58 _raw = ::fi_dupinfo(other._raw);
61 FabricInfo::FabricInfo(
FabricInfo&& other) noexcept
75 ::fi_info& FabricInfo::operator*() noexcept
80 ::fi_info
const& FabricInfo::operator*() const noexcept
85 ::fi_info* FabricInfo::operator->() noexcept
90 ::fi_info
const* FabricInfo::operator->() const noexcept
95 ::fi_info* FabricInfo::raw() noexcept
100 ::fi_info
const* FabricInfo::raw() const noexcept
110 void FabricInfo::free() noexcept
120 :
_raw(const_cast<::fi_info*>(
raw))
155 return FabricInfo::clone(
_raw);
160 return _raw->tx_attr->iov_limit;
165 return _raw->tx_attr->size;
170 return _raw->ep_attr->type;
175 auto info = std::add_pointer_t<::fi_info>{
nullptr};
176 fiCall(::fi_getinfo,
"Failed to get provider information",
fiVersion(),
nullptr,
nullptr, 0,
nullptr, &info);
182 auto info = std::add_pointer_t<::fi_info>{
nullptr};
183 auto hints = FabricInfo::empty();
185 auto node = std::string{};
186 auto service = std::string{};
187 auto nodeStringBuffer = std::add_pointer_t<char const>{
nullptr};
188 auto serviceStringBuffer = std::add_pointer_t<char const>{
nullptr};
191 hints->fabric_attr->prov_name = ::strdup(providerConfig.
getProviderName().c_str());
196 hints->caps = providerConfig.
getCaps();
203 if (
auto nodeValue = sourceAddress->node(); nodeValue)
206 nodeStringBuffer = node.c_str();
209 if (
auto serviceValue = sourceAddress->service(); serviceValue)
211 service = *serviceValue;
212 serviceStringBuffer = service.c_str();
216 hints->addr_format =
static_cast<std::uint32_t
>(sourceAddress->addressFormat());
220 "Failed to get source interface information",
247 other._begin =
nullptr;
255 other._begin =
nullptr;
~FabricInfoList()
calls fi_freeinfo to deallocate the underlying linked-list
FabricInfoIterator< false > iterator
FabricInfoList(FabricInfoList const &)=delete
static FabricInfoList get()
Calls fi_getinfo without any hints and returns the full list of fabric information objects.
const_iterator cbegin() const noexcept
static FabricInfoList getSourceInterfaces(ProviderConfig const &providerConfig, std::optional< FabricAddress > const &sourceAddress)
Calls fi_getinfo with FI_SOURCE to get source interface information. Uses hints derived from the prov...
iterator begin() noexcept
FabricInfoIterator< true > const_iterator
const_iterator cend() const noexcept
FabricInfoList & operator=(FabricInfoList const &)=delete
static FabricInfoList own(::fi_info *info) noexcept
Take ownership over a fi_info raw pointer.
Non-owning view of a FabricInfo. Returned when iterating over a FabricInfoList.
FabricInfo owned() noexcept
Return an owned version that can be moved, copied and dereferenced safely even if the original Fabric...
::fi_ep_type endpointType() const noexcept
FabricInfoView(::fi_info const *)
Private constructor.
std::size_t txSize() const noexcept
Return the transmit queue size of the endpoint.
::fi_info * operator->() noexcept
Dereferencing returns the raw fi_info object associated with this view.
::fi_info * raw() noexcept
Returns the raw fi_info object associated with this view.
::fi_info & operator*() noexcept
Dereferencing returns the raw fi_info object associated with this view.
std::size_t txIovLimit() const noexcept
Return the IOV limit for this fabric info, which is the maximum number of iovecs that can be posted i...
::fi_ep_type getEndpointType() const noexcept
Return the endpoint type for this provider (FI_EP_MSG, FI_EP_RDM, etc.).
std::uint64_t getCaps() const noexcept
Return the libfabric capability flags for this provider configuration.
std::string getProviderName() const
Get the provider name (as expected by libfabric in prov_name) as a string.
int getSupportedMemoryRegistrationModes() const noexcept
Return a value that represents all supported memory registration modes (mr_mode).
FabricInfo(FabricInfoView) noexcept
Create an owning FabricInfo object from a non-owning view.
FabricInfoView view() const noexcept
Return a non-owning view of the FabricInfo.
std::uint32_t fiVersion() noexcept
Returns the libfabric version this library was compiled with.
::fi_info * raw() noexcept
Returns the raw fi_info object managed by this FabricInfo instance.
int fiCall(F &&fun, std::string_view msg, T &&... args)
Call a libfabric function and check its return code.
void free() noexcept
Called internally to release the fi_info object.