已合并
[fix]hccp include driver/ibv_extend.h #3663
xiongzhe创建于 7月11日
[fix]hccp include driver/ibv_extend.h #3663
已合并
从已删除 :master合入到cann/hcommmaster
共 14 个文件变更+301-269
| @@ -113,6 +113,7 @@ elseif(BUILD_OPEN_PROJECT) | |||
| 113 | # 三方件 | 113 | # 三方件 |
| 114 | include(cmake/hcomm_utils.cmake) | 114 | include(cmake/hcomm_utils.cmake) |
| 115 | include(cmake/third_party/ubengine.cmake) | 115 | include(cmake/third_party/ubengine.cmake) |
| 116 | + include(cmake/third_party/ibv_extend.cmake) | ||
| 116 | add_cann_third_party(json) | 117 | add_cann_third_party(json) |
| 117 | add_cann_third_party(openssl) | 118 | add_cann_third_party(openssl) |
| 118 | add_cann_third_party(rdma-core) | 119 | add_cann_third_party(rdma-core) |
| @@ -45,6 +45,7 @@ find_cann_package(unified_dlog MODULE REQUIRED) | |||
| 45 | # third_party | 45 | # third_party |
| 46 | include(${HCOMM_DIR}/cmake/hcomm_utils.cmake) | 46 | include(${HCOMM_DIR}/cmake/hcomm_utils.cmake) |
| 47 | include(${HCOMM_DIR}/cmake/third_party/ubengine.cmake) | 47 | include(${HCOMM_DIR}/cmake/third_party/ubengine.cmake) |
| 48 | +include(${HCOMM_DIR}/cmake/third_party/ibv_extend.cmake) | ||
| 48 | add_cann_third_party(json) | 49 | add_cann_third_party(json) |
| 49 | add_cann_third_party(openssl) | 50 | add_cann_third_party(openssl) |
| 50 | add_cann_third_party(rdma-core) | 51 | add_cann_third_party(rdma-core) |
| @@ -0,0 +1,28 @@ | |||
| 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 | +message(STATUS "Build third party library ibv_extend") | ||
| 12 | + | ||
| 13 | +set(IBV_EXTEND_DRIVER_DIR "${HCOMM_DIR}/../driver/driver/src/custom/nda/ibv_extend") | ||
Z | |||
| 14 | +set(IBV_EXTEND_FALLBACK_DIR "${HCOMM_DIR}/src/base_comm/resources/hccp/external_depends/ibv_extend") | ||
| 15 | + | ||
| 16 | +if(IS_DIRECTORY "${IBV_EXTEND_DRIVER_DIR}") | ||
| 17 | + set(IBV_EXTEND_INCLUDE_DIR "${CMAKE_BINARY_DIR}/ibv_extend") | ||
| 18 | + file(GLOB IBV_EXTEND_DRIVER_CONTENTS "${IBV_EXTEND_DRIVER_DIR}/*") | ||
| 19 | + if(NOT IBV_EXTEND_DRIVER_CONTENTS) | ||
| 20 | + message(FATAL_ERROR "${IBV_EXTEND_DRIVER_DIR} have no ibv_extend headers") | ||
| 21 | + endif() | ||
| 22 | + file(COPY "${IBV_EXTEND_DRIVER_DIR}/" DESTINATION "${IBV_EXTEND_INCLUDE_DIR}") | ||
| 23 | + message(STATUS "Successfully copied ${IBV_EXTEND_DRIVER_DIR} to ${IBV_EXTEND_INCLUDE_DIR}.") | ||
| 24 | + message(STATUS "built ibv_extend headers.") | ||
| 25 | +else() | ||
| 26 | + set(IBV_EXTEND_INCLUDE_DIR "${IBV_EXTEND_FALLBACK_DIR}") | ||
| 27 | + message(STATUS "IBV_EXTEND_INCLUDE_DIR IS ${IBV_EXTEND_INCLUDE_DIR}") | ||
| 28 | +endif() | ||
Rsrc/base_comm/resources/hccp/external_depends/nda/ibv_extend.h→src/base_comm/resources/hccp/external_depends/ibv_extend/ibv_extend.h+0-0
文件重命名但无更改。
| @@ -34,7 +34,7 @@ target_include_directories(ra_peer PRIVATE | |||
| 34 | 34 | ||
| 35 | # rdma头文件 | 35 | # rdma头文件 |
| 36 | ${CMAKE_CURRENT_SOURCE_DIR}/../../external_depends/host_lite | 36 | ${CMAKE_CURRENT_SOURCE_DIR}/../../external_depends/host_lite |
| 37 | - ${CMAKE_CURRENT_SOURCE_DIR}/../../external_depends/nda | 37 | + ${IBV_EXTEND_INCLUDE_DIR} |
🟡 Medium Priority 本次变更将
测试桩文件 失败模式:启用 建议:将三个测试 CMakeLists.txt 中的 ![]() ![]() | |||
| 38 | 38 | ||
| 39 | # HCCP Legacy | 39 | # HCCP Legacy |
| 40 | ${CMAKE_CURRENT_SOURCE_DIR}/../../rdma_agent/comm/ctx | 40 | ${CMAKE_CURRENT_SOURCE_DIR}/../../rdma_agent/comm/ctx |
| @@ -45,6 +45,7 @@ if(NOT BUILD_OPEN_PROJECT) | |||
| 45 | target_include_directories(ra_peer PRIVATE | 45 | target_include_directories(ra_peer PRIVATE |
| 46 | ${TOP_DIR}/runtime/pkg_inc/base | 46 | ${TOP_DIR}/runtime/pkg_inc/base |
| 47 | ${TOP_DIR}/driver/driver/pkg_inc/ | 47 | ${TOP_DIR}/driver/driver/pkg_inc/ |
| 48 | + ${TOP_DIR}/driver/driver/src/custom/nda/ibv_extend/ | ||
| 48 | ) | 49 | ) |
| 49 | endif() | 50 | endif() |
| 50 | 51 | ||
| @@ -24,7 +24,7 @@ set(RS_SOURCE_LIST | |||
| 24 | rs_drv_rdma.c | 24 | rs_drv_rdma.c |
| 25 | rs_drv_socket.c | 25 | rs_drv_socket.c |
| 26 | dl_ibverbs_function.c | 26 | dl_ibverbs_function.c |
| 27 | - dl_nda_function.c | 27 | + dl_ibv_extend_function.c |
| 28 | hccp_dl.c | 28 | hccp_dl.c |
| 29 | ctx/dl_net_function.c | 29 | ctx/dl_net_function.c |
| 30 | ctx/dl_ccu_function.c | 30 | ctx/dl_ccu_function.c |
| @@ -108,12 +108,12 @@ target_include_directories(rs PRIVATE | |||
| 108 | # rdma头文件 | 108 | # rdma头文件 |
| 109 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/host_lite | 109 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/host_lite |
| 110 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/rdma-core/providers/hns | 110 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/rdma-core/providers/hns |
| 111 | - ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/nda | ||
| 112 | # HCCP Legacy | 111 | # HCCP Legacy |
| 113 | ${CMAKE_CURRENT_SOURCE_DIR}/ctx | 112 | ${CMAKE_CURRENT_SOURCE_DIR}/ctx |
| 114 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/ccu | 113 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/ccu |
| 115 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/net_adapt | 114 | ${CMAKE_CURRENT_SOURCE_DIR}/../external_depends/net_adapt |
| 116 | ${URMA_INCLUDE_DIR} | 115 | ${URMA_INCLUDE_DIR} |
| 116 | + ${IBV_EXTEND_INCLUDE_DIR} | ||
| 117 | ) | 117 | ) |
| 118 | 118 | ||
| 119 | if(NOT BUILD_OPEN_PROJECT) | 119 | if(NOT BUILD_OPEN_PROJECT) |
| @@ -124,6 +124,7 @@ if(NOT BUILD_OPEN_PROJECT) | |||
| 124 | ${TOP_DIR}/drivers/network/tls_adp | 124 | ${TOP_DIR}/drivers/network/tls_adp |
| 125 | ${TOP_DIR}/runtime/pkg_inc/base | 125 | ${TOP_DIR}/runtime/pkg_inc/base |
| 126 | ${TOP_DIR}/driver/driver/pkg_inc/ | 126 | ${TOP_DIR}/driver/driver/pkg_inc/ |
| 127 | + ${TOP_DIR}/driver/driver/src/custom/nda/ibv_extend/ | ||
| 127 | ) | 128 | ) |
| 128 | endif() | 129 | endif() |
| 129 | 130 | ||
| @@ -0,0 +1,221 @@ | |||
| 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 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +void *gRoceIbvExtendApiHandle = NULL; | ||
| 16 | + | ||
| 17 | +STATIC struct RsIbvExtendOps gIbvExtendOps = {0}; | ||
| 18 | + | ||
| 19 | +struct RsIbvExtendOps gIbvExtendOps = { | ||
| 20 | + .rsIbvExtendGetVersion = ibv_extend_get_version, | ||
| 21 | + .rsIbvExtendCheckVersion = ibv_extend_check_version, | ||
| 22 | + .rsIbvOpenExtend = ibv_open_extend, | ||
| 23 | + .rsIbvCloseExtend = ibv_close_extend, | ||
| 24 | + .rsIbvQueryDeviceExtend = ibv_query_device_extend, | ||
| 25 | + .rsIbvCreateQpExtend = ibv_create_qp_extend, | ||
| 26 | + .rsIbvCreateCqExtend = ibv_create_cq_extend, | ||
| 27 | + .rsIbvDestroyQpExtend = ibv_destroy_qp_extend, | ||
| 28 | + .rsIbvDestroyCqExtend = ibv_destroy_cq_extend, | ||
| 29 | +}; | ||
| 30 | + | ||
| 31 | + | ||
| 32 | +STATIC int RsIbvExtendIbvApiInit(void) | ||
| 33 | +{ | ||
| 34 | + | ||
| 35 | + gIbvExtendOps.rsIbvExtendGetVersion = (const char* (*)(uint32_t *, uint32_t *, uint32_t *)) | ||
| 36 | + HccpDlsym(gRoceIbvExtendApiHandle, "ibv_extend_get_version"); | ||
| 37 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvExtendGetVersion, "ibv_extend_get_version"); | ||
| 38 | + gIbvExtendOps.rsIbvExtendCheckVersion = (int (*)(uint32_t, uint32_t, uint32_t)) | ||
| 39 | + HccpDlsym(gRoceIbvExtendApiHandle, "ibv_extend_check_version"); | ||
| 40 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvExtendCheckVersion, "ibv_extend_check_version"); | ||
| 41 | + gIbvExtendOps.rsIbvOpenExtend = (struct ibv_context_extend* (*)(struct ibv_context *)) | ||
| 42 | + HccpDlsym(gRoceIbvExtendApiHandle, "ibv_open_extend"); | ||
| 43 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvOpenExtend, "ibv_open_extend"); | ||
| 44 | + gIbvExtendOps.rsIbvCloseExtend = (int (*)(struct ibv_context_extend *)) | ||
| 45 | + HccpDlsym(gRoceIbvExtendApiHandle, "ibv_close_extend"); | ||
| 46 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvCloseExtend, "ibv_close_extend"); | ||
| 47 | + gIbvExtendOps.rsIbvQueryDeviceExtend = (int (*)(struct ibv_context_extend *, struct ibv_device_attr_extend *)) | ||
| 48 | + HccpDlsym(gRoceIbvExtendApiHandle, "ibv_query_device_extend"); | ||
| 49 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvQueryDeviceExtend, "ibv_query_device_extend"); | ||
| 50 | + gIbvExtendOps.rsIbvCreateQpExtend = (struct ibv_qp_extend* (*)(struct ibv_context_extend *, | ||
| 51 | + struct ibv_qp_init_attr_extend *)) HccpDlsym(gRoceIbvExtendApiHandle, "ibv_create_qp_extend"); | ||
| 52 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvCreateQpExtend, "ibv_create_qp_extend"); | ||
| 53 | + gIbvExtendOps.rsIbvCreateCqExtend = (struct ibv_cq_extend* (*)(struct ibv_context_extend *, | ||
| 54 | + struct ibv_cq_init_attr_extend *)) HccpDlsym(gRoceIbvExtendApiHandle, "ibv_create_cq_extend"); | ||
| 55 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvCreateCqExtend, "ibv_create_cq_extend"); | ||
| 56 | + gIbvExtendOps.rsIbvDestroyQpExtend = (int (*)(struct ibv_context_extend *, | ||
| 57 | + struct ibv_qp_extend *)) HccpDlsym(gRoceIbvExtendApiHandle, "ibv_destroy_qp_extend"); | ||
| 58 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvDestroyQpExtend, "ibv_destroy_qp_extend"); | ||
| 59 | + gIbvExtendOps.rsIbvDestroyCqExtend = (int (*)(struct ibv_context_extend *, | ||
| 60 | + struct ibv_cq_extend *)) HccpDlsym(gRoceIbvExtendApiHandle, "ibv_destroy_cq_extend"); | ||
| 61 | + DL_API_RET_IS_NULL_CHECK(gIbvExtendOps.rsIbvDestroyCqExtend, "ibv_destroy_cq_extend"); | ||
| 62 | + | ||
| 63 | + return 0; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +STATIC int RsOpenIbvExtendSo(void) | ||
| 67 | +{ | ||
| 68 | + | ||
| 69 | + if (gRoceIbvExtendApiHandle == NULL) { | ||
| 70 | + gRoceIbvExtendApiHandle = HccpDlopen("libibv_extend.so", RTLD_NOW | RTLD_GLOBAL); | ||
| 71 | + if (gRoceIbvExtendApiHandle != NULL) { | ||
| 72 | + return 0; | ||
| 73 | + } | ||
| 74 | + return -EINVAL; | ||
| 75 | + } else { | ||
| 76 | + hccp_run_info("IbvExtendApi dlopen again!"); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + return 0; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +STATIC void RsCloseIbvExtendSo(void) | ||
| 83 | +{ | ||
| 84 | + | ||
| 85 | + if (gRoceIbvExtendApiHandle != NULL) { | ||
| 86 | + (void)HccpDlclose(gRoceIbvExtendApiHandle); | ||
| 87 | + gRoceIbvExtendApiHandle = NULL; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + return; | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +int RsIbvExtendApiInit(void) | ||
| 94 | +{ | ||
| 95 | + | ||
| 96 | + int ret = 0; | ||
| 97 | + | ||
| 98 | + ret = RsOpenIbvExtendSo(); | ||
| 99 | + if (ret != 0) { | ||
| 100 | + hccp_warn("HccpDlopen[libibv_extend.so] doesn't exist!"); | ||
| 101 | + return 0; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + ret = RsIbvExtendIbvApiInit(); | ||
| 105 | + if (ret != 0) { | ||
| 106 | + hccp_err("RsIbvExtendIbvApiInit failed! ret:%d", ret); | ||
| 107 | + RsCloseIbvExtendSo(); | ||
| 108 | + return ret; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + return 0; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +void RsIbvExtendApiDeinit(void) | ||
| 115 | +{ | ||
| 116 | + RsCloseIbvExtendSo(); | ||
| 117 | + return; | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +const char *RsIbvExtendGetVersion(uint32_t *major, uint32_t *minor, uint32_t *patch) | ||
| 121 | +{ | ||
| 122 | + if (gIbvExtendOps.rsIbvExtendGetVersion == NULL) { | ||
| 123 | + | ||
| 124 | + return NULL; | ||
| 125 | + | ||
| 126 | + } | ||
| 127 | + return gIbvExtendOps.rsIbvExtendGetVersion(major, minor, patch); | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +int RsIbvExtendCheckVersion(uint32_t driverMajor, uint32_t driverMinor, uint32_t driverPatch) | ||
| 131 | +{ | ||
| 132 | + if (gIbvExtendOps.rsIbvExtendCheckVersion == NULL) { | ||
| 133 | + | ||
| 134 | + return -EINVAL; | ||
| 135 | + | ||
| 136 | + } | ||
| 137 | + return gIbvExtendOps.rsIbvExtendCheckVersion(driverMajor, driverMinor, driverPatch); | ||
| 138 | +} | ||
| 139 | + | ||
| 140 | +struct ibv_context_extend *RsIbvOpenExtend(struct ibv_context *context) | ||
| 141 | +{ | ||
| 142 | + if (gIbvExtendOps.rsIbvOpenExtend == NULL) { | ||
| 143 | + | ||
| 144 | + return NULL; | ||
| 145 | + | ||
| 146 | + } | ||
| 147 | + return gIbvExtendOps.rsIbvOpenExtend(context); | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +int RsIbvCloseExtend(struct ibv_context_extend *context) | ||
| 151 | +{ | ||
| 152 | + if (context == NULL) { | ||
| 153 | + return 0; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + if (gIbvExtendOps.rsIbvCloseExtend == NULL) { | ||
| 157 | + | ||
| 158 | + return 0; | ||
| 159 | + | ||
| 160 | + } | ||
| 161 | + return gIbvExtendOps.rsIbvCloseExtend(context); | ||
| 162 | +} | ||
| 163 | + | ||
| 164 | +int RsIbvQueryDeviceExtend(struct ibv_context_extend *context, struct ibv_device_attr_extend *extDevAttr) | ||
| 165 | +{ | ||
| 166 | + if (gIbvExtendOps.rsIbvQueryDeviceExtend == NULL) { | ||
| 167 | + | ||
| 168 | + hccp_err("rsIbvQueryDeviceExtend is null"); | ||
| 169 | + return -EINVAL; | ||
| 170 | + | ||
| 171 | + } | ||
| 172 | + return gIbvExtendOps.rsIbvQueryDeviceExtend(context, extDevAttr); | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +struct ibv_cq_extend *RsIbvCreateCqExtend(struct ibv_context_extend *context, | ||
| 176 | + struct ibv_cq_init_attr_extend *cqInitAttr) | ||
| 177 | +{ | ||
| 178 | + if (gIbvExtendOps.rsIbvCreateCqExtend == NULL) { | ||
| 179 | + | ||
| 180 | + hccp_err("rsIbvCreateCqExtend is null"); | ||
| 181 | + return NULL; | ||
| 182 | + | ||
| 183 | + } | ||
| 184 | + return gIbvExtendOps.rsIbvCreateCqExtend(context, cqInitAttr); | ||
| 185 | +} | ||
| 186 | + | ||
| 187 | +int RsIbvDestroyCqExtend(struct ibv_context_extend *context, void *ibvCqExt) | ||
| 188 | +{ | ||
| 189 | + struct ibv_cq_extend *cqExtend = (struct ibv_cq_extend *)ibvCqExt; | ||
| 190 | + | ||
| 191 | + if (gIbvExtendOps.rsIbvDestroyCqExtend == NULL) { | ||
| 192 | + | ||
| 193 | + hccp_err("rsIbvDestroyCqExtend is null"); | ||
| 194 | + return -EINVAL; | ||
| 195 | + | ||
| 196 | + } | ||
| 197 | + return gIbvExtendOps.rsIbvDestroyCqExtend(context, cqExtend); | ||
| 198 | +} | ||
| 199 | + | ||
| 200 | +struct ibv_qp_extend *RsIbvCreateQpExtend(struct ibv_context_extend *context, | ||
| 201 | + struct ibv_qp_init_attr_extend *qpInitAttr) | ||
| 202 | +{ | ||
| 203 | + if (gIbvExtendOps.rsIbvCreateQpExtend == NULL) { | ||
| 204 | + | ||
| 205 | + hccp_err("rsIbvCreateQpExtend is null"); | ||
| 206 | + return NULL; | ||
| 207 | + | ||
| 208 | + } | ||
| 209 | + return gIbvExtendOps.rsIbvCreateQpExtend(context, qpInitAttr); | ||
| 210 | +} | ||
| 211 | + | ||
| 212 | +int RsIbvDestroyQpExtend(struct ibv_context_extend *context, struct ibv_qp_extend *qpExtend) | ||
| 213 | +{ | ||
| 214 | + if (gIbvExtendOps.rsIbvDestroyQpExtend == NULL) { | ||
| 215 | + | ||
| 216 | + hccp_err("rsIbvDestroyQpExtend is null"); | ||
| 217 | + return -EINVAL; | ||
| 218 | + | ||
| 219 | + } | ||
| 220 | + return gIbvExtendOps.rsIbvDestroyQpExtend(context, qpExtend); | ||
| 221 | +} | ||
Rsrc/base_comm/resources/hccp/rdma_service/dl_nda_function.h→src/base_comm/resources/hccp/rdma_service/dl_ibv_extend_function.h+24-24
| @@ -8,8 +8,8 @@ | |||
| 8 | * See LICENSE in the root of the software repository for the full text of the License. | 8 | * See LICENSE in the root of the software repository for the full text of the License. |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | -#ifndef DL_NDA_FUNCTION_H | 11 | +#ifndef DL_IBV_EXTEND_FUNCTION_H |
| 12 | -#define DL_NDA_FUNCTION_H | 12 | +#define DL_IBV_EXTEND_FUNCTION_H |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | ||
| @@ -20,32 +20,32 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | -struct RsNdaOps { | 23 | +struct RsIbvExtendOps { |
| 24 | - const char *(*rsNdaIbvExtendGetVersion)(uint32_t *major, uint32_t *minor, uint32_t *patch); | 24 | + const char *(*rsIbvExtendGetVersion)(uint32_t *major, uint32_t *minor, uint32_t *patch); |
| 25 | - int (*rsNdaIbvExtendCheckVersion)(uint32_t driverMajor, uint32_t driverMinor, uint32_t driverPatch); | 25 | + int (*rsIbvExtendCheckVersion)(uint32_t driverMajor, uint32_t driverMinor, uint32_t driverPatch); |
| 26 | - struct ibv_context_extend *(*rsNdaIbvOpenExtend)(struct ibv_context *context); | 26 | + struct ibv_context_extend *(*rsIbvOpenExtend)(struct ibv_context *context); |
| 27 | - int (*rsNdaIbvCloseExtend)(struct ibv_context_extend *context); | 27 | + int (*rsIbvCloseExtend)(struct ibv_context_extend *context); |
| 28 | - int (*rsNdaIbvQueryDeviceExtend)(struct ibv_context_extend *context, struct ibv_device_attr_extend *extDevAttr); | 28 | + int (*rsIbvQueryDeviceExtend)(struct ibv_context_extend *context, struct ibv_device_attr_extend *extDevAttr); |
| 29 | - struct ibv_qp_extend *(*rsNdaIbvCreateQpExtend)(struct ibv_context_extend *context, | 29 | + struct ibv_qp_extend *(*rsIbvCreateQpExtend)(struct ibv_context_extend *context, |
| 30 | struct ibv_qp_init_attr_extend *qpInitAttr); | 30 | struct ibv_qp_init_attr_extend *qpInitAttr); |
| 31 | - struct ibv_cq_extend *(*rsNdaIbvCreateCqExtend)(struct ibv_context_extend *context, | 31 | + struct ibv_cq_extend *(*rsIbvCreateCqExtend)(struct ibv_context_extend *context, |
| 32 | struct ibv_cq_init_attr_extend *cqInitAttr); | 32 | struct ibv_cq_init_attr_extend *cqInitAttr); |
| 33 | - int (*rsNdaIbvDestroyQpExtend)(struct ibv_context_extend *context, struct ibv_qp_extend *qpExtend); | 33 | + int (*rsIbvDestroyQpExtend)(struct ibv_context_extend *context, struct ibv_qp_extend *qpExtend); |
| 34 | - int (*rsNdaIbvDestroyCqExtend)(struct ibv_context_extend *context, struct ibv_cq_extend *cqExtend); | 34 | + int (*rsIbvDestroyCqExtend)(struct ibv_context_extend *context, struct ibv_cq_extend *cqExtend); |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | -int RsNdaApiInit(void); | 37 | +int RsIbvExtendApiInit(void); |
| 38 | -void RsNdaApiDeinit(void); | 38 | +void RsIbvExtendApiDeinit(void); |
| 39 | -const char *RsNdaIbvExtendGetVersion(uint32_t *major, uint32_t *minor, uint32_t *patch); | 39 | +const char *RsIbvExtendGetVersion(uint32_t *major, uint32_t *minor, uint32_t *patch); |
| 40 | -int RsNdaIbvExtendCheckVersion(uint32_t driverMajor, uint32_t driverMinor, uint32_t driverPatch); | 40 | +int RsIbvExtendCheckVersion(uint32_t driverMajor, uint32_t driverMinor, uint32_t driverPatch); |
| 41 | -struct ibv_context_extend *RsNdaIbvOpenExtend(struct ibv_context *context); | 41 | +struct ibv_context_extend *RsIbvOpenExtend(struct ibv_context *context); |
| 42 | -int RsNdaIbvCloseExtend(struct ibv_context_extend *context); | 42 | +int RsIbvCloseExtend(struct ibv_context_extend *context); |
| 43 | -int RsNdaIbvQueryDeviceExtend(struct ibv_context_extend *context, struct ibv_device_attr_extend *extDevAttr); | 43 | +int RsIbvQueryDeviceExtend(struct ibv_context_extend *context, struct ibv_device_attr_extend *extDevAttr); |
| 44 | -struct ibv_cq_extend *RsNdaIbvCreateCqExtend(struct ibv_context_extend *context, | 44 | +struct ibv_cq_extend *RsIbvCreateCqExtend(struct ibv_context_extend *context, |
| 45 | struct ibv_cq_init_attr_extend *cqInitAttr); | 45 | struct ibv_cq_init_attr_extend *cqInitAttr); |
| 46 | -int RsNdaIbvDestroyCqExtend(struct ibv_context_extend *context, void *ibvCqExt); | 46 | +int RsIbvDestroyCqExtend(struct ibv_context_extend *context, void *ibvCqExt); |
| 47 | -struct ibv_qp_extend *RsNdaIbvCreateQpExtend(struct ibv_context_extend *context, | 47 | +struct ibv_qp_extend *RsIbvCreateQpExtend(struct ibv_context_extend *context, |
| 48 | struct ibv_qp_init_attr_extend *qpInitAttr); | 48 | struct ibv_qp_init_attr_extend *qpInitAttr); |
| 49 | -int RsNdaIbvDestroyQpExtend(struct ibv_context_extend *context, struct ibv_qp_extend *qpExtend); | 49 | +int RsIbvDestroyQpExtend(struct ibv_context_extend *context, struct ibv_qp_extend *qpExtend); |
| 50 | 50 | ||
| 51 | -#endif // DL_NDA_FUNCTION_H | 51 | +#endif // DL_IBV_EXTEND_FUNCTION_H |
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | -#include "dl_nda_function.h" | 13 | +#include "dl_ibv_extend_function.h" |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | static pthread_mutex_t gRoceUserApiLock = PTHREAD_MUTEX_INITIALIZER; | 16 | static pthread_mutex_t gRoceUserApiLock = PTHREAD_MUTEX_INITIALIZER; |
| @@ -549,7 +549,7 @@ DL_ATTRI_VISI_DEF int RsApiInit(void) | |||
| 549 | RsCloseIbverbsSo(); | 549 | RsCloseIbverbsSo(); |
| 550 | return ret; | 550 | return ret; |
| 551 | } | 551 | } |
| 552 | - ret = RsNdaApiInit(); | 552 | + ret = RsIbvExtendApiInit(); |
| 553 | if (ret != 0) { | 553 | if (ret != 0) { |
| 554 | hccp_err("RsHrnApiInit failed! ret=[%d]", ret); | 554 | hccp_err("RsHrnApiInit failed! ret=[%d]", ret); |
| 555 | RsCloseHrnSo(); | 555 | RsCloseHrnSo(); |
| @@ -562,7 +562,7 @@ DL_ATTRI_VISI_DEF int RsApiInit(void) | |||
| 562 | hccp_err("rs_roce_user_api_init failed! ret=[%d]", ret); | 562 | hccp_err("rs_roce_user_api_init failed! ret=[%d]", ret); |
| 563 | RsCloseHrnSo(); | 563 | RsCloseHrnSo(); |
| 564 | RsCloseIbverbsSo(); | 564 | RsCloseIbverbsSo(); |
| 565 | - RsNdaApiDeinit(); | 565 | + RsIbvExtendApiDeinit(); |
| 566 | return ret; | 566 | return ret; |
| 567 | } | 567 | } |
| 568 | 568 | ||
| @@ -574,7 +574,7 @@ DL_ATTRI_VISI_DEF void RsApiDeinit(void) | |||
| 574 | { | 574 | { |
| 575 | RsCloseIbverbsSo(); | 575 | RsCloseIbverbsSo(); |
| 576 | RsCloseHrnSo(); | 576 | RsCloseHrnSo(); |
| 577 | - RsNdaApiDeinit(); | 577 | + RsIbvExtendApiDeinit(); |
| 578 | RsCloseRoceUserSo(); | 578 | RsCloseRoceUserSo(); |
| 579 | return; | 579 | return; |
| 580 | } | 580 | } |
| @@ -1,221 +0,0 @@ | |||
| 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 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -void *gRoceNdaApiHandle = NULL; | ||
| 16 | - | ||
| 17 | -STATIC struct RsNdaOps gNdaOps = {0}; | ||
| 18 | - | ||
| 19 | -struct RsNdaOps gNdaOps = { | ||
| 20 | - .rsNdaIbvExtendGetVersion = ibv_extend_get_version, | ||
| 21 | - .rsNdaIbvExtendCheckVersion = ibv_extend_check_version, | ||
| 22 | - .rsNdaIbvOpenExtend = ibv_open_extend, | ||
| 23 | - .rsNdaIbvCloseExtend = ibv_close_extend, | ||
| 24 | - .rsNdaIbvQueryDeviceExtend = ibv_query_device_extend, | ||
| 25 | - .rsNdaIbvCreateQpExtend = ibv_create_qp_extend, | ||
| 26 | - .rsNdaIbvCreateCqExtend = ibv_create_cq_extend, | ||
| 27 | - .rsNdaIbvDestroyQpExtend = ibv_destroy_qp_extend, | ||
| 28 | - .rsNdaIbvDestroyCqExtend = ibv_destroy_cq_extend, | ||
| 29 | -}; | ||
| 30 | - | ||
| 31 | - | ||
| 32 | -STATIC int RsNdaIbvApiInit(void) | ||
| 33 | -{ | ||
| 34 | - | ||
| 35 | - gNdaOps.rsNdaIbvExtendGetVersion = (const char* (*)(uint32_t *, uint32_t *, uint32_t *)) | ||
| 36 | - HccpDlsym(gRoceNdaApiHandle, "ibv_extend_get_version"); | ||
| 37 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvExtendGetVersion, "ibv_extend_get_version"); | ||
| 38 | - gNdaOps.rsNdaIbvExtendCheckVersion = (int (*)(uint32_t, uint32_t, uint32_t)) | ||
| 39 | - HccpDlsym(gRoceNdaApiHandle, "ibv_extend_check_version"); | ||
| 40 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvExtendCheckVersion, "ibv_extend_check_version"); | ||
| 41 | - gNdaOps.rsNdaIbvOpenExtend = (struct ibv_context_extend* (*)(struct ibv_context *)) | ||
| 42 | - HccpDlsym(gRoceNdaApiHandle, "ibv_open_extend"); | ||
| 43 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvOpenExtend, "ibv_open_extend"); | ||
| 44 | - gNdaOps.rsNdaIbvCloseExtend = (int (*)(struct ibv_context_extend *)) | ||
| 45 | - HccpDlsym(gRoceNdaApiHandle, "ibv_close_extend"); | ||
| 46 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvCloseExtend, "ibv_close_extend"); | ||
| 47 | - gNdaOps.rsNdaIbvQueryDeviceExtend = (int (*)(struct ibv_context_extend *, struct ibv_device_attr_extend *)) | ||
| 48 | - HccpDlsym(gRoceNdaApiHandle, "ibv_query_device_extend"); | ||
| 49 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvQueryDeviceExtend, "ibv_query_device_extend"); | ||
| 50 | - gNdaOps.rsNdaIbvCreateQpExtend = (struct ibv_qp_extend* (*)(struct ibv_context_extend *, | ||
| 51 | - struct ibv_qp_init_attr_extend *)) HccpDlsym(gRoceNdaApiHandle, "ibv_create_qp_extend"); | ||
| 52 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvCreateQpExtend, "ibv_create_qp_extend"); | ||
| 53 | - gNdaOps.rsNdaIbvCreateCqExtend = (struct ibv_cq_extend* (*)(struct ibv_context_extend *, | ||
| 54 | - struct ibv_cq_init_attr_extend *)) HccpDlsym(gRoceNdaApiHandle, "ibv_create_cq_extend"); | ||
| 55 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvCreateCqExtend, "ibv_create_cq_extend"); | ||
| 56 | - gNdaOps.rsNdaIbvDestroyQpExtend = (int (*)(struct ibv_context_extend *, | ||
| 57 | - struct ibv_qp_extend *)) HccpDlsym(gRoceNdaApiHandle, "ibv_destroy_qp_extend"); | ||
| 58 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvDestroyQpExtend, "ibv_destroy_qp_extend"); | ||
| 59 | - gNdaOps.rsNdaIbvDestroyCqExtend = (int (*)(struct ibv_context_extend *, | ||
| 60 | - struct ibv_cq_extend *)) HccpDlsym(gRoceNdaApiHandle, "ibv_destroy_cq_extend"); | ||
| 61 | - DL_API_RET_IS_NULL_CHECK(gNdaOps.rsNdaIbvDestroyCqExtend, "ibv_destroy_cq_extend"); | ||
| 62 | - | ||
| 63 | - return 0; | ||
| 64 | -} | ||
| 65 | - | ||
| 66 | -STATIC int RsOpenNdaSo(void) | ||
| 67 | -{ | ||
| 68 | - | ||
| 69 | - if (gRoceNdaApiHandle == NULL) { | ||
| 70 | - gRoceNdaApiHandle = HccpDlopen("libibv_extend.so", RTLD_NOW | RTLD_GLOBAL); | ||
| 71 | - if (gRoceNdaApiHandle != NULL) { | ||
| 72 | - return 0; | ||
| 73 | - } | ||
| 74 | - return -EINVAL; | ||
| 75 | - } else { | ||
| 76 | - hccp_run_info("NdaApi dlopen again!"); | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - return 0; | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | -STATIC void RsCloseNdaSo(void) | ||
| 83 | -{ | ||
| 84 | - | ||
| 85 | - if (gRoceNdaApiHandle != NULL) { | ||
| 86 | - (void)HccpDlclose(gRoceNdaApiHandle); | ||
| 87 | - gRoceNdaApiHandle = NULL; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - return; | ||
| 91 | -} | ||
| 92 | - | ||
| 93 | -int RsNdaApiInit(void) | ||
| 94 | -{ | ||
| 95 | - | ||
| 96 | - int ret = 0; | ||
| 97 | - | ||
| 98 | - ret = RsOpenNdaSo(); | ||
| 99 | - if (ret != 0) { | ||
| 100 | - hccp_warn("HccpDlopen[libibv_extend.so] doesn't exist!"); | ||
| 101 | - return 0; | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - ret = RsNdaIbvApiInit(); | ||
| 105 | - if (ret != 0) { | ||
| 106 | - hccp_err("RsNdaIbvApiInit failed! ret:%d", ret); | ||
| 107 | - RsCloseNdaSo(); | ||
| 108 | - return ret; | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - return 0; | ||
| 112 | -} | ||
| 113 | - | ||
| 114 | -void RsNdaApiDeinit(void) | ||
| 115 | -{ | ||
| 116 | - RsCloseNdaSo(); | ||
| 117 | - return; | ||
| 118 | -} | ||
| 119 | - | ||
| 120 | -const char *RsNdaIbvExtendGetVersion(uint32_t *major, uint32_t *minor, uint32_t *patch) | ||
| 121 | -{ | ||
| 122 | - if (gNdaOps.rsNdaIbvExtendGetVersion == NULL) { | ||
| 123 | - | ||
| 124 | - return NULL; | ||
| 125 | - | ||
| 126 | - } | ||
| 127 | - return gNdaOps.rsNdaIbvExtendGetVersion(major, minor, patch); | ||
| 128 | -} | ||
| 129 | - | ||
| 130 | -int RsNdaIbvExtendCheckVersion(uint32_t driverMajor, uint32_t driverMinor, uint32_t driverPatch) | ||
| 131 | -{ | ||
| 132 | - if (gNdaOps.rsNdaIbvExtendCheckVersion == NULL) { | ||
| 133 | - | ||
| 134 | - return -EINVAL; | ||
| 135 | - | ||
| 136 | - } | ||
| 137 | - return gNdaOps.rsNdaIbvExtendCheckVersion(driverMajor, driverMinor, driverPatch); | ||
| 138 | -} | ||
| 139 | - | ||
| 140 | -struct ibv_context_extend *RsNdaIbvOpenExtend(struct ibv_context *context) | ||
| 141 | -{ | ||
| 142 | - if (gNdaOps.rsNdaIbvOpenExtend == NULL) { | ||
| 143 | - | ||
| 144 | - return NULL; | ||
| 145 | - | ||
| 146 | - } | ||
| 147 | - return gNdaOps.rsNdaIbvOpenExtend(context); | ||
| 148 | -} | ||
| 149 | - | ||
| 150 | -int RsNdaIbvCloseExtend(struct ibv_context_extend *context) | ||
| 151 | -{ | ||
| 152 | - if (context == NULL) { | ||
| 153 | - return 0; | ||
| 154 | - } | ||
| 155 | - | ||
| 156 | - if (gNdaOps.rsNdaIbvCloseExtend == NULL) { | ||
| 157 | - | ||
| 158 | - return 0; | ||
| 159 | - | ||
| 160 | - } | ||
| 161 | - return gNdaOps.rsNdaIbvCloseExtend(context); | ||
| 162 | -} | ||
| 163 | - | ||
| 164 | -int RsNdaIbvQueryDeviceExtend(struct ibv_context_extend *context, struct ibv_device_attr_extend *extDevAttr) | ||
| 165 | -{ | ||
| 166 | - if (gNdaOps.rsNdaIbvQueryDeviceExtend == NULL) { | ||
| 167 | - | ||
| 168 | - hccp_err("rsNdaIbvQueryDeviceExtend is null"); | ||
| 169 | - return -EINVAL; | ||
| 170 | - | ||
| 171 | - } | ||
| 172 | - return gNdaOps.rsNdaIbvQueryDeviceExtend(context, extDevAttr); | ||
| 173 | -} | ||
| 174 | - | ||
| 175 | -struct ibv_cq_extend *RsNdaIbvCreateCqExtend(struct ibv_context_extend *context, | ||
| 176 | - struct ibv_cq_init_attr_extend *cqInitAttr) | ||
| 177 | -{ | ||
| 178 | - if (gNdaOps.rsNdaIbvCreateCqExtend == NULL) { | ||
| 179 | - | ||
| 180 | - hccp_err("rsNdaIbvCreateCqExtend is null"); | ||
| 181 | - return NULL; | ||
| 182 | - | ||
| 183 | - } | ||
| 184 | - return gNdaOps.rsNdaIbvCreateCqExtend(context, cqInitAttr); | ||
| 185 | -} | ||
| 186 | - | ||
| 187 | -int RsNdaIbvDestroyCqExtend(struct ibv_context_extend *context, void *ibvCqExt) | ||
| 188 | -{ | ||
| 189 | - struct ibv_cq_extend *cqExtend = (struct ibv_cq_extend *)ibvCqExt; | ||
| 190 | - | ||
| 191 | - if (gNdaOps.rsNdaIbvDestroyCqExtend == NULL) { | ||
| 192 | - | ||
| 193 | - hccp_err("rsNdaIbvDestroyCqExtend is null"); | ||
| 194 | - return -EINVAL; | ||
| 195 | - | ||
| 196 | - } | ||
| 197 | - return gNdaOps.rsNdaIbvDestroyCqExtend(context, cqExtend); | ||
| 198 | -} | ||
| 199 | - | ||
| 200 | -struct ibv_qp_extend *RsNdaIbvCreateQpExtend(struct ibv_context_extend *context, | ||
| 201 | - struct ibv_qp_init_attr_extend *qpInitAttr) | ||
| 202 | -{ | ||
| 203 | - if (gNdaOps.rsNdaIbvCreateQpExtend == NULL) { | ||
| 204 | - | ||
| 205 | - hccp_err("rsNdaIbvCreateQpExtend is null"); | ||
| 206 | - return NULL; | ||
| 207 | - | ||
| 208 | - } | ||
| 209 | - return gNdaOps.rsNdaIbvCreateQpExtend(context, qpInitAttr); | ||
| 210 | -} | ||
| 211 | - | ||
| 212 | -int RsNdaIbvDestroyQpExtend(struct ibv_context_extend *context, struct ibv_qp_extend *qpExtend) | ||
| 213 | -{ | ||
| 214 | - if (gNdaOps.rsNdaIbvDestroyQpExtend == NULL) { | ||
| 215 | - | ||
| 216 | - hccp_err("rsNdaIbvDestroyQpExtend is null"); | ||
| 217 | - return -EINVAL; | ||
| 218 | - | ||
| 219 | - } | ||
| 220 | - return gNdaOps.rsNdaIbvDestroyQpExtend(context, qpExtend); | ||
| 221 | -} | ||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | -#include "dl_nda_function.h" | 17 | +#include "dl_ibv_extend_function.h" |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | 20 | ||
| @@ -37,8 +37,8 @@ RS_ATTRI_VISI_DEF int RsNdaGetDirectFlag(unsigned int phyId, unsigned int rdevIn | |||
| 37 | return ret; | 37 | return ret; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | - ret = RsNdaIbvQueryDeviceExtend(rdevCb->ibCtxEx, &extDevAttr); | 40 | + ret = RsIbvQueryDeviceExtend(rdevCb->ibCtxEx, &extDevAttr); |
| 41 | - CHK_PRT_RETURN(ret != 0, hccp_err("RsNdaIbvQueryDeviceExtend failed, phyId:%u rdevIndex:%u ret:%d", | 41 | + CHK_PRT_RETURN(ret != 0, hccp_err("RsIbvQueryDeviceExtend failed, phyId:%u rdevIndex:%u ret:%d", |
| 42 | phyId, rdevIndex, ret), ret); | 42 | phyId, rdevIndex, ret), ret); |
| 43 | 43 | ||
| 44 | if ((extDevAttr.ext_cap & IBV_EXTEND_DEV_NDA) == 0) { | 44 | if ((extDevAttr.ext_cap & IBV_EXTEND_DEV_NDA) == 0) { |
| @@ -431,7 +431,7 @@ int RsInitNdaCb(struct RsRdevCb *rdevCb) | |||
| 431 | 431 | ||
| 432 | rdevCb->directFlag = RsNdaGetDirectFlagByDevAttr(&rdevCb->deviceAttr); | 432 | rdevCb->directFlag = RsNdaGetDirectFlagByDevAttr(&rdevCb->deviceAttr); |
| 433 | 433 | ||
| 434 | - rdevCb->ibCtxEx = RsNdaIbvOpenExtend(rdevCb->ibCtx); | 434 | + rdevCb->ibCtxEx = RsIbvOpenExtend(rdevCb->ibCtx); |
| 435 | if (rdevCb->ibCtxEx == NULL) { | 435 | if (rdevCb->ibCtxEx == NULL) { |
| 436 | return 0; | 436 | return 0; |
| 437 | } | 437 | } |
| @@ -455,7 +455,7 @@ int RsInitNdaCb(struct RsRdevCb *rdevCb) | |||
| 455 | 455 | ||
| 456 | calloc_err: | 456 | calloc_err: |
| 457 | (void)__sync_fetch_and_sub(&rdevCb->rsCb->ndaCbRefCnt, 1); | 457 | (void)__sync_fetch_and_sub(&rdevCb->rsCb->ndaCbRefCnt, 1); |
| 458 | - (void)RsNdaIbvCloseExtend(rdevCb->ibCtxEx); | 458 | + (void)RsIbvCloseExtend(rdevCb->ibCtxEx); |
| 459 | rdevCb->ibCtxEx = NULL; | 459 | rdevCb->ibCtxEx = NULL; |
| 460 | return ret; | 460 | return ret; |
| 461 | } | 461 | } |
| @@ -466,7 +466,7 @@ void RsDeinitNdaCb(struct RsRdevCb *rdevCb) | |||
| 466 | return; | 466 | return; |
| 467 | } | 467 | } |
| 468 | 468 | ||
| 469 | - (void)RsNdaIbvCloseExtend(rdevCb->ibCtxEx); | 469 | + (void)RsIbvCloseExtend(rdevCb->ibCtxEx); |
| 470 | rdevCb->ibCtxEx = NULL; | 470 | rdevCb->ibCtxEx = NULL; |
| 471 | 471 | ||
| 472 | if (__sync_fetch_and_sub(&rdevCb->rsCb->ndaCbRefCnt, 1) > 1) { | 472 | if (__sync_fetch_and_sub(&rdevCb->rsCb->ndaCbRefCnt, 1) > 1) { |
| @@ -508,7 +508,7 @@ STATIC int RsNdaCqCreateEx(struct RsRdevCb *rdevCb, struct ibv_cq_init_attr_exte | |||
| 508 | struct ibv_cq_extend *cqExt = NULL; | 508 | struct ibv_cq_extend *cqExt = NULL; |
| 509 | int ret = 0; | 509 | int ret = 0; |
| 510 | 510 | ||
| 511 | - cqExt = RsNdaIbvCreateCqExtend(rdevCb->ibCtxEx, cqInitAttrEx); | 511 | + cqExt = RsIbvCreateCqExtend(rdevCb->ibCtxEx, cqInitAttrEx); |
| 512 | CHK_PRT_RETURN(cqExt == NULL, hccp_err("RsNdaCreateCqExtend failed, errno:%d", errno), -ENOMEM); | 512 | CHK_PRT_RETURN(cqExt == NULL, hccp_err("RsNdaCreateCqExtend failed, errno:%d", errno), -ENOMEM); |
| 513 | 513 | ||
| 514 | ret = memcpy_s(&info->cqInfo, sizeof(struct queueInfo), &cqExt->cq_info, sizeof(struct queue_info)); | 514 | ret = memcpy_s(&info->cqInfo, sizeof(struct queueInfo), &cqExt->cq_info, sizeof(struct queue_info)); |
| @@ -557,8 +557,8 @@ RS_ATTRI_VISI_DEF int RsNdaCqDestroy(unsigned int phyId, unsigned int rdevIndex, | |||
| 557 | CHK_PRT_RETURN(ret != 0, hccp_err("RsQueryRdevCb failed, phyId:%u rdevIndex:%u ret:%d", phyId, rdevIndex, ret), | 557 | CHK_PRT_RETURN(ret != 0, hccp_err("RsQueryRdevCb failed, phyId:%u rdevIndex:%u ret:%d", phyId, rdevIndex, ret), |
| 558 | ret); | 558 | ret); |
| 559 | 559 | ||
| 560 | - ret = RsNdaIbvDestroyCqExtend(rdevCb->ibCtxEx, ibvCqExt); | 560 | + ret = RsIbvDestroyCqExtend(rdevCb->ibCtxEx, ibvCqExt); |
| 561 | - CHK_PRT_RETURN(ret != 0, hccp_err("RsNdaIbvDestroyCqExtend failed, phyId:%u rdevIndex:%u ret:%d", | 561 | + CHK_PRT_RETURN(ret != 0, hccp_err("RsIbvDestroyCqExtend failed, phyId:%u rdevIndex:%u ret:%d", |
| 562 | phyId, rdevIndex, ret), ret); | 562 | phyId, rdevIndex, ret), ret); |
| 563 | 563 | ||
| 564 | return ret; | 564 | return ret; |
| @@ -635,7 +635,7 @@ STATIC int RsNdaQpCreateEx(struct RsQpCb *qpCb, struct ibv_qp_init_attr_extend * | |||
| 635 | int ret = 0; | 635 | int ret = 0; |
| 636 | 636 | ||
| 637 | rdevCb = qpCb->rdevCb; | 637 | rdevCb = qpCb->rdevCb; |
| 638 | - qpCb->ibQpEx = RsNdaIbvCreateQpExtend(rdevCb->ibCtxEx, qpInitAttrEx); | 638 | + qpCb->ibQpEx = RsIbvCreateQpExtend(rdevCb->ibCtxEx, qpInitAttrEx); |
| 639 | CHK_PRT_RETURN(qpCb->ibQpEx == NULL, hccp_err("RsNdaCreateQpExtend failed, errno:%d", errno), -ENOMEM); | 639 | CHK_PRT_RETURN(qpCb->ibQpEx == NULL, hccp_err("RsNdaCreateQpExtend failed, errno:%d", errno), -ENOMEM); |
| 640 | 640 | ||
| 641 | qpCb->ibQp = qpCb->ibQpEx->qp; | 641 | qpCb->ibQp = qpCb->ibQpEx->qp; |
| @@ -663,7 +663,7 @@ STATIC int RsNdaQpCreateEx(struct RsQpCb *qpCb, struct ibv_qp_init_attr_extend * | |||
| 663 | return ret; | 663 | return ret; |
| 664 | 664 | ||
| 665 | nda_init_qp_err: | 665 | nda_init_qp_err: |
| 666 | - (void)RsNdaIbvDestroyQpExtend(rdevCb->ibCtxEx, qpCb->ibQpEx); | 666 | + (void)RsIbvDestroyQpExtend(rdevCb->ibCtxEx, qpCb->ibQpEx); |
| 667 | qpCb->ibQpEx = NULL; | 667 | qpCb->ibQpEx = NULL; |
| 668 | return ret; | 668 | return ret; |
| 669 | } | 669 | } |
| @@ -732,7 +732,7 @@ RS_ATTRI_VISI_DEF int RsNdaQpDestroy(unsigned int phyId, unsigned int rdevIndex, | |||
| 732 | 732 | ||
| 733 | RsMrRelease(qpCb); | 733 | RsMrRelease(qpCb); |
| 734 | 734 | ||
| 735 | - ret = RsNdaIbvDestroyQpExtend(qpCb->rdevCb->ibCtxEx, qpCb->ibQpEx); | 735 | + ret = RsIbvDestroyQpExtend(qpCb->rdevCb->ibCtxEx, qpCb->ibQpEx); |
| 736 | if (ret != 0) { | 736 | if (ret != 0) { |
| 737 | hccp_err("qp:%u destroy extend failed, ret:%d", qpn, ret); | 737 | hccp_err("qp:%u destroy extend failed, ret:%d", qpn, ret); |
| 738 | } | 738 | } |
| @@ -105,7 +105,7 @@ target_include_directories(rdma_agent_utest BEFORE PRIVATE | |||
| 105 | ${ASCEND_CANN_PACKAGE_PATH}/pkg_inc/driver/ | 105 | ${ASCEND_CANN_PACKAGE_PATH}/pkg_inc/driver/ |
| 106 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ | 106 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ |
| 107 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/host_lite | 107 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/host_lite |
| 108 | - ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/nda | 108 | + ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ibv_extend |
| 109 | ) | 109 | ) |
| 110 | 110 | ||
| 111 | target_compile_options(rdma_agent_utest PRIVATE | 111 | target_compile_options(rdma_agent_utest PRIVATE |
| @@ -41,7 +41,7 @@ set(rs_ut_abnormal_list | |||
| 41 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/rs_epoll.c | 41 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/rs_epoll.c |
| 42 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/rs_drv_socket.c | 42 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/rs_drv_socket.c |
| 43 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_ibverbs_function.c | 43 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_ibverbs_function.c |
| 44 | - ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_nda_function.c | 44 | + ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_ibv_extend_function.c |
| 45 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/hccp_dl.c | 45 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/hccp_dl.c |
| 46 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/rs_socket.c | 46 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/rs_socket.c |
| 47 | ${SRC_DIR}/test/ut/platform/hccp/stub/roce_user/stub_hns_roce_u_cmd.c | 47 | ${SRC_DIR}/test/ut/platform/hccp/stub/roce_user/stub_hns_roce_u_cmd.c |
| @@ -85,7 +85,7 @@ target_include_directories(rs_ut_abnormal BEFORE PRIVATE | |||
| 85 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ | 85 | ${ASCEND_CANN_PACKAGE_PATH}/include/driver/ |
| 86 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ubengine | 86 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ubengine |
| 87 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ccu | 87 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ccu |
| 88 | - ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/nda | 88 | + ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ibv_extend |
| 89 | ) | 89 | ) |
| 90 | 90 | ||
| 91 | target_compile_options(rs_ut_abnormal PRIVATE | 91 | target_compile_options(rs_ut_abnormal PRIVATE |
| @@ -47,7 +47,7 @@ set(rs_ut_normal_list | |||
| 47 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/tlv/rs_tlv.c | 47 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/tlv/rs_tlv.c |
| 48 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/tlv/rs_adp_nslb.c | 48 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/tlv/rs_adp_nslb.c |
| 49 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_ibverbs_function.c | 49 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_ibverbs_function.c |
| 50 | - ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_nda_function.c | 50 | + ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/dl_ibv_extend_function.c |
| 51 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/tlv/dl_netco_function.c | 51 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/tlv/dl_netco_function.c |
| 52 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/hccp_dl.c | 52 | ${SRC_DIR}/src/base_comm/resources/hccp/rdma_service/hccp_dl.c |
| 53 | ${SRC_DIR}/test/ut/platform/hccp/stub/roce_user/stub_hns_roce_u_cmd.c | 53 | ${SRC_DIR}/test/ut/platform/hccp/stub/roce_user/stub_hns_roce_u_cmd.c |
| @@ -93,7 +93,7 @@ target_include_directories(rs_ut_normal BEFORE PRIVATE | |||
| 93 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ubengine | 93 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ubengine |
| 94 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/net_adapt | 94 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/net_adapt |
| 95 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ccu | 95 | ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ccu |
| 96 | - ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/nda | 96 | + ${SRC_DIR}/src/base_comm/resources/hccp/external_depends/ibv_extend |
| 97 | ) | 97 | ) |
| 98 | 98 | ||
| 99 | target_compile_options(rs_ut_normal PRIVATE | 99 | target_compile_options(rs_ut_normal PRIVATE |


${HCOMM_DIR}/.. 是不是改成${TOP_DIR}