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 <hcomm_adapter_urma.h>
12 : #include "log.h"
13 :
14 : namespace hcomm {
15 :
16 0 : HcclResult HrtUrmaPostJettySendWr(urma_jetty_t* jetty, urma_jfs_wr_t* wr, urma_jfs_wr_t** bad_wr)
17 : {
18 : // 参数有效性检查
19 0 : if (jetty == nullptr || wr == nullptr) {
20 0 : HCCL_ERROR("HrtUrmaPostJettySendWr jetty[%p] or wr[%p] is nullptr", jetty, wr);
21 0 : return HCCL_E_PTR;
22 : }
23 0 : if (UNLIKELY(!DlUrmaFunction::GetInstance().DlUrmaFunctionIsInit())) {
24 0 : CHK_RET(DlUrmaFunction::GetInstance().DlUrmaFunctionInit());
25 : }
26 0 : urma_status_t ret = DlUrmaFunction::GetInstance().dlUrmaPostJettySendWr(jetty, wr, bad_wr);
27 0 : CHK_PRT_RET(ret == ENOMEM, HCCL_WARNING("urma post jetty send wr overflow.[%d]", ret), HCCL_E_AGAIN);
28 0 : if (ret != 0) {
29 0 : HCCL_ERROR("HrtUrmaPostJettySendWr failed. ret:[%d] errno[%d][%s]", ret, errno, strerror(errno));
30 0 : return HCCL_E_NETWORK;
31 : }
32 0 : return HCCL_SUCCESS;
33 : }
34 :
35 0 : int HrtUrmaPollJfc(urma_jfc_t* jfc, int cr_cnt, urma_cr_t* cr)
36 : {
37 0 : if (UNLIKELY(!DlUrmaFunction::GetInstance().DlUrmaFunctionIsInit())) {
38 0 : CHK_RET(DlUrmaFunction::GetInstance().DlUrmaFunctionInit());
39 : }
40 0 : return DlUrmaFunction::GetInstance().dlUrmaPollJfc(jfc, cr_cnt, cr);
41 : }
42 :
43 : } // namespace hcomm
|