LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_device/ccu_component/ccu_channel/ccu_channel_v1 - ccu_channel_mgr_v1.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 18 18
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 3 3

            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              : #ifndef HCCL_CCU_CHANNEL_MGR_V1_H
      12              : #define HCCL_CCU_CHANNEL_MGR_V1_H
      13              : 
      14              : #include "ccu_channel_mgr.h"
      15              : #include "ccu_jetty_ctx_mgr_v1_legacy.h"
      16              : 
      17              : namespace Hccl {
      18              : 
      19              : constexpr uint16_t TOKEN_VALUE_VALID = 1;
      20              : constexpr uint16_t REMOTE_CCU_VA_RIGHT_SHIFT_NUM = 23;
      21              : 
      22              : constexpr uint16_t MASK_START_JETTY_ID_LOW = 0x000F;
      23              : constexpr uint16_t MASK_START_JETTY_ID_HIGH = 0x0FFF;
      24              : 
      25              : constexpr uint8_t MASK_JETTY_NUM_LOW = 0x000F;
      26              : constexpr uint8_t MASK_JETTY_NUM_HIGH = 0x0007;
      27              : 
      28              : constexpr uint32_t MASK_TOKEN_ID_LOW = 0x00000FFF;
      29              : constexpr uint32_t MASK_TOKEN_ID_HIGH = 0x000000FF;
      30              : 
      31              : constexpr uint32_t MASK_TOKEN_VALUE_LOW = 0x000000FF;
      32              : constexpr uint32_t MASK_TOKEN_VALUE_MID = 0x0000FFFF;
      33              : constexpr uint32_t MASK_TOKEN_VALUE_HIGH = 0x000000FF;
      34              : 
      35              : constexpr uint64_t MASK_VA_LOW = 0x00000000000000FF;
      36              : constexpr uint64_t MASK_VA_MID = 0x000000000000FFFF;
      37              : constexpr uint64_t MASK_VA_HIGH = 0x000000000000FFFF;
      38              : constexpr uint64_t MASK_VA_HIGHER = 0x0000000000000001;
      39              : 
      40              : #pragma pack(push, 1)
      41              : struct ChannelDataV1 {
      42              :     uint8_t eidRaw[URMA_EID_LEN] = {0};
      43              :     /********16 Bytes**********/
      44              : 
      45              :     uint16_t vtpLow{0};
      46              :     /********18 Bytes**********/
      47              : 
      48              :     uint16_t vtpHigh : 8;
      49              :     uint16_t srcPfeId : 4;
      50              :     uint16_t startJettyIdLow : 4;
      51              :     /********20 Bytes**********/
      52              : 
      53              :     uint16_t startJettyIdHigh : 12;
      54              :     uint16_t jettyNumLow : 4;
      55              :     /********22 Bytes**********/
      56              : 
      57              :     uint16_t jettyNumHigh : 3;
      58              :     uint16_t ioDieId : 1;
      59              :     uint16_t dstTokenIdLow : 12;
      60              :     /********24 Bytes**********/
      61              : 
      62              :     uint16_t dstTokenIdHigh : 8;
      63              :     uint16_t dstTokenValueLow : 8;
      64              :     /********26 Bytes**********/
      65              : 
      66              :     uint16_t dstTokenValueMiddle{0};
      67              :     /********28 Bytes**********/
      68              : 
      69              :     uint16_t dstTokenValueHigh : 8;
      70              :     uint16_t dstVaLow : 8;
      71              :     /********30 Bytes**********/
      72              : 
      73              :     uint16_t dstVaMiddle{0};
      74              :     /********32 Bytes**********/
      75              : 
      76              :     uint16_t dstVaHigh{0};
      77              :     /********34 Bytes**********/
      78              : 
      79              :     uint16_t dstVaHigher : 1;
      80              :     uint16_t dstTokenValueValid : 1;
      81              :     uint16_t rsv14Bits : 14;
      82              :     /********36 Bytes**********/
      83              : 
      84              :     uint16_t rsvs[14] = {0};
      85              :     /********64 Bytes**********/
      86              : 
      87           28 :     ChannelDataV1()
      88           28 :         : vtpHigh(0),
      89           28 :           srcPfeId{0},
      90           28 :           startJettyIdLow{0},
      91           28 :           startJettyIdHigh{0},
      92           28 :           jettyNumLow{0},
      93           28 :           jettyNumHigh{0},
      94           28 :           ioDieId{0},
      95           28 :           dstTokenIdLow(0),
      96           28 :           dstTokenIdHigh{0},
      97           28 :           dstTokenValueLow{0},
      98           28 :           dstTokenValueHigh{0},
      99           28 :           dstVaLow{0},
     100           28 :           dstVaHigher{0},
     101           28 :           dstTokenValueValid{0},
     102           28 :           rsv14Bits{0}
     103           28 :     {}
     104              : };
     105              : #pragma pack(pop)
     106              : 
     107              : class CcuChannelMgrV1 : public CcuChannelMgr {
     108              : public:
     109              :     CcuChannelMgrV1(const int32_t devLogicId, const uint8_t dieId, const uint32_t devPhyId);
     110              : 
     111              :     CcuChannelMgrV1() = default;
     112           48 :     ~CcuChannelMgrV1() override = default;
     113              : 
     114              :     HcclResult Alloc(const ChannelPara& channelPara, std::vector<ChannelInfo>& channelInfos) override;
     115              :     HcclResult Config(const ChannelCfg& channelCfg) override;
     116              :     HcclResult Release(const uint32_t channelId) override;
     117              : 
     118              : private:
     119              :     uint32_t strategy{0};
     120              : 
     121              :     CcuJettyCtxMgrV1 jettyCtxMgr{};
     122              : };
     123              : 
     124              : }; // namespace Hccl
     125              : 
     126              : #endif
        

Generated by: LCOV version 2.0-1