fi_msg(3)
okay so bestie, this is fi_msg(3) from Libfabric v2.5.1 β the message data transfer operations page β and weβre gonna make it make sense. π
β¨
πΈ NAME πΈ
fi_msg β Message data transfer operations.
fi_recv/fi_recvv/fi_recvmsgβ post a buffer to receive an incoming message.fi_send/fi_sendv/fi_sendmsgfi_inject/fi_senddataβ initiate an operation to send a message.
β¨ SYNOPSIS β¨
#include <rdma/fi_endpoint.h>
ssize_t fi_recv(struct fid_ep *ep, void * buf, size_t len,
void *desc, fi_addr_t src_addr, void *context);
ssize_t fi_recvv(struct fid_ep *ep, const struct iovec *iov, void **desc,
size_t count, fi_addr_t src_addr, void *context);
ssize_t fi_recvmsg(struct fid_ep *ep, const struct fi_msg *msg,
uint64_t flags);
ssize_t fi_send(struct fid_ep *ep, const void *buf, size_t len,
void *desc, fi_addr_t dest_addr, void *context);
ssize_t fi_sendv(struct fid_ep *ep, const struct iovec *iov,
void **desc, size_t count, fi_addr_t dest_addr, void *context);
ssize_t fi_sendmsg(struct fid_ep *ep, const struct fi_msg *msg,
uint64_t flags);
ssize_t fi_inject(struct fid_ep *ep, const void *buf, size_t len,
fi_addr_t dest_addr);
ssize_t fi_senddata(struct fid_ep *ep, const void *buf, size_t len,
void *desc, uint64_t data, fi_addr_t dest_addr, void *context);
ssize_t fi_injectdata(struct fid_ep *ep, const void *buf, size_t len,
uint64_t data, fi_addr_t dest_addr);
π ARGUMENTS π
epβ the fabric endpoint on which to initiate a send or post a receive buffer. main character energy tbh π«bufβ the data buffer to send or receive. For 0-byte operations,bufmay be ignored.lenβ length of the data buffer to send or receive, specified in bytes. Valid transfers are from0bytes up to the endpointβsmax_msg_size. no cap, thatβs the range πiovβ vectored data buffer. For 0-byte operations,iovmay be ignored.countβ count of vectored data entries. For 0-byte operations,countmay be0.descβ descriptor associated with the data buffer. For 0-byte operations,descmay be ignored even forFI_MR_LOCAL. Seefi_mr(3). iykyk π§dataβ remote CQ data to transfer with the sent message.dest_addrβ destination address for connectionless transfers. Ignored for connected endpoints.src_addrβ this one only applies to connectionless endpoints configured withFI_DIRECTED_RECV. For all other endpoint configurations,src_addris ignored.src_addrdefines the source address to receive from. By default,src_addris treated as a source endpoint address (i.e.fi_addr_treturned fromfi_av_insert/fi_av_insertsvc/fi_av_remove). If theFI_AUTH_KEYflag is specified withfi_recvmsg,src_addris treated as a source authorization key (i.e.fi_addr_treturned fromfi_av_insert_auth_key). If set toFI_ADDR_UNSPEC, any source address may match. thatβs the whole lore fr πmsgβ message descriptor for send and receive operations.flagsβ additional flags to apply for the send or receive operation.contextβ user specified pointer to associate with the operation. This parameter is ignored if the operation will not generate a successful completion, unless an op flag specifies the context parameter be used for required input.
π DESCRIPTION π
The send functions β fi_send, fi_sendv, fi_sendmsg, fi_inject, and fi_senddata β are used to transmit a message from one endpoint to another endpoint. The main difference between send functions is the number and type of parameters that they accept as input. Otherwise, they perform the same general function. Messages sent using fi_msg operations are received by a remote endpoint into a buffer posted to receive such messages. slay, message boundaries stay intact β¨
The receive functions β fi_recv, fi_recvv, fi_recvmsg β post a data buffer to an endpoint to receive inbound messages. Similar to the send operations, receive operations operate asynchronously.
π¨ Users should not touch the posted data buffer(s) until the receive operation has completed. literally do not touch, bestie π
An endpoint must be enabled before an application can post send or receive operations to it. For connected endpoints, receive buffers may be posted prior to connect or accept being called on the endpoint. This ensures that buffers are available to receive incoming data immediately after the connection has been established. thatβs the pre-game prep π«Ά
Completed message operations are reported to the user through one or more event collectors associated with the endpoint. Users provide context which are associated with each operation, and is returned to the user as part of the event completion. See fi_cq for completion event details. completion-event tea is over there β
π¦ fi_send
The call fi_send transfers the data contained in the user-specified data buffer to a remote endpoint, with message boundaries being maintained. simple, clean, iconic π
π¦ fi_sendv
The fi_sendv call adds support for a scatter-gather list to fi_send. The fi_sendv transfers the set of data buffers referenced by the iov parameter to a remote endpoint as a single message. one message, many buffers, no drama π
π¦ fi_sendmsg
The fi_sendmsg call supports data transfers over both connected and connectionless endpoints, with the ability to control the send operation per call through the use of flags. The fi_sendmsg function takes a struct fi_msg as input. flags give you per-call control, periodt π
struct fi_msg {
const struct iovec *msg_iov; /* scatter-gather array */
void **desc; /* local request descriptors */
size_t iov_count;/* # elements in iov */
fi_addr_t addr; /* optional endpoint address */
void *context; /* user-defined context */
uint64_t data; /* optional message data */
};
For 0-byte operations, msg_iov, desc (including FI_MR_LOCAL) and iov_count may be ignored. 0-byte ops get a pass π
π¦ fi_inject
The send inject call is an optimized version of fi_send with the following characteristics. The data buffer is available for reuse immediately on return from the call, and no CQ entry will be written if the transfer completes successfully. If the transfer fails, an error entry will be written to the CQ. fast, clean, no success CQ spam π₯
Conceptually, this means that the fi_inject function behaves as if the FI_INJECT transfer flag were set, selective completions are enabled, and the FI_COMPLETION flag is not specified. Note that the CQ entry will be suppressed even if the default behavior of the endpoint is to write CQ entries for all successful completions. See the flags discussion below for more details. The requested message size that can be used with fi_inject is limited by inject_size. that size limit is real, bestie π
If FI_HMEM is enabled, the fi_inject call can only accept buffer with iface equal to FI_HMEM_SYSTEM if the provider requires the FI_MR_HMEM mr_mode. This limitation applies to all the fi_*inject* calls and does not affect how inject_size is reported. same rule for all the inject girlies π
π¦ fi_senddata
The send data call is similar to fi_send, but allows for the sending of remote CQ data (see FI_REMOTE_CQ_DATA flag) as part of the transfer. send with a little extra data garnish π
π¦ fi_injectdata
The inject data call is similar to fi_inject, but allows for the sending of remote CQ data (see FI_REMOTE_CQ_DATA flag) as part of the transfer. inject speed plus remote CQ data β
π¦ fi_recv
The fi_recv call posts a data buffer to the receive queue of the corresponding endpoint. Posted receives are searched in the order in which they were posted in order to match sends. Message boundaries are maintained. The order in which the receives complete is dependent on the endpoint type and protocol. For connectionless endpoints, the src_addr parameter can be used to indicate that a buffer should be posted to receive incoming data from a specific remote endpoint. order matters, and boundaries stay cute π
π¦ fi_recvv
The fi_recvv call adds support for a scatter-gather list to fi_recv. The fi_recvv posts the set of data buffers referenced by the iov parameter to receive incoming data. scatter-gather receive era π¦
π¦ fi_recvmsg
The fi_recvmsg call supports posting buffers over both connected and connectionless endpoints, with the ability to control the receive operation per call through the use of flags. The fi_recvmsg function takes a struct fi_msg as input. per-call receive control, iconic behavior π
π FLAGS π
okay so bestie, the fi_recvmsg and fi_sendmsg calls let you pass flags that change the default message handling of the endpoint. Flags you specify with fi_recvmsg / fi_sendmsg override most flags previously configured with the endpoint, except where noted (see fi_endpoint.3). The following list of flags are usable with fi_recvmsg and/or fi_sendmsg.
FI_REMOTE_CQ_DATAβ Applies tofi_sendmsg. It means remote CQ data is available and should be sent as part of the request. Seefi_getinfofor additional details onFI_REMOTE_CQ_DATA. This flag is implicitly set forfi_senddataandfi_injectdata.FI_COMPLETIONβ Says a completion entry should be generated for the specified operation. The endpoint must be bound to a completion queue withFI_SELECTIVE_COMPLETIONthat corresponds to the specified operation, or this flag is ignored.FI_MOREβ Says the user has additional requests that will immediately be posted after the current call returns. Using this flag may improve performance by enabling the provider to optimize its access to the fabric hardware.FI_INJECTβ Applies tofi_sendmsg. Says the outbound data buffer should be returned to the user immediately after the send call returns, even if the operation is handled asynchronously. This may require that the underlying provider implementation copy the data into a local buffer and transfer out of that buffer. This flag can only be used with messages smaller thaninject_size.FI_MULTI_RECVβ Applies to posted receive operations. This flag lets the user post a single buffer that will receive multiple incoming messages. Received messages will be packed into the receive buffer until the buffer has been consumed. Use of this flag may cause a single posted receive operation to generate multiple events as messages are placed into the buffer. The placement of received data into the buffer may be subjected to provider specific alignment restrictions.
The buffer will be released by the provider when the available buffer space falls below the specified minimum (see FI_OPT_MIN_MULTI_RECV). Note that an entry to the associated receive completion queue will always be generated when the buffer has been consumed, even if other receive completions have been suppressed (i.e. the Rx context has been configured for FI_SELECTIVE_COMPLETION). See the FI_MULTI_RECV completion flag fi_cq(3).
FI_INJECT_COMPLETEβ Applies tofi_sendmsg. Says a completion should be generated when the source buffer(s) may be reused.FI_TRANSMIT_COMPLETEβ Applies tofi_sendmsgandfi_recvmsg. For sends, it says a completion should not be generated until the operation has been successfully transmitted and is no longer being tracked by the provider. For receive operations, it says a completion may be generated as soon as the message has been processed by the local provider, even if the message data may not be visible to all processing elements. Seefi_cq(3)for target side completion semantics.FI_DELIVERY_COMPLETEβ Applies tofi_sendmsg. Says a completion should be generated when the operation has been processed by the destination.FI_FENCEβ Applies to transmits. Says the requested operation, also known as the fenced operation, and any operation posted after the fenced operation will be deferred until all previous operations targeting the same peer endpoint have completed. Operations posted after the fencing will see and/or replace the results of any operations initiated prior to the fenced operation.
The ordering of operations starting at the posting of the fenced operation (inclusive) to the posting of a subsequent fenced operation (exclusive) is controlled by the endpointβs ordering semantics.
FI_MULTICASTβ Applies to transmits. This flag says the address specified as the data transfer destination is a multicast address. This flag must be used in all multicast transfers, in conjunction with a multicastfi_addr_t.FI_AUTH_KEYβ Only valid with domains configured withFI_AV_AUTH_KEYand connectionless endpoints configured withFI_DIRECTED_RECV. When used withfi_recvmsg, this flag denotes that thesrc_addris an authorization keyfi_addr_tinstead of an endpointfi_addr_t.
π NOTES π
If an endpoint has been configured with FI_MSG_PREFIX, the application must include buffer space of size msg_prefix_size, as specified by the endpoint attributes. The prefix buffer must occur at the start of the data referenced by the buf parameter, or be referenced by the first IO vector. Message prefix space cannot be split between multiple IO vectors. The size of the prefix buffer should be included as part of the total buffer length.
π«Ά RETURN VALUE π«Ά
Returns 0 on success. On error, a negative value corresponding to fabric errno is returned. Fabric errno values are defined in rdma/fi_errno.h.
See the discussion below for details handling FI_EAGAIN.
π ERRORS π
-FI_EAGAINβ Says the underlying provider currently lacks the resources needed to initiate the requested operation. The reasons for a provider returningFI_EAGAINare varied. However, common reasons include insufficient internal buffering or full processing queues.
Insufficient internal buffering is often associated with operations that use FI_INJECT. In such cases, additional buffering may become available as posted operations complete.
Full processing queues may be a temporary state related to local processing (for example, a large message is being transferred), or may be the result of flow control. In the latter case, the queues may remain blocked until additional resources are made available at the remote side of the transfer.
In all cases, the operation may be retried after additional resources become available. When using FI_PROGRESS_MANUAL, the application must check for transmit and receive completions after receiving FI_EAGAIN as a return value, independent of the operation which failed. This is also strongly recommended when using FI_PROGRESS_AUTO, as acknowledgements or flow control messages may need to be processed in order to resume execution.
π SEE ALSO π
fi_getinfo(3), fi_endpoint(3), fi_domain(3), fi_cq(3)
π AUTHORS π
OpenFabrics.
thatβs the whole vibe, bestie π this page is from the Libfabric Programmerβs Manual, dated 2026-02-27, and itβs fi_msg(3) β slay and stay safe out there πβ¨
π¦ where this page comes from
- centos-stream 10: libfabric-devel 2.5.1-1.el10 Β· BSD-2-Clause OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms