LCOV - code coverage report
Current view: top level - legacy/ascend910/platform/common/adapter - adapter_tdt.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 68.0 % 25 17
Test Date: 2026-07-28 12:11:00 Functions: 50.0 % 4 2

            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 <adapter_tdt.h>
      12              : #include "log.h"
      13              : #include "workflow_pub.h"
      14              : #include "driver/ascend_hal.h"
      15              : #include "sal_pub.h"
      16              : using namespace hccl;
      17              : 
      18              : #ifdef __cplusplus
      19              : extern "C" {
      20              : #endif
      21          206 : HcclResult hrtOpenTsd()
      22              : {
      23              : #ifndef HCCD
      24          206 :     std::string extPam("--hdcType=" + std::to_string(HDC_SERVICE_TYPE_RDMA));
      25              :     rtNetServiceOpenArgs openArgs;
      26          206 :     rtProcExtParam extParam{};
      27          206 :     extParam.paramInfo = extPam.c_str();
      28          206 :     extParam.paramLen = extPam.size();
      29          206 :     openArgs.extParamCnt = 1UL;
      30          206 :     openArgs.extParamList = &extParam;
      31          206 :     CHK_RET(hrtOpenNetService(&openArgs));
      32          206 :     HCCL_INFO("hrtOpenTsd success");
      33          206 :     return HCCL_SUCCESS;
      34              : #else
      35              :     HCCL_ERROR("[hrtOpenTsd]Does not support this interface.");
      36              :     return HCCL_E_NOT_SUPPORT;
      37              : #endif
      38          206 : }
      39              : 
      40            0 : HcclResult __hrtOpenNetService(rtNetServiceOpenArgs *openArgs)
      41              : {
      42              : #if !defined(CCL_KERNEL) && !defined(HCCD)
      43              :     aclError aclret = rtOpenNetService(openArgs);
      44              :     if (aclret != ACL_RT_SUCCESS) {
      45              :         HCCL_ERROR("[hrtOpenNetService]Open NetService failed, err code : %d", aclret);
      46              :         return HcclResult::HCCL_E_UNAVAIL;
      47              :     }
      48              : 
      49              :     return HCCL_SUCCESS;
      50              : #else
      51            0 :     HCCL_ERROR("[hrtOpenNetService]Does not support this interface.");
      52            0 :     return HCCL_E_NOT_SUPPORT;
      53              : #endif
      54              : }
      55              : weak_alias(__hrtOpenNetService, hrtOpenNetService);
      56              : 
      57            0 : HcclResult __hrtCloseNetService()
      58              : {
      59              : #if !defined(CCL_KERNEL) && !defined(HCCD)
      60              :     aclError aclret = rtCloseNetService();
      61              :     if (aclret != ACL_RT_SUCCESS) {
      62              :         HCCL_ERROR("[hrtCloseNetService]Open NetService failed, err code : %d", aclret);
      63              :         return HcclResult::HCCL_E_UNAVAIL;
      64              :     }
      65              : 
      66              :     return HCCL_SUCCESS;
      67              : #else
      68            0 :     HCCL_ERROR("[hrtCloseNetService]Does not support this interface.");
      69            0 :     return HCCL_E_NOT_SUPPORT;
      70              : #endif
      71              : }
      72              : weak_alias(__hrtCloseNetService, hrtCloseNetService);
      73              : 
      74          410 : HcclResult hrtTsdCapabilityGet(uint32_t deviceLogicId, int32_t type, uint64_t ptr)
      75              : {
      76              : #ifndef HCCD
      77          410 :     uint32_t tdtStatus = DlTdtFunction::GetInstance().\
      78          410 :         dlTsdCapabilityGet(deviceLogicId, type, ptr);
      79          410 :     if (tdtStatus != 0) {
      80            0 :         HCCL_ERROR("[Get][TsdCapability]Get TsdCapability failed, tdt error code: %u, error deviceLogicId[%u], ",
      81              :             tdtStatus, deviceLogicId);
      82            0 :         return HCCL_E_UNAVAIL;
      83              :     }
      84          410 :     HCCL_INFO("Get TsdCapability success. deviceLogicId[%u]", deviceLogicId);
      85          410 :     return HCCL_SUCCESS;
      86              : #else
      87              :     HCCL_ERROR("[hrtTsdCapabilityGet]Does not support this interface.");
      88              :     return HCCL_E_NOT_SUPPORT;
      89              : #endif
      90              : }
      91              : #ifdef __cplusplus
      92              : }  // extern "C"
      93              : #endif
        

Generated by: LCOV version 2.0-1