1fi_tagged(3)                   Libfabric v1.18.1                  fi_tagged(3)
2
3
4

NAME

6       fi_tagged - Tagged data transfer operations
7
8       fi_trecv / fi_trecvv / fi_trecvmsg
9              Post a buffer to receive an incoming message
10
11       fi_tsend / fi_tsendv / fi_tsendmsg / fi_tinject / fi_tsenddata
12              Initiate an operation to send a message
13

SYNOPSIS

15              #include <rdma/fi_tagged.h>
16
17              ssize_t fi_trecv(struct fid_ep *ep, void *buf, size_t len, void *desc,
18                  fi_addr_t src_addr, uint64_t tag, uint64_t ignore, void *context);
19
20              ssize_t fi_trecvv(struct fid_ep *ep, const struct iovec *iov, void **desc,
21                  size_t count, fi_addr_t src_addr, uint64_t tag, uint64_t ignore,
22                  void *context);
23
24              ssize_t fi_trecvmsg(struct fid_ep *ep, const struct fi_msg_tagged *msg,
25                  uint64_t flags);
26
27              ssize_t fi_tsend(struct fid_ep *ep, const void *buf, size_t len,
28                  void *desc, fi_addr_t dest_addr, uint64_t tag, void *context);
29
30              ssize_t fi_tsendv(struct fid_ep *ep, const struct iovec *iov,
31                  void **desc, size_t count, fi_addr_t dest_addr, uint64_t tag,
32                  void *context);
33
34              ssize_t fi_tsendmsg(struct fid_ep *ep, const struct fi_msg_tagged *msg,
35                  uint64_t flags);
36
37              ssize_t fi_tinject(struct fid_ep *ep, const void *buf, size_t len,
38                  fi_addr_t dest_addr, uint64_t tag);
39
40              ssize_t fi_tsenddata(struct fid_ep *ep, const void *buf, size_t len,
41                  void *desc, uint64_t data, fi_addr_t dest_addr, uint64_t tag,
42                  void *context);
43
44              ssize_t fi_tinjectdata(struct fid_ep *ep, const void *buf, size_t len,
45                  uint64_t data, fi_addr_t dest_addr, uint64_t tag);
46

ARGUMENTS

48       fid    Fabric endpoint on which to initiate tagged communication opera‐
49              tion.
50
51       buf    Data buffer to send or receive.
52
53       len    Length of data buffer to send or receive.
54
55       iov    Vectored data buffer.
56
57       count  Count of vectored data entries.
58
59       tag    Tag associated with the message.
60
61       ignore Mask of bits to ignore applied to the  tag  for  receive  opera‐
62              tions.
63
64       desc   Memory   descriptor   associated  with  the  data  buffer.   See
65              fi_mr(3).
66
67       data   Remote CQ data to transfer with the sent data.
68
69       dest_addr
70              Destination address for connectionless transfers.   Ignored  for
71              connected endpoints.
72
73       src_addr
74              Source  address  to  receive  from for connectionless transfers.
75              Applies only to connectionless  endpoints  with  the  FI_DIRECT‐
76              ED_RECV capability enabled, otherwise this field is ignored.  If
77              set to FI_ADDR_UNSPEC, any source address may match.
78
79       msg    Message descriptor for send and receive operations.
80
81       flags  Additional flags to apply for the send or receive operation.
82
83       context
84              User specified pointer to associate with  the  operation.   This
85              parameter  is  ignored if the operation will not generate a suc‐
86              cessful completion, unless an op flag specifies the context  pa‐
87              rameter be used for required input.
88

DESCRIPTION

