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 HCOMM_CCU_JETTY_H
12 : #define HCOMM_CCU_JETTY_H
13 :
14 : #include "ip_address.h"
15 : #include "ccu_device_pub.h"
16 : #include "hcomm_adapter_hccp.h"
17 : #include "hccl_common.h"
18 :
19 : namespace hcomm {
20 :
21 : class CcuJetty final {
22 : public:
23 : CcuJetty(const Hccl::IpAddress& ipAddr, const CcuJettyInfo& jettyInfo); // 暂时改为使用Hccl
24 : ~CcuJetty();
25 :
26 : HcclResult Init();
27 :
28 : HcclResult SetMappedJettyPriority(uint32_t priority);
29 :
30 : HcclResult CreateJetty(u8 errTimeout);
31 :
32 : HrtRaUbCreateJettyParam GetCreateJettyParam() const;
33 : HrtRaUbJettyCreatedOutParam GetJettyedOutParam() const;
34 : HcclResult Clean();
35 0 : uint16_t GetJettyId() const { return jettyInfo_.taJettyId; }
36 1 : JettyHandle GetJettyHandle() const { return reinterpret_cast<JettyHandle>(jettyHandlePtr_); }
37 0 : RdmaHandle GetRdmaHandle() const { return rdmaHandle_; }
38 1 : CtxHandle GetCtxHandle() const { return ctxHandle_; }
39 :
40 : private:
41 : CcuJetty(const CcuJetty& that) = delete;
42 : CcuJetty& operator=(const CcuJetty& that) = delete;
43 : CcuJetty(CcuJetty&& that) = delete;
44 : CcuJetty& operator=(CcuJetty&& that) = delete;
45 :
46 : private:
47 : int32_t devLogicId_{0};
48 : Hccl::IpAddress ipAddr_{};
49 : CcuJettyInfo jettyInfo_{};
50 :
51 : CtxHandle ctxHandle_{nullptr};
52 : bool isCreated_{false};
53 : bool isError_{false};
54 :
55 : RequestHandle reqHandle_{0};
56 : std::vector<char> reqDataBuffer_{};
57 : void* jettyHandlePtr_{nullptr};
58 :
59 : HrtRaUbCreateJettyParam inParam_{};
60 : HrtRaUbJettyCreatedOutParam outParam_{};
61 : bool mappedJettyPrioritySet_{false};
62 : uint8_t mappedJettyPriority_{0};
63 :
64 : HcclResult HandleAsyncRequest();
65 : RdmaHandle rdmaHandle_{nullptr};
66 : };
67 :
68 : HcclResult
69 : CcuCreateJetty(const Hccl::IpAddress& ipAddr, const CcuJettyInfo& jettyInfo, std::unique_ptr<CcuJetty>& ccuJetty);
70 :
71 : } // namespace hcomm
72 : #endif // HCOMM_CCU_JETTY_H
|