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 : #ifndef AICPU_TS_UBOE_CHANNEL_H
11 : #define AICPU_TS_UBOE_CHANNEL_H
12 :
13 : #include "aicpu_ts_uboe_ubg_channel_helper.h"
14 :
15 : namespace hcomm {
16 :
17 : class AicpuTsUboeChannel : public AicpuTsUboeUbgChannelHelper {
18 : public:
19 : AicpuTsUboeChannel(EndpointHandle endpointHandle, const HcommChannelDesc &channelDesc);
20 : ~AicpuTsUboeChannel() override;
21 :
22 : HcclResult Init() override;
23 : ChannelStatus GetStatus() override;
24 :
25 : HcclResult UpdateMemInfo(HcommMemHandle *memHandles, uint32_t memHandleNum) override;
26 :
27 1 : HcommChannelKind GetChannelKind() const override
28 : {
29 1 : return HcommChannelKind::AICPU_TS_UBOE;
30 : }
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 31 : MAKE_ENUM(UboeStatus, INIT, SEND_EID, RECV_EID, PROCESS_EID_DATA, BUILD_CONN, SEND_SIZE, RECV_SIZE, SEND_DATA,
52 : RECV_DATA, SEND_FIN, RECV_FIN, PROCESS_DATA, SET_READY, READY)
53 : UboeStatus uboeStatus{UboeStatus::INIT};
54 : };
55 :
56 : } // namespace hcomm
57 :
58 : #endif // AICPU_TS_UBOE_CHANNEL_H
|