90       Tagged  messages  are  data transfers which carry a key or tag with the
91       message buffer.  The tag is used at the receiving endpoint to match the
92       incoming  message  with  a  corresponding receive buffer.  Message tags
93       match when the receive buffer tag is the same as the  send  buffer  tag
94       with the ignored bits masked out.  This can be stated as:
95
96              send_tag & ~ignore == recv_tag & ~ignore
97
98              or
99
100              send_tag | ignore == recv_tag | ignore
101
102       In general, message tags are checked against receive buffers in the or‐
103       der in which messages have been posted to the endpoint.  See the order‐
104       ing discussion below for more details.
105
106       The  send functions – fi_tsend, fi_tsendv, fi_tsendmsg, fi_tinject, and
107       fi_tsenddata – are used to transmit a tagged message from one  endpoint
108       to  another  endpoint.   The main difference between send functions are
109       the number and type of parameters that they accept  as  input.   Other‐
110       wise, they perform the same general function.
111
112       The  receive  functions – fi_trecv, fi_trecvv, fi_recvmsg – post a data
113       buffer to an endpoint to receive inbound tagged messages.   Similar  to
114       the  send operations, receive operations operate asynchronously.  Users
115       should not touch the posted data buffer(s) until the receive  operation
116       has  completed.   Posted  receive buffers are matched with inbound send
117       messages based on the tags associated with the send  and  receive  buf‐
118       fers.
119
120       An  endpoint must be enabled before an application can post send or re‐
121       ceive operations to it.  For connected endpoints, receive  buffers  may
122       be  posted  prior  to  connect  or accept being called on the endpoint.
123       This ensures that buffers are available to receive incoming data  imme‐
124       diately after the connection has been established.
125
126       Completed  message  operations  are reported to the user through one or
127       more event collectors associated with the endpoint.  Users provide con‐
128       text  which  are associated with each operation, and is returned to the
129       user as part of the event completion.  See fi_cq for  completion  event
130       details.
131
132   fi_tsend
133       The  call  fi_tsend  transfers the data contained in the user-specified
134       data buffer to a remote endpoint, with message boundaries  being  main‐
135       tained.   The  local endpoint must be connected to a remote endpoint or
136       destination before fi_tsend is called.  Unless the  endpoint  has  been
137       configured  differently,  the data buffer passed into fi_tsend must not
138       be touched by the application until the fi_tsend call  completes  asyn‐
139       chronously.
140
141   fi_tsendv
142       The  fi_tsendv call adds support for a scatter-gather list to fi_tsend.
143       The fi_sendv transfers the set of data buffers referenced  by  the  iov
144       parameter to a remote endpoint as a single message.
145
146   fi_tsendmsg
147       The  fi_tsendmsg  call  supports data transfers over both connected and
148       connectionless endpoints, with the ability to control the  send  opera‐
149       tion per call through the use of flags.  The fi_tsendmsg function takes
150       a struct fi_msg_tagged as input.
151
152              struct fi_msg_tagged {
153                  const struct iovec *msg_iov; /* scatter-gather array */
154                  void               *desc;    /* data descriptor */
155                  size_t             iov_count;/* # elements in msg_iov */
156                  fi_addr_t          addr;    /* optional endpoint address */
157                  uint64_t           tag;      /* tag associated with message */
158                  uint64_t           ignore;   /* mask applied to tag for receives */
159                  void               *context; /* user-defined context */
160                  uint64_t           data;     /* optional immediate data */
161              };
162
163   fi_tinject
164       The tagged inject call is an optimized version of  fi_tsend.   It  pro‐
165       vides similar completion semantics as fi_inject fi_msg(3).
166
167   fi_tsenddata
168       The  tagged  send  data call is similar to fi_tsend, but allows for the
169       sending of remote CQ data (see FI_REMOTE_CQ_DATA flag) as part  of  the
170       transfer.
171
172   fi_tinjectdata
173       The  tagged  inject  data call is similar to fi_tinject, but allows for
174       the sending of remote CQ data (see FI_REMOTE_CQ_DATA flag) as  part  of
175       the transfer.
176
177   fi_trecv
178       The  fi_trecv call posts a data buffer to the receive queue of the cor‐
179       responding endpoint.  Posted receives are  searched  in  the  order  in
180       which they were posted in order to match sends.  Message boundaries are
181       maintained.  The order in which the receives complete is  dependent  on
182       the endpoint type and protocol.
183
184   fi_trecvv
185       The  fi_trecvv call adds support for a scatter-gather list to fi_trecv.
186       The fi_trecvv posts the set of data buffers referenced by the  iov  pa‐
187       rameter to a receive incoming data.
188
189   fi_trecvmsg
190       The  fi_trecvmsg  call supports posting buffers over both connected and
191       connectionless endpoints, with the ability to control the receive oper‐
192       ation  per  call  through  the  use of flags.  The fi_trecvmsg function
193       takes a struct fi_msg_tagged as input.
194

FLAGS

