LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/common - net_device.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 71.4 % 21 15
Test Date: 2026-08-17 10:19:35 Functions: 88.9 % 9 8

            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              : #include "net_device.h"
      11              : 
      12              : namespace Hccl {
      13           11 : HcclNetDevice::HcclNetDevice(const NetDevInfo& info)
      14              : {
      15           11 :     netDevInfo_ = info;
      16           33 :     HCCL_DEBUG("HcclNetDevice created: %p", this);
      17           11 : }
      18              : 
      19           33 : HcclNetDevice::~HcclNetDevice() { HCCL_DEBUG("HcclNetDevice destroyed: %p", this); }
      20              : 
      21            8 : NetDevInfo HcclNetDevice::GetNetDevInfo() const { return netDevInfo_; }
      22            1 : InnerNetDev* HcclNetDevice::GetInnerNetDev() const { return ndev_; }
      23            9 : void HcclNetDevice::SetInnerNetDev(InnerNetDev* value) { ndev_ = value; }
      24              : 
      25            3 : RdmaHandle HcclNetDevice::GetRdmaHandle() const
      26              : {
      27            3 :     if (ndev_) {
      28            3 :         return ndev_->getRdmaHandle();
      29              :     }
      30            0 :     return nullptr;
      31              : }
      32              : 
      33            2 : std::pair<TokenIdHandle, uint32_t> HcclNetDevice::GetTokenIdInfo(const BufferKey<uintptr_t, u64>& bufKey) const
      34              : {
      35            2 :     if (ndev_) {
      36            2 :         return ndev_->getTokenIdInfo(bufKey);
      37              :     }
      38            0 :     return std::pair<TokenIdHandle, uint32_t>{};
      39              : }
      40              : 
      41            0 : void HcclNetDevice::PutTokenIdInfo(const BufferKey<uintptr_t, u64>& bufKey, TokenIdHandle tokenIdHandle) const
      42              : {
      43            0 :     if (ndev_) {
      44            0 :         ndev_->putTokenIdInfo(bufKey, tokenIdHandle);
      45              :     }
      46            0 : }
      47              : 
      48            3 : bool HcclNetDevice::IsUB() { return netDevInfo_.protoType == LinkProtoType::UB; }
      49              : 
      50              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1