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 : #include <stdlib.h>
12 : #include <errno.h>
13 : #include "hccp_nda.h"
14 : #include "ra_peer_nda.h"
15 : #include "ra_rs_comm.h"
16 :
17 2 : HCCP_ATTRI_VISI_DEF int RaNdaGetDirectFlag(void *rdmaHandle, int *directFlag)
18 : {
19 2 : struct RaRdmaHandle *rdevHandleTmp = (struct RaRdmaHandle *)rdmaHandle;
20 2 : int ret = 0;
21 :
22 2 : CHK_PRT_RETURN(rdmaHandle == NULL || directFlag == NULL,
23 : hccp_err("[get][directFlag]rdmaHandle or directFlag is NULL, invalid"), ConverReturnCode(RDMA_OP, -EINVAL));
24 :
25 1 : ret = RaPeerNdaGetDirectFlag(rdevHandleTmp, directFlag);
26 1 : return ConverReturnCode(RDMA_OP, ret);
27 : }
28 :
29 0 : HCCP_ATTRI_VISI_DEF int RaNdaCqCreate(void *rdmaHandle, struct NdaCqInitAttr *attr, struct NdaCqInfo *info,
30 : void **cqHandle)
31 : {
32 0 : struct RaRdmaHandle *rdevHandleTmp = (struct RaRdmaHandle *)rdmaHandle;
33 0 : int ret = 0;
34 :
35 0 : CHK_PRT_RETURN(rdmaHandle == NULL || attr == NULL || info == NULL || cqHandle == NULL,
36 : hccp_err("[create][RaNdaCq]rdmaHandle or attr or info or cqHandle is NULL"),
37 : ConverReturnCode(RDMA_OP, -EINVAL));
38 :
39 0 : ret = RaPeerNdaCqCreate(rdevHandleTmp, attr, info, cqHandle);
40 0 : return ConverReturnCode(RDMA_OP, ret);
41 : }
42 :
43 0 : HCCP_ATTRI_VISI_DEF int RaNdaCqDestroy(void *rdmaHandle, void *cqHandle)
44 : {
45 0 : struct RaRdmaHandle *rdevHandleTmp = (struct RaRdmaHandle *)rdmaHandle;
46 0 : int ret = 0;
47 :
48 0 : CHK_PRT_RETURN(rdmaHandle == NULL || cqHandle == NULL, hccp_err("[destroy][RaNdaCq]rdmaHandle or cqHandle is NULL"),
49 : ConverReturnCode(RDMA_OP, -EINVAL));
50 :
51 0 : ret = RaPeerNdaCqDestroy(rdevHandleTmp, cqHandle);
52 0 : return ConverReturnCode(RDMA_OP, ret);
53 : }
54 :
55 2 : HCCP_ATTRI_VISI_DEF int RaNdaQpCreate(void *rdmaHandle, struct NdaQpInitAttr *attr, struct NdaQpInfo *info,
56 : void **qpHandle)
57 : {
58 2 : struct RaRdmaHandle *rdevHandleTmp = (struct RaRdmaHandle *)rdmaHandle;
59 2 : int ret = 0;
60 :
61 2 : CHK_PRT_RETURN(rdmaHandle == NULL || attr == NULL || info == NULL || qpHandle == NULL,
62 : hccp_err("[create][RaNdaQp]rdmaHandle or attr or info or qpHandle is NULL"),
63 : ConverReturnCode(RDMA_OP, -EINVAL));
64 :
65 1 : ret = RaPeerNdaQpCreate(rdevHandleTmp, attr, info, qpHandle);
66 1 : return ConverReturnCode(RDMA_OP, ret);
67 : }
|