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 :
11 : #ifndef AICPU_TS_UBOE_CHANNEL_H
12 : #define AICPU_TS_UBOE_CHANNEL_H
13 :
14 : #include "aicpu_ts_uboe_ub_rtp_channel_helper.h"
15 :
16 : namespace hcomm {
17 :
18 : class AicpuTsUboeChannel : public AicpuTsUboeUbRtpChannelHelper {
19 : public:
20 : AicpuTsUboeChannel(EndpointHandle endpointHandle, const HcommChannelDesc& channelDesc);
21 : ~AicpuTsUboeChannel() override;
22 :
23 : HcclResult Init() override;
24 : ChannelStatus GetStatus() override;
25 : HcclResult Clean() override;
26 : HcclResult Resume() override;
27 :
28 : HcclResult UpdateMemInfo(HcommMemHandle* memHandles, uint32_t memHandleNum) override;
29 :
30 1 : HcommChannelKind GetChannelKind() const override { return HcommChannelKind::AICPU_TS_UBOE; }
31 :
32 : protected:
33 : HcclResult BuildConnection() override;
34 : void SendFinish() override;
35 : void RecvFinish() override;
36 :
37 : private:
38 : void EidPack();
39 : void SendEidData();
40 : void RecvEidData();
41 : void RecvEidDataProcess();
42 : void RmtEidUnpackProc(Hccl::IpAddress& rmtAddr);
43 : void HandleProcessData();
44 : void ProcessUboeState();
45 :
46 : HcclResult CheckSocketStatus(const std::string& socketOperator);
47 :
48 : std::vector<char> sendEidData_{};
49 : std::vector<char> recvEidData_{};
50 :
51 35 : MAKE_ENUM(
52 : UboeStatus, INIT, SEND_EID, RECV_EID, PROCESS_EID_DATA, BUILD_CONN, SEND_SIZE, RECV_SIZE, SEND_DATA, RECV_DATA,
53 : SEND_FIN, RECV_FIN, PROCESS_DATA, SET_READY, READY)
54 : UboeStatus uboeStatus{UboeStatus::INIT};
55 : };
56 :
57 : } // namespace hcomm
58 :
59 : #endif // AICPU_TS_UBOE_CHANNEL_H
|