1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* 3 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. 4 * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved. 5 */ 6 7 #ifndef RXE_PARAM_H 8 #define RXE_PARAM_H 9 10 #include <uapi/rdma/rdma_user_rxe.h> 11 12 static inline enum ib_mtu rxe_mtu_int_to_enum(int mtu) 13 { 14 if (mtu < 256) 15 return 0; 16 else if (mtu < 512) 17 return IB_MTU_256; 18 else if (mtu < 1024) 19 return IB_MTU_512; 20 else if (mtu < 2048) 21 return IB_MTU_1024; 22 else if (mtu < 4096) 23 return IB_MTU_2048; 24 else 25 return IB_MTU_4096; 26 } 27 28 /* Find the IB mtu for a given network MTU. */ 29 static inline enum ib_mtu eth_mtu_int_to_enum(int mtu) 30 { 31 mtu -= RXE_MAX_HDR_LENGTH; 32 33 return rxe_mtu_int_to_enum(mtu); 34 } 35 36 /* default/initial rxe device parameter settings */ 37 enum rxe_device_param { 38 RXE_MAX_MR_SIZE = -1ull, 39 RXE_PAGE_SIZE_CAP = 0xfffff000, 40 RXE_MAX_QP_WR = 0x4000, 41 RXE_DEVICE_CAP_FLAGS = IB_DEVICE_BAD_PKEY_CNTR 42 | IB_DEVICE_BAD_QKEY_CNTR 43 | IB_DEVICE_AUTO_PATH_MIG 44 | IB_DEVICE_CHANGE_PHY_PORT 45 | IB_DEVICE_UD_AV_PORT_ENFORCE 46 | IB_DEVICE_PORT_ACTIVE_EVENT 47 | IB_DEVICE_SYS_IMAGE_GUID 48 | IB_DEVICE_RC_RNR_NAK_GEN 49 | IB_DEVICE_SRQ_RESIZE 50 | IB_DEVICE_MEM_MGT_EXTENSIONS 51 | IB_DEVICE_ALLOW_USER_UNREG 52 | IB_DEVICE_MEM_WINDOW 53 | IB_DEVICE_MEM_WINDOW_TYPE_2A 54 | IB_DEVICE_MEM_WINDOW_TYPE_2B, 55 RXE_MAX_SGE = 32, 56 RXE_MAX_WQE_SIZE = sizeof(struct rxe_send_wqe) + 57 sizeof(struct ib_sge) * RXE_MAX_SGE, 58 RXE_MAX_INLINE_DATA = RXE_MAX_WQE_SIZE - 59 sizeof(struct rxe_send_wqe), 60 RXE_MAX_SGE_RD = 32, 61 RXE_MAX_CQ = 16384, 62 RXE_MAX_LOG_CQE = 15, 63 RXE_MAX_PD = 0x7ffc, 64 RXE_MAX_QP_RD_ATOM = 128, 65 RXE_MAX_RES_RD_ATOM = 0x3f000, 66 RXE_MAX_QP_INIT_RD_ATOM = 128, 67 RXE_MAX_MCAST_GRP = 8192, 68 RXE_MAX_MCAST_QP_ATTACH = 56, 69 RXE_MAX_TOT_MCAST_QP_ATTACH = 0x70000, 70 RXE_MAX_AH = 100, 71 RXE_MAX_SRQ_WR = 0x4000, 72 RXE_MIN_SRQ_WR = 1, 73 RXE_MAX_SRQ_SGE = 27, 74 RXE_MIN_SRQ_SGE = 1, 75 RXE_MAX_FMR_PAGE_LIST_LEN = 512, 76 RXE_MAX_PKEYS = 1, 77 RXE_LOCAL_CA_ACK_DELAY = 15, 78 79 RXE_MAX_UCONTEXT = 512, 80 81 RXE_NUM_PORT = 1, 82 83 RXE_MAX_QP = 0x10000, 84 RXE_MIN_QP_INDEX = 16, 85 RXE_MAX_QP_INDEX = 0x00020000, 86 87 RXE_MAX_SRQ = 0x00001000, 88 RXE_MIN_SRQ_INDEX = 0x00020001, 89 RXE_MAX_SRQ_INDEX = 0x00040000, 90 91 RXE_MAX_MR = 0x00001000, 92 RXE_MAX_MW = 0x00001000, 93 RXE_MIN_MR_INDEX = 0x00000001, 94 RXE_MAX_MR_INDEX = 0x00010000, 95 RXE_MIN_MW_INDEX = 0x00010001, 96 RXE_MAX_MW_INDEX = 0x00020000, 97 98 RXE_MAX_PKT_PER_ACK = 64, 99 100 RXE_MAX_UNACKED_PSNS = 128, 101 102 /* Max inflight SKBs per queue pair */ 103 RXE_INFLIGHT_SKBS_PER_QP_HIGH = 64, 104 RXE_INFLIGHT_SKBS_PER_QP_LOW = 16, 105 106 /* Delay before calling arbiter timer */ 107 RXE_NSEC_ARB_TIMER_DELAY = 200, 108 109 /* IBTA v1.4 A3.3.1 VENDOR INFORMATION section */ 110 RXE_VENDOR_ID = 0XFFFFFF, 111 }; 112 113 /* default/initial rxe port parameters */ 114 enum rxe_port_param { 115 RXE_PORT_GID_TBL_LEN = 1024, 116 RXE_PORT_PORT_CAP_FLAGS = RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP, 117 RXE_PORT_MAX_MSG_SZ = 0x800000, 118 RXE_PORT_BAD_PKEY_CNTR = 0, 119 RXE_PORT_QKEY_VIOL_CNTR = 0, 120 RXE_PORT_LID = 0, 121 RXE_PORT_SM_LID = 0, 122 RXE_PORT_SM_SL = 0, 123 RXE_PORT_LMC = 0, 124 RXE_PORT_MAX_VL_NUM = 1, 125 RXE_PORT_SUBNET_TIMEOUT = 0, 126 RXE_PORT_INIT_TYPE_REPLY = 0, 127 RXE_PORT_ACTIVE_WIDTH = IB_WIDTH_1X, 128 RXE_PORT_ACTIVE_SPEED = 1, 129 RXE_PORT_PKEY_TBL_LEN = 1, 130 RXE_PORT_PHYS_STATE = IB_PORT_PHYS_STATE_POLLING, 131 RXE_PORT_SUBNET_PREFIX = 0xfe80000000000000ULL, 132 }; 133 134 /* default/initial port info parameters */ 135 enum rxe_port_info_param { 136 RXE_PORT_INFO_VL_CAP = 4, /* 1-8 */ 137 RXE_PORT_INFO_MTU_CAP = 5, /* 4096 */ 138 RXE_PORT_INFO_OPER_VL = 1, /* 1 */ 139 }; 140 141 #endif /* RXE_PARAM_H */ 142