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.8 % 250 152
Test Date: 2026-08-04 10:52:23 Functions: 57.5 % 73 42

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

Generated by: LCOV version 2.0-1