LCOV - code coverage report
Current view: top level - base_comm/resources/hccp/rdma_service/ctx - dl_urma_function.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 60.3 % 247 149
Test Date: 2026-07-28 12:11:00 Functions: 56.9 % 72 41

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

Generated by: LCOV version 2.0-1