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_RMA_DEV_NET_CONNECTION_H
12 : #define HCCLV2_RMA_DEV_NET_CONNECTION_H
13 :
14 : #include "rma_connection.h"
15 : #include "op_mode.h"
16 : #include "orion_adapter_hccp.h"
17 : #include "socket.h"
18 : #include "task.h"
19 : namespace Hccl {
20 :
21 : class DevRdmaConnection : public RmaConnection {
22 : public:
23 : DevRdmaConnection(Socket* socket, RdmaHandle rdmaHandle, OpMode opMode);
24 : void Connect() override;
25 : RmaConnStatus GetStatus() override;
26 : QpHandle GetHandle();
27 :
28 : unique_ptr<BaseTask>
29 : PrepareWrite(const MemoryBuffer& remoteMemBuf, const MemoryBuffer& localMemBuf, const SqeConfig& config) override;
30 :
31 : ~DevRdmaConnection() override;
32 :
33 : string Describe() const override;
34 :
35 : private:
36 : QpHandle qpHandle{nullptr};
37 : void CheckQpStatus(QpHandle handle);
38 :
39 20 : MAKE_ENUM(RdmaConnStatus, INIT, CONNECTING, SOCKET_TIMEOUT)
40 : RdmaConnStatus rdmaConnStatus{RdmaConnStatus::INIT};
41 :
42 : unique_ptr<BaseTask> PrepareOneRdmaSendForWrite(
43 : const MemoryBuffer& remoteMemBuf, const MemoryBuffer& localMemBuf, u64 offset, u32 size) const;
44 : };
45 :
46 : } // namespace Hccl
47 :
48 : #endif // HCCL_RMA_DEV_NET_CONNECTION_H
|