LCOV - code coverage report
Current view: top level - base_comm/resources/endpoint_pairs/channels/aicpu - dev_rdma_connection_v2.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 7 7
Test Date: 2026-07-28 12:11:00 Functions: 87.5 % 8 7

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2026 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              : #ifndef DEV_RDMA_CONNECTION_V2_H
      11              : #define DEV_RDMA_CONNECTION_V2_H
      12              : 
      13              : #include "hccp_common.h"
      14              : #include "enum_factory.h"
      15              : #include "hccl_common.h"
      16              : #include "mem_device_pub.h"
      17              : #include "../host/exchange_rdma_conn_dto.h"
      18              : #include "orion_adapter_hccp.h"
      19              : #include "hcomm/hcomm_res_entity_defs.h"
      20              : 
      21              : // Orion
      22              : #include "../../../../../legacy/ascend950/unified_platform/resource/socket/socket.h"
      23              : #include "hccp_nda.h"
      24              : 
      25              : namespace hcomm {
      26              : class DevRdmaConnectionV2 {
      27              : public:
      28              :     struct QpAttrDto {
      29              :         uint32_t qpn{UINT32_MAX};
      30              :         uint32_t psn{UINT32_MAX};
      31              :         uint32_t gid_idx{0};
      32              :         unsigned char gid[HCCP_GID_RAW_LEN];
      33              : 
      34            5 :         bool IsValid() {
      35            5 :             if (qpn == UINT32_MAX || psn == UINT32_MAX) {
      36            3 :                 return false;
      37              :             }
      38            2 :             return true;
      39              :         }
      40              :     };
      41          295 :     MAKE_ENUM(RdmaConnStatus, CLOSED, INIT, QP_CREATED, QP_MODIFIED, SOCKET_TIMEOUT)
      42              :     DevRdmaConnectionV2(Hccl::Socket *socket, RdmaHandle rdmaHandle);
      43              :     ~DevRdmaConnectionV2();
      44              : 
      45              :     HcclResult Init();
      46              :     HcclResult CreateQp();
      47              :     HcclResult GetExchangeDto(std::unique_ptr<Hccl::Serializable> &serial);
      48              :     HcclResult ParseRmtExchangeDto(const Hccl::Serializable &rmtDto);
      49              :     HcclResult ModifyQp();
      50              : 
      51              :     std::string Describe() const ;
      52           35 :     Hccl::QpInfo& GetQpInfo() {
      53           35 :         return qpInfo_;
      54              :     }
      55              : 
      56              :     HcclResult BuildSqContext(SqContext* context);
      57              :     HcclResult BuildCqContext(CqContext* context);
      58              : 
      59              :     std::vector<char> GetUniqueId() const;
      60              : 
      61              : private:
      62              :     void GetNdaOps();
      63              :     HcclResult GetDirectFlag();
      64              :     HcclResult GetDmaMode();
      65              :     HcclResult DestroyQp();
      66              : 
      67              :     std::vector<char> GetSqUniqueId() const;
      68              :     std::vector<char> GetCqUniqueId() const;
      69              : 
      70              :     Hccl::Socket        *socket_{nullptr};
      71              :     Hccl::RdmaHandle    rdmaHandle_{nullptr};
      72              :     int32_t             directFlag_{0};
      73              :     uint32_t            dmaMode_{0};
      74              :     NdaOps              ndaOps_{};
      75              : 
      76              :     Hccl::QpHandle      qpHandle_;
      77              :     NdaQpInfo           ndaQpInfo_;
      78              :     Hccl::CqHandle      cqHandle_;
      79              :     NdaCqInfo           ndaCqInfo_;
      80              : 
      81              :     RdmaConnStatus      rdmaConnStatus_{RdmaConnStatus::CLOSED};
      82              :     QpAttrDto           rmtQpAttr_{};
      83              :     QpAttrDto           locQpAttr_{};
      84              :     Hccl::QpInfo        qpInfo_{};
      85              : 
      86              :     hccl::DeviceMem    SqPiMem_;
      87              :     hccl::DeviceMem    SqCiMem_;
      88              :     hccl::DeviceMem    CqPiMem_;
      89              :     hccl::DeviceMem    CqCiMem_;
      90              : };
      91              : 
      92              : } // namespace hcomm
      93              : 
      94              : #endif // DEV_RDMA_CONNECTION_V2_H
        

Generated by: LCOV version 2.0-1