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_NS_RECOVERY_FUNC_H
12 : #define HCCLV2_NS_RECOVERY_FUNC_H
13 :
14 : #include "daemon_func.h"
15 : #include "communicator_impl_lite.h"
16 : #include "communicator_impl_lite_manager.h"
17 : #include "enum_factory_legacy.h"
18 :
19 : namespace Hccl {
20 :
21 : using ts_kill_task_info_t = struct {
22 : volatile uint8_t resv[40];
23 : };
24 :
25 : using ts_query_task_info_t = struct {
26 : volatile uint32_t choice; // APP_ABORT_STS_QUERY_CHOICE
27 : volatile uint32_t sqId;
28 : volatile uint8_t resv[32];
29 : };
30 :
31 : using ts_query_task_ack_info_t = struct {
32 : volatile uint32_t status; // APP_ABORT_STAUTS
33 : volatile uint8_t resv[36];
34 : };
35 :
36 : using ts_ctrl_msg_body_t = struct {
37 : volatile uint32_t type;
38 : union {
39 : ts_kill_task_info_t killTaskInfo;
40 : ts_query_task_info_t query_task_info;
41 : ts_query_task_ack_info_t query_task_ack_info;
42 : } u; // 40 bytes
43 : }; // 44 bytes
44 :
45 : MAKE_ENUM(OPERATION_TYPE, OP_ABORT_APP, OP_QUERY_ABORT_STATUS, OP_INVALID)
46 :
47 : MAKE_ENUM(
48 : APP_ABORT_STS_QUERY_CHOICE, APP_ABORT_STS_QUERY_BY_SQ, APP_ABORT_STS_QUERY_BY_PID, APP_ABORT_STS_QUERY_INVALID)
49 :
50 : MAKE_ENUM(
51 : APP_ABORT_STAUTS, APP_ABORT_TERMINATE_FAIL, APP_ABORT_INIT, APP_ABORT_KILL_FINISH, APP_ABORT_TERMINATE_FINISH,
52 : APP_ABORT_STATUS_INVALID)
53 :
54 : class NsRecoveryHandlerFunc : public DaemonFunc {
55 : public:
56 : static NsRecoveryHandlerFunc& GetInstance();
57 1 : ~NsRecoveryHandlerFunc() override = default;
58 : void Call() override;
59 :
60 : private:
61 : void HandleStopLaunch(CommunicatorImplLite* comm) const;
62 : void HandleClean(CommunicatorImplLite* comm);
63 : void StreamClean(CommunicatorImplLite* comm);
64 : HcclResult DeviceQuery(const uint32_t devId, const uint32_t step, const uint64_t timeout);
65 :
66 : NsRecoveryHandlerFunc() = default;
67 : NsRecoveryHandlerFunc(const NsRecoveryHandlerFunc&) = delete;
68 : NsRecoveryHandlerFunc& operator=(const NsRecoveryHandlerFunc&) = delete;
69 : };
70 :
71 : } // namespace Hccl
72 :
73 : #endif
|