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 HCCLV2_EXCHANGE_RDMA_CONN_DTO_H
12 : #define HCCLV2_EXCHANGE_RDMA_CONN_DTO_H
13 :
14 : #include <string>
15 : #include "binary_stream.h"
16 : #include "serializable.h"
17 :
18 : constexpr uint32_t HYPER_FEATURE_LEN = 64U;
19 :
20 : namespace hcomm {
21 : class ExchangeRdmaConnDto : public Hccl::Serializable {
22 : public:
23 42 : ExchangeRdmaConnDto() {};
24 :
25 6 : ExchangeRdmaConnDto(uint32_t qpn, uint32_t psn, uint32_t gid_idx) : qpn_(qpn), psn_(psn), gid_idx_(gid_idx) {};
26 :
27 1 : void Serialize(Hccl::BinaryStream& stream) override { stream << qpn_ << psn_ << gid_idx_ << gid_ << feature_; }
28 :
29 1 : void Deserialize(Hccl::BinaryStream& stream) override { stream >> qpn_ >> psn_ >> gid_idx_ >> gid_ >> feature_; }
30 :
31 7 : std::string Describe() const override
32 : {
33 7 : return Hccl::StringFormat("ExchangeRdmaConnDto=[qpn=%u, psn=%u, gid_idx=%u]", qpn_, psn_, gid_idx_);
34 : }
35 :
36 : // RaTypicalQpModify
37 : uint32_t qpn_;
38 : uint32_t psn_;
39 : uint32_t gid_idx_;
40 : uint8_t gid_[HCCP_GID_RAW_LEN];
41 : char feature_[HYPER_FEATURE_LEN];
42 : };
43 :
44 : } // namespace hcomm
45 :
46 : #endif // HCCLV2_EXCHANGE_RDMA_CONN_DTO_H
|