nes_hw.h 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381
  1. /*
  2. * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef __NES_HW_H
  33. #define __NES_HW_H
  34. #define NES_PHY_TYPE_CX4 1
  35. #define NES_PHY_TYPE_1G 2
  36. #define NES_PHY_TYPE_ARGUS 4
  37. #define NES_PHY_TYPE_PUMA_1G 5
  38. #define NES_PHY_TYPE_PUMA_10G 6
  39. #define NES_PHY_TYPE_GLADIUS 7
  40. #define NES_PHY_TYPE_SFP_D 8
  41. #define NES_PHY_TYPE_KR 9
  42. #define NES_MULTICAST_PF_MAX 8
  43. #define NES_A0 3
  44. #define NES_ENABLE_PAU 0x07000001
  45. #define NES_DISABLE_PAU 0x07000000
  46. #define NES_PAU_COUNTER 10
  47. #define NES_CQP_OPCODE_MASK 0x3f
  48. enum pci_regs {
  49. NES_INT_STAT = 0x0000,
  50. NES_INT_MASK = 0x0004,
  51. NES_INT_PENDING = 0x0008,
  52. NES_INTF_INT_STAT = 0x000C,
  53. NES_INTF_INT_MASK = 0x0010,
  54. NES_TIMER_STAT = 0x0014,
  55. NES_PERIODIC_CONTROL = 0x0018,
  56. NES_ONE_SHOT_CONTROL = 0x001C,
  57. NES_EEPROM_COMMAND = 0x0020,
  58. NES_EEPROM_DATA = 0x0024,
  59. NES_FLASH_COMMAND = 0x0028,
  60. NES_FLASH_DATA = 0x002C,
  61. NES_SOFTWARE_RESET = 0x0030,
  62. NES_CQ_ACK = 0x0034,
  63. NES_WQE_ALLOC = 0x0040,
  64. NES_CQE_ALLOC = 0x0044,
  65. NES_AEQ_ALLOC = 0x0048
  66. };
  67. enum indexed_regs {
  68. NES_IDX_CREATE_CQP_LOW = 0x0000,
  69. NES_IDX_CREATE_CQP_HIGH = 0x0004,
  70. NES_IDX_QP_CONTROL = 0x0040,
  71. NES_IDX_FLM_CONTROL = 0x0080,
  72. NES_IDX_INT_CPU_STATUS = 0x00a0,
  73. NES_IDX_GPR_TRIGGER = 0x00bc,
  74. NES_IDX_GPIO_CONTROL = 0x00f0,
  75. NES_IDX_GPIO_DATA = 0x00f4,
  76. NES_IDX_GPR2 = 0x010c,
  77. NES_IDX_TCP_CONFIG0 = 0x01e4,
  78. NES_IDX_TCP_TIMER_CONFIG = 0x01ec,
  79. NES_IDX_TCP_NOW = 0x01f0,
  80. NES_IDX_QP_MAX_CFG_SIZES = 0x0200,
  81. NES_IDX_QP_CTX_SIZE = 0x0218,
  82. NES_IDX_TCP_TIMER_SIZE0 = 0x0238,
  83. NES_IDX_TCP_TIMER_SIZE1 = 0x0240,
  84. NES_IDX_ARP_CACHE_SIZE = 0x0258,
  85. NES_IDX_CQ_CTX_SIZE = 0x0260,
  86. NES_IDX_MRT_SIZE = 0x0278,
  87. NES_IDX_PBL_REGION_SIZE = 0x0280,
  88. NES_IDX_IRRQ_COUNT = 0x02b0,
  89. NES_IDX_RX_WINDOW_BUFFER_PAGE_TABLE_SIZE = 0x02f0,
  90. NES_IDX_RX_WINDOW_BUFFER_SIZE = 0x0300,
  91. NES_IDX_DST_IP_ADDR = 0x0400,
  92. NES_IDX_PCIX_DIAG = 0x08e8,
  93. NES_IDX_MPP_DEBUG = 0x0a00,
  94. NES_IDX_PORT_RX_DISCARDS = 0x0a30,
  95. NES_IDX_PORT_TX_DISCARDS = 0x0a34,
  96. NES_IDX_MPP_LB_DEBUG = 0x0b00,
  97. NES_IDX_DENALI_CTL_22 = 0x1058,
  98. NES_IDX_MAC_TX_CONTROL = 0x2000,
  99. NES_IDX_MAC_TX_CONFIG = 0x2004,
  100. NES_IDX_MAC_TX_PAUSE_QUANTA = 0x2008,
  101. NES_IDX_MAC_RX_CONTROL = 0x200c,
  102. NES_IDX_MAC_RX_CONFIG = 0x2010,
  103. NES_IDX_MAC_EXACT_MATCH_BOTTOM = 0x201c,
  104. NES_IDX_MAC_MDIO_CONTROL = 0x2084,
  105. NES_IDX_MAC_TX_OCTETS_LOW = 0x2100,
  106. NES_IDX_MAC_TX_OCTETS_HIGH = 0x2104,
  107. NES_IDX_MAC_TX_FRAMES_LOW = 0x2108,
  108. NES_IDX_MAC_TX_FRAMES_HIGH = 0x210c,
  109. NES_IDX_MAC_TX_PAUSE_FRAMES = 0x2118,
  110. NES_IDX_MAC_TX_ERRORS = 0x2138,
  111. NES_IDX_MAC_RX_OCTETS_LOW = 0x213c,
  112. NES_IDX_MAC_RX_OCTETS_HIGH = 0x2140,
  113. NES_IDX_MAC_RX_FRAMES_LOW = 0x2144,
  114. NES_IDX_MAC_RX_FRAMES_HIGH = 0x2148,
  115. NES_IDX_MAC_RX_BC_FRAMES_LOW = 0x214c,
  116. NES_IDX_MAC_RX_MC_FRAMES_HIGH = 0x2150,
  117. NES_IDX_MAC_RX_PAUSE_FRAMES = 0x2154,
  118. NES_IDX_MAC_RX_SHORT_FRAMES = 0x2174,
  119. NES_IDX_MAC_RX_OVERSIZED_FRAMES = 0x2178,
  120. NES_IDX_MAC_RX_JABBER_FRAMES = 0x217c,
  121. NES_IDX_MAC_RX_CRC_ERR_FRAMES = 0x2180,
  122. NES_IDX_MAC_RX_LENGTH_ERR_FRAMES = 0x2184,
  123. NES_IDX_MAC_RX_SYMBOL_ERR_FRAMES = 0x2188,
  124. NES_IDX_MAC_INT_STATUS = 0x21f0,
  125. NES_IDX_MAC_INT_MASK = 0x21f4,
  126. NES_IDX_PHY_PCS_CONTROL_STATUS0 = 0x2800,
  127. NES_IDX_PHY_PCS_CONTROL_STATUS1 = 0x2a00,
  128. NES_IDX_ETH_SERDES_COMMON_CONTROL0 = 0x2808,
  129. NES_IDX_ETH_SERDES_COMMON_CONTROL1 = 0x2a08,
  130. NES_IDX_ETH_SERDES_COMMON_STATUS0 = 0x280c,
  131. NES_IDX_ETH_SERDES_COMMON_STATUS1 = 0x2a0c,
  132. NES_IDX_ETH_SERDES_TX_EMP0 = 0x2810,
  133. NES_IDX_ETH_SERDES_TX_EMP1 = 0x2a10,
  134. NES_IDX_ETH_SERDES_TX_DRIVE0 = 0x2814,
  135. NES_IDX_ETH_SERDES_TX_DRIVE1 = 0x2a14,
  136. NES_IDX_ETH_SERDES_RX_MODE0 = 0x2818,
  137. NES_IDX_ETH_SERDES_RX_MODE1 = 0x2a18,
  138. NES_IDX_ETH_SERDES_RX_SIGDET0 = 0x281c,
  139. NES_IDX_ETH_SERDES_RX_SIGDET1 = 0x2a1c,
  140. NES_IDX_ETH_SERDES_BYPASS0 = 0x2820,
  141. NES_IDX_ETH_SERDES_BYPASS1 = 0x2a20,
  142. NES_IDX_ETH_SERDES_LOOPBACK_CONTROL0 = 0x2824,
  143. NES_IDX_ETH_SERDES_LOOPBACK_CONTROL1 = 0x2a24,
  144. NES_IDX_ETH_SERDES_RX_EQ_CONTROL0 = 0x2828,
  145. NES_IDX_ETH_SERDES_RX_EQ_CONTROL1 = 0x2a28,
  146. NES_IDX_ETH_SERDES_RX_EQ_STATUS0 = 0x282c,
  147. NES_IDX_ETH_SERDES_RX_EQ_STATUS1 = 0x2a2c,
  148. NES_IDX_ETH_SERDES_CDR_RESET0 = 0x2830,
  149. NES_IDX_ETH_SERDES_CDR_RESET1 = 0x2a30,
  150. NES_IDX_ETH_SERDES_CDR_CONTROL0 = 0x2834,
  151. NES_IDX_ETH_SERDES_CDR_CONTROL1 = 0x2a34,
  152. NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE0 = 0x2838,
  153. NES_IDX_ETH_SERDES_TX_HIGHZ_LANE_MODE1 = 0x2a38,
  154. NES_IDX_ENDNODE0_NSTAT_RX_DISCARD = 0x3080,
  155. NES_IDX_ENDNODE0_NSTAT_RX_OCTETS_LO = 0x3000,
  156. NES_IDX_ENDNODE0_NSTAT_RX_OCTETS_HI = 0x3004,
  157. NES_IDX_ENDNODE0_NSTAT_RX_FRAMES_LO = 0x3008,
  158. NES_IDX_ENDNODE0_NSTAT_RX_FRAMES_HI = 0x300c,
  159. NES_IDX_ENDNODE0_NSTAT_TX_OCTETS_LO = 0x7000,
  160. NES_IDX_ENDNODE0_NSTAT_TX_OCTETS_HI = 0x7004,
  161. NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_LO = 0x7008,
  162. NES_IDX_ENDNODE0_NSTAT_TX_FRAMES_HI = 0x700c,
  163. NES_IDX_WQM_CONFIG0 = 0x5000,
  164. NES_IDX_WQM_CONFIG1 = 0x5004,
  165. NES_IDX_CM_CONFIG = 0x5100,
  166. NES_IDX_NIC_LOGPORT_TO_PHYPORT = 0x6000,
  167. NES_IDX_NIC_PHYPORT_TO_USW = 0x6008,
  168. NES_IDX_NIC_ACTIVE = 0x6010,
  169. NES_IDX_NIC_UNICAST_ALL = 0x6018,
  170. NES_IDX_NIC_MULTICAST_ALL = 0x6020,
  171. NES_IDX_NIC_MULTICAST_ENABLE = 0x6028,
  172. NES_IDX_NIC_BROADCAST_ON = 0x6030,
  173. NES_IDX_USED_CHUNKS_TX = 0x60b0,
  174. NES_IDX_TX_POOL_SIZE = 0x60b8,
  175. NES_IDX_QUAD_HASH_TABLE_SIZE = 0x6148,
  176. NES_IDX_PERFECT_FILTER_LOW = 0x6200,
  177. NES_IDX_PERFECT_FILTER_HIGH = 0x6204,
  178. NES_IDX_IPV4_TCP_REXMITS = 0x7080,
  179. NES_IDX_DEBUG_ERROR_CONTROL_STATUS = 0x913c,
  180. NES_IDX_DEBUG_ERROR_MASKS0 = 0x9140,
  181. NES_IDX_DEBUG_ERROR_MASKS1 = 0x9144,
  182. NES_IDX_DEBUG_ERROR_MASKS2 = 0x9148,
  183. NES_IDX_DEBUG_ERROR_MASKS3 = 0x914c,
  184. NES_IDX_DEBUG_ERROR_MASKS4 = 0x9150,
  185. NES_IDX_DEBUG_ERROR_MASKS5 = 0x9154,
  186. };
  187. #define NES_IDX_MAC_TX_CONFIG_ENABLE_PAUSE 1
  188. #define NES_IDX_MPP_DEBUG_PORT_DISABLE_PAUSE (1 << 17)
  189. enum nes_cqp_opcodes {
  190. NES_CQP_CREATE_QP = 0x00,
  191. NES_CQP_MODIFY_QP = 0x01,
  192. NES_CQP_DESTROY_QP = 0x02,
  193. NES_CQP_CREATE_CQ = 0x03,
  194. NES_CQP_MODIFY_CQ = 0x04,
  195. NES_CQP_DESTROY_CQ = 0x05,
  196. NES_CQP_ALLOCATE_STAG = 0x09,
  197. NES_CQP_REGISTER_STAG = 0x0a,
  198. NES_CQP_QUERY_STAG = 0x0b,
  199. NES_CQP_REGISTER_SHARED_STAG = 0x0c,
  200. NES_CQP_DEALLOCATE_STAG = 0x0d,
  201. NES_CQP_MANAGE_ARP_CACHE = 0x0f,
  202. NES_CQP_DOWNLOAD_SEGMENT = 0x10,
  203. NES_CQP_SUSPEND_QPS = 0x11,
  204. NES_CQP_UPLOAD_CONTEXT = 0x13,
  205. NES_CQP_CREATE_CEQ = 0x16,
  206. NES_CQP_DESTROY_CEQ = 0x18,
  207. NES_CQP_CREATE_AEQ = 0x19,
  208. NES_CQP_DESTROY_AEQ = 0x1b,
  209. NES_CQP_LMI_ACCESS = 0x20,
  210. NES_CQP_FLUSH_WQES = 0x22,
  211. NES_CQP_MANAGE_APBVT = 0x23,
  212. NES_CQP_MANAGE_QUAD_HASH = 0x25
  213. };
  214. enum nes_cqp_wqe_word_idx {
  215. NES_CQP_WQE_OPCODE_IDX = 0,
  216. NES_CQP_WQE_ID_IDX = 1,
  217. NES_CQP_WQE_COMP_CTX_LOW_IDX = 2,
  218. NES_CQP_WQE_COMP_CTX_HIGH_IDX = 3,
  219. NES_CQP_WQE_COMP_SCRATCH_LOW_IDX = 4,
  220. NES_CQP_WQE_COMP_SCRATCH_HIGH_IDX = 5,
  221. };
  222. enum nes_cqp_wqe_word_download_idx { /* format differs from other cqp ops */
  223. NES_CQP_WQE_DL_OPCODE_IDX = 0,
  224. NES_CQP_WQE_DL_COMP_CTX_LOW_IDX = 1,
  225. NES_CQP_WQE_DL_COMP_CTX_HIGH_IDX = 2,
  226. NES_CQP_WQE_DL_LENGTH_0_TOTAL_IDX = 3
  227. /* For index values 4-15 use NES_NIC_SQ_WQE_ values */
  228. };
  229. enum nes_cqp_cq_wqeword_idx {
  230. NES_CQP_CQ_WQE_PBL_LOW_IDX = 6,
  231. NES_CQP_CQ_WQE_PBL_HIGH_IDX = 7,
  232. NES_CQP_CQ_WQE_CQ_CONTEXT_LOW_IDX = 8,
  233. NES_CQP_CQ_WQE_CQ_CONTEXT_HIGH_IDX = 9,
  234. NES_CQP_CQ_WQE_DOORBELL_INDEX_HIGH_IDX = 10,
  235. };
  236. enum nes_cqp_stag_wqeword_idx {
  237. NES_CQP_STAG_WQE_PBL_BLK_COUNT_IDX = 1,
  238. NES_CQP_STAG_WQE_LEN_HIGH_PD_IDX = 6,
  239. NES_CQP_STAG_WQE_LEN_LOW_IDX = 7,
  240. NES_CQP_STAG_WQE_STAG_IDX = 8,
  241. NES_CQP_STAG_WQE_VA_LOW_IDX = 10,
  242. NES_CQP_STAG_WQE_VA_HIGH_IDX = 11,
  243. NES_CQP_STAG_WQE_PA_LOW_IDX = 12,
  244. NES_CQP_STAG_WQE_PA_HIGH_IDX = 13,
  245. NES_CQP_STAG_WQE_PBL_LEN_IDX = 14
  246. };
  247. #define NES_CQP_OP_LOGICAL_PORT_SHIFT 26
  248. #define NES_CQP_OP_IWARP_STATE_SHIFT 28
  249. #define NES_CQP_OP_TERMLEN_SHIFT 28
  250. enum nes_cqp_qp_bits {
  251. NES_CQP_QP_ARP_VALID = (1<<8),
  252. NES_CQP_QP_WINBUF_VALID = (1<<9),
  253. NES_CQP_QP_CONTEXT_VALID = (1<<10),
  254. NES_CQP_QP_ORD_VALID = (1<<11),
  255. NES_CQP_QP_WINBUF_DATAIND_EN = (1<<12),
  256. NES_CQP_QP_VIRT_WQS = (1<<13),
  257. NES_CQP_QP_DEL_HTE = (1<<14),
  258. NES_CQP_QP_CQS_VALID = (1<<15),
  259. NES_CQP_QP_TYPE_TSA = 0,
  260. NES_CQP_QP_TYPE_IWARP = (1<<16),
  261. NES_CQP_QP_TYPE_CQP = (4<<16),
  262. NES_CQP_QP_TYPE_NIC = (5<<16),
  263. NES_CQP_QP_MSS_CHG = (1<<20),
  264. NES_CQP_QP_STATIC_RESOURCES = (1<<21),
  265. NES_CQP_QP_IGNORE_MW_BOUND = (1<<22),
  266. NES_CQP_QP_VWQ_USE_LMI = (1<<23),
  267. NES_CQP_QP_IWARP_STATE_IDLE = (1<<NES_CQP_OP_IWARP_STATE_SHIFT),
  268. NES_CQP_QP_IWARP_STATE_RTS = (2<<NES_CQP_OP_IWARP_STATE_SHIFT),
  269. NES_CQP_QP_IWARP_STATE_CLOSING = (3<<NES_CQP_OP_IWARP_STATE_SHIFT),
  270. NES_CQP_QP_IWARP_STATE_TERMINATE = (5<<NES_CQP_OP_IWARP_STATE_SHIFT),
  271. NES_CQP_QP_IWARP_STATE_ERROR = (6<<NES_CQP_OP_IWARP_STATE_SHIFT),
  272. NES_CQP_QP_IWARP_STATE_MASK = (7<<NES_CQP_OP_IWARP_STATE_SHIFT),
  273. NES_CQP_QP_TERM_DONT_SEND_FIN = (1<<24),
  274. NES_CQP_QP_TERM_DONT_SEND_TERM_MSG = (1<<25),
  275. NES_CQP_QP_RESET = (1<<31),
  276. };
  277. enum nes_cqp_qp_wqe_word_idx {
  278. NES_CQP_QP_WQE_CONTEXT_LOW_IDX = 6,
  279. NES_CQP_QP_WQE_CONTEXT_HIGH_IDX = 7,
  280. NES_CQP_QP_WQE_FLUSH_SQ_CODE = 8,
  281. NES_CQP_QP_WQE_FLUSH_RQ_CODE = 9,
  282. NES_CQP_QP_WQE_NEW_MSS_IDX = 15,
  283. };
  284. enum nes_nic_ctx_bits {
  285. NES_NIC_CTX_RQ_SIZE_32 = (3<<8),
  286. NES_NIC_CTX_RQ_SIZE_512 = (3<<8),
  287. NES_NIC_CTX_SQ_SIZE_32 = (1<<10),
  288. NES_NIC_CTX_SQ_SIZE_512 = (3<<10),
  289. };
  290. enum nes_nic_qp_ctx_word_idx {
  291. NES_NIC_CTX_MISC_IDX = 0,
  292. NES_NIC_CTX_SQ_LOW_IDX = 2,
  293. NES_NIC_CTX_SQ_HIGH_IDX = 3,
  294. NES_NIC_CTX_RQ_LOW_IDX = 4,
  295. NES_NIC_CTX_RQ_HIGH_IDX = 5,
  296. };
  297. enum nes_cqp_cq_bits {
  298. NES_CQP_CQ_CEQE_MASK = (1<<9),
  299. NES_CQP_CQ_CEQ_VALID = (1<<10),
  300. NES_CQP_CQ_RESIZE = (1<<11),
  301. NES_CQP_CQ_CHK_OVERFLOW = (1<<12),
  302. NES_CQP_CQ_4KB_CHUNK = (1<<14),
  303. NES_CQP_CQ_VIRT = (1<<15),
  304. };
  305. enum nes_cqp_stag_bits {
  306. NES_CQP_STAG_VA_TO = (1<<9),
  307. NES_CQP_STAG_DEALLOC_PBLS = (1<<10),
  308. NES_CQP_STAG_PBL_BLK_SIZE = (1<<11),
  309. NES_CQP_STAG_MR = (1<<13),
  310. NES_CQP_STAG_RIGHTS_LOCAL_READ = (1<<16),
  311. NES_CQP_STAG_RIGHTS_LOCAL_WRITE = (1<<17),
  312. NES_CQP_STAG_RIGHTS_REMOTE_READ = (1<<18),
  313. NES_CQP_STAG_RIGHTS_REMOTE_WRITE = (1<<19),
  314. NES_CQP_STAG_RIGHTS_WINDOW_BIND = (1<<20),
  315. NES_CQP_STAG_REM_ACC_EN = (1<<21),
  316. NES_CQP_STAG_LEAVE_PENDING = (1<<31),
  317. };
  318. enum nes_cqp_ceq_wqeword_idx {
  319. NES_CQP_CEQ_WQE_ELEMENT_COUNT_IDX = 1,
  320. NES_CQP_CEQ_WQE_PBL_LOW_IDX = 6,
  321. NES_CQP_CEQ_WQE_PBL_HIGH_IDX = 7,
  322. };
  323. enum nes_cqp_ceq_bits {
  324. NES_CQP_CEQ_4KB_CHUNK = (1<<14),
  325. NES_CQP_CEQ_VIRT = (1<<15),
  326. };
  327. enum nes_cqp_aeq_wqeword_idx {
  328. NES_CQP_AEQ_WQE_ELEMENT_COUNT_IDX = 1,
  329. NES_CQP_AEQ_WQE_PBL_LOW_IDX = 6,
  330. NES_CQP_AEQ_WQE_PBL_HIGH_IDX = 7,
  331. };
  332. enum nes_cqp_aeq_bits {
  333. NES_CQP_AEQ_4KB_CHUNK = (1<<14),
  334. NES_CQP_AEQ_VIRT = (1<<15),
  335. };
  336. enum nes_cqp_lmi_wqeword_idx {
  337. NES_CQP_LMI_WQE_LMI_OFFSET_IDX = 1,
  338. NES_CQP_LMI_WQE_FRAG_LOW_IDX = 8,
  339. NES_CQP_LMI_WQE_FRAG_HIGH_IDX = 9,
  340. NES_CQP_LMI_WQE_FRAG_LEN_IDX = 10,
  341. };
  342. enum nes_cqp_arp_wqeword_idx {
  343. NES_CQP_ARP_WQE_MAC_ADDR_LOW_IDX = 6,
  344. NES_CQP_ARP_WQE_MAC_HIGH_IDX = 7,
  345. NES_CQP_ARP_WQE_REACHABILITY_MAX_IDX = 1,
  346. };
  347. enum nes_cqp_upload_wqeword_idx {
  348. NES_CQP_UPLOAD_WQE_CTXT_LOW_IDX = 6,
  349. NES_CQP_UPLOAD_WQE_CTXT_HIGH_IDX = 7,
  350. NES_CQP_UPLOAD_WQE_HTE_IDX = 8,
  351. };
  352. enum nes_cqp_arp_bits {
  353. NES_CQP_ARP_VALID = (1<<8),
  354. NES_CQP_ARP_PERM = (1<<9),
  355. };
  356. enum nes_cqp_flush_bits {
  357. NES_CQP_FLUSH_SQ = (1<<30),
  358. NES_CQP_FLUSH_RQ = (1<<31),
  359. NES_CQP_FLUSH_MAJ_MIN = (1<<28),
  360. };
  361. enum nes_cqe_opcode_bits {
  362. NES_CQE_STAG_VALID = (1<<6),
  363. NES_CQE_ERROR = (1<<7),
  364. NES_CQE_SQ = (1<<8),
  365. NES_CQE_SE = (1<<9),
  366. NES_CQE_PSH = (1<<29),
  367. NES_CQE_FIN = (1<<30),
  368. NES_CQE_VALID = (1<<31),
  369. };
  370. enum nes_cqe_word_idx {
  371. NES_CQE_PAYLOAD_LENGTH_IDX = 0,
  372. NES_CQE_COMP_COMP_CTX_LOW_IDX = 2,
  373. NES_CQE_COMP_COMP_CTX_HIGH_IDX = 3,
  374. NES_CQE_INV_STAG_IDX = 4,
  375. NES_CQE_QP_ID_IDX = 5,
  376. NES_CQE_ERROR_CODE_IDX = 6,
  377. NES_CQE_OPCODE_IDX = 7,
  378. };
  379. enum nes_ceqe_word_idx {
  380. NES_CEQE_CQ_CTX_LOW_IDX = 0,
  381. NES_CEQE_CQ_CTX_HIGH_IDX = 1,
  382. };
  383. enum nes_ceqe_status_bit {
  384. NES_CEQE_VALID = (1<<31),
  385. };
  386. enum nes_int_bits {
  387. NES_INT_CEQ0 = (1<<0),
  388. NES_INT_CEQ1 = (1<<1),
  389. NES_INT_CEQ2 = (1<<2),
  390. NES_INT_CEQ3 = (1<<3),
  391. NES_INT_CEQ4 = (1<<4),
  392. NES_INT_CEQ5 = (1<<5),
  393. NES_INT_CEQ6 = (1<<6),
  394. NES_INT_CEQ7 = (1<<7),
  395. NES_INT_CEQ8 = (1<<8),
  396. NES_INT_CEQ9 = (1<<9),
  397. NES_INT_CEQ10 = (1<<10),
  398. NES_INT_CEQ11 = (1<<11),
  399. NES_INT_CEQ12 = (1<<12),
  400. NES_INT_CEQ13 = (1<<13),
  401. NES_INT_CEQ14 = (1<<14),
  402. NES_INT_CEQ15 = (1<<15),
  403. NES_INT_AEQ0 = (1<<16),
  404. NES_INT_AEQ1 = (1<<17),
  405. NES_INT_AEQ2 = (1<<18),
  406. NES_INT_AEQ3 = (1<<19),
  407. NES_INT_AEQ4 = (1<<20),
  408. NES_INT_AEQ5 = (1<<21),
  409. NES_INT_AEQ6 = (1<<22),
  410. NES_INT_AEQ7 = (1<<23),
  411. NES_INT_MAC0 = (1<<24),
  412. NES_INT_MAC1 = (1<<25),
  413. NES_INT_MAC2 = (1<<26),
  414. NES_INT_MAC3 = (1<<27),
  415. NES_INT_TSW = (1<<28),
  416. NES_INT_TIMER = (1<<29),
  417. NES_INT_INTF = (1<<30),
  418. };
  419. enum nes_intf_int_bits {
  420. NES_INTF_INT_PCIERR = (1<<0),
  421. NES_INTF_PERIODIC_TIMER = (1<<2),
  422. NES_INTF_ONE_SHOT_TIMER = (1<<3),
  423. NES_INTF_INT_CRITERR = (1<<14),
  424. NES_INTF_INT_AEQ0_OFLOW = (1<<16),
  425. NES_INTF_INT_AEQ1_OFLOW = (1<<17),
  426. NES_INTF_INT_AEQ2_OFLOW = (1<<18),
  427. NES_INTF_INT_AEQ3_OFLOW = (1<<19),
  428. NES_INTF_INT_AEQ4_OFLOW = (1<<20),
  429. NES_INTF_INT_AEQ5_OFLOW = (1<<21),
  430. NES_INTF_INT_AEQ6_OFLOW = (1<<22),
  431. NES_INTF_INT_AEQ7_OFLOW = (1<<23),
  432. NES_INTF_INT_AEQ_OFLOW = (0xff<<16),
  433. };
  434. enum nes_mac_int_bits {
  435. NES_MAC_INT_LINK_STAT_CHG = (1<<1),
  436. NES_MAC_INT_XGMII_EXT = (1<<2),
  437. NES_MAC_INT_TX_UNDERFLOW = (1<<6),
  438. NES_MAC_INT_TX_ERROR = (1<<7),
  439. };
  440. enum nes_cqe_allocate_bits {
  441. NES_CQE_ALLOC_INC_SELECT = (1<<28),
  442. NES_CQE_ALLOC_NOTIFY_NEXT = (1<<29),
  443. NES_CQE_ALLOC_NOTIFY_SE = (1<<30),
  444. NES_CQE_ALLOC_RESET = (1<<31),
  445. };
  446. enum nes_nic_rq_wqe_word_idx {
  447. NES_NIC_RQ_WQE_LENGTH_1_0_IDX = 0,
  448. NES_NIC_RQ_WQE_LENGTH_3_2_IDX = 1,
  449. NES_NIC_RQ_WQE_FRAG0_LOW_IDX = 2,
  450. NES_NIC_RQ_WQE_FRAG0_HIGH_IDX = 3,
  451. NES_NIC_RQ_WQE_FRAG1_LOW_IDX = 4,
  452. NES_NIC_RQ_WQE_FRAG1_HIGH_IDX = 5,
  453. NES_NIC_RQ_WQE_FRAG2_LOW_IDX = 6,
  454. NES_NIC_RQ_WQE_FRAG2_HIGH_IDX = 7,
  455. NES_NIC_RQ_WQE_FRAG3_LOW_IDX = 8,
  456. NES_NIC_RQ_WQE_FRAG3_HIGH_IDX = 9,
  457. };
  458. enum nes_nic_sq_wqe_word_idx {
  459. NES_NIC_SQ_WQE_MISC_IDX = 0,
  460. NES_NIC_SQ_WQE_TOTAL_LENGTH_IDX = 1,
  461. NES_NIC_SQ_WQE_LSO_INFO_IDX = 2,
  462. NES_NIC_SQ_WQE_LENGTH_0_TAG_IDX = 3,
  463. NES_NIC_SQ_WQE_LENGTH_2_1_IDX = 4,
  464. NES_NIC_SQ_WQE_LENGTH_4_3_IDX = 5,
  465. NES_NIC_SQ_WQE_FRAG0_LOW_IDX = 6,
  466. NES_NIC_SQ_WQE_FRAG0_HIGH_IDX = 7,
  467. NES_NIC_SQ_WQE_FRAG1_LOW_IDX = 8,
  468. NES_NIC_SQ_WQE_FRAG1_HIGH_IDX = 9,
  469. NES_NIC_SQ_WQE_FRAG2_LOW_IDX = 10,
  470. NES_NIC_SQ_WQE_FRAG2_HIGH_IDX = 11,
  471. NES_NIC_SQ_WQE_FRAG3_LOW_IDX = 12,
  472. NES_NIC_SQ_WQE_FRAG3_HIGH_IDX = 13,
  473. NES_NIC_SQ_WQE_FRAG4_LOW_IDX = 14,
  474. NES_NIC_SQ_WQE_FRAG4_HIGH_IDX = 15,
  475. };
  476. enum nes_iwarp_sq_wqe_word_idx {
  477. NES_IWARP_SQ_WQE_MISC_IDX = 0,
  478. NES_IWARP_SQ_WQE_TOTAL_PAYLOAD_IDX = 1,
  479. NES_IWARP_SQ_WQE_COMP_CTX_LOW_IDX = 2,
  480. NES_IWARP_SQ_WQE_COMP_CTX_HIGH_IDX = 3,
  481. NES_IWARP_SQ_WQE_COMP_SCRATCH_LOW_IDX = 4,
  482. NES_IWARP_SQ_WQE_COMP_SCRATCH_HIGH_IDX = 5,
  483. NES_IWARP_SQ_WQE_INV_STAG_LOW_IDX = 7,
  484. NES_IWARP_SQ_WQE_RDMA_TO_LOW_IDX = 8,
  485. NES_IWARP_SQ_WQE_RDMA_TO_HIGH_IDX = 9,
  486. NES_IWARP_SQ_WQE_RDMA_LENGTH_IDX = 10,
  487. NES_IWARP_SQ_WQE_RDMA_STAG_IDX = 11,
  488. NES_IWARP_SQ_WQE_IMM_DATA_START_IDX = 12,
  489. NES_IWARP_SQ_WQE_FRAG0_LOW_IDX = 16,
  490. NES_IWARP_SQ_WQE_FRAG0_HIGH_IDX = 17,
  491. NES_IWARP_SQ_WQE_LENGTH0_IDX = 18,
  492. NES_IWARP_SQ_WQE_STAG0_IDX = 19,
  493. NES_IWARP_SQ_WQE_FRAG1_LOW_IDX = 20,
  494. NES_IWARP_SQ_WQE_FRAG1_HIGH_IDX = 21,
  495. NES_IWARP_SQ_WQE_LENGTH1_IDX = 22,
  496. NES_IWARP_SQ_WQE_STAG1_IDX = 23,
  497. NES_IWARP_SQ_WQE_FRAG2_LOW_IDX = 24,
  498. NES_IWARP_SQ_WQE_FRAG2_HIGH_IDX = 25,
  499. NES_IWARP_SQ_WQE_LENGTH2_IDX = 26,
  500. NES_IWARP_SQ_WQE_STAG2_IDX = 27,
  501. NES_IWARP_SQ_WQE_FRAG3_LOW_IDX = 28,
  502. NES_IWARP_SQ_WQE_FRAG3_HIGH_IDX = 29,
  503. NES_IWARP_SQ_WQE_LENGTH3_IDX = 30,
  504. NES_IWARP_SQ_WQE_STAG3_IDX = 31,
  505. };
  506. enum nes_iwarp_sq_bind_wqe_word_idx {
  507. NES_IWARP_SQ_BIND_WQE_MR_IDX = 6,
  508. NES_IWARP_SQ_BIND_WQE_MW_IDX = 7,
  509. NES_IWARP_SQ_BIND_WQE_LENGTH_LOW_IDX = 8,
  510. NES_IWARP_SQ_BIND_WQE_LENGTH_HIGH_IDX = 9,
  511. NES_IWARP_SQ_BIND_WQE_VA_FBO_LOW_IDX = 10,
  512. NES_IWARP_SQ_BIND_WQE_VA_FBO_HIGH_IDX = 11,
  513. };
  514. enum nes_iwarp_sq_fmr_wqe_word_idx {
  515. NES_IWARP_SQ_FMR_WQE_MR_STAG_IDX = 7,
  516. NES_IWARP_SQ_FMR_WQE_LENGTH_LOW_IDX = 8,
  517. NES_IWARP_SQ_FMR_WQE_LENGTH_HIGH_IDX = 9,
  518. NES_IWARP_SQ_FMR_WQE_VA_FBO_LOW_IDX = 10,
  519. NES_IWARP_SQ_FMR_WQE_VA_FBO_HIGH_IDX = 11,
  520. NES_IWARP_SQ_FMR_WQE_PBL_ADDR_LOW_IDX = 12,
  521. NES_IWARP_SQ_FMR_WQE_PBL_ADDR_HIGH_IDX = 13,
  522. NES_IWARP_SQ_FMR_WQE_PBL_LENGTH_IDX = 14,
  523. };
  524. enum nes_iwarp_sq_fmr_opcodes {
  525. NES_IWARP_SQ_FMR_WQE_ZERO_BASED = (1<<6),
  526. NES_IWARP_SQ_FMR_WQE_PAGE_SIZE_4K = (0<<7),
  527. NES_IWARP_SQ_FMR_WQE_PAGE_SIZE_2M = (1<<7),
  528. NES_IWARP_SQ_FMR_WQE_RIGHTS_ENABLE_LOCAL_READ = (1<<16),
  529. NES_IWARP_SQ_FMR_WQE_RIGHTS_ENABLE_LOCAL_WRITE = (1<<17),
  530. NES_IWARP_SQ_FMR_WQE_RIGHTS_ENABLE_REMOTE_READ = (1<<18),
  531. NES_IWARP_SQ_FMR_WQE_RIGHTS_ENABLE_REMOTE_WRITE = (1<<19),
  532. NES_IWARP_SQ_FMR_WQE_RIGHTS_ENABLE_WINDOW_BIND = (1<<20),
  533. };
  534. #define NES_IWARP_SQ_FMR_WQE_MR_LENGTH_HIGH_MASK 0xFF;
  535. enum nes_iwarp_sq_locinv_wqe_word_idx {
  536. NES_IWARP_SQ_LOCINV_WQE_INV_STAG_IDX = 6,
  537. };
  538. enum nes_iwarp_rq_wqe_word_idx {
  539. NES_IWARP_RQ_WQE_TOTAL_PAYLOAD_IDX = 1,
  540. NES_IWARP_RQ_WQE_COMP_CTX_LOW_IDX = 2,
  541. NES_IWARP_RQ_WQE_COMP_CTX_HIGH_IDX = 3,
  542. NES_IWARP_RQ_WQE_COMP_SCRATCH_LOW_IDX = 4,
  543. NES_IWARP_RQ_WQE_COMP_SCRATCH_HIGH_IDX = 5,
  544. NES_IWARP_RQ_WQE_FRAG0_LOW_IDX = 8,
  545. NES_IWARP_RQ_WQE_FRAG0_HIGH_IDX = 9,
  546. NES_IWARP_RQ_WQE_LENGTH0_IDX = 10,
  547. NES_IWARP_RQ_WQE_STAG0_IDX = 11,
  548. NES_IWARP_RQ_WQE_FRAG1_LOW_IDX = 12,
  549. NES_IWARP_RQ_WQE_FRAG1_HIGH_IDX = 13,
  550. NES_IWARP_RQ_WQE_LENGTH1_IDX = 14,
  551. NES_IWARP_RQ_WQE_STAG1_IDX = 15,
  552. NES_IWARP_RQ_WQE_FRAG2_LOW_IDX = 16,
  553. NES_IWARP_RQ_WQE_FRAG2_HIGH_IDX = 17,
  554. NES_IWARP_RQ_WQE_LENGTH2_IDX = 18,
  555. NES_IWARP_RQ_WQE_STAG2_IDX = 19,
  556. NES_IWARP_RQ_WQE_FRAG3_LOW_IDX = 20,
  557. NES_IWARP_RQ_WQE_FRAG3_HIGH_IDX = 21,
  558. NES_IWARP_RQ_WQE_LENGTH3_IDX = 22,
  559. NES_IWARP_RQ_WQE_STAG3_IDX = 23,
  560. };
  561. enum nes_nic_sq_wqe_bits {
  562. NES_NIC_SQ_WQE_PHDR_CS_READY = (1<<21),
  563. NES_NIC_SQ_WQE_LSO_ENABLE = (1<<22),
  564. NES_NIC_SQ_WQE_TAGVALUE_ENABLE = (1<<23),
  565. NES_NIC_SQ_WQE_DISABLE_CHKSUM = (1<<30),
  566. NES_NIC_SQ_WQE_COMPLETION = (1<<31),
  567. };
  568. enum nes_nic_cqe_word_idx {
  569. NES_NIC_CQE_ACCQP_ID_IDX = 0,
  570. NES_NIC_CQE_HASH_RCVNXT = 1,
  571. NES_NIC_CQE_TAG_PKT_TYPE_IDX = 2,
  572. NES_NIC_CQE_MISC_IDX = 3,
  573. };
  574. #define NES_PKT_TYPE_APBVT_BITS 0xC112
  575. #define NES_PKT_TYPE_APBVT_MASK 0xff3e
  576. #define NES_PKT_TYPE_PVALID_BITS 0x10000000
  577. #define NES_PKT_TYPE_PVALID_MASK 0x30000000
  578. #define NES_PKT_TYPE_TCPV4_BITS 0x0110
  579. #define NES_PKT_TYPE_TCPV4_MASK 0x3f30
  580. #define NES_PKT_TYPE_UDPV4_BITS 0x0210
  581. #define NES_PKT_TYPE_UDPV4_MASK 0x3f30
  582. #define NES_PKT_TYPE_IPV4_BITS 0x0010
  583. #define NES_PKT_TYPE_IPV4_MASK 0x3f30
  584. #define NES_PKT_TYPE_OTHER_BITS 0x0000
  585. #define NES_PKT_TYPE_OTHER_MASK 0x0030
  586. #define NES_NIC_CQE_ERRV_SHIFT 16
  587. enum nes_nic_ev_bits {
  588. NES_NIC_ERRV_BITS_MODE = (1<<0),
  589. NES_NIC_ERRV_BITS_IPV4_CSUM_ERR = (1<<1),
  590. NES_NIC_ERRV_BITS_TCPUDP_CSUM_ERR = (1<<2),
  591. NES_NIC_ERRV_BITS_WQE_OVERRUN = (1<<3),
  592. NES_NIC_ERRV_BITS_IPH_ERR = (1<<4),
  593. };
  594. enum nes_nic_cqe_bits {
  595. NES_NIC_CQE_ERRV_MASK = (0xff<<NES_NIC_CQE_ERRV_SHIFT),
  596. NES_NIC_CQE_SQ = (1<<24),
  597. NES_NIC_CQE_ACCQP_PORT = (1<<28),
  598. NES_NIC_CQE_ACCQP_VALID = (1<<29),
  599. NES_NIC_CQE_TAG_VALID = (1<<30),
  600. NES_NIC_CQE_VALID = (1<<31),
  601. };
  602. enum nes_aeqe_word_idx {
  603. NES_AEQE_COMP_CTXT_LOW_IDX = 0,
  604. NES_AEQE_COMP_CTXT_HIGH_IDX = 1,
  605. NES_AEQE_COMP_QP_CQ_ID_IDX = 2,
  606. NES_AEQE_MISC_IDX = 3,
  607. };
  608. enum nes_aeqe_bits {
  609. NES_AEQE_QP = (1<<16),
  610. NES_AEQE_CQ = (1<<17),
  611. NES_AEQE_SQ = (1<<18),
  612. NES_AEQE_INBOUND_RDMA = (1<<19),
  613. NES_AEQE_IWARP_STATE_MASK = (7<<20),
  614. NES_AEQE_TCP_STATE_MASK = (0xf<<24),
  615. NES_AEQE_Q2_DATA_WRITTEN = (0x3<<28),
  616. NES_AEQE_VALID = (1<<31),
  617. };
  618. #define NES_AEQE_IWARP_STATE_SHIFT 20
  619. #define NES_AEQE_TCP_STATE_SHIFT 24
  620. #define NES_AEQE_Q2_DATA_ETHERNET (1<<28)
  621. #define NES_AEQE_Q2_DATA_MPA (1<<29)
  622. enum nes_aeqe_iwarp_state {
  623. NES_AEQE_IWARP_STATE_NON_EXISTANT = 0,
  624. NES_AEQE_IWARP_STATE_IDLE = 1,
  625. NES_AEQE_IWARP_STATE_RTS = 2,
  626. NES_AEQE_IWARP_STATE_CLOSING = 3,
  627. NES_AEQE_IWARP_STATE_TERMINATE = 5,
  628. NES_AEQE_IWARP_STATE_ERROR = 6
  629. };
  630. enum nes_aeqe_tcp_state {
  631. NES_AEQE_TCP_STATE_NON_EXISTANT = 0,
  632. NES_AEQE_TCP_STATE_CLOSED = 1,
  633. NES_AEQE_TCP_STATE_LISTEN = 2,
  634. NES_AEQE_TCP_STATE_SYN_SENT = 3,
  635. NES_AEQE_TCP_STATE_SYN_RCVD = 4,
  636. NES_AEQE_TCP_STATE_ESTABLISHED = 5,
  637. NES_AEQE_TCP_STATE_CLOSE_WAIT = 6,
  638. NES_AEQE_TCP_STATE_FIN_WAIT_1 = 7,
  639. NES_AEQE_TCP_STATE_CLOSING = 8,
  640. NES_AEQE_TCP_STATE_LAST_ACK = 9,
  641. NES_AEQE_TCP_STATE_FIN_WAIT_2 = 10,
  642. NES_AEQE_TCP_STATE_TIME_WAIT = 11
  643. };
  644. enum nes_aeqe_aeid {
  645. NES_AEQE_AEID_AMP_UNALLOCATED_STAG = 0x0102,
  646. NES_AEQE_AEID_AMP_INVALID_STAG = 0x0103,
  647. NES_AEQE_AEID_AMP_BAD_QP = 0x0104,
  648. NES_AEQE_AEID_AMP_BAD_PD = 0x0105,
  649. NES_AEQE_AEID_AMP_BAD_STAG_KEY = 0x0106,
  650. NES_AEQE_AEID_AMP_BAD_STAG_INDEX = 0x0107,
  651. NES_AEQE_AEID_AMP_BOUNDS_VIOLATION = 0x0108,
  652. NES_AEQE_AEID_AMP_RIGHTS_VIOLATION = 0x0109,
  653. NES_AEQE_AEID_AMP_TO_WRAP = 0x010a,
  654. NES_AEQE_AEID_AMP_FASTREG_SHARED = 0x010b,
  655. NES_AEQE_AEID_AMP_FASTREG_VALID_STAG = 0x010c,
  656. NES_AEQE_AEID_AMP_FASTREG_MW_STAG = 0x010d,
  657. NES_AEQE_AEID_AMP_FASTREG_INVALID_RIGHTS = 0x010e,
  658. NES_AEQE_AEID_AMP_FASTREG_PBL_TABLE_OVERFLOW = 0x010f,
  659. NES_AEQE_AEID_AMP_FASTREG_INVALID_LENGTH = 0x0110,
  660. NES_AEQE_AEID_AMP_INVALIDATE_SHARED = 0x0111,
  661. NES_AEQE_AEID_AMP_INVALIDATE_NO_REMOTE_ACCESS_RIGHTS = 0x0112,
  662. NES_AEQE_AEID_AMP_INVALIDATE_MR_WITH_BOUND_WINDOWS = 0x0113,
  663. NES_AEQE_AEID_AMP_MWBIND_VALID_STAG = 0x0114,
  664. NES_AEQE_AEID_AMP_MWBIND_OF_MR_STAG = 0x0115,
  665. NES_AEQE_AEID_AMP_MWBIND_TO_ZERO_BASED_STAG = 0x0116,
  666. NES_AEQE_AEID_AMP_MWBIND_TO_MW_STAG = 0x0117,
  667. NES_AEQE_AEID_AMP_MWBIND_INVALID_RIGHTS = 0x0118,
  668. NES_AEQE_AEID_AMP_MWBIND_INVALID_BOUNDS = 0x0119,
  669. NES_AEQE_AEID_AMP_MWBIND_TO_INVALID_PARENT = 0x011a,
  670. NES_AEQE_AEID_AMP_MWBIND_BIND_DISABLED = 0x011b,
  671. NES_AEQE_AEID_BAD_CLOSE = 0x0201,
  672. NES_AEQE_AEID_RDMAP_ROE_BAD_LLP_CLOSE = 0x0202,
  673. NES_AEQE_AEID_CQ_OPERATION_ERROR = 0x0203,
  674. NES_AEQE_AEID_PRIV_OPERATION_DENIED = 0x0204,
  675. NES_AEQE_AEID_RDMA_READ_WHILE_ORD_ZERO = 0x0205,
  676. NES_AEQE_AEID_STAG_ZERO_INVALID = 0x0206,
  677. NES_AEQE_AEID_DDP_INVALID_MSN_GAP_IN_MSN = 0x0301,
  678. NES_AEQE_AEID_DDP_INVALID_MSN_RANGE_IS_NOT_VALID = 0x0302,
  679. NES_AEQE_AEID_DDP_UBE_DDP_MESSAGE_TOO_LONG_FOR_AVAILABLE_BUFFER = 0x0303,
  680. NES_AEQE_AEID_DDP_UBE_INVALID_DDP_VERSION = 0x0304,
  681. NES_AEQE_AEID_DDP_UBE_INVALID_MO = 0x0305,
  682. NES_AEQE_AEID_DDP_UBE_INVALID_MSN_NO_BUFFER_AVAILABLE = 0x0306,
  683. NES_AEQE_AEID_DDP_UBE_INVALID_QN = 0x0307,
  684. NES_AEQE_AEID_DDP_NO_L_BIT = 0x0308,
  685. NES_AEQE_AEID_RDMAP_ROE_INVALID_RDMAP_VERSION = 0x0311,
  686. NES_AEQE_AEID_RDMAP_ROE_UNEXPECTED_OPCODE = 0x0312,
  687. NES_AEQE_AEID_ROE_INVALID_RDMA_READ_REQUEST = 0x0313,
  688. NES_AEQE_AEID_ROE_INVALID_RDMA_WRITE_OR_READ_RESP = 0x0314,
  689. NES_AEQE_AEID_INVALID_ARP_ENTRY = 0x0401,
  690. NES_AEQE_AEID_INVALID_TCP_OPTION_RCVD = 0x0402,
  691. NES_AEQE_AEID_STALE_ARP_ENTRY = 0x0403,
  692. NES_AEQE_AEID_LLP_CLOSE_COMPLETE = 0x0501,
  693. NES_AEQE_AEID_LLP_CONNECTION_RESET = 0x0502,
  694. NES_AEQE_AEID_LLP_FIN_RECEIVED = 0x0503,
  695. NES_AEQE_AEID_LLP_RECEIVED_MARKER_AND_LENGTH_FIELDS_DONT_MATCH = 0x0504,
  696. NES_AEQE_AEID_LLP_RECEIVED_MPA_CRC_ERROR = 0x0505,
  697. NES_AEQE_AEID_LLP_SEGMENT_TOO_LARGE = 0x0506,
  698. NES_AEQE_AEID_LLP_SEGMENT_TOO_SMALL = 0x0507,
  699. NES_AEQE_AEID_LLP_SYN_RECEIVED = 0x0508,
  700. NES_AEQE_AEID_LLP_TERMINATE_RECEIVED = 0x0509,
  701. NES_AEQE_AEID_LLP_TOO_MANY_RETRIES = 0x050a,
  702. NES_AEQE_AEID_LLP_TOO_MANY_KEEPALIVE_RETRIES = 0x050b,
  703. NES_AEQE_AEID_RESET_SENT = 0x0601,
  704. NES_AEQE_AEID_TERMINATE_SENT = 0x0602,
  705. NES_AEQE_AEID_DDP_LCE_LOCAL_CATASTROPHIC = 0x0700
  706. };
  707. enum nes_iwarp_sq_opcodes {
  708. NES_IWARP_SQ_WQE_WRPDU = (1<<15),
  709. NES_IWARP_SQ_WQE_PSH = (1<<21),
  710. NES_IWARP_SQ_WQE_STREAMING = (1<<23),
  711. NES_IWARP_SQ_WQE_IMM_DATA = (1<<28),
  712. NES_IWARP_SQ_WQE_READ_FENCE = (1<<29),
  713. NES_IWARP_SQ_WQE_LOCAL_FENCE = (1<<30),
  714. NES_IWARP_SQ_WQE_SIGNALED_COMPL = (1<<31),
  715. };
  716. enum nes_iwarp_sq_wqe_bits {
  717. NES_IWARP_SQ_OP_RDMAW = 0,
  718. NES_IWARP_SQ_OP_RDMAR = 1,
  719. NES_IWARP_SQ_OP_SEND = 3,
  720. NES_IWARP_SQ_OP_SENDINV = 4,
  721. NES_IWARP_SQ_OP_SENDSE = 5,
  722. NES_IWARP_SQ_OP_SENDSEINV = 6,
  723. NES_IWARP_SQ_OP_BIND = 8,
  724. NES_IWARP_SQ_OP_FAST_REG = 9,
  725. NES_IWARP_SQ_OP_LOCINV = 10,
  726. NES_IWARP_SQ_OP_RDMAR_LOCINV = 11,
  727. NES_IWARP_SQ_OP_NOP = 12,
  728. };
  729. enum nes_iwarp_cqe_major_code {
  730. NES_IWARP_CQE_MAJOR_FLUSH = 1,
  731. NES_IWARP_CQE_MAJOR_DRV = 0x8000
  732. };
  733. enum nes_iwarp_cqe_minor_code {
  734. NES_IWARP_CQE_MINOR_FLUSH = 1
  735. };
  736. #define NES_EEPROM_READ_REQUEST (1<<16)
  737. #define NES_MAC_ADDR_VALID (1<<20)
  738. /*
  739. * NES index registers init values.
  740. */
  741. struct nes_init_values {
  742. u32 index;
  743. u32 data;
  744. u8 wrt;
  745. };
  746. /*
  747. * NES registers in BAR0.
  748. */
  749. struct nes_pci_regs {
  750. u32 int_status;
  751. u32 int_mask;
  752. u32 int_pending;
  753. u32 intf_int_status;
  754. u32 intf_int_mask;
  755. u32 other_regs[59]; /* pad out to 256 bytes for now */
  756. };
  757. #define NES_CQP_SQ_SIZE 128
  758. #define NES_CCQ_SIZE 128
  759. #define NES_NIC_WQ_SIZE 512
  760. #define NES_NIC_CTX_SIZE ((NES_NIC_CTX_RQ_SIZE_512) | (NES_NIC_CTX_SQ_SIZE_512))
  761. #define NES_NIC_BACK_STORE 0x00038000
  762. struct nes_device;
  763. struct nes_hw_nic_qp_context {
  764. __le32 context_words[6];
  765. };
  766. struct nes_hw_nic_sq_wqe {
  767. __le32 wqe_words[16];
  768. };
  769. struct nes_hw_nic_rq_wqe {
  770. __le32 wqe_words[16];
  771. };
  772. struct nes_hw_nic_cqe {
  773. __le32 cqe_words[4];
  774. };
  775. struct nes_hw_cqp_qp_context {
  776. __le32 context_words[4];
  777. };
  778. struct nes_hw_cqp_wqe {
  779. __le32 wqe_words[16];
  780. };
  781. struct nes_hw_qp_wqe {
  782. __le32 wqe_words[32];
  783. };
  784. struct nes_hw_cqe {
  785. __le32 cqe_words[8];
  786. };
  787. struct nes_hw_ceqe {
  788. __le32 ceqe_words[2];
  789. };
  790. struct nes_hw_aeqe {
  791. __le32 aeqe_words[4];
  792. };
  793. struct nes_cqp_request {
  794. union {
  795. u64 cqp_callback_context;
  796. void *cqp_callback_pointer;
  797. };
  798. wait_queue_head_t waitq;
  799. struct nes_hw_cqp_wqe cqp_wqe;
  800. struct list_head list;
  801. atomic_t refcount;
  802. void (*cqp_callback)(struct nes_device *nesdev, struct nes_cqp_request *cqp_request);
  803. u16 major_code;
  804. u16 minor_code;
  805. u8 waiting;
  806. u8 request_done;
  807. u8 dynamic;
  808. u8 callback;
  809. };
  810. struct nes_hw_cqp {
  811. struct nes_hw_cqp_wqe *sq_vbase;
  812. dma_addr_t sq_pbase;
  813. spinlock_t lock;
  814. wait_queue_head_t waitq;
  815. u16 qp_id;
  816. u16 sq_head;
  817. u16 sq_tail;
  818. u16 sq_size;
  819. };
  820. #define NES_FIRST_FRAG_SIZE 128
  821. struct nes_first_frag {
  822. u8 buffer[NES_FIRST_FRAG_SIZE];
  823. };
  824. struct nes_hw_nic {
  825. struct nes_first_frag *first_frag_vbase; /* virtual address of first frags */
  826. struct nes_hw_nic_sq_wqe *sq_vbase; /* virtual address of sq */
  827. struct nes_hw_nic_rq_wqe *rq_vbase; /* virtual address of rq */
  828. struct sk_buff *tx_skb[NES_NIC_WQ_SIZE];
  829. struct sk_buff *rx_skb[NES_NIC_WQ_SIZE];
  830. dma_addr_t frag_paddr[NES_NIC_WQ_SIZE];
  831. unsigned long first_frag_overflow[BITS_TO_LONGS(NES_NIC_WQ_SIZE)];
  832. dma_addr_t sq_pbase; /* PCI memory for host rings */
  833. dma_addr_t rq_pbase; /* PCI memory for host rings */
  834. u16 qp_id;
  835. u16 sq_head;
  836. u16 sq_tail;
  837. u16 sq_size;
  838. u16 rq_head;
  839. u16 rq_tail;
  840. u16 rq_size;
  841. u8 replenishing_rq;
  842. u8 reserved;
  843. spinlock_t rq_lock;
  844. };
  845. struct nes_hw_nic_cq {
  846. struct nes_hw_nic_cqe volatile *cq_vbase; /* PCI memory for host rings */
  847. void (*ce_handler)(struct nes_device *nesdev, struct nes_hw_nic_cq *cq);
  848. dma_addr_t cq_pbase; /* PCI memory for host rings */
  849. int rx_cqes_completed;
  850. int cqe_allocs_pending;
  851. int rx_pkts_indicated;
  852. u16 cq_head;
  853. u16 cq_size;
  854. u16 cq_number;
  855. u8 cqes_pending;
  856. };
  857. struct nes_hw_qp {
  858. struct nes_hw_qp_wqe *sq_vbase; /* PCI memory for host rings */
  859. struct nes_hw_qp_wqe *rq_vbase; /* PCI memory for host rings */
  860. void *q2_vbase; /* PCI memory for host rings */
  861. dma_addr_t sq_pbase; /* PCI memory for host rings */
  862. dma_addr_t rq_pbase; /* PCI memory for host rings */
  863. dma_addr_t q2_pbase; /* PCI memory for host rings */
  864. u32 qp_id;
  865. u16 sq_head;
  866. u16 sq_tail;
  867. u16 sq_size;
  868. u16 rq_head;
  869. u16 rq_tail;
  870. u16 rq_size;
  871. u8 rq_encoded_size;
  872. u8 sq_encoded_size;
  873. };
  874. struct nes_hw_cq {
  875. struct nes_hw_cqe *cq_vbase; /* PCI memory for host rings */
  876. void (*ce_handler)(struct nes_device *nesdev, struct nes_hw_cq *cq);
  877. dma_addr_t cq_pbase; /* PCI memory for host rings */
  878. u16 cq_head;
  879. u16 cq_size;
  880. u16 cq_number;
  881. };
  882. struct nes_hw_ceq {
  883. struct nes_hw_ceqe volatile *ceq_vbase; /* PCI memory for host rings */
  884. dma_addr_t ceq_pbase; /* PCI memory for host rings */
  885. u16 ceq_head;
  886. u16 ceq_size;
  887. };
  888. struct nes_hw_aeq {
  889. struct nes_hw_aeqe volatile *aeq_vbase; /* PCI memory for host rings */
  890. dma_addr_t aeq_pbase; /* PCI memory for host rings */
  891. u16 aeq_head;
  892. u16 aeq_size;
  893. };
  894. struct nic_qp_map {
  895. u8 qpid;
  896. u8 nic_index;
  897. u8 logical_port;
  898. u8 is_hnic;
  899. };
  900. #define NES_CQP_ARP_AEQ_INDEX_MASK 0x000f0000
  901. #define NES_CQP_ARP_AEQ_INDEX_SHIFT 16
  902. #define NES_CQP_APBVT_ADD 0x00008000
  903. #define NES_CQP_APBVT_NIC_SHIFT 16
  904. #define NES_ARP_ADD 1
  905. #define NES_ARP_DELETE 2
  906. #define NES_ARP_RESOLVE 3
  907. #define NES_MAC_SW_IDLE 0
  908. #define NES_MAC_SW_INTERRUPT 1
  909. #define NES_MAC_SW_MH 2
  910. struct nes_arp_entry {
  911. u32 ip_addr;
  912. u8 mac_addr[ETH_ALEN];
  913. };
  914. #define NES_NIC_FAST_TIMER 96
  915. #define NES_NIC_FAST_TIMER_LOW 40
  916. #define NES_NIC_FAST_TIMER_HIGH 1000
  917. #define DEFAULT_NES_QL_HIGH 256
  918. #define DEFAULT_NES_QL_LOW 16
  919. #define DEFAULT_NES_QL_TARGET 64
  920. #define DEFAULT_JUMBO_NES_QL_LOW 12
  921. #define DEFAULT_JUMBO_NES_QL_TARGET 40
  922. #define DEFAULT_JUMBO_NES_QL_HIGH 128
  923. #define NES_NIC_CQ_DOWNWARD_TREND 16
  924. #define NES_PFT_SIZE 48
  925. #define NES_MGT_WQ_COUNT 32
  926. #define NES_MGT_CTX_SIZE ((NES_NIC_CTX_RQ_SIZE_32) | (NES_NIC_CTX_SQ_SIZE_32))
  927. #define NES_MGT_QP_OFFSET 36
  928. #define NES_MGT_QP_COUNT 4
  929. struct nes_hw_tune_timer {
  930. /* u16 cq_count; */
  931. u16 threshold_low;
  932. u16 threshold_target;
  933. u16 threshold_high;
  934. u16 timer_in_use;
  935. u16 timer_in_use_old;
  936. u16 timer_in_use_min;
  937. u16 timer_in_use_max;
  938. u8 timer_direction_upward;
  939. u8 timer_direction_downward;
  940. u16 cq_count_old;
  941. u8 cq_direction_downward;
  942. };
  943. #define NES_TIMER_INT_LIMIT 2
  944. #define NES_TIMER_INT_LIMIT_DYNAMIC 10
  945. #define NES_TIMER_ENABLE_LIMIT 4
  946. #define NES_MAX_LINK_INTERRUPTS 128
  947. #define NES_MAX_LINK_CHECK 200
  948. struct nes_adapter {
  949. u64 fw_ver;
  950. unsigned long *allocated_qps;
  951. unsigned long *allocated_cqs;
  952. unsigned long *allocated_mrs;
  953. unsigned long *allocated_pds;
  954. unsigned long *allocated_arps;
  955. struct nes_qp **qp_table;
  956. struct workqueue_struct *work_q;
  957. struct list_head list;
  958. struct list_head active_listeners;
  959. /* list of the netdev's associated with each logical port */
  960. struct list_head nesvnic_list[4];
  961. struct timer_list mh_timer;
  962. struct timer_list lc_timer;
  963. struct work_struct work;
  964. spinlock_t resource_lock;
  965. spinlock_t phy_lock;
  966. spinlock_t pbl_lock;
  967. spinlock_t periodic_timer_lock;
  968. struct nes_arp_entry arp_table[NES_MAX_ARP_TABLE_SIZE];
  969. /* Adapter CEQ and AEQs */
  970. struct nes_hw_ceq ceq[16];
  971. struct nes_hw_aeq aeq[8];
  972. struct nes_hw_tune_timer tune_timer;
  973. unsigned long doorbell_start;
  974. u32 hw_rev;
  975. u32 vendor_id;
  976. u32 vendor_part_id;
  977. u32 device_cap_flags;
  978. u32 tick_delta;
  979. u32 timer_int_req;
  980. u32 arp_table_size;
  981. u32 next_arp_index;
  982. u32 max_mr;
  983. u32 max_256pbl;
  984. u32 max_4kpbl;
  985. u32 free_256pbl;
  986. u32 free_4kpbl;
  987. u32 max_mr_size;
  988. u32 max_qp;
  989. u32 next_qp;
  990. u32 max_irrq;
  991. u32 max_qp_wr;
  992. u32 max_sge;
  993. u32 max_cq;
  994. u32 next_cq;
  995. u32 max_cqe;
  996. u32 max_pd;
  997. u32 base_pd;
  998. u32 next_pd;
  999. u32 hte_index_mask;
  1000. /* EEPROM information */
  1001. u32 rx_pool_size;
  1002. u32 tx_pool_size;
  1003. u32 rx_threshold;
  1004. u32 tcp_timer_core_clk_divisor;
  1005. u32 iwarp_config;
  1006. u32 cm_config;
  1007. u32 sws_timer_config;
  1008. u32 tcp_config1;
  1009. u32 wqm_wat;
  1010. u32 core_clock;
  1011. u32 firmware_version;
  1012. u32 eeprom_version;
  1013. u32 nic_rx_eth_route_err;
  1014. u32 et_rx_coalesce_usecs;
  1015. u32 et_rx_max_coalesced_frames;
  1016. u32 et_rx_coalesce_usecs_irq;
  1017. u32 et_rx_max_coalesced_frames_irq;
  1018. u32 et_pkt_rate_low;
  1019. u32 et_rx_coalesce_usecs_low;
  1020. u32 et_rx_max_coalesced_frames_low;
  1021. u32 et_pkt_rate_high;
  1022. u32 et_rx_coalesce_usecs_high;
  1023. u32 et_rx_max_coalesced_frames_high;
  1024. u32 et_rate_sample_interval;
  1025. u32 timer_int_limit;
  1026. u32 wqm_quanta;
  1027. u8 allow_unaligned_fpdus;
  1028. /* Adapter base MAC address */
  1029. u32 mac_addr_low;
  1030. u16 mac_addr_high;
  1031. u16 firmware_eeprom_offset;
  1032. u16 software_eeprom_offset;
  1033. u16 max_irrq_wr;
  1034. /* pd config for each port */
  1035. u16 pd_config_size[4];
  1036. u16 pd_config_base[4];
  1037. u16 link_interrupt_count[4];
  1038. u8 crit_error_count[32];
  1039. /* the phy index for each port */
  1040. u8 phy_index[4];
  1041. u8 mac_sw_state[4];
  1042. u8 mac_link_down[4];
  1043. u8 phy_type[4];
  1044. u8 log_port;
  1045. /* PCI information */
  1046. struct nes_device *nesdev;
  1047. unsigned int devfn;
  1048. unsigned char bus_number;
  1049. unsigned char OneG_Mode;
  1050. unsigned char ref_count;
  1051. u8 netdev_count;
  1052. u8 netdev_max; /* from host nic address count in EEPROM */
  1053. u8 port_count;
  1054. u8 virtwq;
  1055. u8 send_term_ok;
  1056. u8 et_use_adaptive_rx_coalesce;
  1057. u8 adapter_fcn_count;
  1058. u8 pft_mcast_map[NES_PFT_SIZE];
  1059. };
  1060. struct nes_pbl {
  1061. u64 *pbl_vbase;
  1062. dma_addr_t pbl_pbase;
  1063. struct page *page;
  1064. unsigned long user_base;
  1065. u32 pbl_size;
  1066. struct list_head list;
  1067. /* TODO: need to add list for two level tables */
  1068. };
  1069. #define NES_4K_PBL_CHUNK_SIZE 4096
  1070. struct nes_fast_mr_wqe_pbl {
  1071. u64 *kva;
  1072. dma_addr_t paddr;
  1073. };
  1074. struct nes_listener {
  1075. struct work_struct work;
  1076. struct workqueue_struct *wq;
  1077. struct nes_vnic *nesvnic;
  1078. struct iw_cm_id *cm_id;
  1079. struct list_head list;
  1080. unsigned long socket;
  1081. u8 accept_failed;
  1082. };
  1083. struct nes_ib_device;
  1084. #define NES_EVENT_DELAY msecs_to_jiffies(100)
  1085. struct nes_vnic {
  1086. struct nes_ib_device *nesibdev;
  1087. u64 sq_full;
  1088. u64 tso_requests;
  1089. u64 segmented_tso_requests;
  1090. u64 linearized_skbs;
  1091. u64 tx_sw_dropped;
  1092. u64 endnode_nstat_rx_discard;
  1093. u64 endnode_nstat_rx_octets;
  1094. u64 endnode_nstat_rx_frames;
  1095. u64 endnode_nstat_tx_octets;
  1096. u64 endnode_nstat_tx_frames;
  1097. u64 endnode_ipv4_tcp_retransmits;
  1098. /* void *mem; */
  1099. struct nes_device *nesdev;
  1100. struct net_device *netdev;
  1101. atomic_t rx_skbs_needed;
  1102. atomic_t rx_skb_timer_running;
  1103. int budget;
  1104. u32 msg_enable;
  1105. /* u32 tx_avail; */
  1106. __be32 local_ipaddr;
  1107. struct napi_struct napi;
  1108. spinlock_t tx_lock; /* could use netdev tx lock? */
  1109. struct timer_list rq_wqes_timer;
  1110. u32 nic_mem_size;
  1111. void *nic_vbase;
  1112. dma_addr_t nic_pbase;
  1113. struct nes_hw_nic nic;
  1114. struct nes_hw_nic_cq nic_cq;
  1115. u32 mcrq_qp_id;
  1116. struct nes_ucontext *mcrq_ucontext;
  1117. struct nes_cqp_request* (*get_cqp_request)(struct nes_device *nesdev);
  1118. void (*post_cqp_request)(struct nes_device*, struct nes_cqp_request *);
  1119. int (*mcrq_mcast_filter)( struct nes_vnic* nesvnic, __u8* dmi_addr );
  1120. struct net_device_stats netstats;
  1121. /* used to put the netdev on the adapters logical port list */
  1122. struct list_head list;
  1123. u16 max_frame_size;
  1124. u8 netdev_open;
  1125. u8 linkup;
  1126. u8 logical_port;
  1127. u8 netdev_index; /* might not be needed, indexes nesdev->netdev */
  1128. u8 perfect_filter_index;
  1129. u8 nic_index;
  1130. u8 qp_nic_index[4];
  1131. u8 next_qp_nic_index;
  1132. u8 of_device_registered;
  1133. u8 rdma_enabled;
  1134. struct timer_list event_timer;
  1135. enum ib_event_type delayed_event;
  1136. enum ib_event_type last_dispatched_event;
  1137. spinlock_t port_ibevent_lock;
  1138. u32 mgt_mem_size;
  1139. void *mgt_vbase;
  1140. dma_addr_t mgt_pbase;
  1141. struct nes_vnic_mgt *mgtvnic[NES_MGT_QP_COUNT];
  1142. struct task_struct *mgt_thread;
  1143. wait_queue_head_t mgt_wait_queue;
  1144. struct sk_buff_head mgt_skb_list;
  1145. };
  1146. struct nes_ib_device {
  1147. struct ib_device ibdev;
  1148. struct nes_vnic *nesvnic;
  1149. /* Virtual RNIC Limits */
  1150. u32 max_mr;
  1151. u32 max_qp;
  1152. u32 max_cq;
  1153. u32 max_pd;
  1154. u32 num_mr;
  1155. u32 num_qp;
  1156. u32 num_cq;
  1157. u32 num_pd;
  1158. };
  1159. enum nes_hdrct_flags {
  1160. DDP_LEN_FLAG = 0x80,
  1161. DDP_HDR_FLAG = 0x40,
  1162. RDMA_HDR_FLAG = 0x20
  1163. };
  1164. enum nes_term_layers {
  1165. LAYER_RDMA = 0,
  1166. LAYER_DDP = 1,
  1167. LAYER_MPA = 2
  1168. };
  1169. enum nes_term_error_types {
  1170. RDMAP_CATASTROPHIC = 0,
  1171. RDMAP_REMOTE_PROT = 1,
  1172. RDMAP_REMOTE_OP = 2,
  1173. DDP_CATASTROPHIC = 0,
  1174. DDP_TAGGED_BUFFER = 1,
  1175. DDP_UNTAGGED_BUFFER = 2,
  1176. DDP_LLP = 3
  1177. };
  1178. enum nes_term_rdma_errors {
  1179. RDMAP_INV_STAG = 0x00,
  1180. RDMAP_INV_BOUNDS = 0x01,
  1181. RDMAP_ACCESS = 0x02,
  1182. RDMAP_UNASSOC_STAG = 0x03,
  1183. RDMAP_TO_WRAP = 0x04,
  1184. RDMAP_INV_RDMAP_VER = 0x05,
  1185. RDMAP_UNEXPECTED_OP = 0x06,
  1186. RDMAP_CATASTROPHIC_LOCAL = 0x07,
  1187. RDMAP_CATASTROPHIC_GLOBAL = 0x08,
  1188. RDMAP_CANT_INV_STAG = 0x09,
  1189. RDMAP_UNSPECIFIED = 0xff
  1190. };
  1191. enum nes_term_ddp_errors {
  1192. DDP_CATASTROPHIC_LOCAL = 0x00,
  1193. DDP_TAGGED_INV_STAG = 0x00,
  1194. DDP_TAGGED_BOUNDS = 0x01,
  1195. DDP_TAGGED_UNASSOC_STAG = 0x02,
  1196. DDP_TAGGED_TO_WRAP = 0x03,
  1197. DDP_TAGGED_INV_DDP_VER = 0x04,
  1198. DDP_UNTAGGED_INV_QN = 0x01,
  1199. DDP_UNTAGGED_INV_MSN_NO_BUF = 0x02,
  1200. DDP_UNTAGGED_INV_MSN_RANGE = 0x03,
  1201. DDP_UNTAGGED_INV_MO = 0x04,
  1202. DDP_UNTAGGED_INV_TOO_LONG = 0x05,
  1203. DDP_UNTAGGED_INV_DDP_VER = 0x06
  1204. };
  1205. enum nes_term_mpa_errors {
  1206. MPA_CLOSED = 0x01,
  1207. MPA_CRC = 0x02,
  1208. MPA_MARKER = 0x03,
  1209. MPA_REQ_RSP = 0x04,
  1210. };
  1211. struct nes_terminate_hdr {
  1212. u8 layer_etype;
  1213. u8 error_code;
  1214. u8 hdrct;
  1215. u8 rsvd;
  1216. };
  1217. /* Used to determine how to fill in terminate error codes */
  1218. #define IWARP_OPCODE_WRITE 0
  1219. #define IWARP_OPCODE_READREQ 1
  1220. #define IWARP_OPCODE_READRSP 2
  1221. #define IWARP_OPCODE_SEND 3
  1222. #define IWARP_OPCODE_SEND_INV 4
  1223. #define IWARP_OPCODE_SEND_SE 5
  1224. #define IWARP_OPCODE_SEND_SE_INV 6
  1225. #define IWARP_OPCODE_TERM 7
  1226. /* These values are used only during terminate processing */
  1227. #define TERM_DDP_LEN_TAGGED 14
  1228. #define TERM_DDP_LEN_UNTAGGED 18
  1229. #define TERM_RDMA_LEN 28
  1230. #define RDMA_OPCODE_MASK 0x0f
  1231. #define RDMA_READ_REQ_OPCODE 1
  1232. #define BAD_FRAME_OFFSET 64
  1233. #define CQE_MAJOR_DRV 0x8000
  1234. /* Used for link status recheck after interrupt processing */
  1235. #define NES_LINK_RECHECK_DELAY msecs_to_jiffies(50)
  1236. #define NES_LINK_RECHECK_MAX 60
  1237. #endif /* __NES_HW_H */