LCOV - code coverage report
Current view: top level - base_comm/resources/hccp/inc/private/network - ra_rs_opcode.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 4 4
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 2 2

            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              : #ifndef RA_RS_OPCODE_H
      12              : #define RA_RS_OPCODE_H
      13              : 
      14              : #include <stdbool.h>
      15              : #include "hccp_opcode.h"
      16              : 
      17              : enum OpType {
      18              :     RA_RS_SOCKET_CONN = 0,
      19              :     RA_RS_SOCKET_CLOSE = 1,
      20              :     RA_RS_SOCKET_LISTEN_START = 2,
      21              :     RA_RS_SOCKET_LISTEN_STOP = 3,
      22              :     RA_RS_GET_SOCKET = 4,
      23              :     RA_RS_SOCKET_SEND = 5,
      24              :     RA_RS_SOCKET_RECV = 6,
      25              :     RA_RS_QP_CREATE = 7,
      26              :     RA_RS_QP_DESTROY = 8,
      27              :     RA_RS_QP_CONNECT = 9,
      28              :     RA_RS_QP_STATUS = 10,
      29              :     RA_RS_MR_REG = 11,
      30              :     RA_RS_MR_DEREG = 12,
      31              :     RA_RS_SEND_WR = 13,
      32              :     RA_RS_GET_NOTIFY_BA = 14,
      33              :     RA_RS_INIT = 15,
      34              :     RA_RS_DEINIT = 16,
      35              :     RA_RS_SOCKET_INIT = 17,
      36              :     RA_RS_SOCKET_DEINIT = 18,
      37              :     RA_RS_RDEV_INIT = 19,
      38              :     RA_RS_RDEV_DEINIT = 20,
      39              :     RA_RS_WLIST_ADD = 21,
      40              :     RA_RS_WLIST_DEL = 22,
      41              :     RA_RS_GET_IFADDRS = 23,
      42              :     RA_RS_GET_INTERFACE_VERSION = 24,
      43              :     RA_RS_SEND_WRLIST = 25,
      44              :     RA_RS_SET_TSQP_DEPTH = 26,
      45              :     RA_RS_GET_TSQP_DEPTH = 27,
      46              :     RA_RS_SEND_WRLIST_EXT = 28,
      47              :     RA_RS_SET_QP_ATTR_QOS = 29,
      48              :     RA_RS_SET_QP_ATTR_TIMEOUT = 30,
      49              :     RA_RS_SET_QP_ATTR_RETRY_CNT = 31,
      50              :     RA_RS_GET_CQE_ERR_INFO = 32,
      51              :     RA_RS_GET_IFNUM = 33,
      52              :     RA_RS_GET_LITE_SUPPORT = 34,
      53              :     RA_RS_GET_LITE_RDEV_CAP = 35,
      54              :     RA_RS_GET_LITE_QP_CQ_ATTR = 36,
      55              :     RA_RS_GET_LITE_CONNECTED_INFO = 37,
      56              :     RA_RS_GET_IFADDRS_V2 = 38,
      57              :     RA_RS_QP_CREATE_WITH_ATTRS = 39,
      58              :     RA_RS_WLIST_ADD_V2 = 40,
      59              :     RA_RS_WLIST_DEL_V2 = 41,
      60              :     RA_RS_SEND_WRLIST_V2 = 42,
      61              :     RA_RS_SEND_WRLIST_EXT_V2 = 43,
      62              :     RA_RS_GET_LITE_MEM_ATTR = 44,
      63              :     RA_RS_TYPICAL_QP_CREATE = 45,
      64              :     RA_RS_TYPICAL_QP_MODIFY = 46,
      65              :     RA_RS_TYPICAL_MR_REG_V1 = 47,
      66              :     RA_RS_TYPICAL_MR_DEREG = 48,
      67              :     RA_RS_CTX_INIT = 49,
      68              :     RA_RS_CTX_DEINIT = 50,
      69              :     RA_RS_LMEM_REG = 51,
      70              :     RA_RS_LMEM_UNREG = 52,
      71              :     RA_RS_RMEM_IMPORT = 53,
      72              :     RA_RS_RMEM_UNIMPORT = 54,
      73              :     RA_RS_GET_VNIC_IP_INFOS_V1 = 55,
      74              :     RA_RS_GET_DEV_EID_INFO_NUM = 56,
      75              :     RA_RS_GET_DEV_EID_INFO_LIST = 57,
      76              :     RA_RS_CTX_CQ_CREATE = 58,
      77              :     RA_RS_CTX_CQ_DESTROY = 59,
      78              :     RA_RS_CTX_QP_CREATE = 60,
      79              :     RA_RS_CTX_QP_DESTROY = 61,
      80              :     RA_RS_CTX_QP_IMPORT = 62,
      81              :     RA_RS_CTX_QP_UNIMPORT_DEPRECATED = 63,
      82              :     RA_RS_CTX_QP_BIND = 64,
      83              :     RA_RS_CTX_QP_UNBIND = 65,
      84              :     RA_RS_CTX_BATCH_SEND_WR = 66,
      85              :     RA_RS_QP_BATCH_MODIFY = 67,
      86              :     RA_RS_AI_QP_CREATE = 68,
      87              :     RA_RS_CUSTOM_CHANNEL_DEPRECATED = 69,
      88              :     RA_RS_RDEV_GET_PORT_STATUS = 70,
      89              :     RA_RS_PING_INIT = 71,
      90              :     RA_RS_PING_ADD = 72,
      91              :     RA_RS_PING_START = 73,
      92              :     RA_RS_PING_GET_RESULTS = 74,
      93              :     RA_RS_PING_STOP = 75,
      94              :     RA_RS_PING_DEL = 76,
      95              :     RA_RS_PING_DEINIT = 77,
      96              :     RA_RS_CTX_UPDATE_CI = 78,
      97              :     RA_RS_GET_CQE_ERR_INFO_NUM = 79,
      98              :     RA_RS_GET_CQE_ERR_INFO_LIST = 80,
      99              :     RA_RS_RDEV_INIT_WITH_BACKUP = 81,
     100              :     RA_RS_QP_INFO = 82,
     101              :     RA_RS_SEND_NORMAL_WRLIST = 83,
     102              :     RA_RS_CTX_CHAN_CREATE = 84,
     103              :     RA_RS_CTX_CHAN_DESTROY = 85,
     104              :     RA_RS_AI_QP_CREATE_WITH_ATTRS = 86,
     105              :     RA_RS_TLV_INIT_V1 = 87,
     106              :     RA_RS_TLV_DEINIT = 88,
     107              :     RA_RS_TLV_REQUEST = 89,
     108              :     RA_RS_CTX_TOKEN_ID_ALLOC = 90,
     109              :     RA_RS_CTX_TOKEN_ID_FREE = 91,
     110              :     RA_RS_REMAP_MR = 92,
     111              :     RA_RS_GET_TP_INFO_LIST = 93,
     112              :     RA_RS_GET_VNIC_IP_INFOS = 94,
     113              :     RA_RS_GET_TLS_ENABLE = 95,
     114              :     RA_RS_GET_ROCE_API_VERSION = 96,
     115              :     RA_RS_SOCKET_ABORT = 97,
     116              :     RA_RS_ACCEPT_CREDIT_ADD = 98,
     117              :     RA_RS_GET_SEC_RANDOM = 99,
     118              :     RA_RS_GET_HCCN_CFG = 100,
     119              :     RA_RS_TYPICAL_MR_REG = 101,
     120              :     RA_RS_CTX_QP_DESTROY_BATCH = 102,
     121              :     RA_RS_CTX_QUERY_QP_BATCH = 103,
     122              :     RA_RS_GET_EID_BY_IP = 104,
     123              :     RA_RS_CTX_GET_AUX_INFO = 105,
     124              :     RA_RS_GET_TP_ATTR = 106,
     125              :     RA_RS_SET_TP_ATTR = 107,
     126              :     RA_RS_CTX_GET_CR_ERR_INFO_LIST = 108,
     127              :     RA_RS_CTX_GET_ASYNC_EVENTS = 109,
     128              :     RA_RS_TLV_INIT = 110,
     129              :     RA_RS_CTX_GET_UB_CONTEXT = 111,
     130              :     RA_RS_TYPICAL_CQ_CREATE = 112,
     131              :     RA_RS_GET_LITE_CQ_ATTR = 113,
     132              :     RA_RS_QP_CREATE_WITH_CQ_WITH_ATTRS = 114,
     133              :     RA_RS_TYPICAL_CQ_DESTROY = 115,
     134              :     RA_RS_QP_DESTROY_WITHOUT_CQ = 116,
     135              :     RA_RS_GET_LITE_QP_ATTR = 117,
     136              :     RA_RS_GET_NET_API_VERSION = 118,
     137              :     RA_RS_TLV_REQUEST_V2 = 119,
     138              :     RA_RS_CTX_QP_UNIMPORT = 120,
     139              :     RA_RS_GET_IP_BY_EID = 121,
     140              :     RA_RS_EXTER_OP_MAX_NUM,
     141              : 
     142              :     // 上面opcode是对部opcode,下面是内部opcode
     143              :     RA_RS_HDC_SESSION_CLOSE = 1000,
     144              :     RA_RS_GET_VNIC_IP = 1001,
     145              :     RA_RS_NOTIFY_CFG_SET = 1002,
     146              :     RA_RS_NOTIFY_CFG_GET = 1003,
     147              :     RA_RS_SET_PID = 1004,
     148              :     RA_RS_ASYNC_HDC_SESSION_CONNECT = 1005,
     149              :     RA_RS_ASYNC_HDC_SESSION_CLOSE = 1006,
     150              :     RA_RS_OP_MAX_NUM,
     151              : };
     152              : 
     153              : enum ModuleType {
     154              :     HCCP_INIT = 0,
     155              :     RDMA_OP = 1,
     156              :     SOCKET_OP = 2,
     157              :     OTHERS = 3,
     158              : };
     159              : 
     160              : int ConverReturnCode(enum ModuleType module, int erroCode);
     161              : 
     162            9 : static inline bool RaRsHasCapability(unsigned int capability, unsigned int roceVersion, unsigned int netVersion)
     163              : {
     164              :     static struct {
     165              :         unsigned int capability;
     166              :         unsigned int roceVersion;
     167              :         unsigned int netVersion;
     168              :     } capInfoList[] = {
     169              :         {RA_CAP_DRV_SHAREPOOL_NON_PIN, 0, 1},
     170              :     };
     171              : 
     172            9 :     if (capability >= RA_CAP_INVALID) {
     173            2 :         return false;
     174              :     }
     175            7 :     return ((roceVersion >= capInfoList[capability].roceVersion) && (netVersion >= capInfoList[capability].netVersion));
     176              : }
     177              : #endif // RA_RS_OPCODE_H
        

Generated by: LCOV version 2.0-1