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: 78.6 % 28 22
Test Date: 2026-08-04 10:52:23 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           11 : HcclNetDevice::~HcclNetDevice()
      20              : {    
      21           33 :     HCCL_DEBUG("HcclNetDevice destroyed: %p", this);
      22           11 : }
      23              : 
      24            8 : NetDevInfo HcclNetDevice::GetNetDevInfo() const
      25              : {
      26            8 :     return netDevInfo_;
      27              : }
      28            1 : InnerNetDev *HcclNetDevice::GetInnerNetDev() const
      29              : {
      30            1 :     return ndev_;
      31              : }
      32            9 : void HcclNetDevice::SetInnerNetDev(InnerNetDev *value)
      33              : {
      34            9 :     ndev_ = value;
      35            9 : }
      36              : 
      37            3 : RdmaHandle HcclNetDevice::GetRdmaHandle() const
      38              : {
      39            3 :     if (ndev_) {
      40            3 :         return ndev_->getRdmaHandle();
      41              :     }
      42            0 :     return nullptr;
      43              : }
      44              : 
      45            2 : std::pair<TokenIdHandle, uint32_t> HcclNetDevice::GetTokenIdInfo(const BufferKey<uintptr_t, u64> &bufKey) const
      46              : {
      47            2 :     if (ndev_) {
      48            2 :         return ndev_->getTokenIdInfo(bufKey);
      49              :     }
      50            0 :     return std::pair<TokenIdHandle, uint32_t>{};
      51              : }
      52              : 
      53            0 : void HcclNetDevice::PutTokenIdInfo(const BufferKey<uintptr_t, u64> &bufKey, TokenIdHandle tokenIdHandle) const
      54              : {
      55            0 :     if (ndev_) {
      56            0 :         ndev_->putTokenIdInfo(bufKey, tokenIdHandle);
      57              :     }
      58            0 : }
      59              : 
      60            3 : bool HcclNetDevice::IsUB()
      61              : {
      62            3 :     return netDevInfo_.protoType == LinkProtoType::UB;
      63              : }
      64              : 
      65              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1