1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
/**
* Copyright (C) Mellanox Technologies Ltd. 2001-2019. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
/**
* @ingroup UCT_AM
* @brief Trace types for active message tracer.
*/
;
/**
* @ingroup UCT_RESOURCE
* @brief Flags for active message and tag-matching offload callbacks (callback's parameters).
*
* If UCT_CB_PARAM_FLAG_DESC flag is enabled, then data is part of a descriptor
* which includes the user-defined rx_headroom, and the callback may return
* UCS_INPROGRESS and hold on to that descriptor. Otherwise, the data can't be
* used outside the callback. If needed, the data must be copied-out.
*
@verbatim
descriptor data
| |
+-------------+-------------------------+
| rx_headroom | payload |
+-------------+-------------------------+
@endverbatim
*
* UCT_CB_PARAM_FLAG_FIRST and UCT_CB_PARAM_FLAG_MORE flags are relevant for
* @ref uct_tag_unexp_eager_cb_t callback only. The former value indicates that
* the data is the first fragment of the message. The latter value means that
* more fragments of the message yet to be delivered.
*/
;
/**
* @addtogroup UCT_RESOURCE
* @{
*/
typedef struct uct_component *uct_component_h;
typedef struct uct_iface *uct_iface_h;
typedef struct uct_iface_config uct_iface_config_t;
typedef struct uct_md_config uct_md_config_t;
typedef struct uct_cm_config uct_cm_config_t;
typedef struct uct_ep *uct_ep_h;
typedef void * uct_mem_h;
typedef uintptr_t uct_rkey_t;
typedef struct uct_md *uct_md_h; /**< @brief Memory domain handler */
typedef struct uct_md_ops uct_md_ops_t;
typedef void *uct_rkey_ctx_h;
typedef struct uct_iface_attr uct_iface_attr_t;
typedef struct uct_iface_params uct_iface_params_t;
typedef struct uct_ep_attr uct_ep_attr_t;
typedef struct uct_md_attr uct_md_attr_t;
typedef struct uct_completion uct_completion_t;
typedef struct uct_pending_req uct_pending_req_t;
typedef struct uct_worker *uct_worker_h;
typedef struct uct_md uct_md_t;
typedef enum uct_am_trace_type uct_am_trace_type_t;
typedef struct uct_device_addr uct_device_addr_t;
typedef struct uct_iface_addr uct_iface_addr_t;
typedef struct uct_ep_addr uct_ep_addr_t;
typedef struct uct_ep_params uct_ep_params_t;
typedef struct uct_ep_connect_params uct_ep_connect_params_t;
typedef struct uct_cm_attr uct_cm_attr_t;
typedef struct uct_cm uct_cm_t;
typedef uct_cm_t *uct_cm_h;
typedef struct uct_listener_attr uct_listener_attr_t;
typedef struct uct_listener *uct_listener_h;
typedef struct uct_listener_params uct_listener_params_t;
typedef struct uct_tag_context uct_tag_context_t;
typedef uint64_t uct_tag_t; /* tag type - 64 bit */
typedef int uct_worker_cb_id_t;
typedef void* uct_conn_request_h;
/**
* @}
*/
/**
* @ingroup UCT_RESOURCE
* @brief Structure for scatter-gather I/O.
*
* Specifies a list of buffers which can be used within a single data transfer
* function call.
*
@verbatim
buffer
|
+-----------+-------+-----------+-------+-----------+
| payload | empty | payload | empty | payload |
+-----------+-------+-----------+-------+-----------+
|<-length-->| |<-length-->| |<-length-->|
|<---- stride ----->|<---- stride ----->|
@endverbatim
*
* @note The sum of lengths in all iov list must be less or equal to max_zcopy
* of the respective communication operation.
* @note If @a length or @a count are zero, the memory pointed to by @a buffer
* will not be accessed. Otherwise, @a buffer must point to valid memory.
*
* @note If @a count is one, every iov entry specifies a single contiguous data block
*
* @note If @a count > 1, each iov entry specifies a strided block of @a count
* elements and distance of @a stride byte between consecutive elements
*
*/
typedef struct uct_iov uct_iov_t;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Client-Server private data pack callback arguments field mask.
*
* The enumeration allows specifying which fields in
* @ref uct_cm_ep_priv_data_pack_args are present, for backward compatibility
* support.
*/
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Client-Server resolve callback arguments field mask.
*
* The enumeration allows specifying which fields in
* @ref uct_cm_ep_resolve_args are present, for backward compatibility support.
*/
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Arguments to the client-server private data pack callback.
*
* Used with the client-server API on a connection manager.
*/
typedef struct uct_cm_ep_priv_data_pack_args uct_cm_ep_priv_data_pack_args_t;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Arguments to the client-server resolved callback.
*
* Used with the client-server API on a connection manager.
*/
typedef struct uct_cm_ep_resolve_args uct_cm_ep_resolve_args_t;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Remote data attributes field mask.
*
* The enumeration allows specifying which fields in @ref uct_cm_remote_data are
* present, for backward compatibility support.
*/
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Data received from the remote peer.
*
* The remote peer's device address, the data received from it and their lengths.
* Used with the client-server API on a connection manager.
*/
typedef struct uct_cm_remote_data uct_cm_remote_data_t;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Listener's connection request callback arguments field mask.
*
* The enumeration allows specifying which fields in
* @ref uct_cm_listener_conn_request_args are present, for backward compatibility
* support.
*/
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Arguments to the listener's connection request callback.
*
* The local device name, connection request handle and the data the client sent.
* Used with the client-server API on a connection manager.
*/
typedef struct uct_cm_listener_conn_request_args uct_cm_listener_conn_request_args_t;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Field mask flags for client-side connection established callback.
*
* The enumeration allows specifying which fields in
* @ref uct_cm_ep_client_connect_args are present, for backward compatibility
* support.
*/
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Arguments to the client's connect callback.
*
* Used with the client-server API on a connection manager.
*/
typedef struct uct_cm_ep_client_connect_args uct_cm_ep_client_connect_args_t;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Field mask flags for server-side connection established notification
* callback.
*
* The enumeration allows specifying which fields in
* @ref uct_cm_ep_server_conn_notify_args are present, for backward compatibility
* support.
*/
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Arguments to the server's notify callback.
*
* Used with the client-server API on a connection manager.
*/
typedef struct uct_cm_ep_server_conn_notify_args uct_cm_ep_server_conn_notify_args_t;
/**
* @ingroup UCT_AM
* @brief Callback to process incoming active message
*
* When the callback is called, @a flags indicates how @a data should be handled.
* If @a flags contain @ref UCT_CB_PARAM_FLAG_DESC value, it means @a data is part of
* a descriptor which must be released later by @ref uct_iface_release_desc by
* the user if the callback returns @ref UCS_INPROGRESS.
*
* @param [in] arg User-defined argument.
* @param [in] data Points to the received data. This may be a part of
* a descriptor which may be released later.
* @param [in] length Length of data.
* @param [in] flags Mask with @ref uct_cb_param_flags
*
* @note This callback could be set and released
* by @ref uct_iface_set_am_handler function.
*
* @retval UCS_OK - descriptor was consumed, and can be released
* by the caller.
* @retval UCS_INPROGRESS - descriptor is owned by the callee, and would be
* released later. Supported only if @a flags contain
* @ref UCT_CB_PARAM_FLAG_DESC value. Otherwise, this is
* an error.
*
*/
typedef ;
/**
* @ingroup UCT_AM
* @brief Callback to trace active messages.
*
* Writes a string which represents active message contents into 'buffer'.
*
* @param [in] arg User-defined argument.
* @param [in] type Message type.
* @param [in] id Active message id.
* @param [in] data Points to the received data.
* @param [in] length Length of data.
* @param [out] buffer Filled with a debug information string.
* @param [in] max Maximal length of the string.
*/
typedef void ;
/**
* @ingroup UCT_RESOURCE
* @brief Callback to process send completion.
*
* @param [in] self Pointer to relevant completion structure, which was
* initially passed to the operation.
*/
typedef void ;
/**
* @ingroup UCT_RESOURCE
* @brief Callback to process pending requests.
*
* @param [in] self Pointer to relevant pending structure, which was
* initially passed to the operation.
*
* @return @ref UCS_OK - This pending request has completed and
* should be removed.
* @ref UCS_INPROGRESS - Some progress was made, but not completed.
* Keep this request and keep processing the queue.
* Otherwise - Could not make any progress. Keep this pending
* request on the queue, and stop processing the queue.
*/
typedef ;
/**
* @ingroup UCT_RESOURCE
* @brief Callback to process peer failure.
*
* @param [in] arg User argument to be passed to the callback.
* @param [in] ep Endpoint which has failed. Upon return from the callback,
* this @a ep is no longer usable and all subsequent
* operations on this @a ep will fail with the error code
* passed in @a status.
* @param [in] status Status indicating error.
*
* @return @ref UCS_OK - The error was handled successfully.
* Otherwise - The error was not handled and is returned back to
* the transport.
*/
typedef ;
/**
* @ingroup UCT_RESOURCE
* @brief Callback to purge pending requests.
*
* @param [in] self Pointer to relevant pending structure, which was
* initially passed to the operation.
* @param [in] arg User argument to be passed to the callback.
*/
typedef void ;
/**
* @ingroup UCT_RESOURCE
* @brief Callback for producing data.
*
* @param [in] dest Memory buffer to pack the data to.
* @param [in] arg Custom user-argument.
*
* @return Size of the data was actually produced.
*/
typedef size_t ;
/**
* @ingroup UCT_RESOURCE
* @brief Callback for consuming data.
*
* @param [in] arg Custom user-argument.
* @param [in] data Memory buffer to unpack the data from.
* @param [in] length How much data to consume (size of "data")
*
* @note The arguments for this callback are in the same order as libc's memcpy().
*/
typedef void ;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Callback to process an incoming connection request on the server side.
*
* This callback routine will be invoked on the server side upon receiving an
* incoming connection request. It should be set by the server side while
* initializing an interface.
* Incoming data is placed inside the conn_priv_data buffer.
* This callback has to be thread safe.
* Other than communication progress routines, it is allowed to call other UCT
* communication routines from this callback.
*
* @param [in] iface Transport interface.
* @param [in] arg User defined argument for this callback.
* @param [in] conn_request Transport level connection request. The user
* should accept or reject the request by calling
* @ref uct_iface_accept or @ref uct_iface_reject
* routines respectively.
* conn_request should not be used outside the
* scope of this callback.
* @param [in] conn_priv_data Points to the received data.
* This is the private data that was passed to the
* @ref uct_ep_params_t::sockaddr_pack_cb on the
* client side.
* @param [in] length Length of the received data.
*
*/
typedef void
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Callback to process an incoming connection request on the server side
* listener in a connection manager.
*
* This callback routine will be invoked on the server side upon receiving an
* incoming connection request. It should be set by the server side while
* initializing a listener in a connection manager.
* This callback has to be thread safe.
* Other than communication progress routines, it is allowed to call other UCT
* communication routines from this callback.
*
* @param [in] listener Transport listener.
* @param [in] arg User argument for this callback as defined in
* @ref uct_listener_params_t::user_data
* @param [in] conn_req_args Listener's arguments to handle the connection
* request from the client.
*/
typedef void
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Callback to process an incoming connection establishment acknowledgment
* on the server side listener, from the client, which indicates that the
* client side is connected.
* The callback also notifies the server side of a local error on a
* not-yet-connected endpoint.
*
* This callback routine will be invoked on the server side upon receiving an
* incoming connection establishment acknowledgment from the client, which is sent
* from it once the client is connected to the server. Used to connect the server
* side to the client or handle an error from it - depending on the status field.
* This callback will also be invoked in the event of an internal local error
* with a failed @ref uct_cm_ep_server_conn_notify_args::status if the endpoint
* was not connected yet.
* This callback has to be thread safe.
* Other than communication progress routines, it is permissible to call other UCT
* communication routines from this callback.
*
* @param [in] ep Transport endpoint.
* @param [in] arg User argument for this callback as defined in
* @ref uct_ep_params_t::user_data
* @param [in] connect_args Server's connect callback arguments.
*/
typedef void
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Callback to process an incoming connection response on the client side
* from the server or handle a local error on a not-yet-connected endpoint.
*
* This callback routine will be invoked on the client side upon receiving an
* incoming connection response from the server. Used to connect the client side
* to the server or handle an error from it - depending on the status field.
* This callback will also be invoked in the event of an internal local error
* with a failed @ref uct_cm_ep_client_connect_args::status if the endpoint was
* not connected yet.
* This callback has to be thread safe.
* Other than communication progress routines, it is permissible to call other UCT
* communication routines from this callback.
*
* @param [in] ep Transport endpoint.
* @param [in] arg User argument for this callback as defined in
* @ref uct_ep_params_t::user_data.
* @param [in] connect_args Client's connect callback arguments
*/
typedef void ;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Callback to handle the disconnection of the remote peer.
*
* This callback routine will be invoked on the client and server sides upon
* a disconnect of the remote peer. It will disconnect the given endpoint from
* the remote peer.
* This callback won't be invoked if the endpoint was not connected to the remote
* peer yet.
* This callback has to be thread safe.
* Other than communication progress routines, it is permissible to call other UCT
* communication routines from this callback.
*
* @param [in] ep Transport endpoint to disconnect.
* @param [in] arg User argument for this callback as defined in
* @ref uct_ep_params_t::user_data.
*/
typedef void ;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Callback to fill the user's private data in a client-server flow.
*
* This callback routine will be invoked on the client side, before sending the
* transport's connection request to the server, or on the server side before
* sending a connection response to the client.
* This callback routine can be set when creating an endpoint.
* The user's private data should be placed inside the priv_data buffer to be
* sent to the remote side.
* The maximal allowed length of the private data is indicated by the field
* max_conn_priv inside @ref uct_iface_attr or inside @ref uct_cm_attr when using a
* connection manager.
* Communication progress routines should not be called from this callback.
* It is allowed to call other UCT communication routines from this callback.
*
* @param [in] arg User defined argument for this callback.
* @param [in] pack_args Handle for the the private data packing.
* @param [out] priv_data User's private data to be passed to the remote side.
*
* @return Negative value indicates an error according to @ref ucs_status_t.
* On success, a non-negative value indicates actual number of
* bytes written to the @a priv_data buffer.
*/
typedef ssize_t
;
/**
* @ingroup UCT_CLIENT_SERVER
* @brief Callback to notify that the client side endpoint is bound to a
* local device.
*
* This callback routine will be invoked, when the client side endpoint is bound
* to a local device.
* The callback routine can be set when creating an endpoint.
* Communication progress routines should not be called from this callback.
* It is allowed to call other UCT communication routines from this callback.
*
* @param [in] user_data User argument as defined in
* @ref uct_ep_params_t::user_data.
* @param [in] resolve_args Handle for the extra arguments provided by the
* transport.
*
* @return UCS_OK on success or error as defined in @ref ucs_status_t.
*/
typedef ucs_status_t
;
/**
* @ingroup UCT_TAG
* @brief Callback to process unexpected eager tagged message.
*
* This callback is invoked when tagged message sent by eager protocol has
* arrived and no corresponding tag has been posted.
*
* @note The callback is always invoked from the context (thread, process)
* that called @a uct_iface_progress().
*
* @note It is allowed to call other communication routines from the callback.
*
* @param [in] arg User-defined argument
* @param [in] data Points to the received unexpected data.
* @param [in] length Length of data.
* @param [in] flags Mask with @ref uct_cb_param_flags flags. If it
* contains @ref UCT_CB_PARAM_FLAG_DESC value, this means
* @a data is part of a descriptor which must be released
* later using @ref uct_iface_release_desc by the user if
* the callback returns @ref UCS_INPROGRESS.
* @param [in] stag Tag from sender.
* @param [in] imm Immediate data from sender.
*
* @param [inout] context Storage for a per-message user-defined context. In
* this context, the message is defined by the sender
* side as a single call to uct_ep_tag_eager_short/bcopy/zcopy.
* On the transport level the message can be fragmented
* and delivered to the target over multiple fragments.
* The fragments will preserve the original order of the
* message. Each fragment will result in invocation of
* the above callback. The user can use
* UCT_CB_PARAM_FLAG_FIRST to identify the first fragment,
* allocate the context object and use the context as a
* token that is set by the user and passed to subsequent
* callbacks of the same message. The user is responsible
* for allocation and release of the context.
*
* @note No need to allocate the context in the case of a single fragment message
* (i.e. @a flags contains @ref UCT_CB_PARAM_FLAG_FIRST, but does not
* contain @ref UCT_CB_PARAM_FLAG_MORE).
*
* @retval UCS_OK - data descriptor was consumed, and can be released
* by the caller.
* @retval UCS_INPROGRESS - data descriptor is owned by the callee, and will be
* released later.
*/
typedef ;
/**
* @ingroup UCT_TAG
* @brief Callback to process unexpected rendezvous tagged message.
*
* This callback is invoked when rendezvous send notification has arrived
* and no corresponding tag has been posted.
*
* @note The callback is always invoked from the context (thread, process)
* that called @a uct_iface_progress().
*
* @note It is allowed to call other communication routines from the callback.
*
* @param [in] arg User-defined argument
* @param [in] flags Mask with @ref uct_cb_param_flags
* @param [in] stag Tag from sender.
* @param [in] header User defined header.
* @param [in] header_length User defined header length in bytes.
* @param [in] remote_addr Sender's buffer virtual address.
* @param [in] length Sender's buffer length.
* @param [in] rkey_buf Sender's buffer packed remote key. It can be
* passed to uct_rkey_unpack() to create uct_rkey_t.
*
* @warning If the user became the owner of the @a desc (by returning
* @ref UCS_INPROGRESS) the descriptor must be released later by
* @ref uct_iface_release_desc by the user.
*
* @retval UCS_OK - descriptor was consumed, and can be released
* by the caller.
* @retval UCS_INPROGRESS - descriptor is owned by the callee, and would be
* released later.
*/
typedef ;
/**
* @ingroup UCT_RESOURCE
* @brief Callback to process asynchronous events.
*
* @param [in] arg User argument to be passed to the callback.
* @param [in] flags Flags to be passed to the callback (reserved for
* future use).
*/
typedef void ;