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-07-28 12:11:00 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[],
      19              :     struct SocketErrInfo err[], 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, hccp_err("[get][ra_peer_socket]ra_get_socket_connect_info failed, "
      26              :         "ret(%d)", ret), ret);
      27              : 
      28            0 :     RaPeerMutexLock(phyId);
      29            0 :     RsSetCtx(phyId);
      30            0 :     ret = RsSocketGetClientSocketErrInfo(connOut, err, num);
      31            0 :     if (ret != 0) {
      32            0 :         hccp_err("[get][ra_peer_socket]ra client get socket info failed, ret(%d)", ret);
      33              :     }
      34            0 :     RaPeerMutexUnlock(phyId);
      35              : 
      36            0 :     return ret;
      37              : }
      38              : 
      39            0 : int RaPeerGetServerSocketErrInfo(unsigned int phyId, struct SocketListenInfoT conn[],
      40              :         struct ServerSocketErrInfo err[], unsigned int num)
      41              : {
      42            0 :     struct SocketListenInfo connOut[MAX_SOCKET_NUM] = {0};
      43              :     int ret;
      44              : 
      45            0 :     ret = RaGetSocketListenInfo(conn, num, connOut, MAX_SOCKET_NUM);
      46            0 :     CHK_PRT_RETURN(ret, hccp_err("[get][ra_peer_socket]ra_get_socket_listen_info failed "
      47              :         "ret(%d)", ret), ret);
      48              : 
      49            0 :     RaPeerMutexLock(phyId);
      50            0 :     RsSetCtx(phyId);
      51            0 :     ret = RsSocketGetServerSocketErrInfo(connOut, err, num);
      52            0 :     if (ret != 0) {
      53            0 :         hccp_err("[get][ra_peer_socket]ra server get socket info failed, ret(%d)", ret);
      54              :     }
      55            0 :     RaPeerMutexUnlock(phyId);
      56              : 
      57            0 :     return ret;
      58              : }
      59              : 
      60            0 : int RaPeerSocketAcceptCreditAdd(unsigned int phyId, struct SocketListenInfoT conn[], unsigned int num,
      61              :     unsigned int creditLimit)
      62              : {
      63            0 :     struct SocketListenInfo rsConn[MAX_SOCKET_NUM] = {0};
      64              :     int ret;
      65              : 
      66            0 :     ret = RaGetSocketListenInfo(conn, num, rsConn, MAX_SOCKET_NUM);
      67            0 :     CHK_PRT_RETURN(ret, hccp_err("[set][ra_peer_socket]ra_peer_get_socket_listen_info failed ret(%d) phyId(%u)",
      68              :         ret, phyId), ret);
      69              : 
      70            0 :     RaPeerMutexLock(phyId);
      71            0 :     RsSetCtx(phyId);
      72            0 :     ret = RsSocketAcceptCreditAdd(rsConn, num, creditLimit);
      73            0 :     if (ret == -ENODEV) {
      74            0 :         hccp_warn("[set][ra_peer_socket]rs_socket_accept_credit_add unsuccessful ret(%d) phyId(%u)", ret, phyId);
      75            0 :     } else if (ret != 0) {
      76            0 :         hccp_err("[set][ra_peer_socket]rs_socket_accept_credit_add failed ret(%d) phyId(%u)", ret, phyId);
      77              :     }
      78            0 :     RaPeerMutexUnlock(phyId);
      79            0 :     return ret;
      80              : }
        

Generated by: LCOV version 2.0-1