fi_tagged(3)
π NAME π
hii bestie π you're on the fi_tagged(3) page, Libfabric v2.5.1 edition, and it's all about tagged data transfer operations. Think of tags like lil name stickers on messages so the right receive buffer can match them, iykyk.
fi_taggedβ Tagged data transfer operations. periodt.fi_trecv/fi_trecvv/fi_trecvmsgβ Post a buffer to receive an incoming message.fi_tsend/fi_tsendv/fi_tsendmsg/fi_tinject/fi_tsenddataβ Initiate an operation to send a message.
β¨ SYNOPSIS β¨
okay so here's the include and the whole function lineup, exactly as the header gives them:
#include <rdma/fi_tagged.h>
ssize_t fi_trecv(struct fid_ep *ep, void *buf, size_t len, void *desc,
fi_addr_t src_addr, uint64_t tag, uint64_t ignore, void *context);
ssize_t fi_trecvv(struct fid_ep *ep, const struct iovec *iov, void **desc,
size_t count, fi_addr_t src_addr, uint64_t tag, uint64_t ignore,
void *context);
ssize_t fi_trecvmsg(struct fid_ep *ep, const struct fi_msg_tagged *msg,
uint64_t flags);
ssize_t fi_tsend(struct fid_ep *ep, const void *buf, size_t len,
void *desc, fi_addr_t dest_addr, uint64_t tag, void *context);
ssize_t fi_tsendv(struct fid_ep *ep, const struct iovec *iov,
void **desc, size_t count, fi_addr_t dest_addr, uint64_t tag,
void *context);
ssize_t fi_tsendmsg(struct fid_ep *ep, const struct fi_msg_tagged *msg,
uint64_t flags);
ssize_t fi_tinject(struct fid_ep *ep, const void *buf, size_t len,
fi_addr_t dest_addr, uint64_t tag);
ssize_t fi_tsenddata(struct fid_ep *ep, const void *buf, size_t len,
void *desc, uint64_t data, fi_addr_t dest_addr, uint64_t tag,
void *context);
ssize_t fi_tinjectdata(struct fid_ep *ep, const void *buf, size_t len,
uint64_t data, fi_addr_t dest_addr, uint64_t tag);
π¦ ARGUMENTS π¦
okay so argument storytime, bestie:
fidβ Fabric endpoint on which to initiate tagged communication operation. Main character endpoint energy.bufβ Data buffer to send or receive. For 0-byte operations,bufmay be ignored.lenβ Length of data buffer to send or receive, specified in bytes. Valid transfers are from 0 bytes up to the endpoint'smax_msg_size.iovβ Vectored data buffer. For 0-byte operations,iovmay be ignored.countβ Count of vectored data entries. For 0-byte operations,countmay be 0.tagβ Tag associated with the message.ignoreβ Mask of bits to ignore applied to the tag for receive operations.descβ Memory descriptor associated with the data buffer. For 0-byte operations,descmay be ignored even forFI_MR_LOCAL. Seefi_mr(3).dataβ Remote CQ data to transfer with the sent data.dest_addrβ Destination address for connectionless transfers. Ignored for connected endpoints.src_addrβ Applies only to connectionless endpoints configured with theFI_DIRECTED_RECV. For all other endpoint configurations,src_addris ignored.src_addrdefines the source address to receive from. By default, thesrc_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_trecvmsg,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.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 π
okay so tagged messages are data transfers which carry a key or tag with the message buffer. The tag is used at the receiving endpoint to match the incoming message with a corresponding receive buffer. Message tags match when the receive buffer tag is the same as the send buffer tag with the ignored bits masked out. This can be stated as:
send_tag & ~ignore == recv_tag & ~ignore
or
send_tag | ignore == recv_tag | ignore
In general, message tags are checked against receive buffers in the order in which messages have been posted to the endpoint. See the ordering discussion below for more details.
The send functions β fi_tsend, fi_tsendv, fi_tsendmsg, fi_tinject, and fi_tsenddata β are used to transmit a tagged message from one endpoint to another endpoint. The main difference between send functions are the number and type of parameters that they accept as input. Otherwise, they perform the same general function.
The receive functions β fi_trecv, fi_trecvv, fi_recvmsg β post a data buffer to an endpoint to receive inbound tagged 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. Posted receive buffers are matched with inbound send messages based on the tags associated with the send and receive buffers.
bestie, this is a real caveat: do not touch the posted receive buffer(s) until the receive operation has completed. no cap. π«Ά
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.
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.
π fi_tsend π
The call fi_tsend transfers the data contained in the user-specified data buffer to a remote endpoint, with message boundaries being maintained. The local endpoint must be connected to a remote endpoint or destination before fi_tsend is called. Unless the endpoint has been configured differently, the data buffer passed into fi_tsend must not be touched by the application until the fi_tsend call completes asynchronously.
another caveat, bestie: don't touch that data buffer until the async fi_tsend completes, unless the endpoint is configured differently. π
π©· fi_tsendv π©·
The fi_tsendv call adds support for a scatter-gather list to fi_tsend. The fi_sendv transfers the set of data buffers referenced by the iov parameter to a remote endpoint as a single message.
π fi_tsendmsg π
The fi_tsendmsg 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_tsendmsg function takes a struct fi_msg_tagged as input.
struct fi_msg_tagged {
const struct iovec *msg_iov; /* scatter-gather array */
void *desc; /* data descriptor */
size_t iov_count;/* # elements in msg_iov */
fi_addr_t addr; /* optional endpoint address */
uint64_t tag; /* tag associated with message */
uint64_t ignore; /* mask applied to tag for receives */
void *context; /* user-defined context */
uint64_t data; /* optional immediate data */
};
For 0-byte operations, msg_iov, desc (including FI_MR_LOCAL) and iov_count may be ignored.
π fi_tinject π
The tagged inject call is an optimized version of fi_tsend. It provides similar completion semantics as fi_inject fi_msg(3).
π fi_tsenddata π
The tagged send data call is similar to fi_tsend, but allows for the sending of remote CQ data (see FI_REMOTE_CQ_DATA flag) as part of the transfer.
π¦ fi_tinjectdata π¦
The tagged inject data call is similar to fi_tinject, but allows for the sending of remote CQ data (see FI_REMOTE_CQ_DATA flag) as part of the transfer.
πΈ fi_trecv πΈ
The fi_trecv 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.
β¨ fi_trecvv β¨
The fi_trecvv call adds support for a scatter-gather list to fi_trecv. The fi_trecvv posts the set of data buffers referenced by the iov parameter to a receive incoming data.
π fi_trecvmsg π
The fi_trecvmsg 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_trecvmsg function takes a struct fi_msg_tagged as input.
β¨ FLAGS β¨
okay so bestie, fi_trecvmsg and fi_tsendmsg let you pass flags that change how the endpoint handles messages by default. Flags you set with fi_trecvmsg / fi_tsendmsg override most flags you already configured on the endpoint, except where noted (see fi_endpoint). Hereβs the whole flag menu usable with fi_trecvmsg and/or fi_tsendmsg π
FI_REMOTE_CQ_DATAβ applies tofi_tsendmsg. It means remote CQ data is available and should be sent as part of the request. Seefi_getinfofor extra details onFI_REMOTE_CQ_DATA. This flag is implicitly set forfi_tsenddataandfi_tinjectdataβ¨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 youβve got additional requests that will be posted immediately after the current call returns. Using it may improve performance by letting the provider optimize its access to the fabric hardware π₯FI_INJECTβ applies tofi_tsendmsg. It 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 the underlying provider implementation to 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 tagged receive operations when theFI_TAGGED_MULTI_RECVcapability is enabled. This flag lets you post a single tagged receive buffer that will receive multiple incoming messages. Received messages get packed into the receive buffer until the buffer has been consumed. Using 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_tsendmsg. Says a completion should be generated when the source buffer(s) may be reused β¨FI_TRANSMIT_COMPLETEβ applies tofi_tsendmsg. Says a completion should not be generated until the operation has been successfully transmitted and is no longer being tracked by the provider πFI_MATCH_COMPLETEβ applies tofi_tsendmsg. Says a completion should be generated only after the message has either been matched with a tagged buffer or was discarded by the target application π¦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_AUTH_KEYβ only valid with domains configured withFI_AV_AUTH_KEYand connectionless endpoints configured withFI_DIRECTED_RECVorFI_TAGGED_DIRECTED_RECV. When used withfi_trecvmsg, this flag denotes that thesrc_addris an authorization keyfi_addr_tinstead of an endpointfi_addr_tποΈ
The following flags may be used with fi_trecvmsg π
FI_PEEKβ the peek flag may be used to see if a specified message has arrived. A peek request is often useful on endpoints that have provider allocated buffering enabled. Unlike standard receive operations, a receive operation with theFI_PEEKflag set does not remain queued with the provider after the peek completes successfully. The peek operation operates asynchronously, and the results of the peek operation are available in the completion queue associated with the endpoint. If no message is found matching the tags specified in the peek request, then a completion queue error entry witherrfield set toFI_ENOMSGwill be available π
If a peek request locates a matching message, the operation will complete successfully. The returned completion data will indicate the meta-data associated with the message, such as the message length, completion flags, available CQ data, tag, and source address. The data available is subject to the completion entry format (e.g. struct fi_cq_tagged_entry) π
FI_CLAIMβ if this flag is used in conjunction withFI_PEEK, it indicates that if the peek request completes successfully (meaning a matching message was located), the message is claimed by the caller. Claimed messages can only be retrieved using a subsequent, paired receive operation with theFI_CLAIMflag set. A receive operation with theFI_CLAIMflag set butFI_PEEKnot set is used to retrieve a previously claimed message π«Ά
In order to use the FI_CLAIM flag, an application must supply a struct fi_context structure as the context for the receive operation. The same fi_context structure used for an FI_PEEK + FI_CLAIM operation must be used by the paired FI_CLAIM request π
FI_DISCARDβ this flag may be used in conjunction with eitherFI_PEEKorFI_CLAIM. If itβs used withFI_PEEK, it indicates that if the peek request completes successfully (meaning a matching message was located), the message is discarded by the provider, because the data is not needed by the application. This flag may also be used withFI_CLAIMto discard a message previously claimed using anFI_PEEK+FI_CLAIMrequest ποΈ
If this flag is set, the input buffer(s) and length parameters are ignored π
π RETURN VALUE π
The tagged send and receive calls return 0 on success. On error, a negative value corresponding to fabric errno is returned. Fabric errno values are defined in fi_errno.h β¨
πΈ ERRORS πΈ
-FI_EAGAINβ seefi_msg(3)for a detailed description of handlingFI_EAGAINπ-FI_EINVALβ indicates that an invalid argument was supplied by the user π-FI_EOTHERβ indicates that an unspecified error occurred π
π¦ SEE ALSO π¦
π AUTHORS π
OpenFabrics.
later bestie, mwah π β this cutie is from the Libfabric Programmerβs Manual, dated 2026-02-27, and itβs all about fi_tagged(3) πβ¨
π¦ 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