Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include <errno.h>
12 : #include <urma_api.h>
13 : #include "hccp_dl.h"
14 : #include "network_comm.h"
15 : #include "dl_urma_function.h"
16 :
17 : static pthread_mutex_t gUrmaApiLock = PTHREAD_MUTEX_INITIALIZER;
18 : static int gUrmaApiRefcnt = 0;
19 : void *gUrmaApiHandle = NULL;
20 : #ifndef CA_CONFIG_LLT
21 : struct RsUrmaOps gUrmaOps;
22 : #else
23 : struct RsUrmaOps gUrmaOps = {
24 : .rsUrmaInit = urma_init,
25 : .rsUrmaUninit = urma_uninit,
26 : .rsUrmaGetDeviceList = urma_get_device_list,
27 : .rsUrmaGetDeviceByEid = urma_get_device_by_eid,
28 : .rsUrmaFreeDeviceList = urma_free_device_list,
29 : .rsUrmaGetEidList = urma_get_eid_list,
30 : .rsUrmaFreeEidList = urma_free_eid_list,
31 : .rsUrmaQueryDevice = urma_query_device,
32 : .rsUrmaGetEidByIp = urma_get_eid_by_ip,
33 : .rsUrmaGetIpByEid = urma_get_ip_by_eid,
34 : .rsUrmaGetSmac = urma_get_smac,
35 : .rsUrmaGetDmac = urma_get_dmac,
36 : .rsUrmaCreateContext = urma_create_context,
37 : .rsUrmaDeleteContext = urma_delete_context,
38 : .rsUrmaCreateJfr = urma_create_jfr,
39 : .rsUrmaDeleteJfr = urma_delete_jfr,
40 : .rsUrmaDeleteJfrBatch = urma_delete_jfr_batch,
41 : .rsUrmaCreateJfc = urma_create_jfc,
42 : .rsUrmaModifyJfc = urma_modify_jfc,
43 : .rsUrmaDeleteJfc = urma_delete_jfc,
44 : .rsUrmaCreateJetty = urma_create_jetty,
45 : .rsUrmaModifyJetty = urma_modify_jetty,
46 : .rsUrmaQueryJetty = urma_query_jetty,
47 : .rsUrmaDeleteJetty = urma_delete_jetty,
48 : .rsUrmaDeleteJettyBatch = urma_delete_jetty_batch,
49 : .rsUrmaImportJetty = urma_import_jetty,
50 : .rsUrmaUnimportJetty = urma_unimport_jetty,
51 : .rsUrmaBindJetty = urma_bind_jetty,
52 : .rsUrmaUnbindJetty = urma_unbind_jetty,
53 : .rsUrmaFlushJetty = urma_flush_jetty,
54 : .rsUrmaCreateJfce = urma_create_jfce,
55 : .rsUrmaDeleteJfce = urma_delete_jfce,
56 : .rsUrmaGetAsyncEvent = urma_get_async_event,
57 : .rsUrmaAckAsyncEvent = urma_ack_async_event,
58 : .rsUrmaAllocTokenId = urma_alloc_token_id,
59 : .rsUrmaFreeTokenId = urma_free_token_id,
60 : .rsUrmaRegisterSeg = urma_register_seg,
61 : .rsUrmaUnregisterSeg = urma_unregister_seg,
62 : .rsUrmaImportSeg = urma_import_seg,
63 : .rsUrmaUnimportSeg = urma_unimport_seg,
64 : .rsUrmaPostJettySendWr = urma_post_jetty_send_wr,
65 : .rsUrmaPostJettyRecvWr = urma_post_jetty_recv_wr,
66 : .rsUrmaPollJfc = urma_poll_jfc,
67 : .rsUrmaRearmJfc = urma_rearm_jfc,
68 : .rsUrmaWaitJfc = urma_wait_jfc,
69 : .rsUrmaAckJfc = urma_ack_jfc,
70 : .rsUrmaUserCtl = urma_user_ctl,
71 : .rsUrmaGetTpList = urma_get_tp_list,
72 : .rsUrmaGetTpAttr = urma_get_tp_attr,
73 : .rsUrmaSetTpAttr = urma_set_tp_attr,
74 : .rsUrmaImportJettyEx = urma_import_jetty_ex,
75 : .rsUrmaAllocJetty = urma_alloc_jetty,
76 : .rsUrmaSetJettyOpt = urma_set_jetty_opt,
77 : .rsUrmaActiveJetty = urma_active_jetty,
78 : .rsUrmaGetJettyOpt = urma_get_jetty_opt,
79 : .rsUrmaDeactiveJetty = urma_deactive_jetty,
80 : .rsUrmaFreeJetty = urma_free_jetty,
81 : .rsUrmaAllocJfc = urma_alloc_jfc,
82 : .rsUrmaSetJfcOpt = urma_set_jfc_opt,
83 : .rsUrmaActiveJfc = urma_active_jfc,
84 : .rsUrmaGetJfcOpt = urma_get_jfc_opt,
85 : .rsUrmaDeactiveJfc = urma_deactive_jfc,
86 : .rsUrmaFreeJfc = urma_free_jfc,
87 : };
88 : #endif
89 :
90 1 : void RsUbApiDeinit(void)
91 : {
92 1 : if (gUrmaApiHandle != NULL) {
93 0 : (void)HccpDlclose(gUrmaApiHandle);
94 0 : gUrmaApiHandle = NULL;
95 : }
96 1 : return;
97 : }
98 :
99 1 : STATIC int RsUrmaDeviceApiInit(void)
100 : {
101 : #ifndef CA_CONFIG_LLT
102 : gUrmaOps.rsUrmaInit = (urma_status_t(*)(urma_init_attr_t *))HccpDlsym(gUrmaApiHandle, "urma_init");
103 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaInit, "urma_init");
104 :
105 : gUrmaOps.rsUrmaUninit = (urma_status_t(*)(void))HccpDlsym(gUrmaApiHandle, "urma_uninit");
106 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaUninit, "urma_uninit");
107 :
108 : gUrmaOps.rsUrmaGetDeviceList = (urma_device_t * *(*)(int *)) HccpDlsym(gUrmaApiHandle, "urma_get_device_list");
109 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetDeviceList, "urma_get_device_list");
110 :
111 : gUrmaOps.rsUrmaGetDeviceByEid = (urma_device_t * (*)(urma_eid_t, urma_transport_type_t))
112 : HccpDlsym(gUrmaApiHandle, "urma_get_device_by_eid");
113 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetDeviceByEid, "urma_get_device_by_eid");
114 :
115 : gUrmaOps.rsUrmaFreeDeviceList = (void (*)(urma_device_t **))HccpDlsym(gUrmaApiHandle, "urma_free_device_list");
116 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaFreeDeviceList, "urma_free_device_list");
117 :
118 : gUrmaOps.rsUrmaGetEidList = (urma_eid_info_t * (*)(urma_device_t *, uint32_t *))
119 : HccpDlsym(gUrmaApiHandle, "urma_get_eid_list");
120 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetEidList, "urma_get_eid_list");
121 :
122 : gUrmaOps.rsUrmaFreeEidList = (void (*)(urma_eid_info_t *))HccpDlsym(gUrmaApiHandle, "urma_free_eid_list");
123 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaFreeEidList, "urma_free_eid_list");
124 :
125 : gUrmaOps.rsUrmaQueryDevice = (urma_status_t(*)(urma_device_t *, urma_device_attr_t *))HccpDlsym(gUrmaApiHandle,
126 : "urma_query_device");
127 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaQueryDevice, "urma_query_device");
128 :
129 : gUrmaOps.rsUrmaGetEidByIp = (urma_status_t(*)(const urma_context_t *, const urma_net_addr_t *,
130 : urma_eid_t *))HccpDlsym(gUrmaApiHandle, "urma_get_eid_by_ip");
131 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetEidByIp, "urma_get_eid_by_ip");
132 :
133 : gUrmaOps.rsUrmaGetIpByEid = (urma_status_t(*)(const urma_context_t *, const urma_eid_t *,
134 : urma_net_addr_t *))HccpDlsym(gUrmaApiHandle, "urma_get_ip_by_eid");
135 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetIpByEid, "urma_get_ip_by_eid");
136 :
137 : gUrmaOps.rsUrmaGetSmac = (urma_status_t(*)(const urma_context_t *, uint8_t *))HccpDlsym(gUrmaApiHandle,
138 : "urma_get_smac");
139 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetSmac, "urma_get_smac");
140 :
141 : gUrmaOps.rsUrmaGetDmac = (urma_status_t(*)(const urma_context_t *, const urma_net_addr_t *,
142 : uint8_t *))HccpDlsym(gUrmaApiHandle, "urma_get_dmac");
143 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetDmac, "urma_get_dmac");
144 :
145 : gUrmaOps.rsUrmaCreateContext = (urma_context_t * (*)(urma_device_t *, uint32_t))
146 : HccpDlsym(gUrmaApiHandle, "urma_create_context");
147 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaCreateContext, "urma_create_context");
148 :
149 : gUrmaOps.rsUrmaDeleteContext = (urma_status_t(*)(urma_context_t *))HccpDlsym(gUrmaApiHandle, "urma_delete_context");
150 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeleteContext, "urma_delete_context");
151 : #endif
152 1 : return 0;
153 : }
154 :
155 1 : STATIC int RsUrmaJettyApiInit(void)
156 : {
157 : #ifndef CA_CONFIG_LLT
158 : gUrmaOps.rsUrmaCreateJfr = (urma_jfr_t * (*)(urma_context_t *, urma_jfr_cfg_t *))
159 : HccpDlsym(gUrmaApiHandle, "urma_create_jfr");
160 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaCreateJfr, "urma_create_jfr");
161 :
162 : gUrmaOps.rsUrmaDeleteJfr = (urma_status_t(*)(urma_jfr_t *))HccpDlsym(gUrmaApiHandle, "urma_delete_jfr");
163 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeleteJfr, "urma_delete_jfr");
164 :
165 : gUrmaOps.rsUrmaDeleteJfrBatch = (urma_status_t(*)(urma_jfr_t * *jfrArr, int jfrNum, urma_jfr_t **badJfr))
166 : HccpDlsym(gUrmaApiHandle, "urma_delete_jfr_batch");
167 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeleteJfrBatch, "urma_delete_jfr_batch");
168 :
169 : gUrmaOps.rsUrmaCreateJetty = (urma_jetty_t * (*)(urma_context_t *, urma_jetty_cfg_t *))
170 : HccpDlsym(gUrmaApiHandle, "urma_create_jetty");
171 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaCreateJetty, "urma_create_jetty");
172 :
173 : gUrmaOps.rsUrmaModifyJetty = (urma_status_t(*)(urma_jetty_t *, urma_jetty_attr_t *))HccpDlsym(gUrmaApiHandle,
174 : "urma_modify_jetty");
175 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaModifyJetty, "urma_modify_jetty");
176 :
177 : gUrmaOps.rsUrmaQueryJetty = (urma_status_t(*)(urma_jetty_t *, urma_jetty_cfg_t *,
178 : urma_jetty_attr_t *))HccpDlsym(gUrmaApiHandle, "urma_query_jetty");
179 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaQueryJetty, "urma_query_jetty");
180 :
181 : gUrmaOps.rsUrmaDeleteJetty = (urma_status_t(*)(urma_jetty_t *))HccpDlsym(gUrmaApiHandle, "urma_delete_jetty");
182 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeleteJetty, "urma_delete_jetty");
183 :
184 : gUrmaOps.rsUrmaDeleteJettyBatch = (urma_status_t(*)(urma_jetty_t * *jettyArr, int jettyNum,
185 : urma_jetty_t **badJetty)) HccpDlsym(gUrmaApiHandle, "urma_delete_jetty_batch");
186 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeleteJettyBatch, "urma_delete_jetty_batch");
187 :
188 : gUrmaOps.rsUrmaImportJetty = (urma_target_jetty_t * (*)(urma_context_t *, urma_rjetty_t *, urma_token_t *))
189 : HccpDlsym(gUrmaApiHandle, "urma_import_jetty");
190 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaImportJetty, "urma_import_jetty");
191 :
192 : gUrmaOps.rsUrmaUnimportJetty = (urma_status_t(*)(urma_target_jetty_t *))HccpDlsym(gUrmaApiHandle,
193 : "urma_unimport_jetty");
194 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaUnimportJetty, "urma_unimport_jetty");
195 :
196 : gUrmaOps.rsUrmaBindJetty = (urma_status_t(*)(urma_jetty_t *, urma_target_jetty_t *))HccpDlsym(gUrmaApiHandle,
197 : "urma_bind_jetty");
198 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaBindJetty, "urma_bind_jetty");
199 :
200 : gUrmaOps.rsUrmaUnbindJetty = (urma_status_t(*)(urma_jetty_t *))HccpDlsym(gUrmaApiHandle, "urma_unbind_jetty");
201 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaUnbindJetty, "urma_unbind_jetty");
202 :
203 : gUrmaOps.rsUrmaFlushJetty = (int (*)(urma_jetty_t *, int, urma_cr_t *))HccpDlsym(gUrmaApiHandle,
204 : "urma_flush_jetty");
205 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaFlushJetty, "urma_flush_jetty");
206 :
207 : gUrmaOps.rsUrmaAllocJetty = (urma_status_t(*)(urma_context_t *, urma_jetty_cfg_t *,
208 : urma_jetty_t **))HccpDlsym(gUrmaApiHandle, "urma_alloc_jetty");
209 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaAllocJetty, "urma_alloc_jetty");
210 :
211 : gUrmaOps.rsUrmaSetJettyOpt = (urma_status_t(*)(urma_jetty_t *, uint64_t, void *, uint32_t))HccpDlsym(gUrmaApiHandle,
212 : "urma_set_jetty_opt");
213 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaSetJettyOpt, "urma_set_jetty_opt");
214 :
215 : gUrmaOps.rsUrmaActiveJetty = (urma_status_t(*)(urma_jetty_t *))HccpDlsym(gUrmaApiHandle, "urma_active_jetty");
216 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaActiveJetty, "urma_active_jetty");
217 :
218 : gUrmaOps.rsUrmaGetJettyOpt = (urma_status_t(*)(urma_jetty_t *, uint64_t, void *, uint32_t))HccpDlsym(gUrmaApiHandle,
219 : "urma_get_jetty_opt");
220 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetJettyOpt, "urma_get_jetty_opt");
221 :
222 : gUrmaOps.rsUrmaDeactiveJetty = (urma_status_t(*)(urma_jetty_t *))HccpDlsym(gUrmaApiHandle, "urma_deactive_jetty");
223 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeactiveJetty, "urma_deactive_jetty");
224 :
225 : gUrmaOps.rsUrmaFreeJetty = (urma_status_t(*)(urma_jetty_t *))HccpDlsym(gUrmaApiHandle, "urma_free_jetty");
226 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaFreeJetty, "urma_free_jetty");
227 : #endif
228 1 : return 0;
229 : }
230 :
231 1 : STATIC int RsUrmaJfcApiInit(void)
232 : {
233 : #ifndef CA_CONFIG_LLT
234 : gUrmaOps.rsUrmaCreateJfc = (urma_jfc_t * (*)(urma_context_t *, urma_jfc_cfg_t *))
235 : HccpDlsym(gUrmaApiHandle, "urma_create_jfc");
236 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaCreateJfc, "urma_create_jfc");
237 :
238 : gUrmaOps.rsUrmaModifyJfc = (urma_status_t(*)(urma_jfc_t *, urma_jfc_attr_t *))HccpDlsym(gUrmaApiHandle,
239 : "urma_modify_jfc");
240 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaModifyJfc, "urma_modify_jfc");
241 :
242 : gUrmaOps.rsUrmaDeleteJfc = (urma_status_t(*)(urma_jfc_t *))HccpDlsym(gUrmaApiHandle, "urma_delete_jfc");
243 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeleteJfc, "urma_delete_jfc");
244 :
245 : gUrmaOps.rsUrmaCreateJfce = (urma_jfce_t * (*)(urma_context_t *)) HccpDlsym(gUrmaApiHandle, "urma_create_jfce");
246 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaCreateJfce, "urma_create_jfce");
247 :
248 : gUrmaOps.rsUrmaDeleteJfce = (urma_status_t(*)(urma_jfce_t *))HccpDlsym(gUrmaApiHandle, "urma_delete_jfce");
249 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeleteJfce, "urma_delete_jfce");
250 :
251 : gUrmaOps.rsUrmaGetAsyncEvent = (urma_status_t(*)(urma_context_t *, urma_async_event_t *))HccpDlsym(gUrmaApiHandle,
252 : "urma_get_async_event");
253 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetAsyncEvent, "urma_get_async_event");
254 :
255 : gUrmaOps.rsUrmaAckAsyncEvent = (void (*)(urma_async_event_t *))HccpDlsym(gUrmaApiHandle, "urma_ack_async_event");
256 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaAckAsyncEvent, "urma_ack_async_event");
257 :
258 : gUrmaOps.rsUrmaAllocJfc = (urma_status_t(*)(urma_context_t *, urma_jfc_cfg_t *,
259 : urma_jfc_t **))HccpDlsym(gUrmaApiHandle, "urma_alloc_jfc");
260 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaAllocJfc, "urma_alloc_jfc");
261 :
262 : gUrmaOps.rsUrmaSetJfcOpt = (urma_status_t(*)(urma_jfc_t *, uint64_t, void *, uint32_t))HccpDlsym(gUrmaApiHandle,
263 : "urma_set_jfc_opt");
264 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaSetJfcOpt, "urma_set_jfc_opt");
265 :
266 : gUrmaOps.rsUrmaActiveJfc = (urma_status_t(*)(urma_jfc_t *))HccpDlsym(gUrmaApiHandle, "urma_active_jfc");
267 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaActiveJfc, "urma_active_jfc");
268 :
269 : gUrmaOps.rsUrmaGetJfcOpt = (urma_status_t(*)(urma_jfc_t *, uint64_t, void *, uint32_t))HccpDlsym(gUrmaApiHandle,
270 : "urma_get_jfc_opt");
271 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetJfcOpt, "urma_get_jfc_opt");
272 :
273 : gUrmaOps.rsUrmaDeactiveJfc = (urma_status_t(*)(urma_jfc_t *))HccpDlsym(gUrmaApiHandle, "urma_deactive_jfc");
274 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaDeactiveJfc, "urma_deactive_jfc");
275 :
276 : gUrmaOps.rsUrmaFreeJfc = (urma_status_t(*)(urma_jfc_t *))HccpDlsym(gUrmaApiHandle, "urma_free_jfc");
277 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaFreeJfc, "urma_free_jfc");
278 : #endif
279 1 : return 0;
280 : }
281 :
282 1 : STATIC int RsUrmaSegmentApiInit(void)
283 : {
284 : #ifndef CA_CONFIG_LLT
285 : gUrmaOps.rsUrmaAllocTokenId = (urma_token_id_t * (*)(urma_context_t *))
286 : HccpDlsym(gUrmaApiHandle, "urma_alloc_token_id");
287 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaAllocTokenId, "urma_alloc_token_id");
288 :
289 : gUrmaOps.rsUrmaFreeTokenId = (urma_status_t(*)(urma_token_id_t *))HccpDlsym(gUrmaApiHandle, "urma_free_token_id");
290 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaFreeTokenId, "urma_free_token_id");
291 :
292 : gUrmaOps.rsUrmaRegisterSeg = (urma_target_seg_t * (*)(urma_context_t *, urma_seg_cfg_t *))
293 : HccpDlsym(gUrmaApiHandle, "urma_register_seg");
294 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaRegisterSeg, "urma_register_seg");
295 :
296 : gUrmaOps.rsUrmaUnregisterSeg = (urma_status_t(*)(urma_target_seg_t *))HccpDlsym(gUrmaApiHandle,
297 : "urma_unregister_seg");
298 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaUnregisterSeg, "urma_unregister_seg");
299 :
300 : gUrmaOps.rsUrmaImportSeg = (urma_target_seg_t *
301 : (*)(urma_context_t *, urma_seg_t *, urma_token_t *, uint64_t, urma_import_seg_flag_t))
302 : HccpDlsym(gUrmaApiHandle, "urma_import_seg");
303 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaImportSeg, "urma_import_seg");
304 :
305 : gUrmaOps.rsUrmaUnimportSeg = (urma_status_t(*)(urma_target_seg_t *))HccpDlsym(gUrmaApiHandle, "urma_unimport_seg");
306 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaUnimportSeg, "urma_unimport_seg");
307 : #endif
308 1 : return 0;
309 : }
310 :
311 1 : STATIC int RsUrmaDataApiInit(void)
312 : {
313 : #ifndef CA_CONFIG_LLT
314 : gUrmaOps.rsUrmaPostJettySendWr = (urma_status_t(*)(urma_jetty_t *, urma_jfs_wr_t *,
315 : urma_jfs_wr_t **))HccpDlsym(gUrmaApiHandle, "urma_post_jetty_send_wr");
316 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaPostJettySendWr, "urma_post_jetty_send_wr");
317 :
318 : gUrmaOps.rsUrmaPostJettyRecvWr = (urma_status_t(*)(urma_jetty_t *, urma_jfr_wr_t *,
319 : urma_jfr_wr_t **))HccpDlsym(gUrmaApiHandle, "urma_post_jetty_recv_wr");
320 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaPostJettyRecvWr, "urma_post_jetty_recv_wr");
321 :
322 : gUrmaOps.rsUrmaPollJfc = (int (*)(urma_jfc_t *, int, urma_cr_t *))HccpDlsym(gUrmaApiHandle, "urma_poll_jfc");
323 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaPollJfc, "urma_poll_jfc");
324 :
325 : gUrmaOps.rsUrmaRearmJfc = (urma_status_t(*)(urma_jfc_t *, bool))HccpDlsym(gUrmaApiHandle, "urma_rearm_jfc");
326 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaRearmJfc, "urma_rearm_jfc");
327 :
328 : gUrmaOps.rsUrmaWaitJfc = (int (*)(urma_jfce_t *, uint32_t, int, urma_jfc_t *[]))HccpDlsym(gUrmaApiHandle,
329 : "urma_wait_jfc");
330 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaWaitJfc, "urma_wait_jfc");
331 :
332 : gUrmaOps.rsUrmaAckJfc = (void (*)(urma_jfc_t *[], uint32_t[], uint32_t))HccpDlsym(gUrmaApiHandle, "urma_ack_jfc");
333 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaAckJfc, "urma_ack_jfc");
334 :
335 : gUrmaOps.rsUrmaUserCtl = (urma_status_t(*)(urma_context_t *, urma_user_ctl_in_t *,
336 : urma_user_ctl_out_t *))HccpDlsym(gUrmaApiHandle, "urma_user_ctl");
337 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaUserCtl, "urma_user_ctl");
338 :
339 : gUrmaOps.rsUrmaGetTpList = (urma_status_t(*)(urma_context_t *, urma_get_tp_cfg_t *, uint32_t *,
340 : urma_tp_info_t *))HccpDlsym(gUrmaApiHandle, "urma_get_tp_list");
341 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetTpList, "urma_get_tp_list");
342 :
343 : gUrmaOps.rsUrmaGetTpAttr = (urma_status_t(*)(const urma_context_t *, const uint64_t, uint8_t *, uint32_t *,
344 : urma_tp_attr_value_t *))HccpDlsym(gUrmaApiHandle, "urma_get_tp_attr");
345 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaGetTpAttr, "urma_get_tp_attr");
346 :
347 : gUrmaOps.rsUrmaSetTpAttr = (urma_status_t(*)(const urma_context_t *, const uint64_t, const uint8_t, const uint32_t,
348 : const urma_tp_attr_value_t *))HccpDlsym(gUrmaApiHandle, "urma_set_tp_attr");
349 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaSetTpAttr, "urma_set_tp_attr");
350 :
351 : gUrmaOps.rsUrmaImportJettyEx = (urma_target_jetty_t * (*)(urma_context_t *, urma_rjetty_t *, urma_token_t *,
352 : urma_import_jetty_ex_cfg_t *))
353 : HccpDlsym(gUrmaApiHandle, "urma_import_jetty_ex");
354 : DL_API_RET_IS_NULL_CHECK(gUrmaOps.rsUrmaImportJettyEx, "urma_import_jetty_ex");
355 : #endif
356 1 : return 0;
357 : }
358 :
359 1 : STATIC int RsOpenUrmaSo(void)
360 : {
361 1 : pthread_mutex_lock(&gUrmaApiLock);
362 : #ifndef CA_CONFIG_LLT
363 : if (gUrmaApiHandle == NULL) {
364 : gUrmaApiHandle = HccpDlopen("liburma.so.0", RTLD_NOW);
365 : if (gUrmaApiHandle != NULL) {
366 : goto out;
367 : }
368 :
369 : gUrmaApiHandle = HccpDlopen("/lib64/liburma.so.0", RTLD_NOW);
370 : if (gUrmaApiHandle != NULL) {
371 : goto out;
372 : }
373 : pthread_mutex_unlock(&gUrmaApiLock);
374 : return -EINVAL;
375 : } else {
376 : hccp_run_info("urma_api dlopen again, gUrmaApiRefcnt:%d", gUrmaApiRefcnt + 1);
377 : }
378 : out:
379 : #endif
380 1 : gUrmaApiRefcnt++;
381 1 : pthread_mutex_unlock(&gUrmaApiLock);
382 1 : return 0;
383 : }
384 :
385 5 : STATIC void RsCloseUrmaSo(void)
386 : {
387 5 : pthread_mutex_lock(&gUrmaApiLock);
388 : #ifndef CA_CONFIG_LLT
389 : if (gUrmaApiHandle != NULL) {
390 : gUrmaApiRefcnt--;
391 : if (gUrmaApiRefcnt > 0) {
392 : goto out;
393 : }
394 :
395 : hccp_run_info("dlclose urma_api, gUrmaApiRefcnt:%d", gUrmaApiRefcnt);
396 : (void)HccpDlclose(gUrmaApiHandle);
397 : gUrmaApiHandle = NULL;
398 : gUrmaApiRefcnt = 0;
399 : }
400 : out:
401 : #endif
402 5 : pthread_mutex_unlock(&gUrmaApiLock);
403 5 : return;
404 : }
405 :
406 6 : STATIC int RsUrmaApiInit(void)
407 : {
408 : int ret;
409 :
410 6 : ret = RsOpenUrmaSo();
411 6 : CHK_PRT_RETURN(ret,
412 : hccp_err("HccpDlopen[liburma.so] failed! ret=[%d], "
413 : "Please check network adapter driver has been installed",
414 : ret),
415 : ret);
416 :
417 6 : ret = RsUrmaDeviceApiInit();
418 6 : if (ret != 0) {
419 1 : hccp_err("[rs_urma_device_api_init]HccpDlopen failed! ret=[%d]", ret);
420 1 : RsCloseUrmaSo();
421 1 : return ret;
422 : }
423 :
424 5 : ret = RsUrmaJettyApiInit();
425 5 : if (ret != 0) {
426 1 : hccp_err("[rs_urma_jetty_api_init]HccpDlopen failed! ret=[%d]", ret);
427 1 : RsCloseUrmaSo();
428 1 : return ret;
429 : }
430 :
431 4 : ret = RsUrmaJfcApiInit();
432 4 : if (ret != 0) {
433 1 : hccp_err("[rs_urma_jfc_api_init]HccpDlopen failed! ret=[%d]", ret);
434 1 : RsCloseUrmaSo();
435 1 : return ret;
436 : }
437 :
438 3 : ret = RsUrmaSegmentApiInit();
439 3 : if (ret != 0) {
440 1 : hccp_err("[rs_urma_segment_api_init]HccpDlopen failed! ret=[%d]", ret);
441 1 : RsCloseUrmaSo();
442 1 : return ret;
443 : }
444 :
445 2 : ret = RsUrmaDataApiInit();
446 2 : if (ret != 0) {
447 1 : hccp_err("[rs_urma_data_api_init]HccpDlopen failed! ret=[%d]", ret);
448 1 : RsCloseUrmaSo();
449 1 : return ret;
450 : }
451 :
452 1 : return 0;
453 : }
454 :
455 1 : int RsUbApiInit(void)
456 : {
457 : int ret;
458 :
459 1 : ret = RsUrmaApiInit();
460 1 : CHK_PRT_RETURN(ret, hccp_err("rs_urma_api_init failed! ret=[%d]", ret), ret);
461 :
462 1 : return 0;
463 : }
464 :
465 0 : int RsUrmaInit(urma_init_attr_t *conf)
466 : {
467 0 : if (gUrmaOps.rsUrmaInit == NULL) {
468 : #ifndef CA_CONFIG_LLT
469 : hccp_err("rs_urma_init is null");
470 : return -EINVAL;
471 : #endif
472 : }
473 0 : return DlRetConvert(gUrmaOps.rsUrmaInit(conf));
474 : }
475 :
476 0 : int RsUrmaUninit(void)
477 : {
478 0 : if (gUrmaOps.rsUrmaUninit == NULL) {
479 : #ifndef CA_CONFIG_LLT
480 : hccp_err("rs_urma_uninit is null");
481 : return -EINVAL;
482 : #endif
483 : }
484 0 : return DlRetConvert(gUrmaOps.rsUrmaUninit());
485 : }
486 :
487 0 : urma_device_t **RsUrmaGetDeviceList(int *numDevices)
488 : {
489 0 : if (gUrmaOps.rsUrmaGetDeviceList == NULL) {
490 : #ifndef CA_CONFIG_LLT
491 : hccp_err("rs_urma_get_device_list is null");
492 : return NULL;
493 : #endif
494 : }
495 0 : return gUrmaOps.rsUrmaGetDeviceList(numDevices);
496 : }
497 :
498 1 : urma_device_t *RsUrmaGetDeviceByEid(urma_eid_t eid, urma_transport_type_t type)
499 : {
500 1 : if (gUrmaOps.rsUrmaGetDeviceByEid == NULL) {
501 : #ifndef CA_CONFIG_LLT
502 : hccp_err("rs_urma_get_device_by_eid is null");
503 : return NULL;
504 : #endif
505 : }
506 1 : return gUrmaOps.rsUrmaGetDeviceByEid(eid, type);
507 : }
508 :
509 0 : void RsUrmaFreeDeviceList(urma_device_t **deviceList)
510 : {
511 0 : if (gUrmaOps.rsUrmaFreeDeviceList == NULL) {
512 : #ifndef CA_CONFIG_LLT
513 : hccp_err("rs_urma_free_device_list is null");
514 : return;
515 : #endif
516 : }
517 0 : gUrmaOps.rsUrmaFreeDeviceList(deviceList);
518 0 : }
519 :
520 0 : urma_eid_info_t *RsUrmaGetEidList(urma_device_t *dev, uint32_t *cnt)
521 : {
522 0 : if (gUrmaOps.rsUrmaGetEidList == NULL) {
523 : #ifndef CA_CONFIG_LLT
524 : hccp_err("rs_urma_get_eid_list is null");
525 : return NULL;
526 : #endif
527 : }
528 0 : return gUrmaOps.rsUrmaGetEidList(dev, cnt);
529 : }
530 :
531 0 : void RsUrmaFreeEidList(urma_eid_info_t *eidList)
532 : {
533 0 : if (gUrmaOps.rsUrmaFreeEidList == NULL) {
534 : #ifndef CA_CONFIG_LLT
535 : hccp_err("rs_urma_free_eid_list is null");
536 : return;
537 : #endif
538 : }
539 0 : gUrmaOps.rsUrmaFreeEidList(eidList);
540 0 : }
541 :
542 0 : int RsUrmaQueryDevice(urma_device_t *dev, urma_device_attr_t *devAttr)
543 : {
544 0 : if (gUrmaOps.rsUrmaQueryDevice == NULL) {
545 : #ifndef CA_CONFIG_LLT
546 : hccp_err("rs_urma_query_device is null");
547 : return -EINVAL;
548 : #endif
549 : }
550 0 : return DlRetConvert(gUrmaOps.rsUrmaQueryDevice(dev, devAttr));
551 : }
552 :
553 32 : int RsUrmaGetEidByIp(const urma_context_t *ctx, const urma_net_addr_t *netAddr, urma_eid_t *eid)
554 : {
555 32 : if (gUrmaOps.rsUrmaGetEidByIp == NULL) {
556 : #ifndef CA_CONFIG_LLT
557 : hccp_err("rs_urma_get_eid_by_ip is null");
558 : return -EINVAL;
559 : #endif
560 : }
561 32 : return DlRetConvert(gUrmaOps.rsUrmaGetEidByIp(ctx, netAddr, eid));
562 : }
563 :
564 32 : int RsUrmaGetIpByEid(const urma_context_t *ctx, const urma_eid_t *eid, urma_net_addr_t *netAddr)
565 : {
566 32 : if (gUrmaOps.rsUrmaGetIpByEid == NULL) {
567 : #ifndef CA_CONFIG_LLT
568 : hccp_err("rsUrmaGetIpByEid is null");
569 : return -EINVAL;
570 : #endif
571 : }
572 32 : return DlRetConvert(gUrmaOps.rsUrmaGetIpByEid(ctx, eid, netAddr));
573 : }
574 :
575 0 : int RsUrmaGetSmac(const urma_context_t *ctx, uint8_t *mac)
576 : {
577 0 : if (gUrmaOps.rsUrmaGetSmac == NULL) {
578 : #ifndef CA_CONFIG_LLT
579 : hccp_err("rsUrmaGetSmac is null");
580 : return -EINVAL;
581 : #endif
582 : }
583 0 : return DlRetConvert(gUrmaOps.rsUrmaGetSmac(ctx, mac));
584 : }
585 :
586 2 : int RsUrmaGetDmac(const urma_context_t *ctx, const urma_net_addr_t *netaddr, uint8_t *mac)
587 : {
588 2 : if (gUrmaOps.rsUrmaGetDmac == NULL) {
589 : #ifndef CA_CONFIG_LLT
590 : hccp_err("rsUrmaGetDmac is null");
591 : return -EINVAL;
592 : #endif
593 : }
594 2 : return DlRetConvert(gUrmaOps.rsUrmaGetDmac(ctx, netaddr, mac));
595 : }
596 :
597 1 : urma_context_t *RsUrmaCreateContext(urma_device_t *dev, uint32_t eidIndex)
598 : {
599 1 : if (gUrmaOps.rsUrmaCreateContext == NULL) {
600 : #ifndef CA_CONFIG_LLT
601 : hccp_err("rs_urma_create_context is null");
602 : return NULL;
603 : #endif
604 : }
605 1 : return gUrmaOps.rsUrmaCreateContext(dev, eidIndex);
606 : }
607 :
608 1 : int RsUrmaDeleteContext(urma_context_t *ctx)
609 : {
610 1 : if (gUrmaOps.rsUrmaDeleteContext == NULL) {
611 : #ifndef CA_CONFIG_LLT
612 : hccp_err("rs_urma_delete_context is null");
613 : return -EINVAL;
614 : #endif
615 : }
616 1 : return DlRetConvert(gUrmaOps.rsUrmaDeleteContext(ctx));
617 : }
618 :
619 2 : urma_jfr_t *RsUrmaCreateJfr(urma_context_t *ctx, urma_jfr_cfg_t *jfrCfg)
620 : {
621 2 : if (gUrmaOps.rsUrmaCreateJfr == NULL) {
622 : #ifndef CA_CONFIG_LLT
623 : hccp_err("rs_urma_create_jfr is null");
624 : return NULL;
625 : #endif
626 : }
627 2 : return gUrmaOps.rsUrmaCreateJfr(ctx, jfrCfg);
628 : }
629 :
630 2 : int RsUrmaDeleteJfr(urma_jfr_t *jfr)
631 : {
632 2 : if (gUrmaOps.rsUrmaDeleteJfr == NULL) {
633 : #ifndef CA_CONFIG_LLT
634 : hccp_err("rs_urma_delete_jfr is null");
635 : return -EINVAL;
636 : #endif
637 : }
638 2 : return DlRetConvert(gUrmaOps.rsUrmaDeleteJfr(jfr));
639 : }
640 :
641 4 : urma_jfc_t *RsUrmaCreateJfc(urma_context_t *ctx, urma_jfc_cfg_t *jfcCfg)
642 : {
643 4 : if (gUrmaOps.rsUrmaCreateJfc == NULL) {
644 : #ifndef CA_CONFIG_LLT
645 : hccp_err("rs_urma_create_jfc is null");
646 : return NULL;
647 : #endif
648 : }
649 4 : return gUrmaOps.rsUrmaCreateJfc(ctx, jfcCfg);
650 : }
651 :
652 0 : int RsUrmaModifyJfc(urma_jfc_t *jfc, urma_jfc_attr_t *attr)
653 : {
654 0 : if (gUrmaOps.rsUrmaModifyJfc == NULL) {
655 : #ifndef CA_CONFIG_LLT
656 : hccp_err("rs_urma_modify_jfc is null");
657 : return -EINVAL;
658 : #endif
659 : }
660 0 : return DlRetConvert(gUrmaOps.rsUrmaModifyJfc(jfc, attr));
661 : }
662 :
663 4 : int RsUrmaDeleteJfc(urma_jfc_t *jfc)
664 : {
665 4 : if (gUrmaOps.rsUrmaDeleteJfc == NULL) {
666 : #ifndef CA_CONFIG_LLT
667 : hccp_err("rs_urma_delete_jfc is null");
668 : return -EINVAL;
669 : #endif
670 : }
671 4 : return DlRetConvert(gUrmaOps.rsUrmaDeleteJfc(jfc));
672 : }
673 :
674 2 : urma_jetty_t *RsUrmaCreateJetty(urma_context_t *ctx, urma_jetty_cfg_t *jettyCfg)
675 : {
676 2 : if (gUrmaOps.rsUrmaCreateJetty == NULL) {
677 : #ifndef CA_CONFIG_LLT
678 : hccp_err("rs_urma_create_jetty is null");
679 : return NULL;
680 : #endif
681 : }
682 2 : return gUrmaOps.rsUrmaCreateJetty(ctx, jettyCfg);
683 : }
684 :
685 0 : int RsUrmaModifyJetty(urma_jetty_t *jetty, urma_jetty_attr_t *attr)
686 : {
687 0 : if (gUrmaOps.rsUrmaModifyJetty == NULL) {
688 : #ifndef CA_CONFIG_LLT
689 : hccp_err("rs_urma_modify_jetty is null");
690 : return -EINVAL;
691 : #endif
692 : }
693 0 : return DlRetConvert(gUrmaOps.rsUrmaModifyJetty(jetty, attr));
694 : }
695 :
696 3 : int RsUrmaQueryJetty(urma_jetty_t *jetty, urma_jetty_cfg_t *cfg, urma_jetty_attr_t *attr)
697 : {
698 3 : if (gUrmaOps.rsUrmaQueryJetty == NULL) {
699 : #ifndef CA_CONFIG_LLT
700 : hccp_err("rs_urma_query_jetty is null");
701 : return -EINVAL;
702 : #endif
703 : }
704 3 : return DlRetConvert(gUrmaOps.rsUrmaQueryJetty(jetty, cfg, attr));
705 : }
706 :
707 2 : int RsUrmaDeleteJetty(urma_jetty_t *jetty)
708 : {
709 2 : if (gUrmaOps.rsUrmaDeleteJetty == NULL) {
710 : #ifndef CA_CONFIG_LLT
711 : hccp_err("rs_urma_delete_jetty is null");
712 : return -EINVAL;
713 : #endif
714 : }
715 2 : return DlRetConvert(gUrmaOps.rsUrmaDeleteJetty(jetty));
716 : }
717 :
718 3 : urma_target_jetty_t *RsUrmaImportJetty(urma_context_t *ctx, urma_rjetty_t *rjetty, urma_token_t *tokenValue)
719 : {
720 3 : if (gUrmaOps.rsUrmaImportJetty == NULL) {
721 : #ifndef CA_CONFIG_LLT
722 : hccp_err("rs_urma_import_jetty is null");
723 : return NULL;
724 : #endif
725 : }
726 3 : return gUrmaOps.rsUrmaImportJetty(ctx, rjetty, tokenValue);
727 : }
728 :
729 2 : int RsUrmaUnimportJetty(urma_target_jetty_t *tjetty)
730 : {
731 2 : if (gUrmaOps.rsUrmaUnimportJetty == NULL) {
732 : #ifndef CA_CONFIG_LLT
733 : hccp_err("rs_urma_unimport_jetty is null");
734 : return -EINVAL;
735 : #endif
736 : }
737 2 : return DlRetConvert(gUrmaOps.rsUrmaUnimportJetty(tjetty));
738 : }
739 :
740 0 : int RsUrmaBindJetty(urma_jetty_t *jetty, urma_target_jetty_t *tjetty)
741 : {
742 0 : if (gUrmaOps.rsUrmaBindJetty == NULL) {
743 : #ifndef CA_CONFIG_LLT
744 : hccp_err("rs_urma_bind_jetty is null");
745 : return -EINVAL;
746 : #endif
747 : }
748 0 : return DlRetConvert(gUrmaOps.rsUrmaBindJetty(jetty, tjetty));
749 : }
750 :
751 0 : int RsUrmaUnbindJetty(urma_jetty_t *jetty)
752 : {
753 0 : if (gUrmaOps.rsUrmaUnbindJetty == NULL) {
754 : #ifndef CA_CONFIG_LLT
755 : hccp_err("rs_urma_unbind_jetty is null");
756 : return -EINVAL;
757 : #endif
758 : }
759 0 : return DlRetConvert(gUrmaOps.rsUrmaUnbindJetty(jetty));
760 : }
761 :
762 0 : int RsUrmaFlushJetty(urma_jetty_t *jetty, int crCnt, urma_cr_t *cr)
763 : {
764 0 : if (gUrmaOps.rsUrmaFlushJetty == NULL) {
765 : #ifndef CA_CONFIG_LLT
766 : hccp_err("rs_urma_flush_jetty is null");
767 : return -EINVAL;
768 : #endif
769 : }
770 0 : return gUrmaOps.rsUrmaFlushJetty(jetty, crCnt, cr);
771 : }
772 :
773 3 : urma_jfce_t *RsUrmaCreateJfce(urma_context_t *ctx)
774 : {
775 3 : if (gUrmaOps.rsUrmaCreateJfce == NULL) {
776 : #ifndef CA_CONFIG_LLT
777 : hccp_err("rs_urma_create_jfce is null");
778 : return NULL;
779 : #endif
780 : }
781 3 : return gUrmaOps.rsUrmaCreateJfce(ctx);
782 : }
783 :
784 3 : int RsUrmaDeleteJfce(urma_jfce_t *jfce)
785 : {
786 3 : if (gUrmaOps.rsUrmaDeleteJfce == NULL) {
787 : #ifndef CA_CONFIG_LLT
788 : hccp_err("rs_urma_delete_jfce is null");
789 : return -EINVAL;
790 : #endif
791 : }
792 3 : return DlRetConvert(gUrmaOps.rsUrmaDeleteJfce(jfce));
793 : }
794 :
795 0 : int RsUrmaGetAsyncEvent(urma_context_t *ctx, urma_async_event_t *event)
796 : {
797 0 : if (gUrmaOps.rsUrmaGetAsyncEvent == NULL) {
798 : #ifndef CA_CONFIG_LLT
799 : hccp_err("rs_urma_get_async_event is null");
800 : return -EINVAL;
801 : #endif
802 : }
803 0 : return DlRetConvert(gUrmaOps.rsUrmaGetAsyncEvent(ctx, event));
804 : }
805 :
806 0 : void RsUrmaAckAsyncEvent(urma_async_event_t *event)
807 : {
808 0 : if (gUrmaOps.rsUrmaAckAsyncEvent == NULL) {
809 : #ifndef CA_CONFIG_LLT
810 : hccp_err("rs_urma_ack_async_event is null");
811 : return;
812 : #endif
813 : }
814 0 : gUrmaOps.rsUrmaAckAsyncEvent(event);
815 0 : }
816 :
817 0 : urma_token_id_t *RsUrmaAllocTokenId(urma_context_t *ctx)
818 : {
819 0 : if (gUrmaOps.rsUrmaAllocTokenId == NULL) {
820 : #ifndef CA_CONFIG_LLT
821 : hccp_err("rs_urma_alloc_token_id is null");
822 : return NULL;
823 : #endif
824 : }
825 0 : return gUrmaOps.rsUrmaAllocTokenId(ctx);
826 : }
827 :
828 0 : int RsUrmaFreeTokenId(urma_token_id_t *tokenId)
829 : {
830 0 : if (gUrmaOps.rsUrmaFreeTokenId == NULL) {
831 : #ifndef CA_CONFIG_LLT
832 : hccp_err("rs_urma_free_token_id is null");
833 : return -EINVAL;
834 : #endif
835 : }
836 0 : return DlRetConvert(gUrmaOps.rsUrmaFreeTokenId(tokenId));
837 : }
838 :
839 4 : urma_target_seg_t *RsUrmaRegisterSeg(urma_context_t *ctx, urma_seg_cfg_t *segCfg)
840 : {
841 4 : if (gUrmaOps.rsUrmaRegisterSeg == NULL) {
842 : #ifndef CA_CONFIG_LLT
843 : hccp_err("rs_urma_register_seg is null");
844 : return NULL;
845 : #endif
846 : }
847 4 : return gUrmaOps.rsUrmaRegisterSeg(ctx, segCfg);
848 : }
849 :
850 4 : int RsUrmaUnregisterSeg(urma_target_seg_t *targetSeg)
851 : {
852 4 : if (gUrmaOps.rsUrmaUnregisterSeg == NULL) {
853 : #ifndef CA_CONFIG_LLT
854 : hccp_err("rs_urma_unregister_seg is null");
855 : return -EINVAL;
856 : #endif
857 : }
858 4 : return DlRetConvert(gUrmaOps.rsUrmaUnregisterSeg(targetSeg));
859 : }
860 :
861 0 : urma_target_seg_t *RsUrmaImportSeg(urma_context_t *ctx, urma_seg_t *seg, urma_token_t *tokenValue, uint64_t addr,
862 : urma_import_seg_flag_t flag)
863 : {
864 0 : if (gUrmaOps.rsUrmaImportSeg == NULL) {
865 : #ifndef CA_CONFIG_LLT
866 : hccp_err("rs_urma_import_seg is null");
867 : return NULL;
868 : #endif
869 : }
870 0 : return gUrmaOps.rsUrmaImportSeg(ctx, seg, tokenValue, addr, flag);
871 : }
872 :
873 0 : int RsUrmaUnimportSeg(urma_target_seg_t *tseg)
874 : {
875 0 : if (gUrmaOps.rsUrmaUnimportSeg == NULL) {
876 : #ifndef CA_CONFIG_LLT
877 : hccp_err("rs_urma_unimport_seg is null");
878 : return -EINVAL;
879 : #endif
880 : }
881 0 : return DlRetConvert(gUrmaOps.rsUrmaUnimportSeg(tseg));
882 : }
883 :
884 2 : int RsUrmaPostJettySendWr(urma_jetty_t *jetty, urma_jfs_wr_t *wr, urma_jfs_wr_t **badWr)
885 : {
886 2 : if (gUrmaOps.rsUrmaPostJettySendWr == NULL) {
887 : #ifndef CA_CONFIG_LLT
888 : hccp_err("rs_urma_post_jetty_send_wr is null");
889 : return -EINVAL;
890 : #endif
891 : }
892 2 : return DlRetConvert(gUrmaOps.rsUrmaPostJettySendWr(jetty, wr, badWr));
893 : }
894 :
895 1 : int RsUrmaPostJettyRecvWr(urma_jetty_t *jetty, urma_jfr_wr_t *wr, urma_jfr_wr_t **badWr)
896 : {
897 1 : if (gUrmaOps.rsUrmaPostJettyRecvWr == NULL) {
898 : #ifndef CA_CONFIG_LLT
899 : hccp_err("rs_urma_post_jetty_recv_wr is null");
900 : return -EINVAL;
901 : #endif
902 : }
903 1 : return DlRetConvert(gUrmaOps.rsUrmaPostJettyRecvWr(jetty, wr, badWr));
904 : }
905 :
906 2 : int RsUrmaPollJfc(urma_jfc_t *jfc, int crCnt, urma_cr_t *cr)
907 : {
908 2 : if (gUrmaOps.rsUrmaPollJfc == NULL) {
909 : #ifndef CA_CONFIG_LLT
910 : hccp_err("rs_urma_poll_jfc is null");
911 : return -EINVAL;
912 : #endif
913 : }
914 2 : return gUrmaOps.rsUrmaPollJfc(jfc, crCnt, cr);
915 : }
916 :
917 7 : int RsUrmaRearmJfc(urma_jfc_t *jfc, bool solicitedOnly)
918 : {
919 7 : if (gUrmaOps.rsUrmaRearmJfc == NULL) {
920 : #ifndef CA_CONFIG_LLT
921 : hccp_err("rs_urma_rearm_jfc is null");
922 : return -EINVAL;
923 : #endif
924 : }
925 7 : return DlRetConvert(gUrmaOps.rsUrmaRearmJfc(jfc, solicitedOnly));
926 : }
927 :
928 1 : int RsUrmaWaitJfc(urma_jfce_t *jfce, uint32_t jfcCnt, int timeOut, urma_jfc_t *jfc[])
929 : {
930 1 : if (gUrmaOps.rsUrmaWaitJfc == NULL) {
931 : #ifndef CA_CONFIG_LLT
932 : hccp_err("rs_urma_wait_jfc is null");
933 : return -EINVAL;
934 : #endif
935 : }
936 1 : return gUrmaOps.rsUrmaWaitJfc(jfce, jfcCnt, timeOut, jfc);
937 : }
938 :
939 8 : void RsUrmaAckJfc(urma_jfc_t *jfc[], uint32_t nevents[], uint32_t jfcCnt)
940 : {
941 8 : if (gUrmaOps.rsUrmaAckJfc == NULL) {
942 : #ifndef CA_CONFIG_LLT
943 : hccp_err("rs_urma_ack_jfc is null");
944 : return;
945 : #endif
946 : }
947 8 : gUrmaOps.rsUrmaAckJfc(jfc, nevents, jfcCnt);
948 8 : }
949 :
950 1 : int RsUrmaUserCtl(urma_context_t *ctx, urma_user_ctl_in_t *in, urma_user_ctl_out_t *out)
951 : {
952 1 : if (gUrmaOps.rsUrmaUserCtl == NULL) {
953 : #ifndef CA_CONFIG_LLT
954 : hccp_err("rs_urma_user_ctl is null");
955 : return -EINVAL;
956 : #endif
957 : }
958 1 : return DlRetConvert(gUrmaOps.rsUrmaUserCtl(ctx, in, out));
959 : }
960 :
961 1 : int RsUrmaGetTpList(urma_context_t *ctx, urma_get_tp_cfg_t *cfg, uint32_t *tpCnt, urma_tp_info_t *tpList)
962 : {
963 1 : if (gUrmaOps.rsUrmaGetTpList == NULL) {
964 : #ifndef CA_CONFIG_LLT
965 : hccp_err("rs_urma_get_tp_list is null");
966 : return -EINVAL;
967 : #endif
968 : }
969 1 : return DlRetConvert(gUrmaOps.rsUrmaGetTpList(ctx, cfg, tpCnt, tpList));
970 : }
971 :
972 1 : int RsUrmaGetTpAttr(const urma_context_t *ctx, const uint64_t tpHandle, uint8_t *tpAttrCnt, uint32_t *tpAttrBitmap,
973 : urma_tp_attr_value_t *tpAttr)
974 : {
975 1 : if (gUrmaOps.rsUrmaGetTpAttr == NULL) {
976 : #ifndef CA_CONFIG_LLT
977 : hccp_err("rs_urma_get_tp_attr is null");
978 : return -EINVAL;
979 : #endif
980 : }
981 1 : return DlRetConvert(gUrmaOps.rsUrmaGetTpAttr(ctx, tpHandle, tpAttrCnt, tpAttrBitmap, tpAttr));
982 : }
983 :
984 1 : int RsUrmaSetTpAttr(const urma_context_t *ctx, const uint64_t tpHandle, const uint8_t tpAttrCnt,
985 : const uint32_t tpAttrBitmap, const urma_tp_attr_value_t *tpAttr)
986 : {
987 1 : if (gUrmaOps.rsUrmaSetTpAttr == NULL) {
988 : #ifndef CA_CONFIG_LLT
989 : hccp_err("rs_urma_set_tp_attr is null");
990 : return -EINVAL;
991 : #endif
992 : }
993 1 : return DlRetConvert(gUrmaOps.rsUrmaSetTpAttr(ctx, tpHandle, tpAttrCnt, tpAttrBitmap, tpAttr));
994 : }
995 :
996 1 : urma_target_jetty_t *RsUrmaImportJettyEx(urma_context_t *ctx, urma_rjetty_t *rjetty, urma_token_t *tokenValue,
997 : urma_import_jetty_ex_cfg_t *cfg)
998 : {
999 1 : if (gUrmaOps.rsUrmaImportJettyEx == NULL) {
1000 : #ifndef CA_CONFIG_LLT
1001 : hccp_err("rs_urma_import_jetty_ex is null");
1002 : return NULL;
1003 : #endif
1004 : }
1005 1 : return gUrmaOps.rsUrmaImportJettyEx(ctx, rjetty, tokenValue, cfg);
1006 : }
1007 :
1008 0 : int RsUrmaDeleteJettyBatch(urma_jetty_t **jettyArr, int jettyNum, urma_jetty_t **badJetty)
1009 : {
1010 0 : if (gUrmaOps.rsUrmaDeleteJettyBatch == NULL) {
1011 : #ifndef CA_CONFIG_LLT
1012 : hccp_err("rs_urma_delete_jetty_batch is null");
1013 : return -EINVAL;
1014 : #endif
1015 : }
1016 0 : return DlRetConvert(gUrmaOps.rsUrmaDeleteJettyBatch(jettyArr, jettyNum, badJetty));
1017 : }
1018 :
1019 0 : int RsUrmaDeleteJfrBatch(urma_jfr_t **jfrArr, int jfrNum, urma_jfr_t **badJfr)
1020 : {
1021 0 : if (gUrmaOps.rsUrmaDeleteJfrBatch == NULL) {
1022 : #ifndef CA_CONFIG_LLT
1023 : hccp_err("rs_urma_delete_jfr_batch is null");
1024 : return -EINVAL;
1025 : #endif
1026 : }
1027 0 : return DlRetConvert(gUrmaOps.rsUrmaDeleteJfrBatch(jfrArr, jfrNum, badJfr));
1028 : }
1029 :
1030 0 : int RsUrmaAllocJetty(urma_context_t *urmaCtx, urma_jetty_cfg_t *cfg, urma_jetty_t **jetty)
1031 : {
1032 0 : if (gUrmaOps.rsUrmaAllocJetty == NULL) {
1033 : #ifndef CA_CONFIG_LLT
1034 : hccp_err("rs_urma_alloc_jetty is null");
1035 : return -EINVAL;
1036 : #endif
1037 : }
1038 0 : return DlRetConvert(gUrmaOps.rsUrmaAllocJetty(urmaCtx, cfg, jetty));
1039 : }
1040 :
1041 0 : int RsUrmaSetJettyOpt(urma_jetty_t *jetty, uint64_t opt, void *buf, uint32_t len)
1042 : {
1043 0 : if (gUrmaOps.rsUrmaSetJettyOpt == NULL) {
1044 : #ifndef CA_CONFIG_LLT
1045 : hccp_err("rs_urma_set_jetty_opt is null");
1046 : return -EINVAL;
1047 : #endif
1048 : }
1049 0 : return DlRetConvert(gUrmaOps.rsUrmaSetJettyOpt(jetty, opt, buf, len));
1050 : }
1051 :
1052 0 : int RsUrmaActiveJetty(urma_jetty_t *jetty)
1053 : {
1054 0 : if (gUrmaOps.rsUrmaActiveJetty == NULL) {
1055 : #ifndef CA_CONFIG_LLT
1056 : hccp_err("rs_urma_active_jetty is null");
1057 : return -EINVAL;
1058 : #endif
1059 : }
1060 0 : return DlRetConvert(gUrmaOps.rsUrmaActiveJetty(jetty));
1061 : }
1062 :
1063 0 : int RsUrmaGetJettyOpt(urma_jetty_t *jetty, uint64_t opt, void *buf, uint32_t len)
1064 : {
1065 0 : if (gUrmaOps.rsUrmaGetJettyOpt == NULL) {
1066 : #ifndef CA_CONFIG_LLT
1067 : hccp_err("rs_urma_get_jetty_opt is null");
1068 : return -EINVAL;
1069 : #endif
1070 : }
1071 0 : return DlRetConvert(gUrmaOps.rsUrmaGetJettyOpt(jetty, opt, buf, len));
1072 : }
1073 :
1074 1 : int RsUrmaDeactiveJetty(urma_jetty_t *jetty)
1075 : {
1076 1 : if (gUrmaOps.rsUrmaDeactiveJetty == NULL) {
1077 : #ifndef CA_CONFIG_LLT
1078 : hccp_err("rs_urma_deactive_jetty is null");
1079 : return -EINVAL;
1080 : #endif
1081 : }
1082 1 : return DlRetConvert(gUrmaOps.rsUrmaDeactiveJetty(jetty));
1083 : }
1084 :
1085 1 : int RsUrmaFreeJetty(urma_jetty_t *jetty)
1086 : {
1087 1 : if (gUrmaOps.rsUrmaFreeJetty == NULL) {
1088 : #ifndef CA_CONFIG_LLT
1089 : hccp_err("rs_urma_free_jetty is null");
1090 : return -EINVAL;
1091 : #endif
1092 : }
1093 1 : return DlRetConvert(gUrmaOps.rsUrmaFreeJetty(jetty));
1094 : }
1095 :
1096 0 : int RsUrmaAllocJfc(urma_context_t *urmaCtx, urma_jfc_cfg_t *cfg, urma_jfc_t **jfc)
1097 : {
1098 0 : if (gUrmaOps.rsUrmaAllocJfc == NULL) {
1099 : #ifndef CA_CONFIG_LLT
1100 : hccp_err("rs_urma_alloc_jfc is null");
1101 : return -EINVAL;
1102 : #endif
1103 : }
1104 0 : return DlRetConvert(gUrmaOps.rsUrmaAllocJfc(urmaCtx, cfg, jfc));
1105 : }
1106 :
1107 0 : int RsUrmaSetJfcOpt(urma_jfc_t *jfc, uint64_t opt, void *buf, uint32_t len)
1108 : {
1109 0 : if (gUrmaOps.rsUrmaSetJfcOpt == NULL) {
1110 : #ifndef CA_CONFIG_LLT
1111 : hccp_err("rs_urma_set_jfc_opt is null");
1112 : return -EINVAL;
1113 : #endif
1114 : }
1115 0 : return DlRetConvert(gUrmaOps.rsUrmaSetJfcOpt(jfc, opt, buf, len));
1116 : }
1117 :
1118 0 : int RsUrmaActiveJfc(urma_jfc_t *jfc)
1119 : {
1120 0 : if (gUrmaOps.rsUrmaActiveJfc == NULL) {
1121 : #ifndef CA_CONFIG_LLT
1122 : hccp_err("rs_urma_active_jfc is null");
1123 : return -EINVAL;
1124 : #endif
1125 : }
1126 0 : return DlRetConvert(gUrmaOps.rsUrmaActiveJfc(jfc));
1127 : }
1128 :
1129 0 : int RsUrmaGetJfcOpt(urma_jfc_t *jfc, uint64_t opt, void *buf, uint32_t len)
1130 : {
1131 0 : if (gUrmaOps.rsUrmaGetJfcOpt == NULL) {
1132 : #ifndef CA_CONFIG_LLT
1133 : hccp_err("rs_urma_get_jfc_opt is null");
1134 : return -EINVAL;
1135 : #endif
1136 : }
1137 0 : return DlRetConvert(gUrmaOps.rsUrmaGetJfcOpt(jfc, opt, buf, len));
1138 : }
1139 :
1140 0 : int RsUrmaDeactiveJfc(urma_jfc_t *jfc)
1141 : {
1142 0 : if (gUrmaOps.rsUrmaDeactiveJfc == NULL) {
1143 : #ifndef CA_CONFIG_LLT
1144 : hccp_err("rs_urma_deactive_jfc is null");
1145 : return -EINVAL;
1146 : #endif
1147 : }
1148 0 : return DlRetConvert(gUrmaOps.rsUrmaDeactiveJfc(jfc));
1149 : }
1150 :
1151 0 : int RsUrmaFreeJfc(urma_jfc_t *jfc)
1152 : {
1153 0 : if (gUrmaOps.rsUrmaFreeJfc == NULL) {
1154 : #ifndef CA_CONFIG_LLT
1155 : hccp_err("rs_urma_free_jfc is null");
1156 : return -EINVAL;
1157 : #endif
1158 : }
1159 0 : return DlRetConvert(gUrmaOps.rsUrmaFreeJfc(jfc));
1160 : }
|