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 NS_RECOVERY_LITE_H
12 : #define NS_RECOVERY_LITE_H
13 :
14 : #include "hdc_pub.h"
15 : #include "kfc.h"
16 : #include "hccl_aicpu_hdc_handler.h"
17 : #include <memory>
18 :
19 : namespace hccl {
20 :
21 : class NsRecoveryLite {
22 : public:
23 : NsRecoveryLite();
24 : void Init(
25 : const std::shared_ptr<HDCommunicate>& kfcControlTransferH2D,
26 : const std::shared_ptr<HDCommunicate>& kfcStatusTransferD2H);
27 :
28 : Hccl::KfcCommand BackGroundGetCmd();
29 0 : void BackGroundSetStatus(Hccl::KfcStatus status, Hccl::KfcErrType errorCode = Hccl::KfcErrType::NONE);
30 : void SetNeedClean(bool flag);
31 : bool IsNeedClean() const;
32 :
33 : private:
34 : bool needClean_{false};
35 :
36 : std::unique_ptr<HcclAicpuHdcHandler> hdcHandler_{nullptr};
37 : std::mutex hdcShmLock_;
38 : };
39 :
40 : using NsRecoveryLitePtr = std::shared_ptr<NsRecoveryLite>;
41 :
42 : } // namespace hccl
43 :
44 : #endif
|