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
/**
* Copyright (C) Mellanox Technologies Ltd. 2020. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
/**
* Maximal value for connection sequence number
*/
/**
* Connection sequence number
*/
typedef uint64_t ucs_conn_sn_t;
/**
* Connection queue type
*/
typedef enum ucs_conn_match_queue_type ucs_conn_match_queue_type_t;
/**
* Structure to embed in a connection entry to support matching with remote
* peer's connections.
*/
typedef struct ucs_conn_match_elem ucs_conn_match_elem_t;
typedef struct ucs_conn_match_ctx ucs_conn_match_ctx_t;
/**
* Function to get the address of the connection between the peers.
*
* @param [in] elem Pointer to the connection matching element.
*
* @return Pointer to the address of the connection between the peers.
*/
typedef const void*
;
/**
* Function to get the sequence number of the connection between the peers.
*
* @param [in] elem Pointer to the connection matching element.
*
* @return Sequnce number of the given connection between the peers.
*/
typedef ucs_conn_sn_t
;
/**
* Function to get string representation of the connection address.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
* @param [in] address Pointer to the connection address.
* @param [out] str A string filled with the address.
* @param [in] max_size Size of a string (considering '\0'-terminated symbol).
*
* @return A resulted string filled with the address.
*/
typedef const char*
;
/**
* Callback that is invoked from @ref ucs_conn_match_cleanup function.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
* @param [in] elem Pointer to the connection matching element.
*/
typedef void
;
/**
* Connection matching operations
*/
typedef struct ucs_conn_match_ops ucs_conn_match_ops_t;
/**
* Connection peer entry - allows *ordered* matching of connections between
* a pair of connected peers. The expected/unexpected lists are *not* circular
*/
typedef struct ucs_conn_match_peer ucs_conn_match_peer_t;
/**
* Context for matching connections
*/
;
/**
* Initialize the connection matching context.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
* @param [in] address_length Length of the addresses used for the connection
* between peers.
* @param [in] max_conn_sn Maximum value for the connection sequence number.
* @param [in] ops Pointer to the user-defined connection matching
* operations.
*/
void ;
/**
* Cleanup the connection matching context.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
*/
void ;
/**
* Get the next value of the connection sequence number between two peers.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
* @param [in] address Pointer to the address of the connection
* between the peers.
*
* @return The next value of the connection sequence number, this value is unique
* for the given connection.
*/
ucs_conn_sn_t ;
/**
* Insert the connection matching entry to the context.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
* @param [in] address Pointer to the address of the connection
* between the peers.
* @param [in] conn_sn Connection sequence number between the peers.
* @param [in] elem Pointer to the connection matching structure.
* @param [in] conn_queue_type Connection queue which should be used to insert
* the connection matching element to.
*
* @return Flag that indicates whether connection element was added
* successfully or not to the connection matching context.
*/
int ;
/**
* Get the connection matching entry from the context.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
* @param [in] address Pointer to the address of the connection
* between the peers.
* @param [in] conn_sn Connection sequence number between the peers.
* @param [in] conn_queue_type Connection queue which should be used to get
* the connection matching element from. If the
* UCS_CONN_MATCH_QUEUE_ANY type was specified,
* the function checks the all queues to find the
* element.
* @param [in] delete_from_queue Delete the element from the queue where the
* element was found.
*
* @return Pointer to the found connection matching entry.
*/
ucs_conn_match_elem_t *
;
/**
* Remove the connection matching entry from the context.
*
* @param [in] conn_match_ctx Pointer to the connection matching context.
* @param [in] elem Pointer to the connection matching element.
* @param [in] conn_queue_type Connection queue which should be used to remove
* the connection matching element from.
*
* @note Connection @conn_match matching entry must be present in the queue
* pointed by @conn_queue_type.
*/
void ;