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_HCCL_INC_ADAPTER_HCCP_H
12 : #define HCOMM_HCCL_INC_ADAPTER_HCCP_H
13 :
14 : #include <functional>
15 :
16 : #include "hccl/base.h"
17 : // ltm路径指定
18 : #include "network/hccp.h"
19 : #include "hccl_common.h"
20 : #include "workflow_pub.h"
21 : #include "network/hccp_tlv.h"
22 : #include "adapter_hccp_common.h"
23 :
24 : constexpr u64 SOCKET_SEND_MAX_SIZE = 0x7FFFFFFFFFFFFFFF;
25 : constexpr u32 MAX_VALUE_U32 = 0xFFFFFFFF; // u32 数据类型最大值
26 : constexpr u32 MAX_SRQ_DEPTH = 16 * 1024 - 1;
27 : constexpr u32 DEFAULT_INIT_PHY_ID = 0;
28 : constexpr u32 DEFAULT_INIT_NIC_POS = 0;
29 : constexpr u32 DEFAULT_HDC_TYPE = 6;
30 : constexpr u32 PID_HDC_TYPE = 18;
31 : constexpr u32 DEFAULT_INIT_RDMA_CONFIG = 0; // 初始化rdma rdev_init_info默认初始化参数
32 : constexpr u32 MAX_PORT_ID = 65535;
33 : constexpr u32 MIN_PORT_ID = 1024;
34 : constexpr u32 AUTO_LISTEN_PORT = 0;
35 : constexpr u32 MAX_SEND_SGE_NUM = 8;
36 : constexpr u32 HOST_SQ_CQ_DEPTH = 8192; // 8K
37 : constexpr u32 AICPU_SQ_CQ_DEPTH = 2048; // 2K
38 :
39 : // QP CQ default attr
40 : constexpr u32 DEFAULT_OPBASE_MAX_SEND_WR = 32768;
41 : constexpr u32 DEFAULT_OFFLINE_MAX_SEND_WR = 128;
42 : constexpr u32 DEFAULT_MAX_RECV_WR = 128;
43 : constexpr u32 DEFAULT_MAX_SEND_SGE = 1;
44 : constexpr u32 DEFAULT_MAX_RECV_SGE = 1;
45 : constexpr u32 DEFAULT_MAX_SEND_CQ_DEPTH = 32768;
46 : constexpr u32 DEFAULT_MAX_ONE_SIDED_SEND_CQ_DEPTH = 512;
47 : constexpr u32 DEFAULT_MAX_RECV_CQ_DEPTH = 128;
48 : constexpr u32 DEFAULT_MAX_INLINE_DATA = 32;
49 : constexpr u32 HETEROG_OFFLINE_EXT_MAX_SEND_WR = 512;
50 :
51 : constexpr u32 AI_QP_CREATE = 68; // RA_RS_AI_QP_CREATE 的 opcode为68
52 : constexpr u32 AI_QP_CREATE_VERSION = 2; // 当前支持的版本号为2
53 : constexpr u32 AI_NORMAL_QP_CREATE_VERSION = 3; // 支持创建NormalQP的版本号为3
54 : constexpr u32 AI_QP_CREATE_WITH_ATTRS = 86; // RA_RS_AI_QP_CREATE_WITH_ATTRS 的 opcode为86
55 : constexpr u32 AI_QP_CREATE_WITH_ATTRS_VERSION = 1; // 当前支持的版本号为1
56 :
57 : constexpr u32 GET_HCCH_CFG = 100;
58 : constexpr u32 GET_HCCH_CFG_VERSION = 1; // 当前支持的版本号为1
59 :
60 : const std::string SOC_NAME_910B = "Ascend910B";
61 :
62 : constexpr u32 RA_RS_GET_ROCE_API = 96; // RA_RS_GET_ROCE_API 的 opcode为96
63 : constexpr u32 RA_RS_ATOMIC_WRITE_VERSION = 1; // 支持使用atomic write的版本号为1
64 :
65 : constexpr u32 QP_DEPTH_MAX = 32768;
66 : constexpr u32 QP_DEPTH_MIN = 128;
67 :
68 : using QpConfig = struct QpConfigDef {
69 : hccl::HcclIpAddress selfIp;
70 : hccl::HcclIpAddress peerIp;
71 : u32 maxWr;
72 : u32 maxSendSge;
73 : u32 maxRecvSge;
74 : s32 sqEvent;
75 : s32 rqEvent;
76 :
77 1 : QpConfigDef(
78 : hccl::HcclIpAddress& selfIp, hccl::HcclIpAddress& peerIp, u32 maxWr, u32 maxSendSge, u32 maxRecvSge,
79 : s32 sqEvent, s32 rqEvent)
80 1 : : selfIp(selfIp),
81 1 : peerIp(peerIp),
82 1 : maxWr(maxWr),
83 1 : maxSendSge(maxSendSge),
84 1 : maxRecvSge(maxRecvSge),
85 1 : sqEvent(sqEvent),
86 1 : rqEvent(rqEvent)
87 1 : {}
88 1 : QpConfigDef(u32 maxWr, u32 maxSendSge, u32 maxRecvSge, s32 sqEvent, s32 rqEvent)
89 2 : : maxWr(maxWr),
90 1 : maxSendSge(maxSendSge),
91 1 : maxRecvSge(maxRecvSge),
92 1 : sqEvent(sqEvent),
93 1 : rqEvent(rqEvent)
94 1 : {}
95 11 : QpConfigDef() : maxWr(0), maxSendSge(0), maxRecvSge(0), sqEvent(0), rqEvent(0) {}
96 : };
97 :
98 : using QpInfo = struct QpInfoDef {
99 : QpConfig attr;
100 : RdmaHandle rdmaHandle;
101 : QpHandle qpHandle;
102 : struct ibv_qp* qp;
103 : void* context;
104 : struct ibv_cq* sendCq;
105 : struct ibv_cq* recvCq;
106 : struct ibv_srq* srq;
107 : struct ibv_cq* srqCq;
108 : void* srqContext;
109 : struct ibv_comp_channel* sendChannel;
110 : struct ibv_comp_channel* recvChannel;
111 : s32 flag = 0;
112 : s32 qpMode = 0;
113 : u32 trafficClass;
114 : u32 serviceLevel;
115 11 : QpInfoDef()
116 22 : : rdmaHandle(nullptr),
117 11 : qpHandle(nullptr),
118 11 : qp(nullptr),
119 11 : context(nullptr),
120 11 : sendCq(nullptr),
121 11 : recvCq(nullptr),
122 11 : srq(nullptr),
123 11 : srqCq(nullptr),
124 11 : srqContext(nullptr),
125 11 : sendChannel(nullptr),
126 11 : recvChannel(nullptr),
127 11 : trafficClass(HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET),
128 11 : serviceLevel(HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET)
129 11 : {}
130 2 : QpInfoDef(
131 : QpConfig attr, RdmaHandle rdmaHandle, QpHandle qpHandle, struct ibv_qp* qp, void* context,
132 : struct ibv_cq* sendCq, struct ibv_cq* recvCq, struct ibv_srq* srq, struct ibv_cq* srqCq,
133 : void* srqContext = nullptr, struct ibv_comp_channel* sendChannel = nullptr,
134 : struct ibv_comp_channel* recvChannel = nullptr, u32 tc = HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET,
135 : u32 sl = HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET)
136 2 : : attr(attr),
137 2 : rdmaHandle(rdmaHandle),
138 2 : qpHandle(qpHandle),
139 2 : qp(qp),
140 2 : context(context),
141 2 : sendCq(sendCq),
142 2 : recvCq(recvCq),
143 2 : srq(srq),
144 2 : srqCq(srqCq),
145 2 : srqContext(srqContext),
146 2 : sendChannel(sendChannel),
147 2 : recvChannel(recvChannel),
148 2 : trafficClass(tc),
149 2 : serviceLevel(sl)
150 2 : {}
151 : };
152 :
153 : using QpConfigInfo = struct QpConfigInfoDef {
154 : uint32_t sq_depth;
155 : uint32_t rq_depth;
156 : uint32_t scq_depth;
157 : uint32_t rcq_depth;
158 : uint32_t use_resv_mem;
159 : uint32_t resv_mem_pool_id;
160 : };
161 :
162 : using QpConfigWithCQInfo = struct QpConfigWithCQInfoDef {
163 : uint32_t sq_depth;
164 : uint32_t rq_depth;
165 : uint32_t scq_depth;
166 : uint32_t rcq_depth;
167 : uint32_t sendCqn;
168 : uint32_t recvCqn;
169 : uint32_t use_resv_mem;
170 : uint32_t resv_mem_pool_id;
171 : int sq_sig_all;
172 : uint32_t max_send_sge;
173 : uint32_t max_recv_sge;
174 : uint32_t max_inline_data;
175 : };
176 :
177 : using CqInfo = struct CqInfoDef {
178 : struct ibv_cq* sq;
179 : struct ibv_cq* rq;
180 : void* context;
181 : u32 depth;
182 : u32 used;
183 : s32 sqEvent;
184 : s32 rqEvent;
185 : void* srqContext;
186 : struct ibv_comp_channel* sendChannel;
187 : struct ibv_comp_channel* recvChannel;
188 : std::vector<QpInfo> qps;
189 0 : CqInfoDef()
190 0 : : sq(nullptr),
191 0 : rq(nullptr),
192 0 : context(nullptr),
193 0 : depth(0),
194 0 : used(0),
195 0 : sqEvent(-1),
196 0 : rqEvent(-1),
197 0 : srqContext(nullptr),
198 0 : sendChannel(nullptr),
199 0 : recvChannel(nullptr)
200 0 : {}
201 2 : CqInfoDef(
202 : struct ibv_cq* sq, struct ibv_cq* rq, void* context, u32 depth, s32 sqEvent, s32 rqEvent,
203 : void* srqContext = nullptr, struct ibv_comp_channel* sendChannel = nullptr,
204 : struct ibv_comp_channel* recvChannel = nullptr)
205 2 : : sq(sq),
206 2 : rq(rq),
207 2 : context(context),
208 2 : depth(depth),
209 2 : used(0),
210 2 : sqEvent(sqEvent),
211 2 : rqEvent(rqEvent),
212 2 : srqContext(srqContext),
213 2 : sendChannel(sendChannel),
214 2 : recvChannel(recvChannel)
215 2 : {}
216 : };
217 :
218 : using SrqInfo = struct SrqInfoDef {
219 : struct ibv_srq* srq;
220 : struct ibv_cq* srqCq;
221 : void* context;
222 : s32 srqDepth;
223 : s32 srqEvent;
224 4 : SrqInfoDef() : srq(nullptr), srqCq(nullptr), context(nullptr), srqDepth(0), srqEvent(-1) {}
225 : };
226 :
227 : template <typename connStruct>
228 88 : void CheckConnPort(connStruct& conn, u32 num)
229 : {
230 176 : for (u32 i = 0; i < num; i++) {
231 88 : if (conn[i].port > MAX_PORT_ID) {
232 : // 未定义或者已定义但不合法的情况下,port默认赋值16666
233 0 : HCCL_WARNING("Port is invalid, set to 16666!");
234 0 : conn[i].port = HETEROG_CCL_PORT;
235 : }
236 : }
237 88 : }
238 :
239 16 : inline HcclResult CheckQpDepth(uint32_t depth)
240 : {
241 16 : if ((depth == INVALID_UINT) || (depth >= QP_DEPTH_MIN && ((depth & (depth - 1)) == 0) && depth <= QP_DEPTH_MAX)) {
242 16 : return HCCL_SUCCESS;
243 : }
244 0 : return HCCL_E_PARA;
245 : }
246 :
247 : HcclResult
248 : ConstructQpAttrs(s32 qpMode, struct QpExtAttrs& attrs, const QueueDepthAttr& qpDepth, bool isWorkFlowLib = false);
249 :
250 : HcclResult HrtRaGetQpDepth(RdmaHandle rdmaHandle, unsigned int* tempDepth, unsigned int* qpNum);
251 : HcclResult HrtRaSetQpDepth(RdmaHandle rdmaHandle, unsigned int tempDepth, unsigned int* qpNum);
252 : HcclResult HrtRaQpCreate(RdmaHandle rdmaHandle, int flag, int qpMode, QpHandle& qpHandle);
253 : HcclResult HrtRaQpDestroy(QpHandle handle);
254 : HcclResult HrtRaQpDestroyWithoutCQ(QpHandle handle);
255 : HcclResult HrtRaQpNonBlockConnectAsync(QpHandle handle, const SocketHandle sockHandle);
256 : HcclResult HrtRaQpConnectAsync(
257 : QpHandle handle, const SocketHandle sockHandle,
258 : std::function<bool()> needStop =
259 0 : []() {
260 0 : return false;
261 : },
262 : u32 timeout = 0);
263 : s32 hrtGetRaQpStatus(QpHandle handle, int* status);
264 : HcclResult HrtRaMrReg(QpHandle handle, struct MrInfoT* mrInfo);
265 : HcclResult HrtRaGetNotifyMrInfo(u32 phyId, RdmaHandle handle, struct MrInfoT* mrInfo);
266 : HcclResult HrtRaMrDereg(QpHandle handle, struct MrInfoT* mrInfo);
267 : HcclResult HrtRaSendWr(QpHandle handle, struct SendWr* wr, struct SendWrRsp* opRsp);
268 : HcclResult HrtRaSendWrV2(
269 : QpHandle handle, struct SendWrV2* wr, struct SendWrRsp* opRsp,
270 : HcclWorkflowMode workflowMode = HcclWorkflowMode::HCCL_WORKFLOW_MODE_OP_BASE);
271 : HcclResult HrtRaSendWrVerbs(QpHandle handle, struct SendWrVerbs* wr, struct SendWrRsp* opRsp);
272 : HcclResult HrtRaRecvWrVerbs(QpHandle handle, struct RecvWrVerbs* wr);
273 : s32 hrtRaPollCq(QpHandle handle, bool is_send_cq, unsigned int num, void* wc);
274 : s32 HrtRaPollTypicalCq(void* cqHandle, u32 num, void* wc);
275 : HcclResult HrtRaSendWrlist(
276 : QpHandle handle, struct SendWrlistData wr[], struct SendWrRsp opRsp[], unsigned int sendNum,
277 : unsigned int* completeNum);
278 : HcclResult HrtRaSendWrlistExt(
279 : QpHandle handle, struct SendWrlistDataExt wr[], struct SendWrRsp opRsp[], unsigned int sendNum,
280 : unsigned int* completeNum);
281 : HcclResult HrtRaSendNormalWrlist(
282 : QpHandle handle, struct WrInfo wr[], struct SendWrRsp opRsp[], unsigned int sendNum, unsigned int* completeNum);
283 : HcclResult HrtRaGetNotifyBaseAddr(
284 0 : RdmaHandle handle, u64* va, u64* size, std::function<bool()> needStop = []() {
285 0 : return false;
286 : });
287 : HcclResult HrtRaInit(struct RaInitConfig* config);
288 : HcclResult HrtRaDeInit(struct RaInitConfig* config);
289 :
290 : HcclResult HrtRaRdmaInit(int mode, u32 notifyType, struct rdev rdevInfo, RdmaHandle& rdmaHandle);
291 : HcclResult HrtRaRdmaInitRef(int mode, u32 notifyType, const struct rdev& rdevInfo, RdmaHandle& rdmaHandle);
292 : HcclResult HrtRaRdmaInitWithAttr(struct RdevInitInfo& init_info, const struct rdev& rdevInfo, RdmaHandle& rdmaHandle);
293 : HcclResult HrtRdmaInitWithBackupAttr(
294 : struct RdevInitInfo& init_info, struct rdev& rdevInfo, struct rdev& backupRdevInfo, RdmaHandle& rdmaHandle);
295 : HcclResult HrtRaRdmaGetHandle(unsigned int phyId, RdmaHandle& rdmaHandle);
296 : HcclResult HrtRaRdmaDeInit(RdmaHandle& rdmaHandle, u32 notifyType);
297 : HcclResult HrtRaRdmaDeInitRef(RdmaHandle& rdmaHandle, u32 notifyType);
298 : HcclResult HrtGetRdmaLiteStatus(RdmaHandle rdmaHandle, int* supportLite);
299 : HcclResult hrtRaSocketInit(int mode, struct rdev rdevInfo, SocketHandle& socketHandle);
300 : HcclResult hrtRaSocketInitRef(int mode, const struct rdev& rdevInfo, SocketHandle& socketHandle);
301 : HcclResult hrtRaSocketInitV1(int mode, struct SocketInitInfoT socket_init, SocketHandle& socketHandle);
302 : HcclResult hrtRaSocketDeInit(SocketHandle& socketHandle);
303 : HcclResult hrtRaSocketDeInitRef(SocketHandle& socketHandle);
304 :
305 : HcclResult hrtRaSocketNonBlockListenStart(struct SocketListenInfoT conn[], u32 num);
306 : HcclResult hrtRaSocketListenStart(struct SocketListenInfoT conn[], u32 num);
307 : HcclResult hrtRaSocketAcceptCreditAdd(struct SocketListenInfoT conn[], u32 num, u32 creditLimit);
308 : HcclResult hrtRaSocketListenStop(struct SocketListenInfoT conn[], u32 num);
309 : HcclResult hrtRaSocketNonBlockBatchConnect(struct SocketConnectInfoT conn[], u32 num);
310 : HcclResult hrtRaSocketBatchConnect(
311 0 : struct SocketConnectInfoT conn[], u32 num, u32 maxLen = MAX_VALUE_U32, std::function<bool()> needStop = []() {
312 0 : return false;
313 : });
314 : HcclResult hrtRaSocketBatchClose(struct SocketCloseInfoT conn[], u32 num, u32 maxLen = MAX_VALUE_U32);
315 : s32 hrtRaGetSockets(u32 role, struct SocketInfoT conn[], u32 num, u32* connectedNum);
316 : HcclResult hrtRaNonBlockGetSockets(u32 role, struct SocketInfoT conn[], u32 num, u32* connectedNum);
317 : HcclResult hrtRaBlockGetSockets(u32 role, struct SocketInfoT conn[], u32 num);
318 : HcclResult hrtRaSocketNonBlockSendHeterog(const FdHandle fdHandle, const void* data, u64 size, u64* sentSize);
319 : s32 hrtRaSocketNonBlockSend(const FdHandle fdHandle, const void* data, u64 size, u64* sentSize);
320 : HcclResult hrtRaSocketNonBlockSendHeart(const FdHandle fdHandle, const void* data, u64 size, u64* sentSize);
321 : HcclResult hrtRaSocketBlockSend(
322 0 : const FdHandle fdHandle, const void* data, u64 sendSize, std::function<bool()> needStop = []() {
323 0 : return false;
324 : });
325 : HcclResult hrtRaSocketNonBlockRecvHeterog(const FdHandle fdHandle, void* data, u64 size, u64* recvSize);
326 : s32 hrtRaSocketNonBlockRecv(const FdHandle fdHandle, void* data, u64 size, u64* recvSize);
327 : HcclResult hrtRaSocketNonBlockRecvHeart(const FdHandle fdHandle, void* data, u64 size, u64* recvSize);
328 : HcclResult hrtRaSocketBlockRecv(
329 : const FdHandle fdHandle, void* data, u64 size,
330 : std::function<bool()> needStop =
331 0 : []() {
332 0 : return false;
333 : },
334 : u32 timeout = 0);
335 :
336 : s32 hrtRaSocketRecv(const FdHandle fdHandle, void* data, u64 size, u64* recvSize);
337 :
338 : HcclResult IsSupportHdcAsync(bool& isSupportHdcAsync);
339 : s32 hrtRaSocketSendAsync(const FdHandle fdHandle, const void* data, u64 size, u64* sentSize, void** reqHandle);
340 : s32 hrtRaSocketRecvAsync(const FdHandle fdHandle, void* data, u64 size, u64* receivedSize, void** reqHandle);
341 : s32 hrtRaSocketGetAsyncReqResult(void* reqHandle, s32* reqResult);
342 :
343 : HcclResult hrtEpollCtlAdd(const FdHandle fdHandle, RaEpollEvent event);
344 : HcclResult hrtEpollCtlMod(const FdHandle fdHandle, RaEpollEvent event);
345 : HcclResult hrtEpollCtlDel(const FdHandle fdHandle);
346 : HcclResult hrtSetRecvDataCallback(const SocketHandle socketHandle, const void* callback);
347 :
348 : HcclResult hrtGetServerId(std::string& serverId);
349 : HcclResult hrtGetIfNum(struct RaGetIfattr& config, u32& num);
350 : HcclResult hrtGetIfAddress(struct RaGetIfattr& config, struct InterfaceInfo ifaddrInfos[], u32& num);
351 : HcclResult hrtRaGetInterfaceVersion(unsigned int phyId, unsigned int interfaceOpcode, unsigned int* interfaceVersion);
352 : HcclResult hrtRaSocketSetWhiteListStatus(u32 enable);
353 : HcclResult hrtRaSocketGetWhiteListStatus(u32& enable);
354 : HcclResult hrtRaSocketWhiteListAdd(SocketHandle socketHandle, struct SocketWlistInfoT whiteList[], u32 num);
355 : HcclResult hrtRaSocketWhiteListDel(SocketHandle socketHandle, struct SocketWlistInfoT whiteList[], u32 num);
356 : HcclResult hrtRaRegGlobalMr(const RdmaHandle rdmaHandle, struct MrInfoT& mrInfo, MrHandle& mrHandle);
357 : HcclResult hrtRaDeRegGlobalMr(const RdmaHandle rdmaHandle, MrHandle mrHandle);
358 : HcclResult
359 : hrtRaNormalQpCreate(RdmaHandle handle, struct ibv_qp_init_attr* initAttr, QpHandle& qpHandle, struct ibv_qp*& qp);
360 : HcclResult hrtRaNormalQpDestroy(QpHandle qpHandle);
361 : HcclResult hrtRaCreateCq(RdmaHandle handle, struct CqAttr* attr);
362 : HcclResult hrtRaDestroyCq(RdmaHandle handle, struct CqAttr* attr);
363 : HcclResult CreateNormalQp(RdmaHandle rdmaHandle, QpInfo& qp);
364 : HcclResult CreateQp(RdmaHandle rdmaHandle, int& flag, s32& qpMode, QpInfo& qp, bool isESMode = false);
365 : HcclResult CreateCqAndQp(RdmaHandle& rdmaHandle, std::string& label, QpConfig& config, QpInfo& info);
366 : HcclResult CreateQpWithSharedCq(
367 : RdmaHandle rdmaHandle, hccl::HcclIpAddress& selfIp, hccl::HcclIpAddress& peerIp, s32 sqEvent, s32 rqEvent,
368 : QpInfo& info, s32 qpAppend = 0, u32 maxSegNum = MAX_SEND_SGE_NUM);
369 : HcclResult DestroyQpWithSharedCq(const QpInfo& info, s32 qpAppend);
370 : HcclResult CreateQpWithCq(
371 : RdmaHandle rdmaHandle, s32 sqEvent, s32 rqEvent, RdmaHandle sendChannel, RdmaHandle recvChannel, QpInfo& info,
372 : bool isHdcMode = false, bool isESMode = false);
373 : HcclResult DestroyQpWithCq(const QpInfo& info, bool isHdcMode = false);
374 : HcclResult CreateAiQp(RdmaHandle rdmaHandle, struct AiQpInfo& aiQpInfo, QpInfo& info, u32 devicePhyId);
375 : HcclResult DestroyAiQp(const QpInfo& info);
376 : HcclResult hrtRaSetQpAttrQos(QpHandle qpHandle, struct QosAttr& attr);
377 : HcclResult hrtRaSetQpAttrTimeOut(QpHandle qpHandle, u32& timeOut);
378 : HcclResult hrtRaSetQpAttrRetryCnt(QpHandle qpHandle, u32& retryCnt);
379 : HcclResult SetQpAttrQos(
380 : QpHandle qpHandle, u32 tc = HCCL_COMM_TRAFFIC_CLASS_CONFIG_NOT_SET,
381 : u32 sl = HCCL_COMM_SERVICE_LEVEL_CONFIG_NOT_SET);
382 : HcclResult SetQpAttrTimeOut(QpHandle qpHandle, u32 timeout = INVALID_UINT);
383 : HcclResult SetQpAttrRetryCnt(QpHandle qpHandle, u32 retryCnt = INVALID_UINT);
384 : HcclResult hrtRaCreateCompChannel(RdmaHandle rdmaHandle, void** compChannel);
385 : HcclResult hrtRaDestroyCompChannel(RdmaHandle rdmaHandle, void* compChannel);
386 : HcclResult hrtRaGetCqeErrInfo(unsigned int phyId, struct CqeErrInfo* info);
387 : HcclResult hrtRaGetCqeErrInfoList(RdmaHandle rdmaHandle, struct CqeErrInfo* infolist, u32* num);
388 : HcclResult IsSuppCqeErrInfoListConfig(bool& supCqeErrInfoListConfig);
389 : HcclResult IsSupportRaSendNormalWrlist(bool& isSupportRaSendNormalWrlist);
390 : HcclResult hrtRaGetQpAttr(QpHandle qpHandle, struct QpAttr* attr);
391 : HcclResult hrtRaCreateSrq(RdmaHandle rdmaHandle, SrqInfo& srqInfo);
392 : HcclResult hrtRaDestroySrq(RdmaHandle rdmaHandle, SrqInfo& srqInfo);
393 : HcclResult hrtRaRecvWrlist(QpHandle handle, struct RecvWrlistData* wr, unsigned int recvNum, unsigned int* completeNum);
394 :
395 : HcclResult hrtRaQpCreateWithAttrs(RdmaHandle rdmaHandle, struct QpExtAttrs* attrs, QpHandle& qpHandle);
396 : HcclResult hrtRaQpCreateWithCQWithAttrs(
397 : RdmaHandle rdmaHandle, struct QpExtAttrs* attrs, unsigned int sendCqn, unsigned int recvCqn, QpHandle& qpHandle);
398 : HcclResult
399 : hrtRaAiQpCreate(u32 phyId, RdmaHandle rdmaHandle, struct QpExtAttrs* attrs, struct AiQpInfo* info, QpHandle& qpHandle);
400 :
401 : HcclResult IsSuppportRaGetSocketVnicIps(bool& supportGetSocketVnicIp);
402 : HcclResult hrtRaGetSocketVnicIpInfos(
403 : u32 phyId, enum IdType type, std::vector<u32> deviceIds, std::vector<hccl::HcclIpAddress>& vnicIps);
404 :
405 : HcclResult hrtRaPingInit(struct PingInitAttr* initAttr, struct PingInitInfo* initInfo, void** pingHandle);
406 : HcclResult hrtRaPingDeinit(void* pingHandle);
407 : HcclResult hrtRaPingTargetAdd(void* pingHandle, struct PingTargetInfo target[], uint32_t num);
408 : HcclResult hrtRaPingTargetDel(void* pingHandle, struct PingTargetCommInfo target[], uint32_t num);
409 : HcclResult hrtRaPingTaskStart(void* pingHandle, struct PingTaskAttr* attr);
410 : HcclResult hrtRaPingTaskStop(void* pingHandle);
411 : HcclResult hrtRaPingGetResults(void* pingHandle, struct PingTargetResult target[], uint32_t* num);
412 :
413 : HcclResult hrtRaIsFirstUsed(s32 insId, bool& used);
414 : HcclResult hrtRaIsLastUsed(s32 insId, bool& used);
415 : HcclResult hrtRaQpBatchModify(RdmaHandle rdmaHandle, QpHandle qpHandle[], unsigned int num, int expectStatus);
416 : HcclResult
417 : hrtRaTypicalQpCreate(RdmaHandle rdmaHandle, int flag, int qpMode, struct TypicalQp* qpInfo, QpHandle& qpHandle);
418 : HcclResult hrtRaTypicalQpModify(QpHandle qpHandle, struct TypicalQp* localQpInfo, struct TypicalQp* remoteQpInfo);
419 : HcclResult hrtRaTypicalSendWr(QpHandle handle, struct SendWr* wr, struct SendWrRsp* opRsp);
420 : HcclResult hrtRaRdevGetPortStatus(RdmaHandle rdmaHandle, enum PortStatus* status);
421 : HcclResult HrtRaRemapMr(RdmaHandle rdmaHandle, struct MemRemapInfo info[], unsigned int num);
422 : HcclResult HrtRaGetTlsEnable(struct RaInfo* info, bool* tlsEnable);
423 : // 目前该接口只支持peer模式,且只适用于终止未建链成功的链路,即未get_socket成功的链路
424 : HcclResult hrtRaSocketNonBlockBatchAbort(SocketConnectInfoT conn[], u32 num);
425 :
426 : HcclResult CreateQpWithDepthConfig(
427 : RdmaHandle rdmaHandle, s32 qpMode, const QpConfigInfo& qpConfig, QpHandle& qpHandle, struct TypicalQp& qpInfo);
428 : HcclResult CreateQpWithCQConfig(
429 : RdmaHandle rdmaHandle, s32 qpMode, const QpConfigWithCQInfo& qpConfig, QpHandle& qpHandle,
430 : struct TypicalQp& qpInfo);
431 : HcclResult CreateTypicalCq(RdmaHandle rdmaHandle, u32 cqDepth, u32& cqn, void** cqHandle);
432 : HcclResult DestroyTypicalCq(RdmaHandle rdmaHandle, u32 cqn, void* cqHandle);
433 : HcclResult IsSupportRaSocketAbort(bool& isSupportRaSocketAbort);
434 : HcclResult hrtRaGetSecRandom(struct RaInfo* info, unsigned int* token);
435 : HcclResult hrtRaGetDevEidInfoNum(RaInfo info, unsigned int* num);
436 : HcclResult hrtRaGetDevEidInfoList(RaInfo info, struct HccpDevEidInfo* eid_info, unsigned int* num);
437 : #endif
|