196       The fi_trecvmsg and fi_tsendmsg calls allow the user to  specify  flags
197       which  can  change the default message handling of the endpoint.  Flags
198       specified with fi_trecvmsg / fi_tsendmsg override most flags previously
199       configured  with  the  endpoint,  except where noted (see fi_endpoint).
200       The  following  list  of  flags  are  usable  with  fi_trecvmsg  and/or
201       fi_tsendmsg.
202
203       FI_REMOTE_CQ_DATA
204              Applies  to fi_tsendmsg and fi_tsenddata.  Indicates that remote
205              CQ data is available and should be sent as part of the  request.
206              See fi_getinfo for additional details on FI_REMOTE_CQ_DATA.
207
208       FI_COMPLETION
209              Indicates  that  a  completion entry should be generated for the
210              specified operation.  The endpoint must be bound to a completion
211              queue with FI_SELECTIVE_COMPLETION that corresponds to the spec‐
212              ified operation, or this flag is ignored.
213
214       FI_MORE
215              Indicates that the user has additional requests that will  imme‐
216              diately  be  posted after the current call returns.  Use of this
217              flag may improve performance by enabling the provider  to  opti‐
218              mize its access to the fabric hardware.
219
220       FI_INJECT
221              Applies to fi_tsendmsg.  Indicates that the outbound data buffer
222              should be returned to user immediately after the send  call  re‐
223              turns,  even  if  the operation is handled asynchronously.  This
224              may require that the underlying provider implementation copy the
225              data  into a local buffer and transfer out of that buffer.  This
226              flag can only be used with messages smaller than inject_size.
227
228       FI_INJECT_COMPLETE
229              Applies to fi_tsendmsg.  Indicates that a completion  should  be
230              generated when the source buffer(s) may be reused.
231
232       FI_TRANSMIT_COMPLETE
233              Applies  to fi_tsendmsg.  Indicates that a completion should not
234              be generated until the operation has been successfully transmit‐
235              ted and is no longer being tracked by the provider.
236
237       FI_MATCH_COMPLETE
238              Applies  to  fi_tsendmsg.  Indicates that a completion should be
239              generated only after the message has either been matched with  a
240              tagged buffer or was discarded by the target application.
241
242       FI_FENCE
243              Applies  to  transmits.  Indicates that the requested operation,
244              also known as the fenced operation, and any operation posted af‐
245              ter the fenced operation will be deferred until all previous op‐
246              erations targeting the same peer endpoint have completed.  Oper‐
247              ations  posted after the fencing will see and/or replace the re‐
248              sults of any operations initiated prior to the fenced operation.
249
250       The ordering of operations starting at the posting of the fenced opera‐
251       tion  (inclusive)  to the posting of a subsequent fenced operation (ex‐
252       clusive) is controlled by the endpoint’s ordering semantics.
253
254       The following flags may be used with fi_trecvmsg.
255
256       FI_PEEK
257              The peek flag may be used to see if a specified message has  ar‐
258              rived.   A  peek  request is often useful on endpoints that have
259              provider  allocated  buffering  enabled  (see   fi_rx_attr   to‐
260              tal_buffered_recv).   Unlike  standard receive operations, a re‐
261              ceive operation with the FI_PEEK flag set does not remain queued
262              with  the  provider  after the peek completes successfully.  The
263              peek operation operates asynchronously, and the results  of  the
264              peek  operation are available in the completion queue associated
265              with the endpoint.  If no message is  found  matching  the  tags
266              specified in the peek request, then a completion queue error en‐
267              try with err field set to FI_ENOMSG will be available.
268
269       If a peek request locates a matching message, the operation  will  com‐
270       plete  successfully.   The  returned  completion data will indicate the
271       meta-data associated with the message, such as the message length, com‐
272       pletion  flags,  available  CQ data, tag, and source address.  The data
273       available is  subject  to  the  completion  entry  format  (e.g. struct
274       fi_cq_tagged_entry).
275
276       An  application  may supply a buffer if it desires to receive data as a
277       part of the peek operation.  In order to receive data as a part of  the
278       peek operation, the buf and len fields must be available in the CQ for‐
279       mat.  In particular, FI_CQ_FORMAT_CONTEXT and  FI_CQ_FORMAT_MSG  cannot
280       be  used  if  peek operations desire to obtain a copy of the data.  The
281       returned data is limited to the size of the input buffer(s) or the mes‐
282       sage  size,  if  smaller.  A provider indicates if data is available by
283       setting the buf field of the CQ entry to the user’s first input buffer.
284       If buf is NULL, no data was available to return.  A provider may return
285       NULL even if the peek operation completes successfully.  Note that  the
286       CQ  entry  len field will reference the size of the message, not neces‐
287       sarily the size of the returned data.
288
289       FI_CLAIM
290              If this flag is used in conjunction with FI_PEEK,  it  indicates
291              if  the  peek request completes successfully – indicating that a
292              matching message was located – the message is claimed by caller.
293              Claimed  messages  can  only  be  retrieved  using a subsequent,
294              paired receive operation with the FI_CLAIM flag set.  A  receive
295              operation  with  the  FI_CLAIM  flag set, but FI_PEEK not set is
296              used to retrieve a previously claimed message.
297
298       In order to use the FI_CLAIM flag, an application must supply a  struct
299       fi_context  structure  as  the  context for the receive operation, or a
300       struct fi_recv_context in the case  of  buffered  receives.   The  same
301       fi_context  structure  used for an FI_PEEK + FI_CLAIM operation must be
302       used by the paired FI_CLAIM request.
303
304       This flag also applies to endpoints configured for FI_BUFFERED_RECV  or
305       FI_VARIABLE_MSG.   When  set,  it  is used to retrieve a tagged message
306       that was buffered by the provider.  See Buffered Tagged  Receives  sec‐
307       tion for details.
308
309       FI_DISCARD
310              This  flag  may  be  used  in conjunction with either FI_PEEK or
311              FI_CLAIM.  If this flag is used in conjunction with FI_PEEK,  it
312              indicates  if the peek request completes successfully – indicat‐
313              ing that a matching message was located – the  message  is  dis‐
314              carded  by the provider, as the data is not needed by the appli‐
315              cation.  This flag may also be used in conjunction with FI_CLAIM
316              in  order  to  discard  a  message  previously  claimed using an
317              FI_PEEK + FI_CLAIM request.
318
319       This flag also applies to endpoints configured for FI_BUFFERED_RECV  or
320       FI_VARIABLE_MSG.   When set, it indicates that the provider should free
321       a buffered messages.  See Buffered Tagged Receives section for details.
322
323       If this flag is set, the input buffer(s) and length parameters are  ig‐
324       nored.
325

