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