LCOV - code coverage report
Current view: top level - base_comm/resources/hccp/rdma_agent/peer - ra_peer_socket.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 35 0
Test Date: 2026-08-18 17:47:01 Functions: 0.0 % 3 0

            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              : #include "user_log.h"
      12              : #include "ra.h"
      13              : #include "ra_comm.h"
      14              : #include "rs.h"
      15              : #include "ra_peer.h"
      16              : #include "ra_peer_socket.h"
      17              : 
      18            0 : int RaPeerGetClientSocketErrInfo(unsigned int phyId, struct SocketConnectInfoT conn[], struct SocketErrInfo err[],
      19              :     unsigned int num)
      20              : {
      21            0 :     struct SocketConnectInfo connOut[MAX_SOCKET_NUM] = {0};
      22              :     int ret;
      23              : 
      24            0 :     ret = RaGetSocketConnectInfo(conn, num, connOut, MAX_SOCKET_NUM);
      25            0 :     CHK_PRT_RETURN(ret != 0,
      26              :         hccp_err("[get][ra_peer_socket]ra_get_socket_connect_info failed, "
      27              :                  "ret(%d), phyId(%u)",
      28              :             ret, phyId),
      29              :         ret);
      30              : 
      31            0 :     RaPeerMutexLock(phyId);
      32            0 :     RsSetCtx(phyId);
      33            0 :     ret = RsSocketGetClientSocketErrInfo(connOut, err, num);
      34            0 :     if (ret != 0) {
      35            0 :         hccp_err("[get][ra_peer_socket]ra client get socket info failed, ret(%d)", ret);
      36              :     }
      37            0 :     RaPeerMutexUnlock(phyId);
      38              : 
      39            0 :     return ret;
      40              : }
      41              : 
      42            0 : int RaPeerGetServerSocketErrInfo(unsigned int phyId, struct SocketListenInfoT conn[], struct ServerSocketErrInfo err[],
      43              :     unsigned int num)
      44              : {
      45            0 :     struct SocketListenInfo connOut[MAX_SOCKET_NUM] = {0};
      46              :     int ret;
      47              : 
      48            0 :     ret = RaGetSocketListenInfo(conn, num, connOut, MAX_SOCKET_NUM);
      49            0 :     CHK_PRT_RETURN(ret != 0,
      50              :         hccp_err("[get][ra_peer_socket]ra_get_socket_listen_info failed "
      51              :                  "ret(%d), phyId(%u)",
      52              :             ret, phyId),
      53              :         ret);
      54              : 
      55            0 :     RaPeerMutexLock(phyId);
      56            0 :     RsSetCtx(phyId);
      57            0 :     ret = RsSocketGetServerSocketErrInfo(connOut, err, num);
      58            0 :     if (ret != 0) {
      59            0 :         hccp_err("[get][ra_peer_socket]ra server get socket info failed, ret(%d)", ret);
      60              :     }
      61            0 :     RaPeerMutexUnlock(phyId);
      62              : 
      63            0 :     return ret;
      64              : }
      65              : 
      66            0 : int RaPeerSocketAcceptCreditAdd(unsigned int phyId, struct SocketListenInfoT conn[], unsigned int num,
      67              :     unsigned int creditLimit)
      68              : {
      69            0 :     struct SocketListenInfo rsConn[MAX_SOCKET_NUM] = {0};
      70              :     int ret;
      71              : 
      72            0 :     ret = RaGetSocketListenInfo(conn, num, rsConn, MAX_SOCKET_NUM);
      73            0 :     CHK_PRT_RETURN(ret != 0,
      74              :         hccp_err("[set][ra_peer_socket]ra_peer_get_socket_listen_info failed ret(%d) phyId(%u)", ret, phyId), ret);
      75              : 
      76            0 :     RaPeerMutexLock(phyId);
      77            0 :     RsSetCtx(phyId);
      78            0 :     ret = RsSocketAcceptCreditAdd(rsConn, num, creditLimit);
      79            0 :     if (ret == -ENODEV) {
      80            0 :         hccp_warn("[set][ra_peer_socket]rs_socket_accept_credit_add unsuccessful ret(%d) phyId(%u)", ret, phyId);
      81            0 :     } else if (ret != 0) {
      82            0 :         hccp_err("[set][ra_peer_socket]rs_socket_accept_credit_add failed ret(%d) phyId(%u)", ret, phyId);
      83              :     }
      84            0 :     RaPeerMutexUnlock(phyId);
      85            0 :     return ret;
      86              : }
        

Generated by: LCOV version 2.0-1