Buffered Tagged Receives

327       See  fi_msg(3)  for an introduction to buffered receives.  The handling
328       of buffered receives differs between fi_msg operations  and  fi_tagged.
329       Although  the  provider is responsible for allocating and managing net‐
330       work buffers, the application is responsible for identifying  the  tags
331       that  will  be  used  to match incoming messages.  The provider handles
332       matching incoming receives to the application specified tags.
333
334       When FI_BUFFERED_RECV is enabled, the application posts the  tags  that
335       will  be  used  for matching purposes.  Tags are posted using fi_trecv,
336       fi_trecvv, and fi_trecvmsg; however, parameters related  to  the  input
337       buffers  are  ignored  (e.g. buf, len, iov, desc).  When a provider re‐
338       ceives a message for which there is a matching tag, it  will  write  an
339       entry to the completion queue associated with the receiving endpoint.
340
341       For  discussion purposes, the completion queue is assumed to be config‐
342       ured for FI_CQ_FORMAT_TAGGED.  The op_context field  will  point  to  a
343       struct fi_recv_context.
344
345              struct fi_recv_context {
346                  struct fid_ep *ep;
347                  void *context;
348              };
349
350       The `ep' field will be NULL.  The `context' field will match the appli‐
351       cation context specified when posting the tag.  Other fields are set as
352       defined in fi_msg(3).
353
354       After  being notified that a buffered receive has arrived, applications
355       must either claim or discard the message as described in fi_msg(3).
356

Variable Length Tagged Messages

358       Variable length messages are defined in  fi_msg(3).   The  requirements
359       for  handling variable length tagged messages is identical to those de‐
360       fined above for buffered tagged receives.
361

RETURN VALUE

363       The tagged send and receive calls return 0 on  success.   On  error,  a
364       negative  value corresponding to fabric errno  is returned.  Fabric er‐
365       rno values are defined in fi_errno.h.
366

ERRORS

368       -FI_EAGAIN
369              See fi_msg(3) for a detailed description of handling FI_EAGAIN.
370
371       -FI_EINVAL
372              Indicates that an invalid argument was supplied by the user.
373
374       -FI_EOTHER
375              Indicates that an unspecified error occurred.
376

SEE ALSO

378       fi_getinfo(3), fi_endpoint(3), fi_domain(3), fi_cq(3)
379

AUTHORS

381       OpenFabrics.
382
383
384
385Libfabric Programmer’s Manual     2023-01-02                      fi_tagged(3)
Impressum