ocrdma_sli.h 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241
  1. /* This file is part of the Emulex RoCE Device Driver for
  2. * RoCE (RDMA over Converged Ethernet) adapters.
  3. * Copyright (C) 2012-2015 Emulex. All rights reserved.
  4. * EMULEX and SLI are trademarks of Emulex.
  5. * www.emulex.com
  6. *
  7. * This software is available to you under a choice of one of two licenses.
  8. * You may choose to be licensed under the terms of the GNU General Public
  9. * License (GPL) Version 2, available from the file COPYING in the main
  10. * directory of this source tree, or the BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * - Redistributions of source code must retain the above copyright notice,
  17. * this list of conditions and the following disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in
  21. * the documentation and/or other materials provided with the distribution.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE
  25. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  26. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  27. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  30. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  31. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  32. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  33. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. * Contact Information:
  36. * linux-drivers@emulex.com
  37. *
  38. * Emulex
  39. * 3333 Susan Street
  40. * Costa Mesa, CA 92626
  41. */
  42. #ifndef __OCRDMA_SLI_H__
  43. #define __OCRDMA_SLI_H__
  44. enum {
  45. OCRDMA_ASIC_GEN_SKH_R = 0x04,
  46. OCRDMA_ASIC_GEN_LANCER = 0x0B
  47. };
  48. enum {
  49. OCRDMA_ASIC_REV_A0 = 0x00,
  50. OCRDMA_ASIC_REV_B0 = 0x10,
  51. OCRDMA_ASIC_REV_C0 = 0x20
  52. };
  53. #define OCRDMA_SUBSYS_ROCE 10
  54. enum {
  55. OCRDMA_CMD_QUERY_CONFIG = 1,
  56. OCRDMA_CMD_ALLOC_PD = 2,
  57. OCRDMA_CMD_DEALLOC_PD = 3,
  58. OCRDMA_CMD_CREATE_AH_TBL = 4,
  59. OCRDMA_CMD_DELETE_AH_TBL = 5,
  60. OCRDMA_CMD_CREATE_QP = 6,
  61. OCRDMA_CMD_QUERY_QP = 7,
  62. OCRDMA_CMD_MODIFY_QP = 8 ,
  63. OCRDMA_CMD_DELETE_QP = 9,
  64. OCRDMA_CMD_RSVD1 = 10,
  65. OCRDMA_CMD_ALLOC_LKEY = 11,
  66. OCRDMA_CMD_DEALLOC_LKEY = 12,
  67. OCRDMA_CMD_REGISTER_NSMR = 13,
  68. OCRDMA_CMD_REREGISTER_NSMR = 14,
  69. OCRDMA_CMD_REGISTER_NSMR_CONT = 15,
  70. OCRDMA_CMD_QUERY_NSMR = 16,
  71. OCRDMA_CMD_ALLOC_MW = 17,
  72. OCRDMA_CMD_QUERY_MW = 18,
  73. OCRDMA_CMD_CREATE_SRQ = 19,
  74. OCRDMA_CMD_QUERY_SRQ = 20,
  75. OCRDMA_CMD_MODIFY_SRQ = 21,
  76. OCRDMA_CMD_DELETE_SRQ = 22,
  77. OCRDMA_CMD_ATTACH_MCAST = 23,
  78. OCRDMA_CMD_DETACH_MCAST = 24,
  79. OCRDMA_CMD_CREATE_RBQ = 25,
  80. OCRDMA_CMD_DESTROY_RBQ = 26,
  81. OCRDMA_CMD_GET_RDMA_STATS = 27,
  82. OCRDMA_CMD_ALLOC_PD_RANGE = 28,
  83. OCRDMA_CMD_DEALLOC_PD_RANGE = 29,
  84. OCRDMA_CMD_MAX
  85. };
  86. #define OCRDMA_SUBSYS_COMMON 1
  87. enum {
  88. OCRDMA_CMD_QUERY_NTWK_LINK_CONFIG_V1 = 5,
  89. OCRDMA_CMD_CREATE_CQ = 12,
  90. OCRDMA_CMD_CREATE_EQ = 13,
  91. OCRDMA_CMD_CREATE_MQ = 21,
  92. OCRDMA_CMD_GET_CTRL_ATTRIBUTES = 32,
  93. OCRDMA_CMD_GET_FW_VER = 35,
  94. OCRDMA_CMD_MODIFY_EQ_DELAY = 41,
  95. OCRDMA_CMD_DELETE_MQ = 53,
  96. OCRDMA_CMD_DELETE_CQ = 54,
  97. OCRDMA_CMD_DELETE_EQ = 55,
  98. OCRDMA_CMD_GET_FW_CONFIG = 58,
  99. OCRDMA_CMD_CREATE_MQ_EXT = 90,
  100. OCRDMA_CMD_PHY_DETAILS = 102
  101. };
  102. enum {
  103. QTYPE_EQ = 1,
  104. QTYPE_CQ = 2,
  105. QTYPE_MCCQ = 3
  106. };
  107. #define OCRDMA_MAX_SGID 16
  108. #define OCRDMA_MAX_QP 2048
  109. #define OCRDMA_MAX_CQ 2048
  110. #define OCRDMA_MAX_STAG 16384
  111. enum {
  112. OCRDMA_DB_RQ_OFFSET = 0xE0,
  113. OCRDMA_DB_GEN2_RQ_OFFSET = 0x100,
  114. OCRDMA_DB_SQ_OFFSET = 0x60,
  115. OCRDMA_DB_GEN2_SQ_OFFSET = 0x1C0,
  116. OCRDMA_DB_SRQ_OFFSET = OCRDMA_DB_RQ_OFFSET,
  117. OCRDMA_DB_GEN2_SRQ_OFFSET = OCRDMA_DB_GEN2_RQ_OFFSET,
  118. OCRDMA_DB_CQ_OFFSET = 0x120,
  119. OCRDMA_DB_EQ_OFFSET = OCRDMA_DB_CQ_OFFSET,
  120. OCRDMA_DB_MQ_OFFSET = 0x140,
  121. OCRDMA_DB_SQ_SHIFT = 16,
  122. OCRDMA_DB_RQ_SHIFT = 24
  123. };
  124. enum {
  125. OCRDMA_L3_TYPE_IB_GRH = 0x00,
  126. OCRDMA_L3_TYPE_IPV4 = 0x01,
  127. OCRDMA_L3_TYPE_IPV6 = 0x02
  128. };
  129. #define OCRDMA_DB_CQ_RING_ID_MASK 0x3FF /* bits 0 - 9 */
  130. #define OCRDMA_DB_CQ_RING_ID_EXT_MASK 0x0C00 /* bits 10-11 of qid at 12-11 */
  131. /* qid #2 msbits at 12-11 */
  132. #define OCRDMA_DB_CQ_RING_ID_EXT_MASK_SHIFT 0x1
  133. #define OCRDMA_DB_CQ_NUM_POPPED_SHIFT 16 /* bits 16 - 28 */
  134. /* Rearm bit */
  135. #define OCRDMA_DB_CQ_REARM_SHIFT 29 /* bit 29 */
  136. /* solicited bit */
  137. #define OCRDMA_DB_CQ_SOLICIT_SHIFT 31 /* bit 31 */
  138. #define OCRDMA_EQ_ID_MASK 0x1FF /* bits 0 - 8 */
  139. #define OCRDMA_EQ_ID_EXT_MASK 0x3e00 /* bits 9-13 */
  140. #define OCRDMA_EQ_ID_EXT_MASK_SHIFT 2 /* qid bits 9-13 at 11-15 */
  141. /* Clear the interrupt for this eq */
  142. #define OCRDMA_EQ_CLR_SHIFT 9 /* bit 9 */
  143. /* Must be 1 */
  144. #define OCRDMA_EQ_TYPE_SHIFT 10 /* bit 10 */
  145. /* Number of event entries processed */
  146. #define OCRDMA_NUM_EQE_SHIFT 16 /* bits 16 - 28 */
  147. /* Rearm bit */
  148. #define OCRDMA_REARM_SHIFT 29 /* bit 29 */
  149. #define OCRDMA_MQ_ID_MASK 0x7FF /* bits 0 - 10 */
  150. /* Number of entries posted */
  151. #define OCRDMA_MQ_NUM_MQE_SHIFT 16 /* bits 16 - 29 */
  152. #define OCRDMA_MIN_HPAGE_SIZE 4096
  153. #define OCRDMA_MIN_Q_PAGE_SIZE 4096
  154. #define OCRDMA_MAX_Q_PAGES 8
  155. #define OCRDMA_SLI_ASIC_ID_OFFSET 0x9C
  156. #define OCRDMA_SLI_ASIC_REV_MASK 0x000000FF
  157. #define OCRDMA_SLI_ASIC_GEN_NUM_MASK 0x0000FF00
  158. #define OCRDMA_SLI_ASIC_GEN_NUM_SHIFT 0x08
  159. /*
  160. # 0: 4K Bytes
  161. # 1: 8K Bytes
  162. # 2: 16K Bytes
  163. # 3: 32K Bytes
  164. # 4: 64K Bytes
  165. # 5: 128K Bytes
  166. # 6: 256K Bytes
  167. # 7: 512K Bytes
  168. */
  169. #define OCRDMA_MAX_Q_PAGE_SIZE_CNT 8
  170. #define OCRDMA_Q_PAGE_BASE_SIZE (OCRDMA_MIN_Q_PAGE_SIZE * OCRDMA_MAX_Q_PAGES)
  171. #define MAX_OCRDMA_QP_PAGES 8
  172. #define OCRDMA_MAX_WQE_MEM_SIZE (MAX_OCRDMA_QP_PAGES * OCRDMA_MIN_HQ_PAGE_SIZE)
  173. #define OCRDMA_CREATE_CQ_MAX_PAGES 4
  174. #define OCRDMA_DPP_CQE_SIZE 4
  175. #define OCRDMA_GEN2_MAX_CQE 1024
  176. #define OCRDMA_GEN2_CQ_PAGE_SIZE 4096
  177. #define OCRDMA_GEN2_WQE_SIZE 256
  178. #define OCRDMA_MAX_CQE 4095
  179. #define OCRDMA_CQ_PAGE_SIZE 16384
  180. #define OCRDMA_WQE_SIZE 128
  181. #define OCRDMA_WQE_STRIDE 8
  182. #define OCRDMA_WQE_ALIGN_BYTES 16
  183. #define MAX_OCRDMA_SRQ_PAGES MAX_OCRDMA_QP_PAGES
  184. enum {
  185. OCRDMA_MCH_OPCODE_SHIFT = 0,
  186. OCRDMA_MCH_OPCODE_MASK = 0xFF,
  187. OCRDMA_MCH_SUBSYS_SHIFT = 8,
  188. OCRDMA_MCH_SUBSYS_MASK = 0xFF00
  189. };
  190. /* mailbox cmd header */
  191. struct ocrdma_mbx_hdr {
  192. u32 subsys_op;
  193. u32 timeout; /* in seconds */
  194. u32 cmd_len;
  195. u32 rsvd_version;
  196. };
  197. enum {
  198. OCRDMA_MBX_RSP_OPCODE_SHIFT = 0,
  199. OCRDMA_MBX_RSP_OPCODE_MASK = 0xFF,
  200. OCRDMA_MBX_RSP_SUBSYS_SHIFT = 8,
  201. OCRDMA_MBX_RSP_SUBSYS_MASK = 0xFF << OCRDMA_MBX_RSP_SUBSYS_SHIFT,
  202. OCRDMA_MBX_RSP_STATUS_SHIFT = 0,
  203. OCRDMA_MBX_RSP_STATUS_MASK = 0xFF,
  204. OCRDMA_MBX_RSP_ASTATUS_SHIFT = 8,
  205. OCRDMA_MBX_RSP_ASTATUS_MASK = 0xFF << OCRDMA_MBX_RSP_ASTATUS_SHIFT
  206. };
  207. /* mailbox cmd response */
  208. struct ocrdma_mbx_rsp {
  209. u32 subsys_op;
  210. u32 status;
  211. u32 rsp_len;
  212. u32 add_rsp_len;
  213. };
  214. enum {
  215. OCRDMA_MQE_EMBEDDED = 1,
  216. OCRDMA_MQE_NONEMBEDDED = 0
  217. };
  218. struct ocrdma_mqe_sge {
  219. u32 pa_lo;
  220. u32 pa_hi;
  221. u32 len;
  222. };
  223. enum {
  224. OCRDMA_MQE_HDR_EMB_SHIFT = 0,
  225. OCRDMA_MQE_HDR_EMB_MASK = BIT(0),
  226. OCRDMA_MQE_HDR_SGE_CNT_SHIFT = 3,
  227. OCRDMA_MQE_HDR_SGE_CNT_MASK = 0x1F << OCRDMA_MQE_HDR_SGE_CNT_SHIFT,
  228. OCRDMA_MQE_HDR_SPECIAL_SHIFT = 24,
  229. OCRDMA_MQE_HDR_SPECIAL_MASK = 0xFF << OCRDMA_MQE_HDR_SPECIAL_SHIFT
  230. };
  231. struct ocrdma_mqe_hdr {
  232. u32 spcl_sge_cnt_emb;
  233. u32 pyld_len;
  234. u32 tag_lo;
  235. u32 tag_hi;
  236. u32 rsvd3;
  237. };
  238. struct ocrdma_mqe_emb_cmd {
  239. struct ocrdma_mbx_hdr mch;
  240. u8 pyld[220];
  241. };
  242. struct ocrdma_mqe {
  243. struct ocrdma_mqe_hdr hdr;
  244. union {
  245. struct ocrdma_mqe_emb_cmd emb_req;
  246. struct {
  247. struct ocrdma_mqe_sge sge[19];
  248. } nonemb_req;
  249. u8 cmd[236];
  250. struct ocrdma_mbx_rsp rsp;
  251. } u;
  252. };
  253. #define OCRDMA_EQ_LEN 4096
  254. #define OCRDMA_MQ_CQ_LEN 256
  255. #define OCRDMA_MQ_LEN 128
  256. #define PAGE_SHIFT_4K 12
  257. #define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
  258. /* Returns number of pages spanned by the data starting at the given addr */
  259. #define PAGES_4K_SPANNED(_address, size) \
  260. ((u32)((((size_t)(_address) & (PAGE_SIZE_4K - 1)) + \
  261. (size) + (PAGE_SIZE_4K - 1)) >> PAGE_SHIFT_4K))
  262. struct ocrdma_delete_q_req {
  263. struct ocrdma_mbx_hdr req;
  264. u32 id;
  265. };
  266. struct ocrdma_pa {
  267. u32 lo;
  268. u32 hi;
  269. };
  270. #define MAX_OCRDMA_EQ_PAGES 8
  271. struct ocrdma_create_eq_req {
  272. struct ocrdma_mbx_hdr req;
  273. u32 num_pages;
  274. u32 valid;
  275. u32 cnt;
  276. u32 delay;
  277. u32 rsvd;
  278. struct ocrdma_pa pa[MAX_OCRDMA_EQ_PAGES];
  279. };
  280. enum {
  281. OCRDMA_CREATE_EQ_VALID = BIT(29),
  282. OCRDMA_CREATE_EQ_CNT_SHIFT = 26,
  283. OCRDMA_CREATE_CQ_DELAY_SHIFT = 13,
  284. };
  285. struct ocrdma_create_eq_rsp {
  286. struct ocrdma_mbx_rsp rsp;
  287. u32 vector_eqid;
  288. };
  289. #define OCRDMA_EQ_MINOR_OTHER 0x1
  290. struct ocrmda_set_eqd {
  291. u32 eq_id;
  292. u32 phase;
  293. u32 delay_multiplier;
  294. };
  295. struct ocrdma_modify_eqd_cmd {
  296. struct ocrdma_mbx_hdr req;
  297. u32 num_eq;
  298. struct ocrmda_set_eqd set_eqd[8];
  299. } __packed;
  300. struct ocrdma_modify_eqd_req {
  301. struct ocrdma_mqe_hdr hdr;
  302. struct ocrdma_modify_eqd_cmd cmd;
  303. };
  304. struct ocrdma_modify_eq_delay_rsp {
  305. struct ocrdma_mbx_rsp hdr;
  306. u32 rsvd0;
  307. } __packed;
  308. enum {
  309. OCRDMA_MCQE_STATUS_SHIFT = 0,
  310. OCRDMA_MCQE_STATUS_MASK = 0xFFFF,
  311. OCRDMA_MCQE_ESTATUS_SHIFT = 16,
  312. OCRDMA_MCQE_ESTATUS_MASK = 0xFFFF << OCRDMA_MCQE_ESTATUS_SHIFT,
  313. OCRDMA_MCQE_CONS_SHIFT = 27,
  314. OCRDMA_MCQE_CONS_MASK = BIT(27),
  315. OCRDMA_MCQE_CMPL_SHIFT = 28,
  316. OCRDMA_MCQE_CMPL_MASK = BIT(28),
  317. OCRDMA_MCQE_AE_SHIFT = 30,
  318. OCRDMA_MCQE_AE_MASK = BIT(30),
  319. OCRDMA_MCQE_VALID_SHIFT = 31,
  320. OCRDMA_MCQE_VALID_MASK = BIT(31)
  321. };
  322. struct ocrdma_mcqe {
  323. u32 status;
  324. u32 tag_lo;
  325. u32 tag_hi;
  326. u32 valid_ae_cmpl_cons;
  327. };
  328. enum {
  329. OCRDMA_AE_MCQE_QPVALID = BIT(31),
  330. OCRDMA_AE_MCQE_QPID_MASK = 0xFFFF,
  331. OCRDMA_AE_MCQE_CQVALID = BIT(31),
  332. OCRDMA_AE_MCQE_CQID_MASK = 0xFFFF,
  333. OCRDMA_AE_MCQE_VALID = BIT(31),
  334. OCRDMA_AE_MCQE_AE = BIT(30),
  335. OCRDMA_AE_MCQE_EVENT_TYPE_SHIFT = 16,
  336. OCRDMA_AE_MCQE_EVENT_TYPE_MASK =
  337. 0xFF << OCRDMA_AE_MCQE_EVENT_TYPE_SHIFT,
  338. OCRDMA_AE_MCQE_EVENT_CODE_SHIFT = 8,
  339. OCRDMA_AE_MCQE_EVENT_CODE_MASK =
  340. 0xFF << OCRDMA_AE_MCQE_EVENT_CODE_SHIFT
  341. };
  342. struct ocrdma_ae_mcqe {
  343. u32 qpvalid_qpid;
  344. u32 cqvalid_cqid;
  345. u32 evt_tag;
  346. u32 valid_ae_event;
  347. };
  348. enum {
  349. OCRDMA_AE_PVID_MCQE_ENABLED_SHIFT = 0,
  350. OCRDMA_AE_PVID_MCQE_ENABLED_MASK = 0xFF,
  351. OCRDMA_AE_PVID_MCQE_TAG_SHIFT = 16,
  352. OCRDMA_AE_PVID_MCQE_TAG_MASK = 0xFFFF << OCRDMA_AE_PVID_MCQE_TAG_SHIFT
  353. };
  354. struct ocrdma_ae_pvid_mcqe {
  355. u32 tag_enabled;
  356. u32 event_tag;
  357. u32 rsvd1;
  358. u32 rsvd2;
  359. };
  360. enum {
  361. OCRDMA_AE_MPA_MCQE_REQ_ID_SHIFT = 16,
  362. OCRDMA_AE_MPA_MCQE_REQ_ID_MASK = 0xFFFF <<
  363. OCRDMA_AE_MPA_MCQE_REQ_ID_SHIFT,
  364. OCRDMA_AE_MPA_MCQE_EVENT_CODE_SHIFT = 8,
  365. OCRDMA_AE_MPA_MCQE_EVENT_CODE_MASK = 0xFF <<
  366. OCRDMA_AE_MPA_MCQE_EVENT_CODE_SHIFT,
  367. OCRDMA_AE_MPA_MCQE_EVENT_TYPE_SHIFT = 16,
  368. OCRDMA_AE_MPA_MCQE_EVENT_TYPE_MASK = 0xFF <<
  369. OCRDMA_AE_MPA_MCQE_EVENT_TYPE_SHIFT,
  370. OCRDMA_AE_MPA_MCQE_EVENT_AE_SHIFT = 30,
  371. OCRDMA_AE_MPA_MCQE_EVENT_AE_MASK = BIT(30),
  372. OCRDMA_AE_MPA_MCQE_EVENT_VALID_SHIFT = 31,
  373. OCRDMA_AE_MPA_MCQE_EVENT_VALID_MASK = BIT(31)
  374. };
  375. struct ocrdma_ae_mpa_mcqe {
  376. u32 req_id;
  377. u32 w1;
  378. u32 w2;
  379. u32 valid_ae_event;
  380. };
  381. enum {
  382. OCRDMA_AE_QP_MCQE_NEW_QP_STATE_SHIFT = 0,
  383. OCRDMA_AE_QP_MCQE_NEW_QP_STATE_MASK = 0xFFFF,
  384. OCRDMA_AE_QP_MCQE_QP_ID_SHIFT = 16,
  385. OCRDMA_AE_QP_MCQE_QP_ID_MASK = 0xFFFF <<
  386. OCRDMA_AE_QP_MCQE_QP_ID_SHIFT,
  387. OCRDMA_AE_QP_MCQE_EVENT_CODE_SHIFT = 8,
  388. OCRDMA_AE_QP_MCQE_EVENT_CODE_MASK = 0xFF <<
  389. OCRDMA_AE_QP_MCQE_EVENT_CODE_SHIFT,
  390. OCRDMA_AE_QP_MCQE_EVENT_TYPE_SHIFT = 16,
  391. OCRDMA_AE_QP_MCQE_EVENT_TYPE_MASK = 0xFF <<
  392. OCRDMA_AE_QP_MCQE_EVENT_TYPE_SHIFT,
  393. OCRDMA_AE_QP_MCQE_EVENT_AE_SHIFT = 30,
  394. OCRDMA_AE_QP_MCQE_EVENT_AE_MASK = BIT(30),
  395. OCRDMA_AE_QP_MCQE_EVENT_VALID_SHIFT = 31,
  396. OCRDMA_AE_QP_MCQE_EVENT_VALID_MASK = BIT(31)
  397. };
  398. struct ocrdma_ae_qp_mcqe {
  399. u32 qp_id_state;
  400. u32 w1;
  401. u32 w2;
  402. u32 valid_ae_event;
  403. };
  404. enum ocrdma_async_event_code {
  405. OCRDMA_ASYNC_LINK_EVE_CODE = 0x01,
  406. OCRDMA_ASYNC_GRP5_EVE_CODE = 0x05,
  407. OCRDMA_ASYNC_RDMA_EVE_CODE = 0x14
  408. };
  409. enum ocrdma_async_grp5_events {
  410. OCRDMA_ASYNC_EVENT_QOS_VALUE = 0x01,
  411. OCRDMA_ASYNC_EVENT_COS_VALUE = 0x02,
  412. OCRDMA_ASYNC_EVENT_PVID_STATE = 0x03
  413. };
  414. enum OCRDMA_ASYNC_EVENT_TYPE {
  415. OCRDMA_CQ_ERROR = 0x00,
  416. OCRDMA_CQ_OVERRUN_ERROR = 0x01,
  417. OCRDMA_CQ_QPCAT_ERROR = 0x02,
  418. OCRDMA_QP_ACCESS_ERROR = 0x03,
  419. OCRDMA_QP_COMM_EST_EVENT = 0x04,
  420. OCRDMA_SQ_DRAINED_EVENT = 0x05,
  421. OCRDMA_DEVICE_FATAL_EVENT = 0x08,
  422. OCRDMA_SRQCAT_ERROR = 0x0E,
  423. OCRDMA_SRQ_LIMIT_EVENT = 0x0F,
  424. OCRDMA_QP_LAST_WQE_EVENT = 0x10,
  425. OCRDMA_MAX_ASYNC_ERRORS
  426. };
  427. struct ocrdma_ae_lnkst_mcqe {
  428. u32 speed_state_ptn;
  429. u32 qos_reason_falut;
  430. u32 evt_tag;
  431. u32 valid_ae_event;
  432. };
  433. enum {
  434. OCRDMA_AE_LSC_PORT_NUM_MASK = 0x3F,
  435. OCRDMA_AE_LSC_PT_SHIFT = 0x06,
  436. OCRDMA_AE_LSC_PT_MASK = (0x03 <<
  437. OCRDMA_AE_LSC_PT_SHIFT),
  438. OCRDMA_AE_LSC_LS_SHIFT = 0x08,
  439. OCRDMA_AE_LSC_LS_MASK = (0xFF <<
  440. OCRDMA_AE_LSC_LS_SHIFT),
  441. OCRDMA_AE_LSC_LD_SHIFT = 0x10,
  442. OCRDMA_AE_LSC_LD_MASK = (0xFF <<
  443. OCRDMA_AE_LSC_LD_SHIFT),
  444. OCRDMA_AE_LSC_PPS_SHIFT = 0x18,
  445. OCRDMA_AE_LSC_PPS_MASK = (0xFF <<
  446. OCRDMA_AE_LSC_PPS_SHIFT),
  447. OCRDMA_AE_LSC_PPF_MASK = 0xFF,
  448. OCRDMA_AE_LSC_ER_SHIFT = 0x08,
  449. OCRDMA_AE_LSC_ER_MASK = (0xFF <<
  450. OCRDMA_AE_LSC_ER_SHIFT),
  451. OCRDMA_AE_LSC_QOS_SHIFT = 0x10,
  452. OCRDMA_AE_LSC_QOS_MASK = (0xFFFF <<
  453. OCRDMA_AE_LSC_QOS_SHIFT)
  454. };
  455. enum {
  456. OCRDMA_AE_LSC_PLINK_DOWN = 0x00,
  457. OCRDMA_AE_LSC_PLINK_UP = 0x01,
  458. OCRDMA_AE_LSC_LLINK_DOWN = 0x02,
  459. OCRDMA_AE_LSC_LLINK_MASK = 0x02,
  460. OCRDMA_AE_LSC_LLINK_UP = 0x03
  461. };
  462. /* mailbox command request and responses */
  463. enum {
  464. OCRDMA_MBX_QUERY_CFG_CQ_OVERFLOW_SHIFT = 2,
  465. OCRDMA_MBX_QUERY_CFG_CQ_OVERFLOW_MASK = BIT(2),
  466. OCRDMA_MBX_QUERY_CFG_SRQ_SUPPORTED_SHIFT = 3,
  467. OCRDMA_MBX_QUERY_CFG_SRQ_SUPPORTED_MASK = BIT(3),
  468. OCRDMA_MBX_QUERY_CFG_MAX_QP_SHIFT = 8,
  469. OCRDMA_MBX_QUERY_CFG_MAX_QP_MASK = 0xFFFFFF <<
  470. OCRDMA_MBX_QUERY_CFG_MAX_QP_SHIFT,
  471. OCRDMA_MBX_QUERY_CFG_MAX_PD_SHIFT = 16,
  472. OCRDMA_MBX_QUERY_CFG_MAX_PD_MASK = 0xFFFF <<
  473. OCRDMA_MBX_QUERY_CFG_MAX_PD_SHIFT,
  474. OCRDMA_MBX_QUERY_CFG_CA_ACK_DELAY_SHIFT = 8,
  475. OCRDMA_MBX_QUERY_CFG_CA_ACK_DELAY_MASK = 0xFF <<
  476. OCRDMA_MBX_QUERY_CFG_CA_ACK_DELAY_SHIFT,
  477. OCRDMA_MBX_QUERY_CFG_L3_TYPE_SHIFT = 3,
  478. OCRDMA_MBX_QUERY_CFG_L3_TYPE_MASK = 0x18,
  479. OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0,
  480. OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF,
  481. OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_SHIFT = 16,
  482. OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_MASK = 0xFFFF <<
  483. OCRDMA_MBX_QUERY_CFG_MAX_RECV_SGE_SHIFT,
  484. OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0,
  485. OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF,
  486. OCRDMA_MBX_QUERY_CFG_MAX_IRD_PER_QP_SHIFT = 16,
  487. OCRDMA_MBX_QUERY_CFG_MAX_IRD_PER_QP_MASK = 0xFFFF <<
  488. OCRDMA_MBX_QUERY_CFG_MAX_IRD_PER_QP_SHIFT,
  489. OCRDMA_MBX_QUERY_CFG_MAX_WQE_SIZE_OFFSET = 24,
  490. OCRDMA_MBX_QUERY_CFG_MAX_WQE_SIZE_MASK = 0xFF <<
  491. OCRDMA_MBX_QUERY_CFG_MAX_WQE_SIZE_OFFSET,
  492. OCRDMA_MBX_QUERY_CFG_MAX_RQE_SIZE_OFFSET = 16,
  493. OCRDMA_MBX_QUERY_CFG_MAX_RQE_SIZE_MASK = 0xFF <<
  494. OCRDMA_MBX_QUERY_CFG_MAX_RQE_SIZE_OFFSET,
  495. OCRDMA_MBX_QUERY_CFG_MAX_DPP_CQES_OFFSET = 0,
  496. OCRDMA_MBX_QUERY_CFG_MAX_DPP_CQES_MASK = 0xFFFF <<
  497. OCRDMA_MBX_QUERY_CFG_MAX_DPP_CQES_OFFSET,
  498. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_OFFSET = 16,
  499. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_MASK = 0xFFFF <<
  500. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_OFFSET,
  501. OCRDMA_MBX_QUERY_CFG_MAX_RPIR_QPS_OFFSET = 0,
  502. OCRDMA_MBX_QUERY_CFG_MAX_RPIR_QPS_MASK = 0xFFFF <<
  503. OCRDMA_MBX_QUERY_CFG_MAX_RPIR_QPS_OFFSET,
  504. OCRDMA_MBX_QUERY_CFG_MAX_DPP_PDS_OFFSET = 16,
  505. OCRDMA_MBX_QUERY_CFG_MAX_DPP_PDS_MASK = 0xFFFF <<
  506. OCRDMA_MBX_QUERY_CFG_MAX_DPP_PDS_OFFSET,
  507. OCRDMA_MBX_QUERY_CFG_MAX_DPP_CREDITS_OFFSET = 0,
  508. OCRDMA_MBX_QUERY_CFG_MAX_DPP_CREDITS_MASK = 0xFFFF <<
  509. OCRDMA_MBX_QUERY_CFG_MAX_DPP_CREDITS_OFFSET,
  510. OCRDMA_MBX_QUERY_CFG_MAX_DPP_QPS_OFFSET = 0,
  511. OCRDMA_MBX_QUERY_CFG_MAX_DPP_QPS_MASK = 0xFFFF <<
  512. OCRDMA_MBX_QUERY_CFG_MAX_DPP_QPS_OFFSET,
  513. OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET = 16,
  514. OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_MASK = 0xFFFF <<
  515. OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET,
  516. OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET = 0,
  517. OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_MASK = 0xFFFF <<
  518. OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET,
  519. OCRDMA_MBX_QUERY_CFG_MAX_CQ_OFFSET = 16,
  520. OCRDMA_MBX_QUERY_CFG_MAX_CQ_MASK = 0xFFFF <<
  521. OCRDMA_MBX_QUERY_CFG_MAX_CQ_OFFSET,
  522. OCRDMA_MBX_QUERY_CFG_MAX_CQES_PER_CQ_OFFSET = 0,
  523. OCRDMA_MBX_QUERY_CFG_MAX_CQES_PER_CQ_MASK = 0xFFFF <<
  524. OCRDMA_MBX_QUERY_CFG_MAX_CQES_PER_CQ_OFFSET,
  525. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_RQE_OFFSET = 16,
  526. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_RQE_MASK = 0xFFFF <<
  527. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_RQE_OFFSET,
  528. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET = 0,
  529. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK = 0xFFFF <<
  530. OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET,
  531. OCRDMA_MBX_QUERY_CFG_MAX_RD_SGE_SHIFT = 0,
  532. OCRDMA_MBX_QUERY_CFG_MAX_RD_SGE_MASK = 0xFFFF,
  533. };
  534. struct ocrdma_mbx_query_config {
  535. struct ocrdma_mqe_hdr hdr;
  536. struct ocrdma_mbx_rsp rsp;
  537. u32 qp_srq_cq_ird_ord;
  538. u32 max_pd_ca_ack_delay;
  539. u32 max_recv_send_sge;
  540. u32 max_ird_ord_per_qp;
  541. u32 max_shared_ird_ord;
  542. u32 max_mr;
  543. u32 max_mr_size_hi;
  544. u32 max_mr_size_lo;
  545. u32 max_num_mr_pbl;
  546. u32 max_mw;
  547. u32 max_fmr;
  548. u32 max_pages_per_frmr;
  549. u32 max_mcast_group;
  550. u32 max_mcast_qp_attach;
  551. u32 max_total_mcast_qp_attach;
  552. u32 wqe_rqe_stride_max_dpp_cqs;
  553. u32 max_srq_rpir_qps;
  554. u32 max_dpp_pds_credits;
  555. u32 max_dpp_credits_pds_per_pd;
  556. u32 max_wqes_rqes_per_q;
  557. u32 max_cq_cqes_per_cq;
  558. u32 max_srq_rqe_sge;
  559. u32 max_wr_rd_sge;
  560. u32 ird_pgsz_num_pages;
  561. };
  562. struct ocrdma_fw_ver_rsp {
  563. struct ocrdma_mqe_hdr hdr;
  564. struct ocrdma_mbx_rsp rsp;
  565. u8 running_ver[32];
  566. };
  567. struct ocrdma_fw_conf_rsp {
  568. struct ocrdma_mqe_hdr hdr;
  569. struct ocrdma_mbx_rsp rsp;
  570. u32 config_num;
  571. u32 asic_revision;
  572. u32 phy_port;
  573. u32 fn_mode;
  574. struct {
  575. u32 mode;
  576. u32 nic_wqid_base;
  577. u32 nic_wq_tot;
  578. u32 prot_wqid_base;
  579. u32 prot_wq_tot;
  580. u32 prot_rqid_base;
  581. u32 prot_rqid_tot;
  582. u32 rsvd[6];
  583. } ulp[2];
  584. u32 fn_capabilities;
  585. u32 rsvd1;
  586. u32 rsvd2;
  587. u32 base_eqid;
  588. u32 max_eq;
  589. };
  590. enum {
  591. OCRDMA_FN_MODE_RDMA = 0x4
  592. };
  593. enum {
  594. OCRDMA_IF_TYPE_MASK = 0xFFFF0000,
  595. OCRDMA_IF_TYPE_SHIFT = 0x10,
  596. OCRDMA_PHY_TYPE_MASK = 0x0000FFFF,
  597. OCRDMA_FUTURE_DETAILS_MASK = 0xFFFF0000,
  598. OCRDMA_FUTURE_DETAILS_SHIFT = 0x10,
  599. OCRDMA_EX_PHY_DETAILS_MASK = 0x0000FFFF,
  600. OCRDMA_FSPEED_SUPP_MASK = 0xFFFF0000,
  601. OCRDMA_FSPEED_SUPP_SHIFT = 0x10,
  602. OCRDMA_ASPEED_SUPP_MASK = 0x0000FFFF
  603. };
  604. struct ocrdma_get_phy_info_rsp {
  605. struct ocrdma_mqe_hdr hdr;
  606. struct ocrdma_mbx_rsp rsp;
  607. u32 ityp_ptyp;
  608. u32 misc_params;
  609. u32 ftrdtl_exphydtl;
  610. u32 fspeed_aspeed;
  611. u32 future_use[2];
  612. };
  613. enum {
  614. OCRDMA_PHY_SPEED_ZERO = 0x0,
  615. OCRDMA_PHY_SPEED_10MBPS = 0x1,
  616. OCRDMA_PHY_SPEED_100MBPS = 0x2,
  617. OCRDMA_PHY_SPEED_1GBPS = 0x4,
  618. OCRDMA_PHY_SPEED_10GBPS = 0x8,
  619. OCRDMA_PHY_SPEED_40GBPS = 0x20
  620. };
  621. enum {
  622. OCRDMA_PORT_NUM_MASK = 0x3F,
  623. OCRDMA_PT_MASK = 0xC0,
  624. OCRDMA_PT_SHIFT = 0x6,
  625. OCRDMA_LINK_DUP_MASK = 0x0000FF00,
  626. OCRDMA_LINK_DUP_SHIFT = 0x8,
  627. OCRDMA_PHY_PS_MASK = 0x00FF0000,
  628. OCRDMA_PHY_PS_SHIFT = 0x10,
  629. OCRDMA_PHY_PFLT_MASK = 0xFF000000,
  630. OCRDMA_PHY_PFLT_SHIFT = 0x18,
  631. OCRDMA_QOS_LNKSP_MASK = 0xFFFF0000,
  632. OCRDMA_QOS_LNKSP_SHIFT = 0x10,
  633. OCRDMA_LINK_ST_MASK = 0x01,
  634. OCRDMA_PLFC_MASK = 0x00000400,
  635. OCRDMA_PLFC_SHIFT = 0x8,
  636. OCRDMA_PLRFC_MASK = 0x00000200,
  637. OCRDMA_PLRFC_SHIFT = 0x8,
  638. OCRDMA_PLTFC_MASK = 0x00000100,
  639. OCRDMA_PLTFC_SHIFT = 0x8
  640. };
  641. struct ocrdma_get_link_speed_rsp {
  642. struct ocrdma_mqe_hdr hdr;
  643. struct ocrdma_mbx_rsp rsp;
  644. u32 pflt_pps_ld_pnum;
  645. u32 qos_lsp;
  646. u32 res_lnk_st;
  647. };
  648. enum {
  649. OCRDMA_PHYS_LINK_SPEED_ZERO = 0x0,
  650. OCRDMA_PHYS_LINK_SPEED_10MBPS = 0x1,
  651. OCRDMA_PHYS_LINK_SPEED_100MBPS = 0x2,
  652. OCRDMA_PHYS_LINK_SPEED_1GBPS = 0x3,
  653. OCRDMA_PHYS_LINK_SPEED_10GBPS = 0x4,
  654. OCRDMA_PHYS_LINK_SPEED_20GBPS = 0x5,
  655. OCRDMA_PHYS_LINK_SPEED_25GBPS = 0x6,
  656. OCRDMA_PHYS_LINK_SPEED_40GBPS = 0x7,
  657. OCRDMA_PHYS_LINK_SPEED_100GBPS = 0x8
  658. };
  659. enum {
  660. OCRDMA_CREATE_CQ_VER2 = 2,
  661. OCRDMA_CREATE_CQ_VER3 = 3,
  662. OCRDMA_CREATE_CQ_PAGE_CNT_MASK = 0xFFFF,
  663. OCRDMA_CREATE_CQ_PAGE_SIZE_SHIFT = 16,
  664. OCRDMA_CREATE_CQ_PAGE_SIZE_MASK = 0xFF,
  665. OCRDMA_CREATE_CQ_COALESCWM_SHIFT = 12,
  666. OCRDMA_CREATE_CQ_COALESCWM_MASK = BIT(13) | BIT(12),
  667. OCRDMA_CREATE_CQ_FLAGS_NODELAY = BIT(14),
  668. OCRDMA_CREATE_CQ_FLAGS_AUTO_VALID = BIT(15),
  669. OCRDMA_CREATE_CQ_EQ_ID_MASK = 0xFFFF,
  670. OCRDMA_CREATE_CQ_CQE_COUNT_MASK = 0xFFFF
  671. };
  672. enum {
  673. OCRDMA_CREATE_CQ_VER0 = 0,
  674. OCRDMA_CREATE_CQ_DPP = 1,
  675. OCRDMA_CREATE_CQ_TYPE_SHIFT = 24,
  676. OCRDMA_CREATE_CQ_EQID_SHIFT = 22,
  677. OCRDMA_CREATE_CQ_CNT_SHIFT = 27,
  678. OCRDMA_CREATE_CQ_FLAGS_VALID = BIT(29),
  679. OCRDMA_CREATE_CQ_FLAGS_EVENTABLE = BIT(31),
  680. OCRDMA_CREATE_CQ_DEF_FLAGS = OCRDMA_CREATE_CQ_FLAGS_VALID |
  681. OCRDMA_CREATE_CQ_FLAGS_EVENTABLE |
  682. OCRDMA_CREATE_CQ_FLAGS_NODELAY
  683. };
  684. struct ocrdma_create_cq_cmd {
  685. struct ocrdma_mbx_hdr req;
  686. u32 pgsz_pgcnt;
  687. u32 ev_cnt_flags;
  688. u32 eqn;
  689. u32 pdid_cqecnt;
  690. u32 rsvd6;
  691. struct ocrdma_pa pa[OCRDMA_CREATE_CQ_MAX_PAGES];
  692. };
  693. struct ocrdma_create_cq {
  694. struct ocrdma_mqe_hdr hdr;
  695. struct ocrdma_create_cq_cmd cmd;
  696. };
  697. enum {
  698. OCRDMA_CREATE_CQ_CMD_PDID_SHIFT = 0x10
  699. };
  700. enum {
  701. OCRDMA_CREATE_CQ_RSP_CQ_ID_MASK = 0xFFFF
  702. };
  703. struct ocrdma_create_cq_cmd_rsp {
  704. struct ocrdma_mbx_rsp rsp;
  705. u32 cq_id;
  706. };
  707. struct ocrdma_create_cq_rsp {
  708. struct ocrdma_mqe_hdr hdr;
  709. struct ocrdma_create_cq_cmd_rsp rsp;
  710. };
  711. enum {
  712. OCRDMA_CREATE_MQ_V0_CQ_ID_SHIFT = 22,
  713. OCRDMA_CREATE_MQ_CQ_ID_SHIFT = 16,
  714. OCRDMA_CREATE_MQ_RING_SIZE_SHIFT = 16,
  715. OCRDMA_CREATE_MQ_VALID = BIT(31),
  716. OCRDMA_CREATE_MQ_ASYNC_CQ_VALID = BIT(0)
  717. };
  718. struct ocrdma_create_mq_req {
  719. struct ocrdma_mbx_hdr req;
  720. u32 cqid_pages;
  721. u32 async_event_bitmap;
  722. u32 async_cqid_ringsize;
  723. u32 valid;
  724. u32 async_cqid_valid;
  725. u32 rsvd;
  726. struct ocrdma_pa pa[8];
  727. };
  728. struct ocrdma_create_mq_rsp {
  729. struct ocrdma_mbx_rsp rsp;
  730. u32 id;
  731. };
  732. enum {
  733. OCRDMA_DESTROY_CQ_QID_SHIFT = 0,
  734. OCRDMA_DESTROY_CQ_QID_MASK = 0xFFFF,
  735. OCRDMA_DESTROY_CQ_QID_BYPASS_FLUSH_SHIFT = 16,
  736. OCRDMA_DESTROY_CQ_QID_BYPASS_FLUSH_MASK = 0xFFFF <<
  737. OCRDMA_DESTROY_CQ_QID_BYPASS_FLUSH_SHIFT
  738. };
  739. struct ocrdma_destroy_cq {
  740. struct ocrdma_mqe_hdr hdr;
  741. struct ocrdma_mbx_hdr req;
  742. u32 bypass_flush_qid;
  743. };
  744. struct ocrdma_destroy_cq_rsp {
  745. struct ocrdma_mqe_hdr hdr;
  746. struct ocrdma_mbx_rsp rsp;
  747. };
  748. enum {
  749. OCRDMA_QPT_GSI = 1,
  750. OCRDMA_QPT_RC = 2,
  751. OCRDMA_QPT_UD = 4,
  752. };
  753. enum {
  754. OCRDMA_CREATE_QP_REQ_PD_ID_SHIFT = 0,
  755. OCRDMA_CREATE_QP_REQ_PD_ID_MASK = 0xFFFF,
  756. OCRDMA_CREATE_QP_REQ_SQ_PAGE_SIZE_SHIFT = 16,
  757. OCRDMA_CREATE_QP_REQ_RQ_PAGE_SIZE_SHIFT = 19,
  758. OCRDMA_CREATE_QP_REQ_QPT_SHIFT = 29,
  759. OCRDMA_CREATE_QP_REQ_QPT_MASK = BIT(31) | BIT(30) | BIT(29),
  760. OCRDMA_CREATE_QP_REQ_MAX_RQE_SHIFT = 0,
  761. OCRDMA_CREATE_QP_REQ_MAX_RQE_MASK = 0xFFFF,
  762. OCRDMA_CREATE_QP_REQ_MAX_WQE_SHIFT = 16,
  763. OCRDMA_CREATE_QP_REQ_MAX_WQE_MASK = 0xFFFF <<
  764. OCRDMA_CREATE_QP_REQ_MAX_WQE_SHIFT,
  765. OCRDMA_CREATE_QP_REQ_MAX_SGE_WRITE_SHIFT = 0,
  766. OCRDMA_CREATE_QP_REQ_MAX_SGE_WRITE_MASK = 0xFFFF,
  767. OCRDMA_CREATE_QP_REQ_MAX_SGE_SEND_SHIFT = 16,
  768. OCRDMA_CREATE_QP_REQ_MAX_SGE_SEND_MASK = 0xFFFF <<
  769. OCRDMA_CREATE_QP_REQ_MAX_SGE_SEND_SHIFT,
  770. OCRDMA_CREATE_QP_REQ_FMR_EN_SHIFT = 0,
  771. OCRDMA_CREATE_QP_REQ_FMR_EN_MASK = BIT(0),
  772. OCRDMA_CREATE_QP_REQ_ZERO_LKEYEN_SHIFT = 1,
  773. OCRDMA_CREATE_QP_REQ_ZERO_LKEYEN_MASK = BIT(1),
  774. OCRDMA_CREATE_QP_REQ_BIND_MEMWIN_SHIFT = 2,
  775. OCRDMA_CREATE_QP_REQ_BIND_MEMWIN_MASK = BIT(2),
  776. OCRDMA_CREATE_QP_REQ_INB_WREN_SHIFT = 3,
  777. OCRDMA_CREATE_QP_REQ_INB_WREN_MASK = BIT(3),
  778. OCRDMA_CREATE_QP_REQ_INB_RDEN_SHIFT = 4,
  779. OCRDMA_CREATE_QP_REQ_INB_RDEN_MASK = BIT(4),
  780. OCRDMA_CREATE_QP_REQ_USE_SRQ_SHIFT = 5,
  781. OCRDMA_CREATE_QP_REQ_USE_SRQ_MASK = BIT(5),
  782. OCRDMA_CREATE_QP_REQ_ENABLE_RPIR_SHIFT = 6,
  783. OCRDMA_CREATE_QP_REQ_ENABLE_RPIR_MASK = BIT(6),
  784. OCRDMA_CREATE_QP_REQ_ENABLE_DPP_SHIFT = 7,
  785. OCRDMA_CREATE_QP_REQ_ENABLE_DPP_MASK = BIT(7),
  786. OCRDMA_CREATE_QP_REQ_ENABLE_DPP_CQ_SHIFT = 8,
  787. OCRDMA_CREATE_QP_REQ_ENABLE_DPP_CQ_MASK = BIT(8),
  788. OCRDMA_CREATE_QP_REQ_MAX_SGE_RECV_SHIFT = 16,
  789. OCRDMA_CREATE_QP_REQ_MAX_SGE_RECV_MASK = 0xFFFF <<
  790. OCRDMA_CREATE_QP_REQ_MAX_SGE_RECV_SHIFT,
  791. OCRDMA_CREATE_QP_REQ_MAX_IRD_SHIFT = 0,
  792. OCRDMA_CREATE_QP_REQ_MAX_IRD_MASK = 0xFFFF,
  793. OCRDMA_CREATE_QP_REQ_MAX_ORD_SHIFT = 16,
  794. OCRDMA_CREATE_QP_REQ_MAX_ORD_MASK = 0xFFFF <<
  795. OCRDMA_CREATE_QP_REQ_MAX_ORD_SHIFT,
  796. OCRDMA_CREATE_QP_REQ_NUM_RQ_PAGES_SHIFT = 0,
  797. OCRDMA_CREATE_QP_REQ_NUM_RQ_PAGES_MASK = 0xFFFF,
  798. OCRDMA_CREATE_QP_REQ_NUM_WQ_PAGES_SHIFT = 16,
  799. OCRDMA_CREATE_QP_REQ_NUM_WQ_PAGES_MASK = 0xFFFF <<
  800. OCRDMA_CREATE_QP_REQ_NUM_WQ_PAGES_SHIFT,
  801. OCRDMA_CREATE_QP_REQ_RQE_SIZE_SHIFT = 0,
  802. OCRDMA_CREATE_QP_REQ_RQE_SIZE_MASK = 0xFFFF,
  803. OCRDMA_CREATE_QP_REQ_WQE_SIZE_SHIFT = 16,
  804. OCRDMA_CREATE_QP_REQ_WQE_SIZE_MASK = 0xFFFF <<
  805. OCRDMA_CREATE_QP_REQ_WQE_SIZE_SHIFT,
  806. OCRDMA_CREATE_QP_REQ_RQ_CQID_SHIFT = 0,
  807. OCRDMA_CREATE_QP_REQ_RQ_CQID_MASK = 0xFFFF,
  808. OCRDMA_CREATE_QP_REQ_WQ_CQID_SHIFT = 16,
  809. OCRDMA_CREATE_QP_REQ_WQ_CQID_MASK = 0xFFFF <<
  810. OCRDMA_CREATE_QP_REQ_WQ_CQID_SHIFT,
  811. OCRDMA_CREATE_QP_REQ_DPP_CQPID_SHIFT = 0,
  812. OCRDMA_CREATE_QP_REQ_DPP_CQPID_MASK = 0xFFFF,
  813. OCRDMA_CREATE_QP_REQ_DPP_CREDIT_SHIFT = 16,
  814. OCRDMA_CREATE_QP_REQ_DPP_CREDIT_MASK = 0xFFFF <<
  815. OCRDMA_CREATE_QP_REQ_DPP_CREDIT_SHIFT
  816. };
  817. enum {
  818. OCRDMA_CREATE_QP_REQ_DPP_CREDIT_LIMIT = 16,
  819. OCRDMA_CREATE_QP_RSP_DPP_PAGE_SHIFT = 1
  820. };
  821. #define MAX_OCRDMA_IRD_PAGES 4
  822. enum ocrdma_qp_flags {
  823. OCRDMA_QP_MW_BIND = 1,
  824. OCRDMA_QP_LKEY0 = (1 << 1),
  825. OCRDMA_QP_FAST_REG = (1 << 2),
  826. OCRDMA_QP_INB_RD = (1 << 6),
  827. OCRDMA_QP_INB_WR = (1 << 7),
  828. };
  829. enum ocrdma_qp_state {
  830. OCRDMA_QPS_RST = 0,
  831. OCRDMA_QPS_INIT = 1,
  832. OCRDMA_QPS_RTR = 2,
  833. OCRDMA_QPS_RTS = 3,
  834. OCRDMA_QPS_SQE = 4,
  835. OCRDMA_QPS_SQ_DRAINING = 5,
  836. OCRDMA_QPS_ERR = 6,
  837. OCRDMA_QPS_SQD = 7
  838. };
  839. struct ocrdma_create_qp_req {
  840. struct ocrdma_mqe_hdr hdr;
  841. struct ocrdma_mbx_hdr req;
  842. u32 type_pgsz_pdn;
  843. u32 max_wqe_rqe;
  844. u32 max_sge_send_write;
  845. u32 max_sge_recv_flags;
  846. u32 max_ord_ird;
  847. u32 num_wq_rq_pages;
  848. u32 wqe_rqe_size;
  849. u32 wq_rq_cqid;
  850. struct ocrdma_pa wq_addr[MAX_OCRDMA_QP_PAGES];
  851. struct ocrdma_pa rq_addr[MAX_OCRDMA_QP_PAGES];
  852. u32 dpp_credits_cqid;
  853. u32 rpir_lkey;
  854. struct ocrdma_pa ird_addr[MAX_OCRDMA_IRD_PAGES];
  855. };
  856. enum {
  857. OCRDMA_CREATE_QP_RSP_QP_ID_SHIFT = 0,
  858. OCRDMA_CREATE_QP_RSP_QP_ID_MASK = 0xFFFF,
  859. OCRDMA_CREATE_QP_RSP_MAX_RQE_SHIFT = 0,
  860. OCRDMA_CREATE_QP_RSP_MAX_RQE_MASK = 0xFFFF,
  861. OCRDMA_CREATE_QP_RSP_MAX_WQE_SHIFT = 16,
  862. OCRDMA_CREATE_QP_RSP_MAX_WQE_MASK = 0xFFFF <<
  863. OCRDMA_CREATE_QP_RSP_MAX_WQE_SHIFT,
  864. OCRDMA_CREATE_QP_RSP_MAX_SGE_WRITE_SHIFT = 0,
  865. OCRDMA_CREATE_QP_RSP_MAX_SGE_WRITE_MASK = 0xFFFF,
  866. OCRDMA_CREATE_QP_RSP_MAX_SGE_SEND_SHIFT = 16,
  867. OCRDMA_CREATE_QP_RSP_MAX_SGE_SEND_MASK = 0xFFFF <<
  868. OCRDMA_CREATE_QP_RSP_MAX_SGE_SEND_SHIFT,
  869. OCRDMA_CREATE_QP_RSP_MAX_SGE_RECV_SHIFT = 16,
  870. OCRDMA_CREATE_QP_RSP_MAX_SGE_RECV_MASK = 0xFFFF <<
  871. OCRDMA_CREATE_QP_RSP_MAX_SGE_RECV_SHIFT,
  872. OCRDMA_CREATE_QP_RSP_MAX_IRD_SHIFT = 0,
  873. OCRDMA_CREATE_QP_RSP_MAX_IRD_MASK = 0xFFFF,
  874. OCRDMA_CREATE_QP_RSP_MAX_ORD_SHIFT = 16,
  875. OCRDMA_CREATE_QP_RSP_MAX_ORD_MASK = 0xFFFF <<
  876. OCRDMA_CREATE_QP_RSP_MAX_ORD_SHIFT,
  877. OCRDMA_CREATE_QP_RSP_RQ_ID_SHIFT = 0,
  878. OCRDMA_CREATE_QP_RSP_RQ_ID_MASK = 0xFFFF,
  879. OCRDMA_CREATE_QP_RSP_SQ_ID_SHIFT = 16,
  880. OCRDMA_CREATE_QP_RSP_SQ_ID_MASK = 0xFFFF <<
  881. OCRDMA_CREATE_QP_RSP_SQ_ID_SHIFT,
  882. OCRDMA_CREATE_QP_RSP_DPP_ENABLED_MASK = BIT(0),
  883. OCRDMA_CREATE_QP_RSP_DPP_PAGE_OFFSET_SHIFT = 1,
  884. OCRDMA_CREATE_QP_RSP_DPP_PAGE_OFFSET_MASK = 0x7FFF <<
  885. OCRDMA_CREATE_QP_RSP_DPP_PAGE_OFFSET_SHIFT,
  886. OCRDMA_CREATE_QP_RSP_DPP_CREDITS_SHIFT = 16,
  887. OCRDMA_CREATE_QP_RSP_DPP_CREDITS_MASK = 0xFFFF <<
  888. OCRDMA_CREATE_QP_RSP_DPP_CREDITS_SHIFT,
  889. };
  890. struct ocrdma_create_qp_rsp {
  891. struct ocrdma_mqe_hdr hdr;
  892. struct ocrdma_mbx_rsp rsp;
  893. u32 qp_id;
  894. u32 max_wqe_rqe;
  895. u32 max_sge_send_write;
  896. u32 max_sge_recv;
  897. u32 max_ord_ird;
  898. u32 sq_rq_id;
  899. u32 dpp_response;
  900. };
  901. struct ocrdma_destroy_qp {
  902. struct ocrdma_mqe_hdr hdr;
  903. struct ocrdma_mbx_hdr req;
  904. u32 qp_id;
  905. };
  906. struct ocrdma_destroy_qp_rsp {
  907. struct ocrdma_mqe_hdr hdr;
  908. struct ocrdma_mbx_rsp rsp;
  909. };
  910. enum {
  911. OCRDMA_MODIFY_QP_ID_SHIFT = 0,
  912. OCRDMA_MODIFY_QP_ID_MASK = 0xFFFF,
  913. OCRDMA_QP_PARA_QPS_VALID = BIT(0),
  914. OCRDMA_QP_PARA_SQD_ASYNC_VALID = BIT(1),
  915. OCRDMA_QP_PARA_PKEY_VALID = BIT(2),
  916. OCRDMA_QP_PARA_QKEY_VALID = BIT(3),
  917. OCRDMA_QP_PARA_PMTU_VALID = BIT(4),
  918. OCRDMA_QP_PARA_ACK_TO_VALID = BIT(5),
  919. OCRDMA_QP_PARA_RETRY_CNT_VALID = BIT(6),
  920. OCRDMA_QP_PARA_RRC_VALID = BIT(7),
  921. OCRDMA_QP_PARA_RQPSN_VALID = BIT(8),
  922. OCRDMA_QP_PARA_MAX_IRD_VALID = BIT(9),
  923. OCRDMA_QP_PARA_MAX_ORD_VALID = BIT(10),
  924. OCRDMA_QP_PARA_RNT_VALID = BIT(11),
  925. OCRDMA_QP_PARA_SQPSN_VALID = BIT(12),
  926. OCRDMA_QP_PARA_DST_QPN_VALID = BIT(13),
  927. OCRDMA_QP_PARA_MAX_WQE_VALID = BIT(14),
  928. OCRDMA_QP_PARA_MAX_RQE_VALID = BIT(15),
  929. OCRDMA_QP_PARA_SGE_SEND_VALID = BIT(16),
  930. OCRDMA_QP_PARA_SGE_RECV_VALID = BIT(17),
  931. OCRDMA_QP_PARA_SGE_WR_VALID = BIT(18),
  932. OCRDMA_QP_PARA_INB_RDEN_VALID = BIT(19),
  933. OCRDMA_QP_PARA_INB_WREN_VALID = BIT(20),
  934. OCRDMA_QP_PARA_FLOW_LBL_VALID = BIT(21),
  935. OCRDMA_QP_PARA_BIND_EN_VALID = BIT(22),
  936. OCRDMA_QP_PARA_ZLKEY_EN_VALID = BIT(23),
  937. OCRDMA_QP_PARA_FMR_EN_VALID = BIT(24),
  938. OCRDMA_QP_PARA_INBAT_EN_VALID = BIT(25),
  939. OCRDMA_QP_PARA_VLAN_EN_VALID = BIT(26),
  940. OCRDMA_MODIFY_QP_FLAGS_RD = BIT(0),
  941. OCRDMA_MODIFY_QP_FLAGS_WR = BIT(1),
  942. OCRDMA_MODIFY_QP_FLAGS_SEND = BIT(2),
  943. OCRDMA_MODIFY_QP_FLAGS_ATOMIC = BIT(3)
  944. };
  945. enum {
  946. OCRDMA_QP_PARAMS_SRQ_ID_SHIFT = 0,
  947. OCRDMA_QP_PARAMS_SRQ_ID_MASK = 0xFFFF,
  948. OCRDMA_QP_PARAMS_MAX_RQE_SHIFT = 0,
  949. OCRDMA_QP_PARAMS_MAX_RQE_MASK = 0xFFFF,
  950. OCRDMA_QP_PARAMS_MAX_WQE_SHIFT = 16,
  951. OCRDMA_QP_PARAMS_MAX_WQE_MASK = 0xFFFF <<
  952. OCRDMA_QP_PARAMS_MAX_WQE_SHIFT,
  953. OCRDMA_QP_PARAMS_MAX_SGE_WRITE_SHIFT = 0,
  954. OCRDMA_QP_PARAMS_MAX_SGE_WRITE_MASK = 0xFFFF,
  955. OCRDMA_QP_PARAMS_MAX_SGE_SEND_SHIFT = 16,
  956. OCRDMA_QP_PARAMS_MAX_SGE_SEND_MASK = 0xFFFF <<
  957. OCRDMA_QP_PARAMS_MAX_SGE_SEND_SHIFT,
  958. OCRDMA_QP_PARAMS_FLAGS_FMR_EN = BIT(0),
  959. OCRDMA_QP_PARAMS_FLAGS_LKEY_0_EN = BIT(1),
  960. OCRDMA_QP_PARAMS_FLAGS_BIND_MW_EN = BIT(2),
  961. OCRDMA_QP_PARAMS_FLAGS_INBWR_EN = BIT(3),
  962. OCRDMA_QP_PARAMS_FLAGS_INBRD_EN = BIT(4),
  963. OCRDMA_QP_PARAMS_STATE_SHIFT = 5,
  964. OCRDMA_QP_PARAMS_STATE_MASK = BIT(5) | BIT(6) | BIT(7),
  965. OCRDMA_QP_PARAMS_FLAGS_SQD_ASYNC = BIT(8),
  966. OCRDMA_QP_PARAMS_FLAGS_INB_ATEN = BIT(9),
  967. OCRDMA_QP_PARAMS_FLAGS_L3_TYPE_SHIFT = 11,
  968. OCRDMA_QP_PARAMS_FLAGS_L3_TYPE_MASK = BIT(11) | BIT(12) | BIT(13),
  969. OCRDMA_QP_PARAMS_MAX_SGE_RECV_SHIFT = 16,
  970. OCRDMA_QP_PARAMS_MAX_SGE_RECV_MASK = 0xFFFF <<
  971. OCRDMA_QP_PARAMS_MAX_SGE_RECV_SHIFT,
  972. OCRDMA_QP_PARAMS_MAX_IRD_SHIFT = 0,
  973. OCRDMA_QP_PARAMS_MAX_IRD_MASK = 0xFFFF,
  974. OCRDMA_QP_PARAMS_MAX_ORD_SHIFT = 16,
  975. OCRDMA_QP_PARAMS_MAX_ORD_MASK = 0xFFFF <<
  976. OCRDMA_QP_PARAMS_MAX_ORD_SHIFT,
  977. OCRDMA_QP_PARAMS_RQ_CQID_SHIFT = 0,
  978. OCRDMA_QP_PARAMS_RQ_CQID_MASK = 0xFFFF,
  979. OCRDMA_QP_PARAMS_WQ_CQID_SHIFT = 16,
  980. OCRDMA_QP_PARAMS_WQ_CQID_MASK = 0xFFFF <<
  981. OCRDMA_QP_PARAMS_WQ_CQID_SHIFT,
  982. OCRDMA_QP_PARAMS_RQ_PSN_SHIFT = 0,
  983. OCRDMA_QP_PARAMS_RQ_PSN_MASK = 0xFFFFFF,
  984. OCRDMA_QP_PARAMS_HOP_LMT_SHIFT = 24,
  985. OCRDMA_QP_PARAMS_HOP_LMT_MASK = 0xFF <<
  986. OCRDMA_QP_PARAMS_HOP_LMT_SHIFT,
  987. OCRDMA_QP_PARAMS_SQ_PSN_SHIFT = 0,
  988. OCRDMA_QP_PARAMS_SQ_PSN_MASK = 0xFFFFFF,
  989. OCRDMA_QP_PARAMS_TCLASS_SHIFT = 24,
  990. OCRDMA_QP_PARAMS_TCLASS_MASK = 0xFF <<
  991. OCRDMA_QP_PARAMS_TCLASS_SHIFT,
  992. OCRDMA_QP_PARAMS_DEST_QPN_SHIFT = 0,
  993. OCRDMA_QP_PARAMS_DEST_QPN_MASK = 0xFFFFFF,
  994. OCRDMA_QP_PARAMS_RNR_RETRY_CNT_SHIFT = 24,
  995. OCRDMA_QP_PARAMS_RNR_RETRY_CNT_MASK = 0x7 <<
  996. OCRDMA_QP_PARAMS_RNR_RETRY_CNT_SHIFT,
  997. OCRDMA_QP_PARAMS_ACK_TIMEOUT_SHIFT = 27,
  998. OCRDMA_QP_PARAMS_ACK_TIMEOUT_MASK = 0x1F <<
  999. OCRDMA_QP_PARAMS_ACK_TIMEOUT_SHIFT,
  1000. OCRDMA_QP_PARAMS_PKEY_IDNEX_SHIFT = 0,
  1001. OCRDMA_QP_PARAMS_PKEY_INDEX_MASK = 0xFFFF,
  1002. OCRDMA_QP_PARAMS_PATH_MTU_SHIFT = 18,
  1003. OCRDMA_QP_PARAMS_PATH_MTU_MASK = 0x3FFF <<
  1004. OCRDMA_QP_PARAMS_PATH_MTU_SHIFT,
  1005. OCRDMA_QP_PARAMS_FLOW_LABEL_SHIFT = 0,
  1006. OCRDMA_QP_PARAMS_FLOW_LABEL_MASK = 0xFFFFF,
  1007. OCRDMA_QP_PARAMS_SL_SHIFT = 20,
  1008. OCRDMA_QP_PARAMS_SL_MASK = 0xF <<
  1009. OCRDMA_QP_PARAMS_SL_SHIFT,
  1010. OCRDMA_QP_PARAMS_RETRY_CNT_SHIFT = 24,
  1011. OCRDMA_QP_PARAMS_RETRY_CNT_MASK = 0x7 <<
  1012. OCRDMA_QP_PARAMS_RETRY_CNT_SHIFT,
  1013. OCRDMA_QP_PARAMS_RNR_NAK_TIMER_SHIFT = 27,
  1014. OCRDMA_QP_PARAMS_RNR_NAK_TIMER_MASK = 0x1F <<
  1015. OCRDMA_QP_PARAMS_RNR_NAK_TIMER_SHIFT,
  1016. OCRDMA_QP_PARAMS_DMAC_B4_TO_B5_SHIFT = 0,
  1017. OCRDMA_QP_PARAMS_DMAC_B4_TO_B5_MASK = 0xFFFF,
  1018. OCRDMA_QP_PARAMS_VLAN_SHIFT = 16,
  1019. OCRDMA_QP_PARAMS_VLAN_MASK = 0xFFFF <<
  1020. OCRDMA_QP_PARAMS_VLAN_SHIFT
  1021. };
  1022. struct ocrdma_qp_params {
  1023. u32 id;
  1024. u32 max_wqe_rqe;
  1025. u32 max_sge_send_write;
  1026. u32 max_sge_recv_flags;
  1027. u32 max_ord_ird;
  1028. u32 wq_rq_cqid;
  1029. u32 hop_lmt_rq_psn;
  1030. u32 tclass_sq_psn;
  1031. u32 ack_to_rnr_rtc_dest_qpn;
  1032. u32 path_mtu_pkey_indx;
  1033. u32 rnt_rc_sl_fl;
  1034. u8 sgid[16];
  1035. u8 dgid[16];
  1036. u32 dmac_b0_to_b3;
  1037. u32 vlan_dmac_b4_to_b5;
  1038. u32 qkey;
  1039. };
  1040. struct ocrdma_modify_qp {
  1041. struct ocrdma_mqe_hdr hdr;
  1042. struct ocrdma_mbx_hdr req;
  1043. struct ocrdma_qp_params params;
  1044. u32 flags;
  1045. u32 rdma_flags;
  1046. u32 num_outstanding_atomic_rd;
  1047. };
  1048. enum {
  1049. OCRDMA_MODIFY_QP_RSP_MAX_RQE_SHIFT = 0,
  1050. OCRDMA_MODIFY_QP_RSP_MAX_RQE_MASK = 0xFFFF,
  1051. OCRDMA_MODIFY_QP_RSP_MAX_WQE_SHIFT = 16,
  1052. OCRDMA_MODIFY_QP_RSP_MAX_WQE_MASK = 0xFFFF <<
  1053. OCRDMA_MODIFY_QP_RSP_MAX_WQE_SHIFT,
  1054. OCRDMA_MODIFY_QP_RSP_MAX_IRD_SHIFT = 0,
  1055. OCRDMA_MODIFY_QP_RSP_MAX_IRD_MASK = 0xFFFF,
  1056. OCRDMA_MODIFY_QP_RSP_MAX_ORD_SHIFT = 16,
  1057. OCRDMA_MODIFY_QP_RSP_MAX_ORD_MASK = 0xFFFF <<
  1058. OCRDMA_MODIFY_QP_RSP_MAX_ORD_SHIFT
  1059. };
  1060. struct ocrdma_modify_qp_rsp {
  1061. struct ocrdma_mqe_hdr hdr;
  1062. struct ocrdma_mbx_rsp rsp;
  1063. u32 max_wqe_rqe;
  1064. u32 max_ord_ird;
  1065. };
  1066. struct ocrdma_query_qp {
  1067. struct ocrdma_mqe_hdr hdr;
  1068. struct ocrdma_mbx_hdr req;
  1069. #define OCRDMA_QUERY_UP_QP_ID_SHIFT 0
  1070. #define OCRDMA_QUERY_UP_QP_ID_MASK 0xFFFFFF
  1071. u32 qp_id;
  1072. };
  1073. struct ocrdma_query_qp_rsp {
  1074. struct ocrdma_mqe_hdr hdr;
  1075. struct ocrdma_mbx_rsp rsp;
  1076. struct ocrdma_qp_params params;
  1077. u32 dpp_credits_cqid;
  1078. u32 rbq_id;
  1079. };
  1080. enum {
  1081. OCRDMA_CREATE_SRQ_PD_ID_SHIFT = 0,
  1082. OCRDMA_CREATE_SRQ_PD_ID_MASK = 0xFFFF,
  1083. OCRDMA_CREATE_SRQ_PG_SZ_SHIFT = 16,
  1084. OCRDMA_CREATE_SRQ_PG_SZ_MASK = 0x3 <<
  1085. OCRDMA_CREATE_SRQ_PG_SZ_SHIFT,
  1086. OCRDMA_CREATE_SRQ_MAX_RQE_SHIFT = 0,
  1087. OCRDMA_CREATE_SRQ_MAX_SGE_RECV_SHIFT = 16,
  1088. OCRDMA_CREATE_SRQ_MAX_SGE_RECV_MASK = 0xFFFF <<
  1089. OCRDMA_CREATE_SRQ_MAX_SGE_RECV_SHIFT,
  1090. OCRDMA_CREATE_SRQ_RQE_SIZE_SHIFT = 0,
  1091. OCRDMA_CREATE_SRQ_RQE_SIZE_MASK = 0xFFFF,
  1092. OCRDMA_CREATE_SRQ_NUM_RQ_PAGES_SHIFT = 16,
  1093. OCRDMA_CREATE_SRQ_NUM_RQ_PAGES_MASK = 0xFFFF <<
  1094. OCRDMA_CREATE_SRQ_NUM_RQ_PAGES_SHIFT
  1095. };
  1096. struct ocrdma_create_srq {
  1097. struct ocrdma_mqe_hdr hdr;
  1098. struct ocrdma_mbx_hdr req;
  1099. u32 pgsz_pdid;
  1100. u32 max_sge_rqe;
  1101. u32 pages_rqe_sz;
  1102. struct ocrdma_pa rq_addr[MAX_OCRDMA_SRQ_PAGES];
  1103. };
  1104. enum {
  1105. OCRDMA_CREATE_SRQ_RSP_SRQ_ID_SHIFT = 0,
  1106. OCRDMA_CREATE_SRQ_RSP_SRQ_ID_MASK = 0xFFFFFF,
  1107. OCRDMA_CREATE_SRQ_RSP_MAX_RQE_ALLOCATED_SHIFT = 0,
  1108. OCRDMA_CREATE_SRQ_RSP_MAX_RQE_ALLOCATED_MASK = 0xFFFF,
  1109. OCRDMA_CREATE_SRQ_RSP_MAX_SGE_RECV_ALLOCATED_SHIFT = 16,
  1110. OCRDMA_CREATE_SRQ_RSP_MAX_SGE_RECV_ALLOCATED_MASK = 0xFFFF <<
  1111. OCRDMA_CREATE_SRQ_RSP_MAX_SGE_RECV_ALLOCATED_SHIFT
  1112. };
  1113. struct ocrdma_create_srq_rsp {
  1114. struct ocrdma_mqe_hdr hdr;
  1115. struct ocrdma_mbx_rsp rsp;
  1116. u32 id;
  1117. u32 max_sge_rqe_allocated;
  1118. };
  1119. enum {
  1120. OCRDMA_MODIFY_SRQ_ID_SHIFT = 0,
  1121. OCRDMA_MODIFY_SRQ_ID_MASK = 0xFFFFFF,
  1122. OCRDMA_MODIFY_SRQ_MAX_RQE_SHIFT = 0,
  1123. OCRDMA_MODIFY_SRQ_MAX_RQE_MASK = 0xFFFF,
  1124. OCRDMA_MODIFY_SRQ_LIMIT_SHIFT = 16,
  1125. OCRDMA_MODIFY_SRQ__LIMIT_MASK = 0xFFFF <<
  1126. OCRDMA_MODIFY_SRQ_LIMIT_SHIFT
  1127. };
  1128. struct ocrdma_modify_srq {
  1129. struct ocrdma_mqe_hdr hdr;
  1130. struct ocrdma_mbx_rsp rep;
  1131. u32 id;
  1132. u32 limit_max_rqe;
  1133. };
  1134. enum {
  1135. OCRDMA_QUERY_SRQ_ID_SHIFT = 0,
  1136. OCRDMA_QUERY_SRQ_ID_MASK = 0xFFFFFF
  1137. };
  1138. struct ocrdma_query_srq {
  1139. struct ocrdma_mqe_hdr hdr;
  1140. struct ocrdma_mbx_rsp req;
  1141. u32 id;
  1142. };
  1143. enum {
  1144. OCRDMA_QUERY_SRQ_RSP_PD_ID_SHIFT = 0,
  1145. OCRDMA_QUERY_SRQ_RSP_PD_ID_MASK = 0xFFFF,
  1146. OCRDMA_QUERY_SRQ_RSP_MAX_RQE_SHIFT = 16,
  1147. OCRDMA_QUERY_SRQ_RSP_MAX_RQE_MASK = 0xFFFF <<
  1148. OCRDMA_QUERY_SRQ_RSP_MAX_RQE_SHIFT,
  1149. OCRDMA_QUERY_SRQ_RSP_MAX_SGE_RECV_SHIFT = 0,
  1150. OCRDMA_QUERY_SRQ_RSP_MAX_SGE_RECV_MASK = 0xFFFF,
  1151. OCRDMA_QUERY_SRQ_RSP_SRQ_LIMIT_SHIFT = 16,
  1152. OCRDMA_QUERY_SRQ_RSP_SRQ_LIMIT_MASK = 0xFFFF <<
  1153. OCRDMA_QUERY_SRQ_RSP_SRQ_LIMIT_SHIFT
  1154. };
  1155. struct ocrdma_query_srq_rsp {
  1156. struct ocrdma_mqe_hdr hdr;
  1157. struct ocrdma_mbx_rsp req;
  1158. u32 max_rqe_pdid;
  1159. u32 srq_lmt_max_sge;
  1160. };
  1161. enum {
  1162. OCRDMA_DESTROY_SRQ_ID_SHIFT = 0,
  1163. OCRDMA_DESTROY_SRQ_ID_MASK = 0xFFFFFF
  1164. };
  1165. struct ocrdma_destroy_srq {
  1166. struct ocrdma_mqe_hdr hdr;
  1167. struct ocrdma_mbx_rsp req;
  1168. u32 id;
  1169. };
  1170. enum {
  1171. OCRDMA_ALLOC_PD_ENABLE_DPP = BIT(16),
  1172. OCRDMA_DPP_PAGE_SIZE = 4096
  1173. };
  1174. struct ocrdma_alloc_pd {
  1175. struct ocrdma_mqe_hdr hdr;
  1176. struct ocrdma_mbx_hdr req;
  1177. u32 enable_dpp_rsvd;
  1178. };
  1179. enum {
  1180. OCRDMA_ALLOC_PD_RSP_DPP = BIT(16),
  1181. OCRDMA_ALLOC_PD_RSP_DPP_PAGE_SHIFT = 20,
  1182. OCRDMA_ALLOC_PD_RSP_PDID_MASK = 0xFFFF,
  1183. };
  1184. struct ocrdma_alloc_pd_rsp {
  1185. struct ocrdma_mqe_hdr hdr;
  1186. struct ocrdma_mbx_rsp rsp;
  1187. u32 dpp_page_pdid;
  1188. };
  1189. struct ocrdma_dealloc_pd {
  1190. struct ocrdma_mqe_hdr hdr;
  1191. struct ocrdma_mbx_hdr req;
  1192. u32 id;
  1193. };
  1194. struct ocrdma_dealloc_pd_rsp {
  1195. struct ocrdma_mqe_hdr hdr;
  1196. struct ocrdma_mbx_rsp rsp;
  1197. };
  1198. struct ocrdma_alloc_pd_range {
  1199. struct ocrdma_mqe_hdr hdr;
  1200. struct ocrdma_mbx_hdr req;
  1201. u32 enable_dpp_rsvd;
  1202. u32 pd_count;
  1203. };
  1204. struct ocrdma_alloc_pd_range_rsp {
  1205. struct ocrdma_mqe_hdr hdr;
  1206. struct ocrdma_mbx_rsp rsp;
  1207. u32 dpp_page_pdid;
  1208. u32 pd_count;
  1209. };
  1210. enum {
  1211. OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK = 0xFFFF,
  1212. };
  1213. struct ocrdma_dealloc_pd_range {
  1214. struct ocrdma_mqe_hdr hdr;
  1215. struct ocrdma_mbx_hdr req;
  1216. u32 start_pd_id;
  1217. u32 pd_count;
  1218. };
  1219. struct ocrdma_dealloc_pd_range_rsp {
  1220. struct ocrdma_mqe_hdr hdr;
  1221. struct ocrdma_mbx_hdr req;
  1222. u32 rsvd;
  1223. };
  1224. enum {
  1225. OCRDMA_ADDR_CHECK_ENABLE = 1,
  1226. OCRDMA_ADDR_CHECK_DISABLE = 0
  1227. };
  1228. enum {
  1229. OCRDMA_ALLOC_LKEY_PD_ID_SHIFT = 0,
  1230. OCRDMA_ALLOC_LKEY_PD_ID_MASK = 0xFFFF,
  1231. OCRDMA_ALLOC_LKEY_ADDR_CHECK_SHIFT = 0,
  1232. OCRDMA_ALLOC_LKEY_ADDR_CHECK_MASK = BIT(0),
  1233. OCRDMA_ALLOC_LKEY_FMR_SHIFT = 1,
  1234. OCRDMA_ALLOC_LKEY_FMR_MASK = BIT(1),
  1235. OCRDMA_ALLOC_LKEY_REMOTE_INV_SHIFT = 2,
  1236. OCRDMA_ALLOC_LKEY_REMOTE_INV_MASK = BIT(2),
  1237. OCRDMA_ALLOC_LKEY_REMOTE_WR_SHIFT = 3,
  1238. OCRDMA_ALLOC_LKEY_REMOTE_WR_MASK = BIT(3),
  1239. OCRDMA_ALLOC_LKEY_REMOTE_RD_SHIFT = 4,
  1240. OCRDMA_ALLOC_LKEY_REMOTE_RD_MASK = BIT(4),
  1241. OCRDMA_ALLOC_LKEY_LOCAL_WR_SHIFT = 5,
  1242. OCRDMA_ALLOC_LKEY_LOCAL_WR_MASK = BIT(5),
  1243. OCRDMA_ALLOC_LKEY_REMOTE_ATOMIC_MASK = BIT(6),
  1244. OCRDMA_ALLOC_LKEY_REMOTE_ATOMIC_SHIFT = 6,
  1245. OCRDMA_ALLOC_LKEY_PBL_SIZE_SHIFT = 16,
  1246. OCRDMA_ALLOC_LKEY_PBL_SIZE_MASK = 0xFFFF <<
  1247. OCRDMA_ALLOC_LKEY_PBL_SIZE_SHIFT
  1248. };
  1249. struct ocrdma_alloc_lkey {
  1250. struct ocrdma_mqe_hdr hdr;
  1251. struct ocrdma_mbx_hdr req;
  1252. u32 pdid;
  1253. u32 pbl_sz_flags;
  1254. };
  1255. struct ocrdma_alloc_lkey_rsp {
  1256. struct ocrdma_mqe_hdr hdr;
  1257. struct ocrdma_mbx_rsp rsp;
  1258. u32 lrkey;
  1259. u32 num_pbl_rsvd;
  1260. };
  1261. struct ocrdma_dealloc_lkey {
  1262. struct ocrdma_mqe_hdr hdr;
  1263. struct ocrdma_mbx_hdr req;
  1264. u32 lkey;
  1265. u32 rsvd_frmr;
  1266. };
  1267. struct ocrdma_dealloc_lkey_rsp {
  1268. struct ocrdma_mqe_hdr hdr;
  1269. struct ocrdma_mbx_rsp rsp;
  1270. };
  1271. #define MAX_OCRDMA_NSMR_PBL (u32)22
  1272. #define MAX_OCRDMA_PBL_SIZE 65536
  1273. #define MAX_OCRDMA_PBL_PER_LKEY 32767
  1274. enum {
  1275. OCRDMA_REG_NSMR_LRKEY_INDEX_SHIFT = 0,
  1276. OCRDMA_REG_NSMR_LRKEY_INDEX_MASK = 0xFFFFFF,
  1277. OCRDMA_REG_NSMR_LRKEY_SHIFT = 24,
  1278. OCRDMA_REG_NSMR_LRKEY_MASK = 0xFF <<
  1279. OCRDMA_REG_NSMR_LRKEY_SHIFT,
  1280. OCRDMA_REG_NSMR_PD_ID_SHIFT = 0,
  1281. OCRDMA_REG_NSMR_PD_ID_MASK = 0xFFFF,
  1282. OCRDMA_REG_NSMR_NUM_PBL_SHIFT = 16,
  1283. OCRDMA_REG_NSMR_NUM_PBL_MASK = 0xFFFF <<
  1284. OCRDMA_REG_NSMR_NUM_PBL_SHIFT,
  1285. OCRDMA_REG_NSMR_PBE_SIZE_SHIFT = 0,
  1286. OCRDMA_REG_NSMR_PBE_SIZE_MASK = 0xFFFF,
  1287. OCRDMA_REG_NSMR_HPAGE_SIZE_SHIFT = 16,
  1288. OCRDMA_REG_NSMR_HPAGE_SIZE_MASK = 0xFF <<
  1289. OCRDMA_REG_NSMR_HPAGE_SIZE_SHIFT,
  1290. OCRDMA_REG_NSMR_BIND_MEMWIN_SHIFT = 24,
  1291. OCRDMA_REG_NSMR_BIND_MEMWIN_MASK = BIT(24),
  1292. OCRDMA_REG_NSMR_ZB_SHIFT = 25,
  1293. OCRDMA_REG_NSMR_ZB_SHIFT_MASK = BIT(25),
  1294. OCRDMA_REG_NSMR_REMOTE_INV_SHIFT = 26,
  1295. OCRDMA_REG_NSMR_REMOTE_INV_MASK = BIT(26),
  1296. OCRDMA_REG_NSMR_REMOTE_WR_SHIFT = 27,
  1297. OCRDMA_REG_NSMR_REMOTE_WR_MASK = BIT(27),
  1298. OCRDMA_REG_NSMR_REMOTE_RD_SHIFT = 28,
  1299. OCRDMA_REG_NSMR_REMOTE_RD_MASK = BIT(28),
  1300. OCRDMA_REG_NSMR_LOCAL_WR_SHIFT = 29,
  1301. OCRDMA_REG_NSMR_LOCAL_WR_MASK = BIT(29),
  1302. OCRDMA_REG_NSMR_REMOTE_ATOMIC_SHIFT = 30,
  1303. OCRDMA_REG_NSMR_REMOTE_ATOMIC_MASK = BIT(30),
  1304. OCRDMA_REG_NSMR_LAST_SHIFT = 31,
  1305. OCRDMA_REG_NSMR_LAST_MASK = BIT(31)
  1306. };
  1307. struct ocrdma_reg_nsmr {
  1308. struct ocrdma_mqe_hdr hdr;
  1309. struct ocrdma_mbx_hdr cmd;
  1310. u32 fr_mr;
  1311. u32 num_pbl_pdid;
  1312. u32 flags_hpage_pbe_sz;
  1313. u32 totlen_low;
  1314. u32 totlen_high;
  1315. u32 fbo_low;
  1316. u32 fbo_high;
  1317. u32 va_loaddr;
  1318. u32 va_hiaddr;
  1319. struct ocrdma_pa pbl[MAX_OCRDMA_NSMR_PBL];
  1320. };
  1321. enum {
  1322. OCRDMA_REG_NSMR_CONT_PBL_SHIFT = 0,
  1323. OCRDMA_REG_NSMR_CONT_PBL_SHIFT_MASK = 0xFFFF,
  1324. OCRDMA_REG_NSMR_CONT_NUM_PBL_SHIFT = 16,
  1325. OCRDMA_REG_NSMR_CONT_NUM_PBL_MASK = 0xFFFF <<
  1326. OCRDMA_REG_NSMR_CONT_NUM_PBL_SHIFT,
  1327. OCRDMA_REG_NSMR_CONT_LAST_SHIFT = 31,
  1328. OCRDMA_REG_NSMR_CONT_LAST_MASK = BIT(31)
  1329. };
  1330. struct ocrdma_reg_nsmr_cont {
  1331. struct ocrdma_mqe_hdr hdr;
  1332. struct ocrdma_mbx_hdr cmd;
  1333. u32 lrkey;
  1334. u32 num_pbl_offset;
  1335. u32 last;
  1336. struct ocrdma_pa pbl[MAX_OCRDMA_NSMR_PBL];
  1337. };
  1338. struct ocrdma_pbe {
  1339. u32 pa_hi;
  1340. u32 pa_lo;
  1341. };
  1342. enum {
  1343. OCRDMA_REG_NSMR_RSP_NUM_PBL_SHIFT = 16,
  1344. OCRDMA_REG_NSMR_RSP_NUM_PBL_MASK = 0xFFFF0000
  1345. };
  1346. struct ocrdma_reg_nsmr_rsp {
  1347. struct ocrdma_mqe_hdr hdr;
  1348. struct ocrdma_mbx_rsp rsp;
  1349. u32 lrkey;
  1350. u32 num_pbl;
  1351. };
  1352. enum {
  1353. OCRDMA_REG_NSMR_CONT_RSP_LRKEY_INDEX_SHIFT = 0,
  1354. OCRDMA_REG_NSMR_CONT_RSP_LRKEY_INDEX_MASK = 0xFFFFFF,
  1355. OCRDMA_REG_NSMR_CONT_RSP_LRKEY_SHIFT = 24,
  1356. OCRDMA_REG_NSMR_CONT_RSP_LRKEY_MASK = 0xFF <<
  1357. OCRDMA_REG_NSMR_CONT_RSP_LRKEY_SHIFT,
  1358. OCRDMA_REG_NSMR_CONT_RSP_NUM_PBL_SHIFT = 16,
  1359. OCRDMA_REG_NSMR_CONT_RSP_NUM_PBL_MASK = 0xFFFF <<
  1360. OCRDMA_REG_NSMR_CONT_RSP_NUM_PBL_SHIFT
  1361. };
  1362. struct ocrdma_reg_nsmr_cont_rsp {
  1363. struct ocrdma_mqe_hdr hdr;
  1364. struct ocrdma_mbx_rsp rsp;
  1365. u32 lrkey_key_index;
  1366. u32 num_pbl;
  1367. };
  1368. enum {
  1369. OCRDMA_ALLOC_MW_PD_ID_SHIFT = 0,
  1370. OCRDMA_ALLOC_MW_PD_ID_MASK = 0xFFFF
  1371. };
  1372. struct ocrdma_alloc_mw {
  1373. struct ocrdma_mqe_hdr hdr;
  1374. struct ocrdma_mbx_hdr req;
  1375. u32 pdid;
  1376. };
  1377. enum {
  1378. OCRDMA_ALLOC_MW_RSP_LRKEY_INDEX_SHIFT = 0,
  1379. OCRDMA_ALLOC_MW_RSP_LRKEY_INDEX_MASK = 0xFFFFFF
  1380. };
  1381. struct ocrdma_alloc_mw_rsp {
  1382. struct ocrdma_mqe_hdr hdr;
  1383. struct ocrdma_mbx_rsp rsp;
  1384. u32 lrkey_index;
  1385. };
  1386. struct ocrdma_attach_mcast {
  1387. struct ocrdma_mqe_hdr hdr;
  1388. struct ocrdma_mbx_hdr req;
  1389. u32 qp_id;
  1390. u8 mgid[16];
  1391. u32 mac_b0_to_b3;
  1392. u32 vlan_mac_b4_to_b5;
  1393. };
  1394. struct ocrdma_attach_mcast_rsp {
  1395. struct ocrdma_mqe_hdr hdr;
  1396. struct ocrdma_mbx_rsp rsp;
  1397. };
  1398. struct ocrdma_detach_mcast {
  1399. struct ocrdma_mqe_hdr hdr;
  1400. struct ocrdma_mbx_hdr req;
  1401. u32 qp_id;
  1402. u8 mgid[16];
  1403. u32 mac_b0_to_b3;
  1404. u32 vlan_mac_b4_to_b5;
  1405. };
  1406. struct ocrdma_detach_mcast_rsp {
  1407. struct ocrdma_mqe_hdr hdr;
  1408. struct ocrdma_mbx_rsp rsp;
  1409. };
  1410. enum {
  1411. OCRDMA_CREATE_AH_NUM_PAGES_SHIFT = 19,
  1412. OCRDMA_CREATE_AH_NUM_PAGES_MASK = 0xF <<
  1413. OCRDMA_CREATE_AH_NUM_PAGES_SHIFT,
  1414. OCRDMA_CREATE_AH_PAGE_SIZE_SHIFT = 16,
  1415. OCRDMA_CREATE_AH_PAGE_SIZE_MASK = 0x7 <<
  1416. OCRDMA_CREATE_AH_PAGE_SIZE_SHIFT,
  1417. OCRDMA_CREATE_AH_ENTRY_SIZE_SHIFT = 23,
  1418. OCRDMA_CREATE_AH_ENTRY_SIZE_MASK = 0x1FF <<
  1419. OCRDMA_CREATE_AH_ENTRY_SIZE_SHIFT,
  1420. };
  1421. #define OCRDMA_AH_TBL_PAGES 8
  1422. struct ocrdma_create_ah_tbl {
  1423. struct ocrdma_mqe_hdr hdr;
  1424. struct ocrdma_mbx_hdr req;
  1425. u32 ah_conf;
  1426. struct ocrdma_pa tbl_addr[8];
  1427. };
  1428. struct ocrdma_create_ah_tbl_rsp {
  1429. struct ocrdma_mqe_hdr hdr;
  1430. struct ocrdma_mbx_rsp rsp;
  1431. u32 ahid;
  1432. };
  1433. struct ocrdma_delete_ah_tbl {
  1434. struct ocrdma_mqe_hdr hdr;
  1435. struct ocrdma_mbx_hdr req;
  1436. u32 ahid;
  1437. };
  1438. struct ocrdma_delete_ah_tbl_rsp {
  1439. struct ocrdma_mqe_hdr hdr;
  1440. struct ocrdma_mbx_rsp rsp;
  1441. };
  1442. enum {
  1443. OCRDMA_EQE_VALID_SHIFT = 0,
  1444. OCRDMA_EQE_VALID_MASK = BIT(0),
  1445. OCRDMA_EQE_MAJOR_CODE_MASK = 0x0E,
  1446. OCRDMA_EQE_MAJOR_CODE_SHIFT = 0x01,
  1447. OCRDMA_EQE_FOR_CQE_MASK = 0xFFFE,
  1448. OCRDMA_EQE_RESOURCE_ID_SHIFT = 16,
  1449. OCRDMA_EQE_RESOURCE_ID_MASK = 0xFFFF <<
  1450. OCRDMA_EQE_RESOURCE_ID_SHIFT,
  1451. };
  1452. enum major_code {
  1453. OCRDMA_MAJOR_CODE_COMPLETION = 0x00,
  1454. OCRDMA_MAJOR_CODE_SENTINAL = 0x01
  1455. };
  1456. struct ocrdma_eqe {
  1457. u32 id_valid;
  1458. };
  1459. enum OCRDMA_CQE_STATUS {
  1460. OCRDMA_CQE_SUCCESS = 0,
  1461. OCRDMA_CQE_LOC_LEN_ERR,
  1462. OCRDMA_CQE_LOC_QP_OP_ERR,
  1463. OCRDMA_CQE_LOC_EEC_OP_ERR,
  1464. OCRDMA_CQE_LOC_PROT_ERR,
  1465. OCRDMA_CQE_WR_FLUSH_ERR,
  1466. OCRDMA_CQE_MW_BIND_ERR,
  1467. OCRDMA_CQE_BAD_RESP_ERR,
  1468. OCRDMA_CQE_LOC_ACCESS_ERR,
  1469. OCRDMA_CQE_REM_INV_REQ_ERR,
  1470. OCRDMA_CQE_REM_ACCESS_ERR,
  1471. OCRDMA_CQE_REM_OP_ERR,
  1472. OCRDMA_CQE_RETRY_EXC_ERR,
  1473. OCRDMA_CQE_RNR_RETRY_EXC_ERR,
  1474. OCRDMA_CQE_LOC_RDD_VIOL_ERR,
  1475. OCRDMA_CQE_REM_INV_RD_REQ_ERR,
  1476. OCRDMA_CQE_REM_ABORT_ERR,
  1477. OCRDMA_CQE_INV_EECN_ERR,
  1478. OCRDMA_CQE_INV_EEC_STATE_ERR,
  1479. OCRDMA_CQE_FATAL_ERR,
  1480. OCRDMA_CQE_RESP_TIMEOUT_ERR,
  1481. OCRDMA_CQE_GENERAL_ERR,
  1482. OCRDMA_MAX_CQE_ERR
  1483. };
  1484. enum {
  1485. /* w0 */
  1486. OCRDMA_CQE_WQEIDX_SHIFT = 0,
  1487. OCRDMA_CQE_WQEIDX_MASK = 0xFFFF,
  1488. /* w1 */
  1489. OCRDMA_CQE_UD_XFER_LEN_SHIFT = 16,
  1490. OCRDMA_CQE_UD_XFER_LEN_MASK = 0x1FFF,
  1491. OCRDMA_CQE_PKEY_SHIFT = 0,
  1492. OCRDMA_CQE_PKEY_MASK = 0xFFFF,
  1493. OCRDMA_CQE_UD_L3TYPE_SHIFT = 29,
  1494. OCRDMA_CQE_UD_L3TYPE_MASK = 0x07,
  1495. /* w2 */
  1496. OCRDMA_CQE_QPN_SHIFT = 0,
  1497. OCRDMA_CQE_QPN_MASK = 0x0000FFFF,
  1498. OCRDMA_CQE_BUFTAG_SHIFT = 16,
  1499. OCRDMA_CQE_BUFTAG_MASK = 0xFFFF << OCRDMA_CQE_BUFTAG_SHIFT,
  1500. /* w3 */
  1501. OCRDMA_CQE_UD_STATUS_SHIFT = 24,
  1502. OCRDMA_CQE_UD_STATUS_MASK = 0x7 << OCRDMA_CQE_UD_STATUS_SHIFT,
  1503. OCRDMA_CQE_STATUS_SHIFT = 16,
  1504. OCRDMA_CQE_STATUS_MASK = 0xFF << OCRDMA_CQE_STATUS_SHIFT,
  1505. OCRDMA_CQE_VALID = BIT(31),
  1506. OCRDMA_CQE_INVALIDATE = BIT(30),
  1507. OCRDMA_CQE_QTYPE = BIT(29),
  1508. OCRDMA_CQE_IMM = BIT(28),
  1509. OCRDMA_CQE_WRITE_IMM = BIT(27),
  1510. OCRDMA_CQE_QTYPE_SQ = 0,
  1511. OCRDMA_CQE_QTYPE_RQ = 1,
  1512. OCRDMA_CQE_SRCQP_MASK = 0xFFFFFF
  1513. };
  1514. struct ocrdma_cqe {
  1515. union {
  1516. /* w0 to w2 */
  1517. struct {
  1518. u32 wqeidx;
  1519. u32 bytes_xfered;
  1520. u32 qpn;
  1521. } wq;
  1522. struct {
  1523. u32 lkey_immdt;
  1524. u32 rxlen;
  1525. u32 buftag_qpn;
  1526. } rq;
  1527. struct {
  1528. u32 lkey_immdt;
  1529. u32 rxlen_pkey;
  1530. u32 buftag_qpn;
  1531. } ud;
  1532. struct {
  1533. u32 word_0;
  1534. u32 word_1;
  1535. u32 qpn;
  1536. } cmn;
  1537. };
  1538. u32 flags_status_srcqpn; /* w3 */
  1539. };
  1540. struct ocrdma_sge {
  1541. u32 addr_hi;
  1542. u32 addr_lo;
  1543. u32 lrkey;
  1544. u32 len;
  1545. };
  1546. enum {
  1547. OCRDMA_FLAG_SIG = 0x1,
  1548. OCRDMA_FLAG_INV = 0x2,
  1549. OCRDMA_FLAG_FENCE_L = 0x4,
  1550. OCRDMA_FLAG_FENCE_R = 0x8,
  1551. OCRDMA_FLAG_SOLICIT = 0x10,
  1552. OCRDMA_FLAG_IMM = 0x20,
  1553. OCRDMA_FLAG_AH_VLAN_PR = 0x40,
  1554. /* Stag flags */
  1555. OCRDMA_LKEY_FLAG_LOCAL_WR = 0x1,
  1556. OCRDMA_LKEY_FLAG_REMOTE_RD = 0x2,
  1557. OCRDMA_LKEY_FLAG_REMOTE_WR = 0x4,
  1558. OCRDMA_LKEY_FLAG_VATO = 0x8,
  1559. };
  1560. enum OCRDMA_WQE_OPCODE {
  1561. OCRDMA_WRITE = 0x06,
  1562. OCRDMA_READ = 0x0C,
  1563. OCRDMA_RESV0 = 0x02,
  1564. OCRDMA_SEND = 0x00,
  1565. OCRDMA_CMP_SWP = 0x14,
  1566. OCRDMA_BIND_MW = 0x10,
  1567. OCRDMA_FR_MR = 0x11,
  1568. OCRDMA_RESV1 = 0x0A,
  1569. OCRDMA_LKEY_INV = 0x15,
  1570. OCRDMA_FETCH_ADD = 0x13,
  1571. OCRDMA_POST_RQ = 0x12
  1572. };
  1573. enum {
  1574. OCRDMA_TYPE_INLINE = 0x0,
  1575. OCRDMA_TYPE_LKEY = 0x1,
  1576. };
  1577. enum {
  1578. OCRDMA_WQE_OPCODE_SHIFT = 0,
  1579. OCRDMA_WQE_OPCODE_MASK = 0x0000001F,
  1580. OCRDMA_WQE_FLAGS_SHIFT = 5,
  1581. OCRDMA_WQE_TYPE_SHIFT = 16,
  1582. OCRDMA_WQE_TYPE_MASK = 0x00030000,
  1583. OCRDMA_WQE_SIZE_SHIFT = 18,
  1584. OCRDMA_WQE_SIZE_MASK = 0xFF,
  1585. OCRDMA_WQE_NXT_WQE_SIZE_SHIFT = 25,
  1586. OCRDMA_WQE_LKEY_FLAGS_SHIFT = 0,
  1587. OCRDMA_WQE_LKEY_FLAGS_MASK = 0xF
  1588. };
  1589. /* header WQE for all the SQ and RQ operations */
  1590. struct ocrdma_hdr_wqe {
  1591. u32 cw;
  1592. union {
  1593. u32 rsvd_tag;
  1594. u32 rsvd_lkey_flags;
  1595. };
  1596. union {
  1597. u32 immdt;
  1598. u32 lkey;
  1599. };
  1600. u32 total_len;
  1601. };
  1602. struct ocrdma_ewqe_ud_hdr {
  1603. u32 rsvd_dest_qpn;
  1604. u32 qkey;
  1605. u32 rsvd_ahid;
  1606. u32 hdr_type;
  1607. };
  1608. /* extended wqe followed by hdr_wqe for Fast Memory register */
  1609. struct ocrdma_ewqe_fr {
  1610. u32 va_hi;
  1611. u32 va_lo;
  1612. u32 fbo_hi;
  1613. u32 fbo_lo;
  1614. u32 size_sge;
  1615. u32 num_sges;
  1616. u32 rsvd;
  1617. u32 rsvd2;
  1618. };
  1619. struct ocrdma_eth_basic {
  1620. u8 dmac[6];
  1621. u8 smac[6];
  1622. __be16 eth_type;
  1623. } __packed;
  1624. struct ocrdma_eth_vlan {
  1625. u8 dmac[6];
  1626. u8 smac[6];
  1627. __be16 eth_type;
  1628. __be16 vlan_tag;
  1629. __be16 roce_eth_type;
  1630. } __packed;
  1631. struct ocrdma_grh {
  1632. __be32 tclass_flow;
  1633. __be32 pdid_hoplimit;
  1634. u8 sgid[16];
  1635. u8 dgid[16];
  1636. u16 rsvd;
  1637. } __packed;
  1638. #define OCRDMA_AV_VALID BIT(7)
  1639. #define OCRDMA_AV_VLAN_VALID BIT(1)
  1640. struct ocrdma_av {
  1641. struct ocrdma_eth_vlan eth_hdr;
  1642. struct ocrdma_grh grh;
  1643. u32 valid;
  1644. } __packed;
  1645. struct ocrdma_rsrc_stats {
  1646. u32 dpp_pds;
  1647. u32 non_dpp_pds;
  1648. u32 rc_dpp_qps;
  1649. u32 uc_dpp_qps;
  1650. u32 ud_dpp_qps;
  1651. u32 rc_non_dpp_qps;
  1652. u32 rsvd;
  1653. u32 uc_non_dpp_qps;
  1654. u32 ud_non_dpp_qps;
  1655. u32 rsvd1;
  1656. u32 srqs;
  1657. u32 rbqs;
  1658. u32 r64K_nsmr;
  1659. u32 r64K_to_2M_nsmr;
  1660. u32 r2M_to_44M_nsmr;
  1661. u32 r44M_to_1G_nsmr;
  1662. u32 r1G_to_4G_nsmr;
  1663. u32 nsmr_count_4G_to_32G;
  1664. u32 r32G_to_64G_nsmr;
  1665. u32 r64G_to_128G_nsmr;
  1666. u32 r128G_to_higher_nsmr;
  1667. u32 embedded_nsmr;
  1668. u32 frmr;
  1669. u32 prefetch_qps;
  1670. u32 ondemand_qps;
  1671. u32 phy_mr;
  1672. u32 mw;
  1673. u32 rsvd2[7];
  1674. };
  1675. struct ocrdma_db_err_stats {
  1676. u32 sq_doorbell_errors;
  1677. u32 cq_doorbell_errors;
  1678. u32 rq_srq_doorbell_errors;
  1679. u32 cq_overflow_errors;
  1680. u32 rsvd[4];
  1681. };
  1682. struct ocrdma_wqe_stats {
  1683. u32 large_send_rc_wqes_lo;
  1684. u32 large_send_rc_wqes_hi;
  1685. u32 large_write_rc_wqes_lo;
  1686. u32 large_write_rc_wqes_hi;
  1687. u32 rsvd[4];
  1688. u32 read_wqes_lo;
  1689. u32 read_wqes_hi;
  1690. u32 frmr_wqes_lo;
  1691. u32 frmr_wqes_hi;
  1692. u32 mw_bind_wqes_lo;
  1693. u32 mw_bind_wqes_hi;
  1694. u32 invalidate_wqes_lo;
  1695. u32 invalidate_wqes_hi;
  1696. u32 rsvd1[2];
  1697. u32 dpp_wqe_drops;
  1698. u32 rsvd2[5];
  1699. };
  1700. struct ocrdma_tx_stats {
  1701. u32 send_pkts_lo;
  1702. u32 send_pkts_hi;
  1703. u32 write_pkts_lo;
  1704. u32 write_pkts_hi;
  1705. u32 read_pkts_lo;
  1706. u32 read_pkts_hi;
  1707. u32 read_rsp_pkts_lo;
  1708. u32 read_rsp_pkts_hi;
  1709. u32 ack_pkts_lo;
  1710. u32 ack_pkts_hi;
  1711. u32 send_bytes_lo;
  1712. u32 send_bytes_hi;
  1713. u32 write_bytes_lo;
  1714. u32 write_bytes_hi;
  1715. u32 read_req_bytes_lo;
  1716. u32 read_req_bytes_hi;
  1717. u32 read_rsp_bytes_lo;
  1718. u32 read_rsp_bytes_hi;
  1719. u32 ack_timeouts;
  1720. u32 rsvd[5];
  1721. };
  1722. struct ocrdma_tx_qp_err_stats {
  1723. u32 local_length_errors;
  1724. u32 local_protection_errors;
  1725. u32 local_qp_operation_errors;
  1726. u32 retry_count_exceeded_errors;
  1727. u32 rnr_retry_count_exceeded_errors;
  1728. u32 rsvd[3];
  1729. };
  1730. struct ocrdma_rx_stats {
  1731. u32 roce_frame_bytes_lo;
  1732. u32 roce_frame_bytes_hi;
  1733. u32 roce_frame_icrc_drops;
  1734. u32 roce_frame_payload_len_drops;
  1735. u32 ud_drops;
  1736. u32 qp1_drops;
  1737. u32 psn_error_request_packets;
  1738. u32 psn_error_resp_packets;
  1739. u32 rnr_nak_timeouts;
  1740. u32 rnr_nak_receives;
  1741. u32 roce_frame_rxmt_drops;
  1742. u32 nak_count_psn_sequence_errors;
  1743. u32 rc_drop_count_lookup_errors;
  1744. u32 rq_rnr_naks;
  1745. u32 srq_rnr_naks;
  1746. u32 roce_frames_lo;
  1747. u32 roce_frames_hi;
  1748. u32 rsvd;
  1749. };
  1750. struct ocrdma_rx_qp_err_stats {
  1751. u32 nak_invalid_requst_errors;
  1752. u32 nak_remote_operation_errors;
  1753. u32 nak_count_remote_access_errors;
  1754. u32 local_length_errors;
  1755. u32 local_protection_errors;
  1756. u32 local_qp_operation_errors;
  1757. u32 rsvd[2];
  1758. };
  1759. struct ocrdma_tx_dbg_stats {
  1760. u32 data[100];
  1761. };
  1762. struct ocrdma_rx_dbg_stats {
  1763. u32 data[200];
  1764. };
  1765. struct ocrdma_rdma_stats_req {
  1766. struct ocrdma_mbx_hdr hdr;
  1767. u8 reset_stats;
  1768. u8 rsvd[3];
  1769. } __packed;
  1770. struct ocrdma_rdma_stats_resp {
  1771. struct ocrdma_mbx_hdr hdr;
  1772. struct ocrdma_rsrc_stats act_rsrc_stats;
  1773. struct ocrdma_rsrc_stats th_rsrc_stats;
  1774. struct ocrdma_db_err_stats db_err_stats;
  1775. struct ocrdma_wqe_stats wqe_stats;
  1776. struct ocrdma_tx_stats tx_stats;
  1777. struct ocrdma_tx_qp_err_stats tx_qp_err_stats;
  1778. struct ocrdma_rx_stats rx_stats;
  1779. struct ocrdma_rx_qp_err_stats rx_qp_err_stats;
  1780. struct ocrdma_tx_dbg_stats tx_dbg_stats;
  1781. struct ocrdma_rx_dbg_stats rx_dbg_stats;
  1782. } __packed;
  1783. enum {
  1784. OCRDMA_HBA_ATTRB_EPROM_VER_LO_MASK = 0xFF,
  1785. OCRDMA_HBA_ATTRB_EPROM_VER_HI_MASK = 0xFF00,
  1786. OCRDMA_HBA_ATTRB_EPROM_VER_HI_SHIFT = 0x08,
  1787. OCRDMA_HBA_ATTRB_CDBLEN_MASK = 0xFFFF,
  1788. OCRDMA_HBA_ATTRB_ASIC_REV_MASK = 0xFF0000,
  1789. OCRDMA_HBA_ATTRB_ASIC_REV_SHIFT = 0x10,
  1790. OCRDMA_HBA_ATTRB_GUID0_MASK = 0xFF000000,
  1791. OCRDMA_HBA_ATTRB_GUID0_SHIFT = 0x18,
  1792. OCRDMA_HBA_ATTRB_GUID13_MASK = 0xFF,
  1793. OCRDMA_HBA_ATTRB_GUID14_MASK = 0xFF00,
  1794. OCRDMA_HBA_ATTRB_GUID14_SHIFT = 0x08,
  1795. OCRDMA_HBA_ATTRB_GUID15_MASK = 0xFF0000,
  1796. OCRDMA_HBA_ATTRB_GUID15_SHIFT = 0x10,
  1797. OCRDMA_HBA_ATTRB_PCNT_MASK = 0xFF000000,
  1798. OCRDMA_HBA_ATTRB_PCNT_SHIFT = 0x18,
  1799. OCRDMA_HBA_ATTRB_LDTOUT_MASK = 0xFFFF,
  1800. OCRDMA_HBA_ATTRB_ISCSI_VER_MASK = 0xFF0000,
  1801. OCRDMA_HBA_ATTRB_ISCSI_VER_SHIFT = 0x10,
  1802. OCRDMA_HBA_ATTRB_MFUNC_DEV_MASK = 0xFF000000,
  1803. OCRDMA_HBA_ATTRB_MFUNC_DEV_SHIFT = 0x18,
  1804. OCRDMA_HBA_ATTRB_CV_MASK = 0xFF,
  1805. OCRDMA_HBA_ATTRB_HBA_ST_MASK = 0xFF00,
  1806. OCRDMA_HBA_ATTRB_HBA_ST_SHIFT = 0x08,
  1807. OCRDMA_HBA_ATTRB_MAX_DOMS_MASK = 0xFF0000,
  1808. OCRDMA_HBA_ATTRB_MAX_DOMS_SHIFT = 0x10,
  1809. OCRDMA_HBA_ATTRB_PTNUM_MASK = 0x3F000000,
  1810. OCRDMA_HBA_ATTRB_PTNUM_SHIFT = 0x18,
  1811. OCRDMA_HBA_ATTRB_PT_MASK = 0xC0000000,
  1812. OCRDMA_HBA_ATTRB_PT_SHIFT = 0x1E,
  1813. OCRDMA_HBA_ATTRB_ISCSI_FET_MASK = 0xFF,
  1814. OCRDMA_HBA_ATTRB_ASIC_GEN_MASK = 0xFF00,
  1815. OCRDMA_HBA_ATTRB_ASIC_GEN_SHIFT = 0x08,
  1816. OCRDMA_HBA_ATTRB_PCI_VID_MASK = 0xFFFF,
  1817. OCRDMA_HBA_ATTRB_PCI_DID_MASK = 0xFFFF0000,
  1818. OCRDMA_HBA_ATTRB_PCI_DID_SHIFT = 0x10,
  1819. OCRDMA_HBA_ATTRB_PCI_SVID_MASK = 0xFFFF,
  1820. OCRDMA_HBA_ATTRB_PCI_SSID_MASK = 0xFFFF0000,
  1821. OCRDMA_HBA_ATTRB_PCI_SSID_SHIFT = 0x10,
  1822. OCRDMA_HBA_ATTRB_PCI_BUSNUM_MASK = 0xFF,
  1823. OCRDMA_HBA_ATTRB_PCI_DEVNUM_MASK = 0xFF00,
  1824. OCRDMA_HBA_ATTRB_PCI_DEVNUM_SHIFT = 0x08,
  1825. OCRDMA_HBA_ATTRB_PCI_FUNCNUM_MASK = 0xFF0000,
  1826. OCRDMA_HBA_ATTRB_PCI_FUNCNUM_SHIFT = 0x10,
  1827. OCRDMA_HBA_ATTRB_IF_TYPE_MASK = 0xFF000000,
  1828. OCRDMA_HBA_ATTRB_IF_TYPE_SHIFT = 0x18,
  1829. OCRDMA_HBA_ATTRB_NETFIL_MASK =0xFF
  1830. };
  1831. struct mgmt_hba_attribs {
  1832. u8 flashrom_version_string[32];
  1833. u8 manufacturer_name[32];
  1834. u32 supported_modes;
  1835. u32 rsvd_eprom_verhi_verlo;
  1836. u32 mbx_ds_ver;
  1837. u32 epfw_ds_ver;
  1838. u8 ncsi_ver_string[12];
  1839. u32 default_extended_timeout;
  1840. u8 controller_model_number[32];
  1841. u8 controller_description[64];
  1842. u8 controller_serial_number[32];
  1843. u8 ip_version_string[32];
  1844. u8 firmware_version_string[32];
  1845. u8 bios_version_string[32];
  1846. u8 redboot_version_string[32];
  1847. u8 driver_version_string[32];
  1848. u8 fw_on_flash_version_string[32];
  1849. u32 functionalities_supported;
  1850. u32 guid0_asicrev_cdblen;
  1851. u8 generational_guid[12];
  1852. u32 portcnt_guid15;
  1853. u32 mfuncdev_iscsi_ldtout;
  1854. u32 ptpnum_maxdoms_hbast_cv;
  1855. u32 firmware_post_status;
  1856. u32 hba_mtu[8];
  1857. u32 res_asicgen_iscsi_feaures;
  1858. u32 rsvd1[3];
  1859. };
  1860. struct mgmt_controller_attrib {
  1861. struct mgmt_hba_attribs hba_attribs;
  1862. u32 pci_did_vid;
  1863. u32 pci_ssid_svid;
  1864. u32 ityp_fnum_devnum_bnum;
  1865. u32 uid_hi;
  1866. u32 uid_lo;
  1867. u32 res_nnetfil;
  1868. u32 rsvd0[4];
  1869. };
  1870. struct ocrdma_get_ctrl_attribs_rsp {
  1871. struct ocrdma_mbx_hdr hdr;
  1872. struct mgmt_controller_attrib ctrl_attribs;
  1873. };
  1874. #define OCRDMA_SUBSYS_DCBX 0x10
  1875. enum OCRDMA_DCBX_OPCODE {
  1876. OCRDMA_CMD_GET_DCBX_CONFIG = 0x01
  1877. };
  1878. enum OCRDMA_DCBX_PARAM_TYPE {
  1879. OCRDMA_PARAMETER_TYPE_ADMIN = 0x00,
  1880. OCRDMA_PARAMETER_TYPE_OPER = 0x01,
  1881. OCRDMA_PARAMETER_TYPE_PEER = 0x02
  1882. };
  1883. enum OCRDMA_DCBX_PROTO {
  1884. OCRDMA_PROTO_SELECT_L2 = 0x00,
  1885. OCRDMA_PROTO_SELECT_L4 = 0x01
  1886. };
  1887. enum OCRDMA_DCBX_APP_PARAM {
  1888. OCRDMA_APP_PARAM_APP_PROTO_MASK = 0xFFFF,
  1889. OCRDMA_APP_PARAM_PROTO_SEL_MASK = 0xFF,
  1890. OCRDMA_APP_PARAM_PROTO_SEL_SHIFT = 0x10,
  1891. OCRDMA_APP_PARAM_VALID_MASK = 0xFF,
  1892. OCRDMA_APP_PARAM_VALID_SHIFT = 0x18
  1893. };
  1894. enum OCRDMA_DCBX_STATE_FLAGS {
  1895. OCRDMA_STATE_FLAG_ENABLED = 0x01,
  1896. OCRDMA_STATE_FLAG_ADDVERTISED = 0x02,
  1897. OCRDMA_STATE_FLAG_WILLING = 0x04,
  1898. OCRDMA_STATE_FLAG_SYNC = 0x08,
  1899. OCRDMA_STATE_FLAG_UNSUPPORTED = 0x40000000,
  1900. OCRDMA_STATE_FLAG_NEG_FAILD = 0x80000000
  1901. };
  1902. enum OCRDMA_TCV_AEV_OPV_ST {
  1903. OCRDMA_DCBX_TC_SUPPORT_MASK = 0xFF,
  1904. OCRDMA_DCBX_TC_SUPPORT_SHIFT = 0x18,
  1905. OCRDMA_DCBX_APP_ENTRY_SHIFT = 0x10,
  1906. OCRDMA_DCBX_OP_PARAM_SHIFT = 0x08,
  1907. OCRDMA_DCBX_STATE_MASK = 0xFF
  1908. };
  1909. struct ocrdma_app_parameter {
  1910. u32 valid_proto_app;
  1911. u32 oui;
  1912. u32 app_prio[2];
  1913. };
  1914. struct ocrdma_dcbx_cfg {
  1915. u32 tcv_aev_opv_st;
  1916. u32 tc_state;
  1917. u32 pfc_state;
  1918. u32 qcn_state;
  1919. u32 appl_state;
  1920. u32 ll_state;
  1921. u32 tc_bw[2];
  1922. u32 tc_prio[8];
  1923. u32 pfc_prio[2];
  1924. struct ocrdma_app_parameter app_param[15];
  1925. };
  1926. struct ocrdma_get_dcbx_cfg_req {
  1927. struct ocrdma_mbx_hdr hdr;
  1928. u32 param_type;
  1929. } __packed;
  1930. struct ocrdma_get_dcbx_cfg_rsp {
  1931. struct ocrdma_mbx_rsp hdr;
  1932. struct ocrdma_dcbx_cfg cfg;
  1933. } __packed;
  1934. #endif /* __OCRDMA_SLI_H__ */