rxe_param.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
  3. * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #ifndef RXE_PARAM_H
  34. #define RXE_PARAM_H
  35. static inline enum ib_mtu rxe_mtu_int_to_enum(int mtu)
  36. {
  37. if (mtu < 256)
  38. return 0;
  39. else if (mtu < 512)
  40. return IB_MTU_256;
  41. else if (mtu < 1024)
  42. return IB_MTU_512;
  43. else if (mtu < 2048)
  44. return IB_MTU_1024;
  45. else if (mtu < 4096)
  46. return IB_MTU_2048;
  47. else
  48. return IB_MTU_4096;
  49. }
  50. /* Find the IB mtu for a given network MTU. */
  51. static inline enum ib_mtu eth_mtu_int_to_enum(int mtu)
  52. {
  53. mtu -= RXE_MAX_HDR_LENGTH;
  54. return rxe_mtu_int_to_enum(mtu);
  55. }
  56. /* default/initial rxe device parameter settings */
  57. enum rxe_device_param {
  58. RXE_FW_VER = 0,
  59. RXE_MAX_MR_SIZE = -1ull,
  60. RXE_PAGE_SIZE_CAP = 0xfffff000,
  61. RXE_VENDOR_ID = 0,
  62. RXE_VENDOR_PART_ID = 0,
  63. RXE_HW_VER = 0,
  64. RXE_MAX_QP = 0x10000,
  65. RXE_MAX_QP_WR = 0x4000,
  66. RXE_MAX_INLINE_DATA = 400,
  67. RXE_DEVICE_CAP_FLAGS = IB_DEVICE_BAD_PKEY_CNTR
  68. | IB_DEVICE_BAD_QKEY_CNTR
  69. | IB_DEVICE_AUTO_PATH_MIG
  70. | IB_DEVICE_CHANGE_PHY_PORT
  71. | IB_DEVICE_UD_AV_PORT_ENFORCE
  72. | IB_DEVICE_PORT_ACTIVE_EVENT
  73. | IB_DEVICE_SYS_IMAGE_GUID
  74. | IB_DEVICE_RC_RNR_NAK_GEN
  75. | IB_DEVICE_SRQ_RESIZE
  76. | IB_DEVICE_MEM_MGT_EXTENSIONS,
  77. RXE_MAX_SGE = 32,
  78. RXE_MAX_SGE_RD = 32,
  79. RXE_MAX_CQ = 16384,
  80. RXE_MAX_LOG_CQE = 15,
  81. RXE_MAX_MR = 2 * 1024,
  82. RXE_MAX_PD = 0x7ffc,
  83. RXE_MAX_QP_RD_ATOM = 128,
  84. RXE_MAX_EE_RD_ATOM = 0,
  85. RXE_MAX_RES_RD_ATOM = 0x3f000,
  86. RXE_MAX_QP_INIT_RD_ATOM = 128,
  87. RXE_MAX_EE_INIT_RD_ATOM = 0,
  88. RXE_ATOMIC_CAP = 1,
  89. RXE_MAX_EE = 0,
  90. RXE_MAX_RDD = 0,
  91. RXE_MAX_MW = 0,
  92. RXE_MAX_RAW_IPV6_QP = 0,
  93. RXE_MAX_RAW_ETHY_QP = 0,
  94. RXE_MAX_MCAST_GRP = 8192,
  95. RXE_MAX_MCAST_QP_ATTACH = 56,
  96. RXE_MAX_TOT_MCAST_QP_ATTACH = 0x70000,
  97. RXE_MAX_AH = 100,
  98. RXE_MAX_FMR = 0,
  99. RXE_MAX_MAP_PER_FMR = 0,
  100. RXE_MAX_SRQ = 960,
  101. RXE_MAX_SRQ_WR = 0x4000,
  102. RXE_MIN_SRQ_WR = 1,
  103. RXE_MAX_SRQ_SGE = 27,
  104. RXE_MIN_SRQ_SGE = 1,
  105. RXE_MAX_FMR_PAGE_LIST_LEN = 512,
  106. RXE_MAX_PKEYS = 64,
  107. RXE_LOCAL_CA_ACK_DELAY = 15,
  108. RXE_MAX_UCONTEXT = 512,
  109. RXE_NUM_PORT = 1,
  110. RXE_NUM_COMP_VECTORS = 1,
  111. RXE_MIN_QP_INDEX = 16,
  112. RXE_MAX_QP_INDEX = 0x00020000,
  113. RXE_MIN_SRQ_INDEX = 0x00020001,
  114. RXE_MAX_SRQ_INDEX = 0x00040000,
  115. RXE_MIN_MR_INDEX = 0x00000001,
  116. RXE_MAX_MR_INDEX = 0x00040000,
  117. RXE_MIN_MW_INDEX = 0x00040001,
  118. RXE_MAX_MW_INDEX = 0x00060000,
  119. RXE_MAX_PKT_PER_ACK = 64,
  120. RXE_MAX_UNACKED_PSNS = 128,
  121. /* Max inflight SKBs per queue pair */
  122. RXE_INFLIGHT_SKBS_PER_QP_HIGH = 64,
  123. RXE_INFLIGHT_SKBS_PER_QP_LOW = 16,
  124. /* Delay before calling arbiter timer */
  125. RXE_NSEC_ARB_TIMER_DELAY = 200,
  126. };
  127. /* default/initial rxe port parameters */
  128. enum rxe_port_param {
  129. RXE_PORT_STATE = IB_PORT_DOWN,
  130. RXE_PORT_MAX_MTU = IB_MTU_4096,
  131. RXE_PORT_ACTIVE_MTU = IB_MTU_256,
  132. RXE_PORT_GID_TBL_LEN = 1024,
  133. RXE_PORT_PORT_CAP_FLAGS = RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP,
  134. RXE_PORT_MAX_MSG_SZ = 0x800000,
  135. RXE_PORT_BAD_PKEY_CNTR = 0,
  136. RXE_PORT_QKEY_VIOL_CNTR = 0,
  137. RXE_PORT_LID = 0,
  138. RXE_PORT_SM_LID = 0,
  139. RXE_PORT_SM_SL = 0,
  140. RXE_PORT_LMC = 0,
  141. RXE_PORT_MAX_VL_NUM = 1,
  142. RXE_PORT_SUBNET_TIMEOUT = 0,
  143. RXE_PORT_INIT_TYPE_REPLY = 0,
  144. RXE_PORT_ACTIVE_WIDTH = IB_WIDTH_1X,
  145. RXE_PORT_ACTIVE_SPEED = 1,
  146. RXE_PORT_PKEY_TBL_LEN = 64,
  147. RXE_PORT_PHYS_STATE = 2,
  148. RXE_PORT_SUBNET_PREFIX = 0xfe80000000000000ULL,
  149. };
  150. /* default/initial port info parameters */
  151. enum rxe_port_info_param {
  152. RXE_PORT_INFO_VL_CAP = 4, /* 1-8 */
  153. RXE_PORT_INFO_MTU_CAP = 5, /* 4096 */
  154. RXE_PORT_INFO_OPER_VL = 1, /* 1 */
  155. };
  156. #endif /* RXE_PARAM_H */