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 : namespace hcomm {
19 : class ExchangeRdmaConnDto : public Hccl::Serializable {
20 : public:
21 42 : ExchangeRdmaConnDto(){};
22 :
23 6 : ExchangeRdmaConnDto(uint32_t qpn, uint32_t psn, uint32_t gid_idx) : qpn_(qpn), psn_(psn), gid_idx_(gid_idx){};
24 :
25 1 : void Serialize(Hccl::BinaryStream &stream) override
26 : {
27 1 : stream << qpn_ << psn_ << gid_idx_ << gid_;
28 1 : }
29 :
30 1 : void Deserialize(Hccl::BinaryStream &stream) override
31 : {
32 1 : stream >> qpn_ >> psn_ >> gid_idx_ >> gid_;
33 1 : }
34 :
35 7 : std::string Describe() const override
36 : {
37 : return Hccl::StringFormat("ExchangeRdmaConnDto=[qpn=%u, psn=%u, gid_idx=%u]",
38 7 : qpn_, psn_, gid_idx_);
39 : }
40 :
41 : // RaTypicalQpModify
42 : uint32_t qpn_;
43 : uint32_t psn_;
44 : uint32_t gid_idx_;
45 : uint8_t gid_[HCCP_GID_RAW_LEN];
46 : };
47 :
48 : } // namespace Hccl
49 :
50 : #endif // HCCLV2_EXCHANGE_RDMA_CONN_DTO_H
|