t4fw_api.h 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358
  1. /*
  2. * This file is part of the Chelsio T4 Ethernet driver for Linux.
  3. *
  4. * Copyright (c) 2009-2014 Chelsio Communications, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef _T4FW_INTERFACE_H_
  35. #define _T4FW_INTERFACE_H_
  36. enum fw_retval {
  37. FW_SUCCESS = 0, /* completed sucessfully */
  38. FW_EPERM = 1, /* operation not permitted */
  39. FW_ENOENT = 2, /* no such file or directory */
  40. FW_EIO = 5, /* input/output error; hw bad */
  41. FW_ENOEXEC = 8, /* exec format error; inv microcode */
  42. FW_EAGAIN = 11, /* try again */
  43. FW_ENOMEM = 12, /* out of memory */
  44. FW_EFAULT = 14, /* bad address; fw bad */
  45. FW_EBUSY = 16, /* resource busy */
  46. FW_EEXIST = 17, /* file exists */
  47. FW_ENODEV = 19, /* no such device */
  48. FW_EINVAL = 22, /* invalid argument */
  49. FW_ENOSPC = 28, /* no space left on device */
  50. FW_ENOSYS = 38, /* functionality not implemented */
  51. FW_ENODATA = 61, /* no data available */
  52. FW_EPROTO = 71, /* protocol error */
  53. FW_EADDRINUSE = 98, /* address already in use */
  54. FW_EADDRNOTAVAIL = 99, /* cannot assigned requested address */
  55. FW_ENETDOWN = 100, /* network is down */
  56. FW_ENETUNREACH = 101, /* network is unreachable */
  57. FW_ENOBUFS = 105, /* no buffer space available */
  58. FW_ETIMEDOUT = 110, /* timeout */
  59. FW_EINPROGRESS = 115, /* fw internal */
  60. FW_SCSI_ABORT_REQUESTED = 128, /* */
  61. FW_SCSI_ABORT_TIMEDOUT = 129, /* */
  62. FW_SCSI_ABORTED = 130, /* */
  63. FW_SCSI_CLOSE_REQUESTED = 131, /* */
  64. FW_ERR_LINK_DOWN = 132, /* */
  65. FW_RDEV_NOT_READY = 133, /* */
  66. FW_ERR_RDEV_LOST = 134, /* */
  67. FW_ERR_RDEV_LOGO = 135, /* */
  68. FW_FCOE_NO_XCHG = 136, /* */
  69. FW_SCSI_RSP_ERR = 137, /* */
  70. FW_ERR_RDEV_IMPL_LOGO = 138, /* */
  71. FW_SCSI_UNDER_FLOW_ERR = 139, /* */
  72. FW_SCSI_OVER_FLOW_ERR = 140, /* */
  73. FW_SCSI_DDP_ERR = 141, /* DDP error*/
  74. FW_SCSI_TASK_ERR = 142, /* No SCSI tasks available */
  75. };
  76. #define FW_T4VF_SGE_BASE_ADDR 0x0000
  77. #define FW_T4VF_MPS_BASE_ADDR 0x0100
  78. #define FW_T4VF_PL_BASE_ADDR 0x0200
  79. #define FW_T4VF_MBDATA_BASE_ADDR 0x0240
  80. #define FW_T4VF_CIM_BASE_ADDR 0x0300
  81. enum fw_wr_opcodes {
  82. FW_FILTER_WR = 0x02,
  83. FW_ULPTX_WR = 0x04,
  84. FW_TP_WR = 0x05,
  85. FW_ETH_TX_PKT_WR = 0x08,
  86. FW_OFLD_CONNECTION_WR = 0x2f,
  87. FW_FLOWC_WR = 0x0a,
  88. FW_OFLD_TX_DATA_WR = 0x0b,
  89. FW_CMD_WR = 0x10,
  90. FW_ETH_TX_PKT_VM_WR = 0x11,
  91. FW_RI_RES_WR = 0x0c,
  92. FW_RI_INIT_WR = 0x0d,
  93. FW_RI_RDMA_WRITE_WR = 0x14,
  94. FW_RI_SEND_WR = 0x15,
  95. FW_RI_RDMA_READ_WR = 0x16,
  96. FW_RI_RECV_WR = 0x17,
  97. FW_RI_BIND_MW_WR = 0x18,
  98. FW_RI_FR_NSMR_WR = 0x19,
  99. FW_RI_INV_LSTAG_WR = 0x1a,
  100. FW_LASTC2E_WR = 0x40
  101. };
  102. struct fw_wr_hdr {
  103. __be32 hi;
  104. __be32 lo;
  105. };
  106. /* work request opcode (hi) */
  107. #define FW_WR_OP_S 24
  108. #define FW_WR_OP_M 0xff
  109. #define FW_WR_OP_V(x) ((x) << FW_WR_OP_S)
  110. #define FW_WR_OP_G(x) (((x) >> FW_WR_OP_S) & FW_WR_OP_M)
  111. /* atomic flag (hi) - firmware encapsulates CPLs in CPL_BARRIER */
  112. #define FW_WR_ATOMIC_S 23
  113. #define FW_WR_ATOMIC_V(x) ((x) << FW_WR_ATOMIC_S)
  114. /* flush flag (hi) - firmware flushes flushable work request buffered
  115. * in the flow context.
  116. */
  117. #define FW_WR_FLUSH_S 22
  118. #define FW_WR_FLUSH_V(x) ((x) << FW_WR_FLUSH_S)
  119. /* completion flag (hi) - firmware generates a cpl_fw6_ack */
  120. #define FW_WR_COMPL_S 21
  121. #define FW_WR_COMPL_V(x) ((x) << FW_WR_COMPL_S)
  122. #define FW_WR_COMPL_F FW_WR_COMPL_V(1U)
  123. /* work request immediate data length (hi) */
  124. #define FW_WR_IMMDLEN_S 0
  125. #define FW_WR_IMMDLEN_M 0xff
  126. #define FW_WR_IMMDLEN_V(x) ((x) << FW_WR_IMMDLEN_S)
  127. /* egress queue status update to associated ingress queue entry (lo) */
  128. #define FW_WR_EQUIQ_S 31
  129. #define FW_WR_EQUIQ_V(x) ((x) << FW_WR_EQUIQ_S)
  130. #define FW_WR_EQUIQ_F FW_WR_EQUIQ_V(1U)
  131. /* egress queue status update to egress queue status entry (lo) */
  132. #define FW_WR_EQUEQ_S 30
  133. #define FW_WR_EQUEQ_V(x) ((x) << FW_WR_EQUEQ_S)
  134. #define FW_WR_EQUEQ_F FW_WR_EQUEQ_V(1U)
  135. /* flow context identifier (lo) */
  136. #define FW_WR_FLOWID_S 8
  137. #define FW_WR_FLOWID_V(x) ((x) << FW_WR_FLOWID_S)
  138. /* length in units of 16-bytes (lo) */
  139. #define FW_WR_LEN16_S 0
  140. #define FW_WR_LEN16_V(x) ((x) << FW_WR_LEN16_S)
  141. #define HW_TPL_FR_MT_PR_IV_P_FC 0X32B
  142. #define HW_TPL_FR_MT_PR_OV_P_FC 0X327
  143. /* filter wr reply code in cookie in CPL_SET_TCB_RPL */
  144. enum fw_filter_wr_cookie {
  145. FW_FILTER_WR_SUCCESS,
  146. FW_FILTER_WR_FLT_ADDED,
  147. FW_FILTER_WR_FLT_DELETED,
  148. FW_FILTER_WR_SMT_TBL_FULL,
  149. FW_FILTER_WR_EINVAL,
  150. };
  151. struct fw_filter_wr {
  152. __be32 op_pkd;
  153. __be32 len16_pkd;
  154. __be64 r3;
  155. __be32 tid_to_iq;
  156. __be32 del_filter_to_l2tix;
  157. __be16 ethtype;
  158. __be16 ethtypem;
  159. __u8 frag_to_ovlan_vldm;
  160. __u8 smac_sel;
  161. __be16 rx_chan_rx_rpl_iq;
  162. __be32 maci_to_matchtypem;
  163. __u8 ptcl;
  164. __u8 ptclm;
  165. __u8 ttyp;
  166. __u8 ttypm;
  167. __be16 ivlan;
  168. __be16 ivlanm;
  169. __be16 ovlan;
  170. __be16 ovlanm;
  171. __u8 lip[16];
  172. __u8 lipm[16];
  173. __u8 fip[16];
  174. __u8 fipm[16];
  175. __be16 lp;
  176. __be16 lpm;
  177. __be16 fp;
  178. __be16 fpm;
  179. __be16 r7;
  180. __u8 sma[6];
  181. };
  182. #define S_FW_FILTER_WR_TID 12
  183. #define M_FW_FILTER_WR_TID 0xfffff
  184. #define V_FW_FILTER_WR_TID(x) ((x) << S_FW_FILTER_WR_TID)
  185. #define G_FW_FILTER_WR_TID(x) \
  186. (((x) >> S_FW_FILTER_WR_TID) & M_FW_FILTER_WR_TID)
  187. #define S_FW_FILTER_WR_RQTYPE 11
  188. #define M_FW_FILTER_WR_RQTYPE 0x1
  189. #define V_FW_FILTER_WR_RQTYPE(x) ((x) << S_FW_FILTER_WR_RQTYPE)
  190. #define G_FW_FILTER_WR_RQTYPE(x) \
  191. (((x) >> S_FW_FILTER_WR_RQTYPE) & M_FW_FILTER_WR_RQTYPE)
  192. #define F_FW_FILTER_WR_RQTYPE V_FW_FILTER_WR_RQTYPE(1U)
  193. #define S_FW_FILTER_WR_NOREPLY 10
  194. #define M_FW_FILTER_WR_NOREPLY 0x1
  195. #define V_FW_FILTER_WR_NOREPLY(x) ((x) << S_FW_FILTER_WR_NOREPLY)
  196. #define G_FW_FILTER_WR_NOREPLY(x) \
  197. (((x) >> S_FW_FILTER_WR_NOREPLY) & M_FW_FILTER_WR_NOREPLY)
  198. #define F_FW_FILTER_WR_NOREPLY V_FW_FILTER_WR_NOREPLY(1U)
  199. #define S_FW_FILTER_WR_IQ 0
  200. #define M_FW_FILTER_WR_IQ 0x3ff
  201. #define V_FW_FILTER_WR_IQ(x) ((x) << S_FW_FILTER_WR_IQ)
  202. #define G_FW_FILTER_WR_IQ(x) \
  203. (((x) >> S_FW_FILTER_WR_IQ) & M_FW_FILTER_WR_IQ)
  204. #define S_FW_FILTER_WR_DEL_FILTER 31
  205. #define M_FW_FILTER_WR_DEL_FILTER 0x1
  206. #define V_FW_FILTER_WR_DEL_FILTER(x) ((x) << S_FW_FILTER_WR_DEL_FILTER)
  207. #define G_FW_FILTER_WR_DEL_FILTER(x) \
  208. (((x) >> S_FW_FILTER_WR_DEL_FILTER) & M_FW_FILTER_WR_DEL_FILTER)
  209. #define F_FW_FILTER_WR_DEL_FILTER V_FW_FILTER_WR_DEL_FILTER(1U)
  210. #define S_FW_FILTER_WR_RPTTID 25
  211. #define M_FW_FILTER_WR_RPTTID 0x1
  212. #define V_FW_FILTER_WR_RPTTID(x) ((x) << S_FW_FILTER_WR_RPTTID)
  213. #define G_FW_FILTER_WR_RPTTID(x) \
  214. (((x) >> S_FW_FILTER_WR_RPTTID) & M_FW_FILTER_WR_RPTTID)
  215. #define F_FW_FILTER_WR_RPTTID V_FW_FILTER_WR_RPTTID(1U)
  216. #define S_FW_FILTER_WR_DROP 24
  217. #define M_FW_FILTER_WR_DROP 0x1
  218. #define V_FW_FILTER_WR_DROP(x) ((x) << S_FW_FILTER_WR_DROP)
  219. #define G_FW_FILTER_WR_DROP(x) \
  220. (((x) >> S_FW_FILTER_WR_DROP) & M_FW_FILTER_WR_DROP)
  221. #define F_FW_FILTER_WR_DROP V_FW_FILTER_WR_DROP(1U)
  222. #define S_FW_FILTER_WR_DIRSTEER 23
  223. #define M_FW_FILTER_WR_DIRSTEER 0x1
  224. #define V_FW_FILTER_WR_DIRSTEER(x) ((x) << S_FW_FILTER_WR_DIRSTEER)
  225. #define G_FW_FILTER_WR_DIRSTEER(x) \
  226. (((x) >> S_FW_FILTER_WR_DIRSTEER) & M_FW_FILTER_WR_DIRSTEER)
  227. #define F_FW_FILTER_WR_DIRSTEER V_FW_FILTER_WR_DIRSTEER(1U)
  228. #define S_FW_FILTER_WR_MASKHASH 22
  229. #define M_FW_FILTER_WR_MASKHASH 0x1
  230. #define V_FW_FILTER_WR_MASKHASH(x) ((x) << S_FW_FILTER_WR_MASKHASH)
  231. #define G_FW_FILTER_WR_MASKHASH(x) \
  232. (((x) >> S_FW_FILTER_WR_MASKHASH) & M_FW_FILTER_WR_MASKHASH)
  233. #define F_FW_FILTER_WR_MASKHASH V_FW_FILTER_WR_MASKHASH(1U)
  234. #define S_FW_FILTER_WR_DIRSTEERHASH 21
  235. #define M_FW_FILTER_WR_DIRSTEERHASH 0x1
  236. #define V_FW_FILTER_WR_DIRSTEERHASH(x) ((x) << S_FW_FILTER_WR_DIRSTEERHASH)
  237. #define G_FW_FILTER_WR_DIRSTEERHASH(x) \
  238. (((x) >> S_FW_FILTER_WR_DIRSTEERHASH) & M_FW_FILTER_WR_DIRSTEERHASH)
  239. #define F_FW_FILTER_WR_DIRSTEERHASH V_FW_FILTER_WR_DIRSTEERHASH(1U)
  240. #define S_FW_FILTER_WR_LPBK 20
  241. #define M_FW_FILTER_WR_LPBK 0x1
  242. #define V_FW_FILTER_WR_LPBK(x) ((x) << S_FW_FILTER_WR_LPBK)
  243. #define G_FW_FILTER_WR_LPBK(x) \
  244. (((x) >> S_FW_FILTER_WR_LPBK) & M_FW_FILTER_WR_LPBK)
  245. #define F_FW_FILTER_WR_LPBK V_FW_FILTER_WR_LPBK(1U)
  246. #define S_FW_FILTER_WR_DMAC 19
  247. #define M_FW_FILTER_WR_DMAC 0x1
  248. #define V_FW_FILTER_WR_DMAC(x) ((x) << S_FW_FILTER_WR_DMAC)
  249. #define G_FW_FILTER_WR_DMAC(x) \
  250. (((x) >> S_FW_FILTER_WR_DMAC) & M_FW_FILTER_WR_DMAC)
  251. #define F_FW_FILTER_WR_DMAC V_FW_FILTER_WR_DMAC(1U)
  252. #define S_FW_FILTER_WR_SMAC 18
  253. #define M_FW_FILTER_WR_SMAC 0x1
  254. #define V_FW_FILTER_WR_SMAC(x) ((x) << S_FW_FILTER_WR_SMAC)
  255. #define G_FW_FILTER_WR_SMAC(x) \
  256. (((x) >> S_FW_FILTER_WR_SMAC) & M_FW_FILTER_WR_SMAC)
  257. #define F_FW_FILTER_WR_SMAC V_FW_FILTER_WR_SMAC(1U)
  258. #define S_FW_FILTER_WR_INSVLAN 17
  259. #define M_FW_FILTER_WR_INSVLAN 0x1
  260. #define V_FW_FILTER_WR_INSVLAN(x) ((x) << S_FW_FILTER_WR_INSVLAN)
  261. #define G_FW_FILTER_WR_INSVLAN(x) \
  262. (((x) >> S_FW_FILTER_WR_INSVLAN) & M_FW_FILTER_WR_INSVLAN)
  263. #define F_FW_FILTER_WR_INSVLAN V_FW_FILTER_WR_INSVLAN(1U)
  264. #define S_FW_FILTER_WR_RMVLAN 16
  265. #define M_FW_FILTER_WR_RMVLAN 0x1
  266. #define V_FW_FILTER_WR_RMVLAN(x) ((x) << S_FW_FILTER_WR_RMVLAN)
  267. #define G_FW_FILTER_WR_RMVLAN(x) \
  268. (((x) >> S_FW_FILTER_WR_RMVLAN) & M_FW_FILTER_WR_RMVLAN)
  269. #define F_FW_FILTER_WR_RMVLAN V_FW_FILTER_WR_RMVLAN(1U)
  270. #define S_FW_FILTER_WR_HITCNTS 15
  271. #define M_FW_FILTER_WR_HITCNTS 0x1
  272. #define V_FW_FILTER_WR_HITCNTS(x) ((x) << S_FW_FILTER_WR_HITCNTS)
  273. #define G_FW_FILTER_WR_HITCNTS(x) \
  274. (((x) >> S_FW_FILTER_WR_HITCNTS) & M_FW_FILTER_WR_HITCNTS)
  275. #define F_FW_FILTER_WR_HITCNTS V_FW_FILTER_WR_HITCNTS(1U)
  276. #define S_FW_FILTER_WR_TXCHAN 13
  277. #define M_FW_FILTER_WR_TXCHAN 0x3
  278. #define V_FW_FILTER_WR_TXCHAN(x) ((x) << S_FW_FILTER_WR_TXCHAN)
  279. #define G_FW_FILTER_WR_TXCHAN(x) \
  280. (((x) >> S_FW_FILTER_WR_TXCHAN) & M_FW_FILTER_WR_TXCHAN)
  281. #define S_FW_FILTER_WR_PRIO 12
  282. #define M_FW_FILTER_WR_PRIO 0x1
  283. #define V_FW_FILTER_WR_PRIO(x) ((x) << S_FW_FILTER_WR_PRIO)
  284. #define G_FW_FILTER_WR_PRIO(x) \
  285. (((x) >> S_FW_FILTER_WR_PRIO) & M_FW_FILTER_WR_PRIO)
  286. #define F_FW_FILTER_WR_PRIO V_FW_FILTER_WR_PRIO(1U)
  287. #define S_FW_FILTER_WR_L2TIX 0
  288. #define M_FW_FILTER_WR_L2TIX 0xfff
  289. #define V_FW_FILTER_WR_L2TIX(x) ((x) << S_FW_FILTER_WR_L2TIX)
  290. #define G_FW_FILTER_WR_L2TIX(x) \
  291. (((x) >> S_FW_FILTER_WR_L2TIX) & M_FW_FILTER_WR_L2TIX)
  292. #define S_FW_FILTER_WR_FRAG 7
  293. #define M_FW_FILTER_WR_FRAG 0x1
  294. #define V_FW_FILTER_WR_FRAG(x) ((x) << S_FW_FILTER_WR_FRAG)
  295. #define G_FW_FILTER_WR_FRAG(x) \
  296. (((x) >> S_FW_FILTER_WR_FRAG) & M_FW_FILTER_WR_FRAG)
  297. #define F_FW_FILTER_WR_FRAG V_FW_FILTER_WR_FRAG(1U)
  298. #define S_FW_FILTER_WR_FRAGM 6
  299. #define M_FW_FILTER_WR_FRAGM 0x1
  300. #define V_FW_FILTER_WR_FRAGM(x) ((x) << S_FW_FILTER_WR_FRAGM)
  301. #define G_FW_FILTER_WR_FRAGM(x) \
  302. (((x) >> S_FW_FILTER_WR_FRAGM) & M_FW_FILTER_WR_FRAGM)
  303. #define F_FW_FILTER_WR_FRAGM V_FW_FILTER_WR_FRAGM(1U)
  304. #define S_FW_FILTER_WR_IVLAN_VLD 5
  305. #define M_FW_FILTER_WR_IVLAN_VLD 0x1
  306. #define V_FW_FILTER_WR_IVLAN_VLD(x) ((x) << S_FW_FILTER_WR_IVLAN_VLD)
  307. #define G_FW_FILTER_WR_IVLAN_VLD(x) \
  308. (((x) >> S_FW_FILTER_WR_IVLAN_VLD) & M_FW_FILTER_WR_IVLAN_VLD)
  309. #define F_FW_FILTER_WR_IVLAN_VLD V_FW_FILTER_WR_IVLAN_VLD(1U)
  310. #define S_FW_FILTER_WR_OVLAN_VLD 4
  311. #define M_FW_FILTER_WR_OVLAN_VLD 0x1
  312. #define V_FW_FILTER_WR_OVLAN_VLD(x) ((x) << S_FW_FILTER_WR_OVLAN_VLD)
  313. #define G_FW_FILTER_WR_OVLAN_VLD(x) \
  314. (((x) >> S_FW_FILTER_WR_OVLAN_VLD) & M_FW_FILTER_WR_OVLAN_VLD)
  315. #define F_FW_FILTER_WR_OVLAN_VLD V_FW_FILTER_WR_OVLAN_VLD(1U)
  316. #define S_FW_FILTER_WR_IVLAN_VLDM 3
  317. #define M_FW_FILTER_WR_IVLAN_VLDM 0x1
  318. #define V_FW_FILTER_WR_IVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_IVLAN_VLDM)
  319. #define G_FW_FILTER_WR_IVLAN_VLDM(x) \
  320. (((x) >> S_FW_FILTER_WR_IVLAN_VLDM) & M_FW_FILTER_WR_IVLAN_VLDM)
  321. #define F_FW_FILTER_WR_IVLAN_VLDM V_FW_FILTER_WR_IVLAN_VLDM(1U)
  322. #define S_FW_FILTER_WR_OVLAN_VLDM 2
  323. #define M_FW_FILTER_WR_OVLAN_VLDM 0x1
  324. #define V_FW_FILTER_WR_OVLAN_VLDM(x) ((x) << S_FW_FILTER_WR_OVLAN_VLDM)
  325. #define G_FW_FILTER_WR_OVLAN_VLDM(x) \
  326. (((x) >> S_FW_FILTER_WR_OVLAN_VLDM) & M_FW_FILTER_WR_OVLAN_VLDM)
  327. #define F_FW_FILTER_WR_OVLAN_VLDM V_FW_FILTER_WR_OVLAN_VLDM(1U)
  328. #define S_FW_FILTER_WR_RX_CHAN 15
  329. #define M_FW_FILTER_WR_RX_CHAN 0x1
  330. #define V_FW_FILTER_WR_RX_CHAN(x) ((x) << S_FW_FILTER_WR_RX_CHAN)
  331. #define G_FW_FILTER_WR_RX_CHAN(x) \
  332. (((x) >> S_FW_FILTER_WR_RX_CHAN) & M_FW_FILTER_WR_RX_CHAN)
  333. #define F_FW_FILTER_WR_RX_CHAN V_FW_FILTER_WR_RX_CHAN(1U)
  334. #define S_FW_FILTER_WR_RX_RPL_IQ 0
  335. #define M_FW_FILTER_WR_RX_RPL_IQ 0x3ff
  336. #define V_FW_FILTER_WR_RX_RPL_IQ(x) ((x) << S_FW_FILTER_WR_RX_RPL_IQ)
  337. #define G_FW_FILTER_WR_RX_RPL_IQ(x) \
  338. (((x) >> S_FW_FILTER_WR_RX_RPL_IQ) & M_FW_FILTER_WR_RX_RPL_IQ)
  339. #define S_FW_FILTER_WR_MACI 23
  340. #define M_FW_FILTER_WR_MACI 0x1ff
  341. #define V_FW_FILTER_WR_MACI(x) ((x) << S_FW_FILTER_WR_MACI)
  342. #define G_FW_FILTER_WR_MACI(x) \
  343. (((x) >> S_FW_FILTER_WR_MACI) & M_FW_FILTER_WR_MACI)
  344. #define S_FW_FILTER_WR_MACIM 14
  345. #define M_FW_FILTER_WR_MACIM 0x1ff
  346. #define V_FW_FILTER_WR_MACIM(x) ((x) << S_FW_FILTER_WR_MACIM)
  347. #define G_FW_FILTER_WR_MACIM(x) \
  348. (((x) >> S_FW_FILTER_WR_MACIM) & M_FW_FILTER_WR_MACIM)
  349. #define S_FW_FILTER_WR_FCOE 13
  350. #define M_FW_FILTER_WR_FCOE 0x1
  351. #define V_FW_FILTER_WR_FCOE(x) ((x) << S_FW_FILTER_WR_FCOE)
  352. #define G_FW_FILTER_WR_FCOE(x) \
  353. (((x) >> S_FW_FILTER_WR_FCOE) & M_FW_FILTER_WR_FCOE)
  354. #define F_FW_FILTER_WR_FCOE V_FW_FILTER_WR_FCOE(1U)
  355. #define S_FW_FILTER_WR_FCOEM 12
  356. #define M_FW_FILTER_WR_FCOEM 0x1
  357. #define V_FW_FILTER_WR_FCOEM(x) ((x) << S_FW_FILTER_WR_FCOEM)
  358. #define G_FW_FILTER_WR_FCOEM(x) \
  359. (((x) >> S_FW_FILTER_WR_FCOEM) & M_FW_FILTER_WR_FCOEM)
  360. #define F_FW_FILTER_WR_FCOEM V_FW_FILTER_WR_FCOEM(1U)
  361. #define S_FW_FILTER_WR_PORT 9
  362. #define M_FW_FILTER_WR_PORT 0x7
  363. #define V_FW_FILTER_WR_PORT(x) ((x) << S_FW_FILTER_WR_PORT)
  364. #define G_FW_FILTER_WR_PORT(x) \
  365. (((x) >> S_FW_FILTER_WR_PORT) & M_FW_FILTER_WR_PORT)
  366. #define S_FW_FILTER_WR_PORTM 6
  367. #define M_FW_FILTER_WR_PORTM 0x7
  368. #define V_FW_FILTER_WR_PORTM(x) ((x) << S_FW_FILTER_WR_PORTM)
  369. #define G_FW_FILTER_WR_PORTM(x) \
  370. (((x) >> S_FW_FILTER_WR_PORTM) & M_FW_FILTER_WR_PORTM)
  371. #define S_FW_FILTER_WR_MATCHTYPE 3
  372. #define M_FW_FILTER_WR_MATCHTYPE 0x7
  373. #define V_FW_FILTER_WR_MATCHTYPE(x) ((x) << S_FW_FILTER_WR_MATCHTYPE)
  374. #define G_FW_FILTER_WR_MATCHTYPE(x) \
  375. (((x) >> S_FW_FILTER_WR_MATCHTYPE) & M_FW_FILTER_WR_MATCHTYPE)
  376. #define S_FW_FILTER_WR_MATCHTYPEM 0
  377. #define M_FW_FILTER_WR_MATCHTYPEM 0x7
  378. #define V_FW_FILTER_WR_MATCHTYPEM(x) ((x) << S_FW_FILTER_WR_MATCHTYPEM)
  379. #define G_FW_FILTER_WR_MATCHTYPEM(x) \
  380. (((x) >> S_FW_FILTER_WR_MATCHTYPEM) & M_FW_FILTER_WR_MATCHTYPEM)
  381. struct fw_ulptx_wr {
  382. __be32 op_to_compl;
  383. __be32 flowid_len16;
  384. u64 cookie;
  385. };
  386. struct fw_tp_wr {
  387. __be32 op_to_immdlen;
  388. __be32 flowid_len16;
  389. u64 cookie;
  390. };
  391. struct fw_eth_tx_pkt_wr {
  392. __be32 op_immdlen;
  393. __be32 equiq_to_len16;
  394. __be64 r3;
  395. };
  396. struct fw_ofld_connection_wr {
  397. __be32 op_compl;
  398. __be32 len16_pkd;
  399. __u64 cookie;
  400. __be64 r2;
  401. __be64 r3;
  402. struct fw_ofld_connection_le {
  403. __be32 version_cpl;
  404. __be32 filter;
  405. __be32 r1;
  406. __be16 lport;
  407. __be16 pport;
  408. union fw_ofld_connection_leip {
  409. struct fw_ofld_connection_le_ipv4 {
  410. __be32 pip;
  411. __be32 lip;
  412. __be64 r0;
  413. __be64 r1;
  414. __be64 r2;
  415. } ipv4;
  416. struct fw_ofld_connection_le_ipv6 {
  417. __be64 pip_hi;
  418. __be64 pip_lo;
  419. __be64 lip_hi;
  420. __be64 lip_lo;
  421. } ipv6;
  422. } u;
  423. } le;
  424. struct fw_ofld_connection_tcb {
  425. __be32 t_state_to_astid;
  426. __be16 cplrxdataack_cplpassacceptrpl;
  427. __be16 rcv_adv;
  428. __be32 rcv_nxt;
  429. __be32 tx_max;
  430. __be64 opt0;
  431. __be32 opt2;
  432. __be32 r1;
  433. __be64 r2;
  434. __be64 r3;
  435. } tcb;
  436. };
  437. #define S_FW_OFLD_CONNECTION_WR_VERSION 31
  438. #define M_FW_OFLD_CONNECTION_WR_VERSION 0x1
  439. #define V_FW_OFLD_CONNECTION_WR_VERSION(x) \
  440. ((x) << S_FW_OFLD_CONNECTION_WR_VERSION)
  441. #define G_FW_OFLD_CONNECTION_WR_VERSION(x) \
  442. (((x) >> S_FW_OFLD_CONNECTION_WR_VERSION) & \
  443. M_FW_OFLD_CONNECTION_WR_VERSION)
  444. #define F_FW_OFLD_CONNECTION_WR_VERSION \
  445. V_FW_OFLD_CONNECTION_WR_VERSION(1U)
  446. #define S_FW_OFLD_CONNECTION_WR_CPL 30
  447. #define M_FW_OFLD_CONNECTION_WR_CPL 0x1
  448. #define V_FW_OFLD_CONNECTION_WR_CPL(x) ((x) << S_FW_OFLD_CONNECTION_WR_CPL)
  449. #define G_FW_OFLD_CONNECTION_WR_CPL(x) \
  450. (((x) >> S_FW_OFLD_CONNECTION_WR_CPL) & M_FW_OFLD_CONNECTION_WR_CPL)
  451. #define F_FW_OFLD_CONNECTION_WR_CPL V_FW_OFLD_CONNECTION_WR_CPL(1U)
  452. #define S_FW_OFLD_CONNECTION_WR_T_STATE 28
  453. #define M_FW_OFLD_CONNECTION_WR_T_STATE 0xf
  454. #define V_FW_OFLD_CONNECTION_WR_T_STATE(x) \
  455. ((x) << S_FW_OFLD_CONNECTION_WR_T_STATE)
  456. #define G_FW_OFLD_CONNECTION_WR_T_STATE(x) \
  457. (((x) >> S_FW_OFLD_CONNECTION_WR_T_STATE) & \
  458. M_FW_OFLD_CONNECTION_WR_T_STATE)
  459. #define S_FW_OFLD_CONNECTION_WR_RCV_SCALE 24
  460. #define M_FW_OFLD_CONNECTION_WR_RCV_SCALE 0xf
  461. #define V_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \
  462. ((x) << S_FW_OFLD_CONNECTION_WR_RCV_SCALE)
  463. #define G_FW_OFLD_CONNECTION_WR_RCV_SCALE(x) \
  464. (((x) >> S_FW_OFLD_CONNECTION_WR_RCV_SCALE) & \
  465. M_FW_OFLD_CONNECTION_WR_RCV_SCALE)
  466. #define S_FW_OFLD_CONNECTION_WR_ASTID 0
  467. #define M_FW_OFLD_CONNECTION_WR_ASTID 0xffffff
  468. #define V_FW_OFLD_CONNECTION_WR_ASTID(x) \
  469. ((x) << S_FW_OFLD_CONNECTION_WR_ASTID)
  470. #define G_FW_OFLD_CONNECTION_WR_ASTID(x) \
  471. (((x) >> S_FW_OFLD_CONNECTION_WR_ASTID) & M_FW_OFLD_CONNECTION_WR_ASTID)
  472. #define S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 15
  473. #define M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK 0x1
  474. #define V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \
  475. ((x) << S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK)
  476. #define G_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(x) \
  477. (((x) >> S_FW_OFLD_CONNECTION_WR_CPLRXDATAACK) & \
  478. M_FW_OFLD_CONNECTION_WR_CPLRXDATAACK)
  479. #define F_FW_OFLD_CONNECTION_WR_CPLRXDATAACK \
  480. V_FW_OFLD_CONNECTION_WR_CPLRXDATAACK(1U)
  481. #define S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 14
  482. #define M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL 0x1
  483. #define V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \
  484. ((x) << S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL)
  485. #define G_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(x) \
  486. (((x) >> S_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL) & \
  487. M_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL)
  488. #define F_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL \
  489. V_FW_OFLD_CONNECTION_WR_CPLPASSACCEPTRPL(1U)
  490. enum fw_flowc_mnem {
  491. FW_FLOWC_MNEM_PFNVFN, /* PFN [15:8] VFN [7:0] */
  492. FW_FLOWC_MNEM_CH,
  493. FW_FLOWC_MNEM_PORT,
  494. FW_FLOWC_MNEM_IQID,
  495. FW_FLOWC_MNEM_SNDNXT,
  496. FW_FLOWC_MNEM_RCVNXT,
  497. FW_FLOWC_MNEM_SNDBUF,
  498. FW_FLOWC_MNEM_MSS,
  499. };
  500. struct fw_flowc_mnemval {
  501. u8 mnemonic;
  502. u8 r4[3];
  503. __be32 val;
  504. };
  505. struct fw_flowc_wr {
  506. __be32 op_to_nparams;
  507. __be32 flowid_len16;
  508. struct fw_flowc_mnemval mnemval[0];
  509. };
  510. #define FW_FLOWC_WR_NPARAMS_S 0
  511. #define FW_FLOWC_WR_NPARAMS_V(x) ((x) << FW_FLOWC_WR_NPARAMS_S)
  512. struct fw_ofld_tx_data_wr {
  513. __be32 op_to_immdlen;
  514. __be32 flowid_len16;
  515. __be32 plen;
  516. __be32 tunnel_to_proxy;
  517. };
  518. #define FW_OFLD_TX_DATA_WR_TUNNEL_S 19
  519. #define FW_OFLD_TX_DATA_WR_TUNNEL_V(x) ((x) << FW_OFLD_TX_DATA_WR_TUNNEL_S)
  520. #define FW_OFLD_TX_DATA_WR_SAVE_S 18
  521. #define FW_OFLD_TX_DATA_WR_SAVE_V(x) ((x) << FW_OFLD_TX_DATA_WR_SAVE_S)
  522. #define FW_OFLD_TX_DATA_WR_FLUSH_S 17
  523. #define FW_OFLD_TX_DATA_WR_FLUSH_V(x) ((x) << FW_OFLD_TX_DATA_WR_FLUSH_S)
  524. #define FW_OFLD_TX_DATA_WR_FLUSH_F FW_OFLD_TX_DATA_WR_FLUSH_V(1U)
  525. #define FW_OFLD_TX_DATA_WR_URGENT_S 16
  526. #define FW_OFLD_TX_DATA_WR_URGENT_V(x) ((x) << FW_OFLD_TX_DATA_WR_URGENT_S)
  527. #define FW_OFLD_TX_DATA_WR_MORE_S 15
  528. #define FW_OFLD_TX_DATA_WR_MORE_V(x) ((x) << FW_OFLD_TX_DATA_WR_MORE_S)
  529. #define FW_OFLD_TX_DATA_WR_SHOVE_S 14
  530. #define FW_OFLD_TX_DATA_WR_SHOVE_V(x) ((x) << FW_OFLD_TX_DATA_WR_SHOVE_S)
  531. #define FW_OFLD_TX_DATA_WR_SHOVE_F FW_OFLD_TX_DATA_WR_SHOVE_V(1U)
  532. #define FW_OFLD_TX_DATA_WR_ULPMODE_S 10
  533. #define FW_OFLD_TX_DATA_WR_ULPMODE_V(x) ((x) << FW_OFLD_TX_DATA_WR_ULPMODE_S)
  534. #define FW_OFLD_TX_DATA_WR_ULPSUBMODE_S 6
  535. #define FW_OFLD_TX_DATA_WR_ULPSUBMODE_V(x) \
  536. ((x) << FW_OFLD_TX_DATA_WR_ULPSUBMODE_S)
  537. struct fw_cmd_wr {
  538. __be32 op_dma;
  539. #define FW_CMD_WR_DMA (1U << 17)
  540. __be32 len16_pkd;
  541. __be64 cookie_daddr;
  542. };
  543. #define FW_CMD_WR_DMA_S 17
  544. #define FW_CMD_WR_DMA_V(x) ((x) << FW_CMD_WR_DMA_S)
  545. struct fw_eth_tx_pkt_vm_wr {
  546. __be32 op_immdlen;
  547. __be32 equiq_to_len16;
  548. __be32 r3[2];
  549. u8 ethmacdst[6];
  550. u8 ethmacsrc[6];
  551. __be16 ethtype;
  552. __be16 vlantci;
  553. };
  554. #define FW_CMD_MAX_TIMEOUT 10000
  555. /*
  556. * If a host driver does a HELLO and discovers that there's already a MASTER
  557. * selected, we may have to wait for that MASTER to finish issuing RESET,
  558. * configuration and INITIALIZE commands. Also, there's a possibility that
  559. * our own HELLO may get lost if it happens right as the MASTER is issuign a
  560. * RESET command, so we need to be willing to make a few retries of our HELLO.
  561. */
  562. #define FW_CMD_HELLO_TIMEOUT (3 * FW_CMD_MAX_TIMEOUT)
  563. #define FW_CMD_HELLO_RETRIES 3
  564. enum fw_cmd_opcodes {
  565. FW_LDST_CMD = 0x01,
  566. FW_RESET_CMD = 0x03,
  567. FW_HELLO_CMD = 0x04,
  568. FW_BYE_CMD = 0x05,
  569. FW_INITIALIZE_CMD = 0x06,
  570. FW_CAPS_CONFIG_CMD = 0x07,
  571. FW_PARAMS_CMD = 0x08,
  572. FW_PFVF_CMD = 0x09,
  573. FW_IQ_CMD = 0x10,
  574. FW_EQ_MNGT_CMD = 0x11,
  575. FW_EQ_ETH_CMD = 0x12,
  576. FW_EQ_CTRL_CMD = 0x13,
  577. FW_EQ_OFLD_CMD = 0x21,
  578. FW_VI_CMD = 0x14,
  579. FW_VI_MAC_CMD = 0x15,
  580. FW_VI_RXMODE_CMD = 0x16,
  581. FW_VI_ENABLE_CMD = 0x17,
  582. FW_ACL_MAC_CMD = 0x18,
  583. FW_ACL_VLAN_CMD = 0x19,
  584. FW_VI_STATS_CMD = 0x1a,
  585. FW_PORT_CMD = 0x1b,
  586. FW_PORT_STATS_CMD = 0x1c,
  587. FW_PORT_LB_STATS_CMD = 0x1d,
  588. FW_PORT_TRACE_CMD = 0x1e,
  589. FW_PORT_TRACE_MMAP_CMD = 0x1f,
  590. FW_RSS_IND_TBL_CMD = 0x20,
  591. FW_RSS_GLB_CONFIG_CMD = 0x22,
  592. FW_RSS_VI_CONFIG_CMD = 0x23,
  593. FW_CLIP_CMD = 0x28,
  594. FW_LASTC2E_CMD = 0x40,
  595. FW_ERROR_CMD = 0x80,
  596. FW_DEBUG_CMD = 0x81,
  597. };
  598. enum fw_cmd_cap {
  599. FW_CMD_CAP_PF = 0x01,
  600. FW_CMD_CAP_DMAQ = 0x02,
  601. FW_CMD_CAP_PORT = 0x04,
  602. FW_CMD_CAP_PORTPROMISC = 0x08,
  603. FW_CMD_CAP_PORTSTATS = 0x10,
  604. FW_CMD_CAP_VF = 0x80,
  605. };
  606. /*
  607. * Generic command header flit0
  608. */
  609. struct fw_cmd_hdr {
  610. __be32 hi;
  611. __be32 lo;
  612. };
  613. #define FW_CMD_OP_S 24
  614. #define FW_CMD_OP_M 0xff
  615. #define FW_CMD_OP_V(x) ((x) << FW_CMD_OP_S)
  616. #define FW_CMD_OP_G(x) (((x) >> FW_CMD_OP_S) & FW_CMD_OP_M)
  617. #define FW_CMD_REQUEST_S 23
  618. #define FW_CMD_REQUEST_V(x) ((x) << FW_CMD_REQUEST_S)
  619. #define FW_CMD_REQUEST_F FW_CMD_REQUEST_V(1U)
  620. #define FW_CMD_READ_S 22
  621. #define FW_CMD_READ_V(x) ((x) << FW_CMD_READ_S)
  622. #define FW_CMD_READ_F FW_CMD_READ_V(1U)
  623. #define FW_CMD_WRITE_S 21
  624. #define FW_CMD_WRITE_V(x) ((x) << FW_CMD_WRITE_S)
  625. #define FW_CMD_WRITE_F FW_CMD_WRITE_V(1U)
  626. #define FW_CMD_EXEC_S 20
  627. #define FW_CMD_EXEC_V(x) ((x) << FW_CMD_EXEC_S)
  628. #define FW_CMD_EXEC_F FW_CMD_EXEC_V(1U)
  629. #define FW_CMD_RAMASK_S 20
  630. #define FW_CMD_RAMASK_V(x) ((x) << FW_CMD_RAMASK_S)
  631. #define FW_CMD_RETVAL_S 8
  632. #define FW_CMD_RETVAL_M 0xff
  633. #define FW_CMD_RETVAL_V(x) ((x) << FW_CMD_RETVAL_S)
  634. #define FW_CMD_RETVAL_G(x) (((x) >> FW_CMD_RETVAL_S) & FW_CMD_RETVAL_M)
  635. #define FW_CMD_LEN16_S 0
  636. #define FW_CMD_LEN16_V(x) ((x) << FW_CMD_LEN16_S)
  637. #define FW_LEN16(fw_struct) FW_CMD_LEN16_V(sizeof(fw_struct) / 16)
  638. enum fw_ldst_addrspc {
  639. FW_LDST_ADDRSPC_FIRMWARE = 0x0001,
  640. FW_LDST_ADDRSPC_SGE_EGRC = 0x0008,
  641. FW_LDST_ADDRSPC_SGE_INGC = 0x0009,
  642. FW_LDST_ADDRSPC_SGE_FLMC = 0x000a,
  643. FW_LDST_ADDRSPC_SGE_CONMC = 0x000b,
  644. FW_LDST_ADDRSPC_TP_PIO = 0x0010,
  645. FW_LDST_ADDRSPC_TP_TM_PIO = 0x0011,
  646. FW_LDST_ADDRSPC_TP_MIB = 0x0012,
  647. FW_LDST_ADDRSPC_MDIO = 0x0018,
  648. FW_LDST_ADDRSPC_MPS = 0x0020,
  649. FW_LDST_ADDRSPC_FUNC = 0x0028,
  650. FW_LDST_ADDRSPC_FUNC_PCIE = 0x0029,
  651. };
  652. enum fw_ldst_mps_fid {
  653. FW_LDST_MPS_ATRB,
  654. FW_LDST_MPS_RPLC
  655. };
  656. enum fw_ldst_func_access_ctl {
  657. FW_LDST_FUNC_ACC_CTL_VIID,
  658. FW_LDST_FUNC_ACC_CTL_FID
  659. };
  660. enum fw_ldst_func_mod_index {
  661. FW_LDST_FUNC_MPS
  662. };
  663. struct fw_ldst_cmd {
  664. __be32 op_to_addrspace;
  665. #define FW_LDST_CMD_ADDRSPACE(x) ((x) << 0)
  666. __be32 cycles_to_len16;
  667. union fw_ldst {
  668. struct fw_ldst_addrval {
  669. __be32 addr;
  670. __be32 val;
  671. } addrval;
  672. struct fw_ldst_idctxt {
  673. __be32 physid;
  674. __be32 msg_pkd;
  675. __be32 ctxt_data7;
  676. __be32 ctxt_data6;
  677. __be32 ctxt_data5;
  678. __be32 ctxt_data4;
  679. __be32 ctxt_data3;
  680. __be32 ctxt_data2;
  681. __be32 ctxt_data1;
  682. __be32 ctxt_data0;
  683. } idctxt;
  684. struct fw_ldst_mdio {
  685. __be16 paddr_mmd;
  686. __be16 raddr;
  687. __be16 vctl;
  688. __be16 rval;
  689. } mdio;
  690. struct fw_ldst_mps {
  691. __be16 fid_ctl;
  692. __be16 rplcpf_pkd;
  693. __be32 rplc127_96;
  694. __be32 rplc95_64;
  695. __be32 rplc63_32;
  696. __be32 rplc31_0;
  697. __be32 atrb;
  698. __be16 vlan[16];
  699. } mps;
  700. struct fw_ldst_func {
  701. u8 access_ctl;
  702. u8 mod_index;
  703. __be16 ctl_id;
  704. __be32 offset;
  705. __be64 data0;
  706. __be64 data1;
  707. } func;
  708. struct fw_ldst_pcie {
  709. u8 ctrl_to_fn;
  710. u8 bnum;
  711. u8 r;
  712. u8 ext_r;
  713. u8 select_naccess;
  714. u8 pcie_fn;
  715. __be16 nset_pkd;
  716. __be32 data[12];
  717. } pcie;
  718. } u;
  719. };
  720. #define FW_LDST_CMD_MSG(x) ((x) << 31)
  721. #define FW_LDST_CMD_PADDR(x) ((x) << 8)
  722. #define FW_LDST_CMD_MMD(x) ((x) << 0)
  723. #define FW_LDST_CMD_FID(x) ((x) << 15)
  724. #define FW_LDST_CMD_CTL(x) ((x) << 0)
  725. #define FW_LDST_CMD_RPLCPF(x) ((x) << 0)
  726. #define FW_LDST_CMD_LC (1U << 4)
  727. #define FW_LDST_CMD_NACCESS(x) ((x) << 0)
  728. #define FW_LDST_CMD_FN(x) ((x) << 0)
  729. struct fw_reset_cmd {
  730. __be32 op_to_write;
  731. __be32 retval_len16;
  732. __be32 val;
  733. __be32 halt_pkd;
  734. };
  735. #define FW_RESET_CMD_HALT_SHIFT 31
  736. #define FW_RESET_CMD_HALT_MASK 0x1
  737. #define FW_RESET_CMD_HALT(x) ((x) << FW_RESET_CMD_HALT_SHIFT)
  738. #define FW_RESET_CMD_HALT_GET(x) \
  739. (((x) >> FW_RESET_CMD_HALT_SHIFT) & FW_RESET_CMD_HALT_MASK)
  740. enum fw_hellow_cmd {
  741. fw_hello_cmd_stage_os = 0x0
  742. };
  743. struct fw_hello_cmd {
  744. __be32 op_to_write;
  745. __be32 retval_len16;
  746. __be32 err_to_clearinit;
  747. #define FW_HELLO_CMD_ERR (1U << 31)
  748. #define FW_HELLO_CMD_INIT (1U << 30)
  749. #define FW_HELLO_CMD_MASTERDIS(x) ((x) << 29)
  750. #define FW_HELLO_CMD_MASTERFORCE(x) ((x) << 28)
  751. #define FW_HELLO_CMD_MBMASTER_MASK 0xfU
  752. #define FW_HELLO_CMD_MBMASTER_SHIFT 24
  753. #define FW_HELLO_CMD_MBMASTER(x) ((x) << FW_HELLO_CMD_MBMASTER_SHIFT)
  754. #define FW_HELLO_CMD_MBMASTER_GET(x) \
  755. (((x) >> FW_HELLO_CMD_MBMASTER_SHIFT) & FW_HELLO_CMD_MBMASTER_MASK)
  756. #define FW_HELLO_CMD_MBASYNCNOTINT(x) ((x) << 23)
  757. #define FW_HELLO_CMD_MBASYNCNOT(x) ((x) << 20)
  758. #define FW_HELLO_CMD_STAGE(x) ((x) << 17)
  759. #define FW_HELLO_CMD_CLEARINIT (1U << 16)
  760. __be32 fwrev;
  761. };
  762. struct fw_bye_cmd {
  763. __be32 op_to_write;
  764. __be32 retval_len16;
  765. __be64 r3;
  766. };
  767. struct fw_initialize_cmd {
  768. __be32 op_to_write;
  769. __be32 retval_len16;
  770. __be64 r3;
  771. };
  772. enum fw_caps_config_hm {
  773. FW_CAPS_CONFIG_HM_PCIE = 0x00000001,
  774. FW_CAPS_CONFIG_HM_PL = 0x00000002,
  775. FW_CAPS_CONFIG_HM_SGE = 0x00000004,
  776. FW_CAPS_CONFIG_HM_CIM = 0x00000008,
  777. FW_CAPS_CONFIG_HM_ULPTX = 0x00000010,
  778. FW_CAPS_CONFIG_HM_TP = 0x00000020,
  779. FW_CAPS_CONFIG_HM_ULPRX = 0x00000040,
  780. FW_CAPS_CONFIG_HM_PMRX = 0x00000080,
  781. FW_CAPS_CONFIG_HM_PMTX = 0x00000100,
  782. FW_CAPS_CONFIG_HM_MC = 0x00000200,
  783. FW_CAPS_CONFIG_HM_LE = 0x00000400,
  784. FW_CAPS_CONFIG_HM_MPS = 0x00000800,
  785. FW_CAPS_CONFIG_HM_XGMAC = 0x00001000,
  786. FW_CAPS_CONFIG_HM_CPLSWITCH = 0x00002000,
  787. FW_CAPS_CONFIG_HM_T4DBG = 0x00004000,
  788. FW_CAPS_CONFIG_HM_MI = 0x00008000,
  789. FW_CAPS_CONFIG_HM_I2CM = 0x00010000,
  790. FW_CAPS_CONFIG_HM_NCSI = 0x00020000,
  791. FW_CAPS_CONFIG_HM_SMB = 0x00040000,
  792. FW_CAPS_CONFIG_HM_MA = 0x00080000,
  793. FW_CAPS_CONFIG_HM_EDRAM = 0x00100000,
  794. FW_CAPS_CONFIG_HM_PMU = 0x00200000,
  795. FW_CAPS_CONFIG_HM_UART = 0x00400000,
  796. FW_CAPS_CONFIG_HM_SF = 0x00800000,
  797. };
  798. enum fw_caps_config_nbm {
  799. FW_CAPS_CONFIG_NBM_IPMI = 0x00000001,
  800. FW_CAPS_CONFIG_NBM_NCSI = 0x00000002,
  801. };
  802. enum fw_caps_config_link {
  803. FW_CAPS_CONFIG_LINK_PPP = 0x00000001,
  804. FW_CAPS_CONFIG_LINK_QFC = 0x00000002,
  805. FW_CAPS_CONFIG_LINK_DCBX = 0x00000004,
  806. };
  807. enum fw_caps_config_switch {
  808. FW_CAPS_CONFIG_SWITCH_INGRESS = 0x00000001,
  809. FW_CAPS_CONFIG_SWITCH_EGRESS = 0x00000002,
  810. };
  811. enum fw_caps_config_nic {
  812. FW_CAPS_CONFIG_NIC = 0x00000001,
  813. FW_CAPS_CONFIG_NIC_VM = 0x00000002,
  814. };
  815. enum fw_caps_config_ofld {
  816. FW_CAPS_CONFIG_OFLD = 0x00000001,
  817. };
  818. enum fw_caps_config_rdma {
  819. FW_CAPS_CONFIG_RDMA_RDDP = 0x00000001,
  820. FW_CAPS_CONFIG_RDMA_RDMAC = 0x00000002,
  821. };
  822. enum fw_caps_config_iscsi {
  823. FW_CAPS_CONFIG_ISCSI_INITIATOR_PDU = 0x00000001,
  824. FW_CAPS_CONFIG_ISCSI_TARGET_PDU = 0x00000002,
  825. FW_CAPS_CONFIG_ISCSI_INITIATOR_CNXOFLD = 0x00000004,
  826. FW_CAPS_CONFIG_ISCSI_TARGET_CNXOFLD = 0x00000008,
  827. };
  828. enum fw_caps_config_fcoe {
  829. FW_CAPS_CONFIG_FCOE_INITIATOR = 0x00000001,
  830. FW_CAPS_CONFIG_FCOE_TARGET = 0x00000002,
  831. FW_CAPS_CONFIG_FCOE_CTRL_OFLD = 0x00000004,
  832. };
  833. enum fw_memtype_cf {
  834. FW_MEMTYPE_CF_EDC0 = 0x0,
  835. FW_MEMTYPE_CF_EDC1 = 0x1,
  836. FW_MEMTYPE_CF_EXTMEM = 0x2,
  837. FW_MEMTYPE_CF_FLASH = 0x4,
  838. FW_MEMTYPE_CF_INTERNAL = 0x5,
  839. };
  840. struct fw_caps_config_cmd {
  841. __be32 op_to_write;
  842. __be32 cfvalid_to_len16;
  843. __be32 r2;
  844. __be32 hwmbitmap;
  845. __be16 nbmcaps;
  846. __be16 linkcaps;
  847. __be16 switchcaps;
  848. __be16 r3;
  849. __be16 niccaps;
  850. __be16 ofldcaps;
  851. __be16 rdmacaps;
  852. __be16 r4;
  853. __be16 iscsicaps;
  854. __be16 fcoecaps;
  855. __be32 cfcsum;
  856. __be32 finiver;
  857. __be32 finicsum;
  858. };
  859. #define FW_CAPS_CONFIG_CMD_CFVALID (1U << 27)
  860. #define FW_CAPS_CONFIG_CMD_MEMTYPE_CF(x) ((x) << 24)
  861. #define FW_CAPS_CONFIG_CMD_MEMADDR64K_CF(x) ((x) << 16)
  862. /*
  863. * params command mnemonics
  864. */
  865. enum fw_params_mnem {
  866. FW_PARAMS_MNEM_DEV = 1, /* device params */
  867. FW_PARAMS_MNEM_PFVF = 2, /* function params */
  868. FW_PARAMS_MNEM_REG = 3, /* limited register access */
  869. FW_PARAMS_MNEM_DMAQ = 4, /* dma queue params */
  870. FW_PARAMS_MNEM_LAST
  871. };
  872. /*
  873. * device parameters
  874. */
  875. enum fw_params_param_dev {
  876. FW_PARAMS_PARAM_DEV_CCLK = 0x00, /* chip core clock in khz */
  877. FW_PARAMS_PARAM_DEV_PORTVEC = 0x01, /* the port vector */
  878. FW_PARAMS_PARAM_DEV_NTID = 0x02, /* reads the number of TIDs
  879. * allocated by the device's
  880. * Lookup Engine
  881. */
  882. FW_PARAMS_PARAM_DEV_FLOWC_BUFFIFO_SZ = 0x03,
  883. FW_PARAMS_PARAM_DEV_INTVER_NIC = 0x04,
  884. FW_PARAMS_PARAM_DEV_INTVER_VNIC = 0x05,
  885. FW_PARAMS_PARAM_DEV_INTVER_OFLD = 0x06,
  886. FW_PARAMS_PARAM_DEV_INTVER_RI = 0x07,
  887. FW_PARAMS_PARAM_DEV_INTVER_ISCSIPDU = 0x08,
  888. FW_PARAMS_PARAM_DEV_INTVER_ISCSI = 0x09,
  889. FW_PARAMS_PARAM_DEV_INTVER_FCOE = 0x0A,
  890. FW_PARAMS_PARAM_DEV_FWREV = 0x0B,
  891. FW_PARAMS_PARAM_DEV_TPREV = 0x0C,
  892. FW_PARAMS_PARAM_DEV_CF = 0x0D,
  893. FW_PARAMS_PARAM_DEV_MAXORDIRD_QP = 0x13, /* max supported QP IRD/ORD */
  894. FW_PARAMS_PARAM_DEV_MAXIRD_ADAPTER = 0x14, /* max supported adap IRD */
  895. FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL = 0x17,
  896. };
  897. /*
  898. * physical and virtual function parameters
  899. */
  900. enum fw_params_param_pfvf {
  901. FW_PARAMS_PARAM_PFVF_RWXCAPS = 0x00,
  902. FW_PARAMS_PARAM_PFVF_ROUTE_START = 0x01,
  903. FW_PARAMS_PARAM_PFVF_ROUTE_END = 0x02,
  904. FW_PARAMS_PARAM_PFVF_CLIP_START = 0x03,
  905. FW_PARAMS_PARAM_PFVF_CLIP_END = 0x04,
  906. FW_PARAMS_PARAM_PFVF_FILTER_START = 0x05,
  907. FW_PARAMS_PARAM_PFVF_FILTER_END = 0x06,
  908. FW_PARAMS_PARAM_PFVF_SERVER_START = 0x07,
  909. FW_PARAMS_PARAM_PFVF_SERVER_END = 0x08,
  910. FW_PARAMS_PARAM_PFVF_TDDP_START = 0x09,
  911. FW_PARAMS_PARAM_PFVF_TDDP_END = 0x0A,
  912. FW_PARAMS_PARAM_PFVF_ISCSI_START = 0x0B,
  913. FW_PARAMS_PARAM_PFVF_ISCSI_END = 0x0C,
  914. FW_PARAMS_PARAM_PFVF_STAG_START = 0x0D,
  915. FW_PARAMS_PARAM_PFVF_STAG_END = 0x0E,
  916. FW_PARAMS_PARAM_PFVF_RQ_START = 0x1F,
  917. FW_PARAMS_PARAM_PFVF_RQ_END = 0x10,
  918. FW_PARAMS_PARAM_PFVF_PBL_START = 0x11,
  919. FW_PARAMS_PARAM_PFVF_PBL_END = 0x12,
  920. FW_PARAMS_PARAM_PFVF_L2T_START = 0x13,
  921. FW_PARAMS_PARAM_PFVF_L2T_END = 0x14,
  922. FW_PARAMS_PARAM_PFVF_SQRQ_START = 0x15,
  923. FW_PARAMS_PARAM_PFVF_SQRQ_END = 0x16,
  924. FW_PARAMS_PARAM_PFVF_CQ_START = 0x17,
  925. FW_PARAMS_PARAM_PFVF_CQ_END = 0x18,
  926. FW_PARAMS_PARAM_PFVF_SCHEDCLASS_ETH = 0x20,
  927. FW_PARAMS_PARAM_PFVF_VIID = 0x24,
  928. FW_PARAMS_PARAM_PFVF_CPMASK = 0x25,
  929. FW_PARAMS_PARAM_PFVF_OCQ_START = 0x26,
  930. FW_PARAMS_PARAM_PFVF_OCQ_END = 0x27,
  931. FW_PARAMS_PARAM_PFVF_CONM_MAP = 0x28,
  932. FW_PARAMS_PARAM_PFVF_IQFLINT_START = 0x29,
  933. FW_PARAMS_PARAM_PFVF_IQFLINT_END = 0x2A,
  934. FW_PARAMS_PARAM_PFVF_EQ_START = 0x2B,
  935. FW_PARAMS_PARAM_PFVF_EQ_END = 0x2C,
  936. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_START = 0x2D,
  937. FW_PARAMS_PARAM_PFVF_ACTIVE_FILTER_END = 0x2E,
  938. FW_PARAMS_PARAM_PFVF_ETHOFLD_END = 0x30,
  939. FW_PARAMS_PARAM_PFVF_CPLFW4MSG_ENCAP = 0x31
  940. };
  941. /*
  942. * dma queue parameters
  943. */
  944. enum fw_params_param_dmaq {
  945. FW_PARAMS_PARAM_DMAQ_IQ_DCAEN_DCACPU = 0x00,
  946. FW_PARAMS_PARAM_DMAQ_IQ_INTCNTTHRESH = 0x01,
  947. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_MNGT = 0x10,
  948. FW_PARAMS_PARAM_DMAQ_EQ_CMPLIQID_CTRL = 0x11,
  949. FW_PARAMS_PARAM_DMAQ_EQ_SCHEDCLASS_ETH = 0x12,
  950. FW_PARAMS_PARAM_DMAQ_EQ_DCBPRIO_ETH = 0x13,
  951. };
  952. #define FW_PARAMS_MNEM(x) ((x) << 24)
  953. #define FW_PARAMS_PARAM_X(x) ((x) << 16)
  954. #define FW_PARAMS_PARAM_Y_SHIFT 8
  955. #define FW_PARAMS_PARAM_Y_MASK 0xffU
  956. #define FW_PARAMS_PARAM_Y(x) ((x) << FW_PARAMS_PARAM_Y_SHIFT)
  957. #define FW_PARAMS_PARAM_Y_GET(x) (((x) >> FW_PARAMS_PARAM_Y_SHIFT) &\
  958. FW_PARAMS_PARAM_Y_MASK)
  959. #define FW_PARAMS_PARAM_Z_SHIFT 0
  960. #define FW_PARAMS_PARAM_Z_MASK 0xffu
  961. #define FW_PARAMS_PARAM_Z(x) ((x) << FW_PARAMS_PARAM_Z_SHIFT)
  962. #define FW_PARAMS_PARAM_Z_GET(x) (((x) >> FW_PARAMS_PARAM_Z_SHIFT) &\
  963. FW_PARAMS_PARAM_Z_MASK)
  964. #define FW_PARAMS_PARAM_XYZ(x) ((x) << 0)
  965. #define FW_PARAMS_PARAM_YZ(x) ((x) << 0)
  966. struct fw_params_cmd {
  967. __be32 op_to_vfn;
  968. __be32 retval_len16;
  969. struct fw_params_param {
  970. __be32 mnem;
  971. __be32 val;
  972. } param[7];
  973. };
  974. #define FW_PARAMS_CMD_PFN(x) ((x) << 8)
  975. #define FW_PARAMS_CMD_VFN(x) ((x) << 0)
  976. struct fw_pfvf_cmd {
  977. __be32 op_to_vfn;
  978. __be32 retval_len16;
  979. __be32 niqflint_niq;
  980. __be32 type_to_neq;
  981. __be32 tc_to_nexactf;
  982. __be32 r_caps_to_nethctrl;
  983. __be16 nricq;
  984. __be16 nriqp;
  985. __be32 r4;
  986. };
  987. #define FW_PFVF_CMD_PFN(x) ((x) << 8)
  988. #define FW_PFVF_CMD_VFN(x) ((x) << 0)
  989. #define FW_PFVF_CMD_NIQFLINT(x) ((x) << 20)
  990. #define FW_PFVF_CMD_NIQFLINT_GET(x) (((x) >> 20) & 0xfff)
  991. #define FW_PFVF_CMD_NIQ(x) ((x) << 0)
  992. #define FW_PFVF_CMD_NIQ_GET(x) (((x) >> 0) & 0xfffff)
  993. #define FW_PFVF_CMD_TYPE (1 << 31)
  994. #define FW_PFVF_CMD_TYPE_GET(x) (((x) >> 31) & 0x1)
  995. #define FW_PFVF_CMD_CMASK(x) ((x) << 24)
  996. #define FW_PFVF_CMD_CMASK_MASK 0xf
  997. #define FW_PFVF_CMD_CMASK_GET(x) (((x) >> 24) & FW_PFVF_CMD_CMASK_MASK)
  998. #define FW_PFVF_CMD_PMASK(x) ((x) << 20)
  999. #define FW_PFVF_CMD_PMASK_MASK 0xf
  1000. #define FW_PFVF_CMD_PMASK_GET(x) (((x) >> 20) & FW_PFVF_CMD_PMASK_MASK)
  1001. #define FW_PFVF_CMD_NEQ(x) ((x) << 0)
  1002. #define FW_PFVF_CMD_NEQ_GET(x) (((x) >> 0) & 0xfffff)
  1003. #define FW_PFVF_CMD_TC(x) ((x) << 24)
  1004. #define FW_PFVF_CMD_TC_GET(x) (((x) >> 24) & 0xff)
  1005. #define FW_PFVF_CMD_NVI(x) ((x) << 16)
  1006. #define FW_PFVF_CMD_NVI_GET(x) (((x) >> 16) & 0xff)
  1007. #define FW_PFVF_CMD_NEXACTF(x) ((x) << 0)
  1008. #define FW_PFVF_CMD_NEXACTF_GET(x) (((x) >> 0) & 0xffff)
  1009. #define FW_PFVF_CMD_R_CAPS(x) ((x) << 24)
  1010. #define FW_PFVF_CMD_R_CAPS_GET(x) (((x) >> 24) & 0xff)
  1011. #define FW_PFVF_CMD_WX_CAPS(x) ((x) << 16)
  1012. #define FW_PFVF_CMD_WX_CAPS_GET(x) (((x) >> 16) & 0xff)
  1013. #define FW_PFVF_CMD_NETHCTRL(x) ((x) << 0)
  1014. #define FW_PFVF_CMD_NETHCTRL_GET(x) (((x) >> 0) & 0xffff)
  1015. enum fw_iq_type {
  1016. FW_IQ_TYPE_FL_INT_CAP,
  1017. FW_IQ_TYPE_NO_FL_INT_CAP
  1018. };
  1019. struct fw_iq_cmd {
  1020. __be32 op_to_vfn;
  1021. __be32 alloc_to_len16;
  1022. __be16 physiqid;
  1023. __be16 iqid;
  1024. __be16 fl0id;
  1025. __be16 fl1id;
  1026. __be32 type_to_iqandstindex;
  1027. __be16 iqdroprss_to_iqesize;
  1028. __be16 iqsize;
  1029. __be64 iqaddr;
  1030. __be32 iqns_to_fl0congen;
  1031. __be16 fl0dcaen_to_fl0cidxfthresh;
  1032. __be16 fl0size;
  1033. __be64 fl0addr;
  1034. __be32 fl1cngchmap_to_fl1congen;
  1035. __be16 fl1dcaen_to_fl1cidxfthresh;
  1036. __be16 fl1size;
  1037. __be64 fl1addr;
  1038. };
  1039. #define FW_IQ_CMD_PFN(x) ((x) << 8)
  1040. #define FW_IQ_CMD_VFN(x) ((x) << 0)
  1041. #define FW_IQ_CMD_ALLOC (1U << 31)
  1042. #define FW_IQ_CMD_FREE (1U << 30)
  1043. #define FW_IQ_CMD_MODIFY (1U << 29)
  1044. #define FW_IQ_CMD_IQSTART(x) ((x) << 28)
  1045. #define FW_IQ_CMD_IQSTOP(x) ((x) << 27)
  1046. #define FW_IQ_CMD_TYPE(x) ((x) << 29)
  1047. #define FW_IQ_CMD_IQASYNCH(x) ((x) << 28)
  1048. #define FW_IQ_CMD_VIID(x) ((x) << 16)
  1049. #define FW_IQ_CMD_IQANDST(x) ((x) << 15)
  1050. #define FW_IQ_CMD_IQANUS(x) ((x) << 14)
  1051. #define FW_IQ_CMD_IQANUD(x) ((x) << 12)
  1052. #define FW_IQ_CMD_IQANDSTINDEX(x) ((x) << 0)
  1053. #define FW_IQ_CMD_IQDROPRSS (1U << 15)
  1054. #define FW_IQ_CMD_IQGTSMODE (1U << 14)
  1055. #define FW_IQ_CMD_IQPCIECH(x) ((x) << 12)
  1056. #define FW_IQ_CMD_IQDCAEN(x) ((x) << 11)
  1057. #define FW_IQ_CMD_IQDCACPU(x) ((x) << 6)
  1058. #define FW_IQ_CMD_IQINTCNTTHRESH(x) ((x) << 4)
  1059. #define FW_IQ_CMD_IQO (1U << 3)
  1060. #define FW_IQ_CMD_IQCPRIO(x) ((x) << 2)
  1061. #define FW_IQ_CMD_IQESIZE(x) ((x) << 0)
  1062. #define FW_IQ_CMD_IQNS(x) ((x) << 31)
  1063. #define FW_IQ_CMD_IQRO(x) ((x) << 30)
  1064. #define FW_IQ_CMD_IQFLINTIQHSEN(x) ((x) << 28)
  1065. #define FW_IQ_CMD_IQFLINTCONGEN(x) ((x) << 27)
  1066. #define FW_IQ_CMD_IQFLINTISCSIC(x) ((x) << 26)
  1067. #define FW_IQ_CMD_FL0CNGCHMAP(x) ((x) << 20)
  1068. #define FW_IQ_CMD_FL0CACHELOCK(x) ((x) << 15)
  1069. #define FW_IQ_CMD_FL0DBP(x) ((x) << 14)
  1070. #define FW_IQ_CMD_FL0DATANS(x) ((x) << 13)
  1071. #define FW_IQ_CMD_FL0DATARO(x) ((x) << 12)
  1072. #define FW_IQ_CMD_FL0CONGCIF(x) ((x) << 11)
  1073. #define FW_IQ_CMD_FL0ONCHIP(x) ((x) << 10)
  1074. #define FW_IQ_CMD_FL0STATUSPGNS(x) ((x) << 9)
  1075. #define FW_IQ_CMD_FL0STATUSPGRO(x) ((x) << 8)
  1076. #define FW_IQ_CMD_FL0FETCHNS(x) ((x) << 7)
  1077. #define FW_IQ_CMD_FL0FETCHRO(x) ((x) << 6)
  1078. #define FW_IQ_CMD_FL0HOSTFCMODE(x) ((x) << 4)
  1079. #define FW_IQ_CMD_FL0CPRIO(x) ((x) << 3)
  1080. #define FW_IQ_CMD_FL0PADEN(x) ((x) << 2)
  1081. #define FW_IQ_CMD_FL0PACKEN(x) ((x) << 1)
  1082. #define FW_IQ_CMD_FL0CONGEN (1U << 0)
  1083. #define FW_IQ_CMD_FL0DCAEN(x) ((x) << 15)
  1084. #define FW_IQ_CMD_FL0DCACPU(x) ((x) << 10)
  1085. #define FW_IQ_CMD_FL0FBMIN(x) ((x) << 7)
  1086. #define FW_IQ_CMD_FL0FBMAX(x) ((x) << 4)
  1087. #define FW_IQ_CMD_FL0CIDXFTHRESHO (1U << 3)
  1088. #define FW_IQ_CMD_FL0CIDXFTHRESH(x) ((x) << 0)
  1089. #define FW_IQ_CMD_FL1CNGCHMAP(x) ((x) << 20)
  1090. #define FW_IQ_CMD_FL1CACHELOCK(x) ((x) << 15)
  1091. #define FW_IQ_CMD_FL1DBP(x) ((x) << 14)
  1092. #define FW_IQ_CMD_FL1DATANS(x) ((x) << 13)
  1093. #define FW_IQ_CMD_FL1DATARO(x) ((x) << 12)
  1094. #define FW_IQ_CMD_FL1CONGCIF(x) ((x) << 11)
  1095. #define FW_IQ_CMD_FL1ONCHIP(x) ((x) << 10)
  1096. #define FW_IQ_CMD_FL1STATUSPGNS(x) ((x) << 9)
  1097. #define FW_IQ_CMD_FL1STATUSPGRO(x) ((x) << 8)
  1098. #define FW_IQ_CMD_FL1FETCHNS(x) ((x) << 7)
  1099. #define FW_IQ_CMD_FL1FETCHRO(x) ((x) << 6)
  1100. #define FW_IQ_CMD_FL1HOSTFCMODE(x) ((x) << 4)
  1101. #define FW_IQ_CMD_FL1CPRIO(x) ((x) << 3)
  1102. #define FW_IQ_CMD_FL1PADEN (1U << 2)
  1103. #define FW_IQ_CMD_FL1PACKEN (1U << 1)
  1104. #define FW_IQ_CMD_FL1CONGEN (1U << 0)
  1105. #define FW_IQ_CMD_FL1DCAEN(x) ((x) << 15)
  1106. #define FW_IQ_CMD_FL1DCACPU(x) ((x) << 10)
  1107. #define FW_IQ_CMD_FL1FBMIN(x) ((x) << 7)
  1108. #define FW_IQ_CMD_FL1FBMAX(x) ((x) << 4)
  1109. #define FW_IQ_CMD_FL1CIDXFTHRESHO (1U << 3)
  1110. #define FW_IQ_CMD_FL1CIDXFTHRESH(x) ((x) << 0)
  1111. struct fw_eq_eth_cmd {
  1112. __be32 op_to_vfn;
  1113. __be32 alloc_to_len16;
  1114. __be32 eqid_pkd;
  1115. __be32 physeqid_pkd;
  1116. __be32 fetchszm_to_iqid;
  1117. __be32 dcaen_to_eqsize;
  1118. __be64 eqaddr;
  1119. __be32 viid_pkd;
  1120. __be32 r8_lo;
  1121. __be64 r9;
  1122. };
  1123. #define FW_EQ_ETH_CMD_PFN(x) ((x) << 8)
  1124. #define FW_EQ_ETH_CMD_VFN(x) ((x) << 0)
  1125. #define FW_EQ_ETH_CMD_ALLOC (1U << 31)
  1126. #define FW_EQ_ETH_CMD_FREE (1U << 30)
  1127. #define FW_EQ_ETH_CMD_MODIFY (1U << 29)
  1128. #define FW_EQ_ETH_CMD_EQSTART (1U << 28)
  1129. #define FW_EQ_ETH_CMD_EQSTOP (1U << 27)
  1130. #define FW_EQ_ETH_CMD_EQID(x) ((x) << 0)
  1131. #define FW_EQ_ETH_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  1132. #define FW_EQ_ETH_CMD_PHYSEQID(x) ((x) << 0)
  1133. #define FW_EQ_ETH_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  1134. #define FW_EQ_ETH_CMD_FETCHSZM(x) ((x) << 26)
  1135. #define FW_EQ_ETH_CMD_STATUSPGNS(x) ((x) << 25)
  1136. #define FW_EQ_ETH_CMD_STATUSPGRO(x) ((x) << 24)
  1137. #define FW_EQ_ETH_CMD_FETCHNS(x) ((x) << 23)
  1138. #define FW_EQ_ETH_CMD_FETCHRO(x) ((x) << 22)
  1139. #define FW_EQ_ETH_CMD_HOSTFCMODE(x) ((x) << 20)
  1140. #define FW_EQ_ETH_CMD_CPRIO(x) ((x) << 19)
  1141. #define FW_EQ_ETH_CMD_ONCHIP(x) ((x) << 18)
  1142. #define FW_EQ_ETH_CMD_PCIECHN(x) ((x) << 16)
  1143. #define FW_EQ_ETH_CMD_IQID(x) ((x) << 0)
  1144. #define FW_EQ_ETH_CMD_DCAEN(x) ((x) << 31)
  1145. #define FW_EQ_ETH_CMD_DCACPU(x) ((x) << 26)
  1146. #define FW_EQ_ETH_CMD_FBMIN(x) ((x) << 23)
  1147. #define FW_EQ_ETH_CMD_FBMAX(x) ((x) << 20)
  1148. #define FW_EQ_ETH_CMD_CIDXFTHRESHO(x) ((x) << 19)
  1149. #define FW_EQ_ETH_CMD_CIDXFTHRESH(x) ((x) << 16)
  1150. #define FW_EQ_ETH_CMD_EQSIZE(x) ((x) << 0)
  1151. #define FW_EQ_ETH_CMD_AUTOEQUEQE (1U << 30)
  1152. #define FW_EQ_ETH_CMD_VIID(x) ((x) << 16)
  1153. struct fw_eq_ctrl_cmd {
  1154. __be32 op_to_vfn;
  1155. __be32 alloc_to_len16;
  1156. __be32 cmpliqid_eqid;
  1157. __be32 physeqid_pkd;
  1158. __be32 fetchszm_to_iqid;
  1159. __be32 dcaen_to_eqsize;
  1160. __be64 eqaddr;
  1161. };
  1162. #define FW_EQ_CTRL_CMD_PFN(x) ((x) << 8)
  1163. #define FW_EQ_CTRL_CMD_VFN(x) ((x) << 0)
  1164. #define FW_EQ_CTRL_CMD_ALLOC (1U << 31)
  1165. #define FW_EQ_CTRL_CMD_FREE (1U << 30)
  1166. #define FW_EQ_CTRL_CMD_MODIFY (1U << 29)
  1167. #define FW_EQ_CTRL_CMD_EQSTART (1U << 28)
  1168. #define FW_EQ_CTRL_CMD_EQSTOP (1U << 27)
  1169. #define FW_EQ_CTRL_CMD_CMPLIQID(x) ((x) << 20)
  1170. #define FW_EQ_CTRL_CMD_EQID(x) ((x) << 0)
  1171. #define FW_EQ_CTRL_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  1172. #define FW_EQ_CTRL_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  1173. #define FW_EQ_CTRL_CMD_FETCHSZM (1U << 26)
  1174. #define FW_EQ_CTRL_CMD_STATUSPGNS (1U << 25)
  1175. #define FW_EQ_CTRL_CMD_STATUSPGRO (1U << 24)
  1176. #define FW_EQ_CTRL_CMD_FETCHNS (1U << 23)
  1177. #define FW_EQ_CTRL_CMD_FETCHRO (1U << 22)
  1178. #define FW_EQ_CTRL_CMD_HOSTFCMODE(x) ((x) << 20)
  1179. #define FW_EQ_CTRL_CMD_CPRIO(x) ((x) << 19)
  1180. #define FW_EQ_CTRL_CMD_ONCHIP(x) ((x) << 18)
  1181. #define FW_EQ_CTRL_CMD_PCIECHN(x) ((x) << 16)
  1182. #define FW_EQ_CTRL_CMD_IQID(x) ((x) << 0)
  1183. #define FW_EQ_CTRL_CMD_DCAEN(x) ((x) << 31)
  1184. #define FW_EQ_CTRL_CMD_DCACPU(x) ((x) << 26)
  1185. #define FW_EQ_CTRL_CMD_FBMIN(x) ((x) << 23)
  1186. #define FW_EQ_CTRL_CMD_FBMAX(x) ((x) << 20)
  1187. #define FW_EQ_CTRL_CMD_CIDXFTHRESHO(x) ((x) << 19)
  1188. #define FW_EQ_CTRL_CMD_CIDXFTHRESH(x) ((x) << 16)
  1189. #define FW_EQ_CTRL_CMD_EQSIZE(x) ((x) << 0)
  1190. struct fw_eq_ofld_cmd {
  1191. __be32 op_to_vfn;
  1192. __be32 alloc_to_len16;
  1193. __be32 eqid_pkd;
  1194. __be32 physeqid_pkd;
  1195. __be32 fetchszm_to_iqid;
  1196. __be32 dcaen_to_eqsize;
  1197. __be64 eqaddr;
  1198. };
  1199. #define FW_EQ_OFLD_CMD_PFN(x) ((x) << 8)
  1200. #define FW_EQ_OFLD_CMD_VFN(x) ((x) << 0)
  1201. #define FW_EQ_OFLD_CMD_ALLOC (1U << 31)
  1202. #define FW_EQ_OFLD_CMD_FREE (1U << 30)
  1203. #define FW_EQ_OFLD_CMD_MODIFY (1U << 29)
  1204. #define FW_EQ_OFLD_CMD_EQSTART (1U << 28)
  1205. #define FW_EQ_OFLD_CMD_EQSTOP (1U << 27)
  1206. #define FW_EQ_OFLD_CMD_EQID(x) ((x) << 0)
  1207. #define FW_EQ_OFLD_CMD_EQID_GET(x) (((x) >> 0) & 0xfffff)
  1208. #define FW_EQ_OFLD_CMD_PHYSEQID_GET(x) (((x) >> 0) & 0xfffff)
  1209. #define FW_EQ_OFLD_CMD_FETCHSZM(x) ((x) << 26)
  1210. #define FW_EQ_OFLD_CMD_STATUSPGNS(x) ((x) << 25)
  1211. #define FW_EQ_OFLD_CMD_STATUSPGRO(x) ((x) << 24)
  1212. #define FW_EQ_OFLD_CMD_FETCHNS(x) ((x) << 23)
  1213. #define FW_EQ_OFLD_CMD_FETCHRO(x) ((x) << 22)
  1214. #define FW_EQ_OFLD_CMD_HOSTFCMODE(x) ((x) << 20)
  1215. #define FW_EQ_OFLD_CMD_CPRIO(x) ((x) << 19)
  1216. #define FW_EQ_OFLD_CMD_ONCHIP(x) ((x) << 18)
  1217. #define FW_EQ_OFLD_CMD_PCIECHN(x) ((x) << 16)
  1218. #define FW_EQ_OFLD_CMD_IQID(x) ((x) << 0)
  1219. #define FW_EQ_OFLD_CMD_DCAEN(x) ((x) << 31)
  1220. #define FW_EQ_OFLD_CMD_DCACPU(x) ((x) << 26)
  1221. #define FW_EQ_OFLD_CMD_FBMIN(x) ((x) << 23)
  1222. #define FW_EQ_OFLD_CMD_FBMAX(x) ((x) << 20)
  1223. #define FW_EQ_OFLD_CMD_CIDXFTHRESHO(x) ((x) << 19)
  1224. #define FW_EQ_OFLD_CMD_CIDXFTHRESH(x) ((x) << 16)
  1225. #define FW_EQ_OFLD_CMD_EQSIZE(x) ((x) << 0)
  1226. /*
  1227. * Macros for VIID parsing:
  1228. * VIID - [10:8] PFN, [7] VI Valid, [6:0] VI number
  1229. */
  1230. #define FW_VIID_PFN_GET(x) (((x) >> 8) & 0x7)
  1231. #define FW_VIID_VIVLD_GET(x) (((x) >> 7) & 0x1)
  1232. #define FW_VIID_VIN_GET(x) (((x) >> 0) & 0x7F)
  1233. struct fw_vi_cmd {
  1234. __be32 op_to_vfn;
  1235. __be32 alloc_to_len16;
  1236. __be16 type_viid;
  1237. u8 mac[6];
  1238. u8 portid_pkd;
  1239. u8 nmac;
  1240. u8 nmac0[6];
  1241. __be16 rsssize_pkd;
  1242. u8 nmac1[6];
  1243. __be16 idsiiq_pkd;
  1244. u8 nmac2[6];
  1245. __be16 idseiq_pkd;
  1246. u8 nmac3[6];
  1247. __be64 r9;
  1248. __be64 r10;
  1249. };
  1250. #define FW_VI_CMD_PFN(x) ((x) << 8)
  1251. #define FW_VI_CMD_VFN(x) ((x) << 0)
  1252. #define FW_VI_CMD_ALLOC (1U << 31)
  1253. #define FW_VI_CMD_FREE (1U << 30)
  1254. #define FW_VI_CMD_VIID(x) ((x) << 0)
  1255. #define FW_VI_CMD_VIID_GET(x) ((x) & 0xfff)
  1256. #define FW_VI_CMD_PORTID(x) ((x) << 4)
  1257. #define FW_VI_CMD_PORTID_GET(x) (((x) >> 4) & 0xf)
  1258. #define FW_VI_CMD_RSSSIZE_GET(x) (((x) >> 0) & 0x7ff)
  1259. /* Special VI_MAC command index ids */
  1260. #define FW_VI_MAC_ADD_MAC 0x3FF
  1261. #define FW_VI_MAC_ADD_PERSIST_MAC 0x3FE
  1262. #define FW_VI_MAC_MAC_BASED_FREE 0x3FD
  1263. #define FW_CLS_TCAM_NUM_ENTRIES 336
  1264. enum fw_vi_mac_smac {
  1265. FW_VI_MAC_MPS_TCAM_ENTRY,
  1266. FW_VI_MAC_MPS_TCAM_ONLY,
  1267. FW_VI_MAC_SMT_ONLY,
  1268. FW_VI_MAC_SMT_AND_MPSTCAM
  1269. };
  1270. enum fw_vi_mac_result {
  1271. FW_VI_MAC_R_SUCCESS,
  1272. FW_VI_MAC_R_F_NONEXISTENT_NOMEM,
  1273. FW_VI_MAC_R_SMAC_FAIL,
  1274. FW_VI_MAC_R_F_ACL_CHECK
  1275. };
  1276. struct fw_vi_mac_cmd {
  1277. __be32 op_to_viid;
  1278. __be32 freemacs_to_len16;
  1279. union fw_vi_mac {
  1280. struct fw_vi_mac_exact {
  1281. __be16 valid_to_idx;
  1282. u8 macaddr[6];
  1283. } exact[7];
  1284. struct fw_vi_mac_hash {
  1285. __be64 hashvec;
  1286. } hash;
  1287. } u;
  1288. };
  1289. #define FW_VI_MAC_CMD_VIID(x) ((x) << 0)
  1290. #define FW_VI_MAC_CMD_FREEMACS(x) ((x) << 31)
  1291. #define FW_VI_MAC_CMD_HASHVECEN (1U << 23)
  1292. #define FW_VI_MAC_CMD_HASHUNIEN(x) ((x) << 22)
  1293. #define FW_VI_MAC_CMD_VALID (1U << 15)
  1294. #define FW_VI_MAC_CMD_PRIO(x) ((x) << 12)
  1295. #define FW_VI_MAC_CMD_SMAC_RESULT(x) ((x) << 10)
  1296. #define FW_VI_MAC_CMD_SMAC_RESULT_GET(x) (((x) >> 10) & 0x3)
  1297. #define FW_VI_MAC_CMD_IDX(x) ((x) << 0)
  1298. #define FW_VI_MAC_CMD_IDX_GET(x) (((x) >> 0) & 0x3ff)
  1299. #define FW_RXMODE_MTU_NO_CHG 65535
  1300. struct fw_vi_rxmode_cmd {
  1301. __be32 op_to_viid;
  1302. __be32 retval_len16;
  1303. __be32 mtu_to_vlanexen;
  1304. __be32 r4_lo;
  1305. };
  1306. #define FW_VI_RXMODE_CMD_VIID(x) ((x) << 0)
  1307. #define FW_VI_RXMODE_CMD_MTU_MASK 0xffff
  1308. #define FW_VI_RXMODE_CMD_MTU(x) ((x) << 16)
  1309. #define FW_VI_RXMODE_CMD_PROMISCEN_MASK 0x3
  1310. #define FW_VI_RXMODE_CMD_PROMISCEN(x) ((x) << 14)
  1311. #define FW_VI_RXMODE_CMD_ALLMULTIEN_MASK 0x3
  1312. #define FW_VI_RXMODE_CMD_ALLMULTIEN(x) ((x) << 12)
  1313. #define FW_VI_RXMODE_CMD_BROADCASTEN_MASK 0x3
  1314. #define FW_VI_RXMODE_CMD_BROADCASTEN(x) ((x) << 10)
  1315. #define FW_VI_RXMODE_CMD_VLANEXEN_MASK 0x3
  1316. #define FW_VI_RXMODE_CMD_VLANEXEN(x) ((x) << 8)
  1317. struct fw_vi_enable_cmd {
  1318. __be32 op_to_viid;
  1319. __be32 ien_to_len16;
  1320. __be16 blinkdur;
  1321. __be16 r3;
  1322. __be32 r4;
  1323. };
  1324. #define FW_VI_ENABLE_CMD_VIID(x) ((x) << 0)
  1325. #define FW_VI_ENABLE_CMD_IEN(x) ((x) << 31)
  1326. #define FW_VI_ENABLE_CMD_EEN(x) ((x) << 30)
  1327. #define FW_VI_ENABLE_CMD_DCB_INFO(x) ((x) << 28)
  1328. #define FW_VI_ENABLE_CMD_LED (1U << 29)
  1329. /* VI VF stats offset definitions */
  1330. #define VI_VF_NUM_STATS 16
  1331. enum fw_vi_stats_vf_index {
  1332. FW_VI_VF_STAT_TX_BCAST_BYTES_IX,
  1333. FW_VI_VF_STAT_TX_BCAST_FRAMES_IX,
  1334. FW_VI_VF_STAT_TX_MCAST_BYTES_IX,
  1335. FW_VI_VF_STAT_TX_MCAST_FRAMES_IX,
  1336. FW_VI_VF_STAT_TX_UCAST_BYTES_IX,
  1337. FW_VI_VF_STAT_TX_UCAST_FRAMES_IX,
  1338. FW_VI_VF_STAT_TX_DROP_FRAMES_IX,
  1339. FW_VI_VF_STAT_TX_OFLD_BYTES_IX,
  1340. FW_VI_VF_STAT_TX_OFLD_FRAMES_IX,
  1341. FW_VI_VF_STAT_RX_BCAST_BYTES_IX,
  1342. FW_VI_VF_STAT_RX_BCAST_FRAMES_IX,
  1343. FW_VI_VF_STAT_RX_MCAST_BYTES_IX,
  1344. FW_VI_VF_STAT_RX_MCAST_FRAMES_IX,
  1345. FW_VI_VF_STAT_RX_UCAST_BYTES_IX,
  1346. FW_VI_VF_STAT_RX_UCAST_FRAMES_IX,
  1347. FW_VI_VF_STAT_RX_ERR_FRAMES_IX
  1348. };
  1349. /* VI PF stats offset definitions */
  1350. #define VI_PF_NUM_STATS 17
  1351. enum fw_vi_stats_pf_index {
  1352. FW_VI_PF_STAT_TX_BCAST_BYTES_IX,
  1353. FW_VI_PF_STAT_TX_BCAST_FRAMES_IX,
  1354. FW_VI_PF_STAT_TX_MCAST_BYTES_IX,
  1355. FW_VI_PF_STAT_TX_MCAST_FRAMES_IX,
  1356. FW_VI_PF_STAT_TX_UCAST_BYTES_IX,
  1357. FW_VI_PF_STAT_TX_UCAST_FRAMES_IX,
  1358. FW_VI_PF_STAT_TX_OFLD_BYTES_IX,
  1359. FW_VI_PF_STAT_TX_OFLD_FRAMES_IX,
  1360. FW_VI_PF_STAT_RX_BYTES_IX,
  1361. FW_VI_PF_STAT_RX_FRAMES_IX,
  1362. FW_VI_PF_STAT_RX_BCAST_BYTES_IX,
  1363. FW_VI_PF_STAT_RX_BCAST_FRAMES_IX,
  1364. FW_VI_PF_STAT_RX_MCAST_BYTES_IX,
  1365. FW_VI_PF_STAT_RX_MCAST_FRAMES_IX,
  1366. FW_VI_PF_STAT_RX_UCAST_BYTES_IX,
  1367. FW_VI_PF_STAT_RX_UCAST_FRAMES_IX,
  1368. FW_VI_PF_STAT_RX_ERR_FRAMES_IX
  1369. };
  1370. struct fw_vi_stats_cmd {
  1371. __be32 op_to_viid;
  1372. __be32 retval_len16;
  1373. union fw_vi_stats {
  1374. struct fw_vi_stats_ctl {
  1375. __be16 nstats_ix;
  1376. __be16 r6;
  1377. __be32 r7;
  1378. __be64 stat0;
  1379. __be64 stat1;
  1380. __be64 stat2;
  1381. __be64 stat3;
  1382. __be64 stat4;
  1383. __be64 stat5;
  1384. } ctl;
  1385. struct fw_vi_stats_pf {
  1386. __be64 tx_bcast_bytes;
  1387. __be64 tx_bcast_frames;
  1388. __be64 tx_mcast_bytes;
  1389. __be64 tx_mcast_frames;
  1390. __be64 tx_ucast_bytes;
  1391. __be64 tx_ucast_frames;
  1392. __be64 tx_offload_bytes;
  1393. __be64 tx_offload_frames;
  1394. __be64 rx_pf_bytes;
  1395. __be64 rx_pf_frames;
  1396. __be64 rx_bcast_bytes;
  1397. __be64 rx_bcast_frames;
  1398. __be64 rx_mcast_bytes;
  1399. __be64 rx_mcast_frames;
  1400. __be64 rx_ucast_bytes;
  1401. __be64 rx_ucast_frames;
  1402. __be64 rx_err_frames;
  1403. } pf;
  1404. struct fw_vi_stats_vf {
  1405. __be64 tx_bcast_bytes;
  1406. __be64 tx_bcast_frames;
  1407. __be64 tx_mcast_bytes;
  1408. __be64 tx_mcast_frames;
  1409. __be64 tx_ucast_bytes;
  1410. __be64 tx_ucast_frames;
  1411. __be64 tx_drop_frames;
  1412. __be64 tx_offload_bytes;
  1413. __be64 tx_offload_frames;
  1414. __be64 rx_bcast_bytes;
  1415. __be64 rx_bcast_frames;
  1416. __be64 rx_mcast_bytes;
  1417. __be64 rx_mcast_frames;
  1418. __be64 rx_ucast_bytes;
  1419. __be64 rx_ucast_frames;
  1420. __be64 rx_err_frames;
  1421. } vf;
  1422. } u;
  1423. };
  1424. #define FW_VI_STATS_CMD_VIID(x) ((x) << 0)
  1425. #define FW_VI_STATS_CMD_NSTATS(x) ((x) << 12)
  1426. #define FW_VI_STATS_CMD_IX(x) ((x) << 0)
  1427. struct fw_acl_mac_cmd {
  1428. __be32 op_to_vfn;
  1429. __be32 en_to_len16;
  1430. u8 nmac;
  1431. u8 r3[7];
  1432. __be16 r4;
  1433. u8 macaddr0[6];
  1434. __be16 r5;
  1435. u8 macaddr1[6];
  1436. __be16 r6;
  1437. u8 macaddr2[6];
  1438. __be16 r7;
  1439. u8 macaddr3[6];
  1440. };
  1441. #define FW_ACL_MAC_CMD_PFN(x) ((x) << 8)
  1442. #define FW_ACL_MAC_CMD_VFN(x) ((x) << 0)
  1443. #define FW_ACL_MAC_CMD_EN(x) ((x) << 31)
  1444. struct fw_acl_vlan_cmd {
  1445. __be32 op_to_vfn;
  1446. __be32 en_to_len16;
  1447. u8 nvlan;
  1448. u8 dropnovlan_fm;
  1449. u8 r3_lo[6];
  1450. __be16 vlanid[16];
  1451. };
  1452. #define FW_ACL_VLAN_CMD_PFN(x) ((x) << 8)
  1453. #define FW_ACL_VLAN_CMD_VFN(x) ((x) << 0)
  1454. #define FW_ACL_VLAN_CMD_EN(x) ((x) << 31)
  1455. #define FW_ACL_VLAN_CMD_DROPNOVLAN(x) ((x) << 7)
  1456. #define FW_ACL_VLAN_CMD_FM(x) ((x) << 6)
  1457. enum fw_port_cap {
  1458. FW_PORT_CAP_SPEED_100M = 0x0001,
  1459. FW_PORT_CAP_SPEED_1G = 0x0002,
  1460. FW_PORT_CAP_SPEED_2_5G = 0x0004,
  1461. FW_PORT_CAP_SPEED_10G = 0x0008,
  1462. FW_PORT_CAP_SPEED_40G = 0x0010,
  1463. FW_PORT_CAP_SPEED_100G = 0x0020,
  1464. FW_PORT_CAP_FC_RX = 0x0040,
  1465. FW_PORT_CAP_FC_TX = 0x0080,
  1466. FW_PORT_CAP_ANEG = 0x0100,
  1467. FW_PORT_CAP_MDI_0 = 0x0200,
  1468. FW_PORT_CAP_MDI_1 = 0x0400,
  1469. FW_PORT_CAP_BEAN = 0x0800,
  1470. FW_PORT_CAP_PMA_LPBK = 0x1000,
  1471. FW_PORT_CAP_PCS_LPBK = 0x2000,
  1472. FW_PORT_CAP_PHYXS_LPBK = 0x4000,
  1473. FW_PORT_CAP_FAR_END_LPBK = 0x8000,
  1474. };
  1475. enum fw_port_mdi {
  1476. FW_PORT_MDI_UNCHANGED,
  1477. FW_PORT_MDI_AUTO,
  1478. FW_PORT_MDI_F_STRAIGHT,
  1479. FW_PORT_MDI_F_CROSSOVER
  1480. };
  1481. #define FW_PORT_MDI(x) ((x) << 9)
  1482. enum fw_port_action {
  1483. FW_PORT_ACTION_L1_CFG = 0x0001,
  1484. FW_PORT_ACTION_L2_CFG = 0x0002,
  1485. FW_PORT_ACTION_GET_PORT_INFO = 0x0003,
  1486. FW_PORT_ACTION_L2_PPP_CFG = 0x0004,
  1487. FW_PORT_ACTION_L2_DCB_CFG = 0x0005,
  1488. FW_PORT_ACTION_DCB_READ_TRANS = 0x0006,
  1489. FW_PORT_ACTION_DCB_READ_RECV = 0x0007,
  1490. FW_PORT_ACTION_DCB_READ_DET = 0x0008,
  1491. FW_PORT_ACTION_LOW_PWR_TO_NORMAL = 0x0010,
  1492. FW_PORT_ACTION_L1_LOW_PWR_EN = 0x0011,
  1493. FW_PORT_ACTION_L2_WOL_MODE_EN = 0x0012,
  1494. FW_PORT_ACTION_LPBK_TO_NORMAL = 0x0020,
  1495. FW_PORT_ACTION_L1_LPBK = 0x0021,
  1496. FW_PORT_ACTION_L1_PMA_LPBK = 0x0022,
  1497. FW_PORT_ACTION_L1_PCS_LPBK = 0x0023,
  1498. FW_PORT_ACTION_L1_PHYXS_CSIDE_LPBK = 0x0024,
  1499. FW_PORT_ACTION_L1_PHYXS_ESIDE_LPBK = 0x0025,
  1500. FW_PORT_ACTION_PHY_RESET = 0x0040,
  1501. FW_PORT_ACTION_PMA_RESET = 0x0041,
  1502. FW_PORT_ACTION_PCS_RESET = 0x0042,
  1503. FW_PORT_ACTION_PHYXS_RESET = 0x0043,
  1504. FW_PORT_ACTION_DTEXS_REEST = 0x0044,
  1505. FW_PORT_ACTION_AN_RESET = 0x0045
  1506. };
  1507. enum fw_port_l2cfg_ctlbf {
  1508. FW_PORT_L2_CTLBF_OVLAN0 = 0x01,
  1509. FW_PORT_L2_CTLBF_OVLAN1 = 0x02,
  1510. FW_PORT_L2_CTLBF_OVLAN2 = 0x04,
  1511. FW_PORT_L2_CTLBF_OVLAN3 = 0x08,
  1512. FW_PORT_L2_CTLBF_IVLAN = 0x10,
  1513. FW_PORT_L2_CTLBF_TXIPG = 0x20
  1514. };
  1515. enum fw_port_dcb_versions {
  1516. FW_PORT_DCB_VER_UNKNOWN,
  1517. FW_PORT_DCB_VER_CEE1D0,
  1518. FW_PORT_DCB_VER_CEE1D01,
  1519. FW_PORT_DCB_VER_IEEE,
  1520. FW_PORT_DCB_VER_AUTO = 7
  1521. };
  1522. enum fw_port_dcb_cfg {
  1523. FW_PORT_DCB_CFG_PG = 0x01,
  1524. FW_PORT_DCB_CFG_PFC = 0x02,
  1525. FW_PORT_DCB_CFG_APPL = 0x04
  1526. };
  1527. enum fw_port_dcb_cfg_rc {
  1528. FW_PORT_DCB_CFG_SUCCESS = 0x0,
  1529. FW_PORT_DCB_CFG_ERROR = 0x1
  1530. };
  1531. enum fw_port_dcb_type {
  1532. FW_PORT_DCB_TYPE_PGID = 0x00,
  1533. FW_PORT_DCB_TYPE_PGRATE = 0x01,
  1534. FW_PORT_DCB_TYPE_PRIORATE = 0x02,
  1535. FW_PORT_DCB_TYPE_PFC = 0x03,
  1536. FW_PORT_DCB_TYPE_APP_ID = 0x04,
  1537. FW_PORT_DCB_TYPE_CONTROL = 0x05,
  1538. };
  1539. enum fw_port_dcb_feature_state {
  1540. FW_PORT_DCB_FEATURE_STATE_PENDING = 0x0,
  1541. FW_PORT_DCB_FEATURE_STATE_SUCCESS = 0x1,
  1542. FW_PORT_DCB_FEATURE_STATE_ERROR = 0x2,
  1543. FW_PORT_DCB_FEATURE_STATE_TIMEOUT = 0x3,
  1544. };
  1545. struct fw_port_cmd {
  1546. __be32 op_to_portid;
  1547. __be32 action_to_len16;
  1548. union fw_port {
  1549. struct fw_port_l1cfg {
  1550. __be32 rcap;
  1551. __be32 r;
  1552. } l1cfg;
  1553. struct fw_port_l2cfg {
  1554. __u8 ctlbf;
  1555. __u8 ovlan3_to_ivlan0;
  1556. __be16 ivlantype;
  1557. __be16 txipg_force_pinfo;
  1558. __be16 mtu;
  1559. __be16 ovlan0mask;
  1560. __be16 ovlan0type;
  1561. __be16 ovlan1mask;
  1562. __be16 ovlan1type;
  1563. __be16 ovlan2mask;
  1564. __be16 ovlan2type;
  1565. __be16 ovlan3mask;
  1566. __be16 ovlan3type;
  1567. } l2cfg;
  1568. struct fw_port_info {
  1569. __be32 lstatus_to_modtype;
  1570. __be16 pcap;
  1571. __be16 acap;
  1572. __be16 mtu;
  1573. __u8 cbllen;
  1574. __u8 auxlinfo;
  1575. __u8 dcbxdis_pkd;
  1576. __u8 r8_lo[3];
  1577. __be64 r9;
  1578. } info;
  1579. struct fw_port_diags {
  1580. __u8 diagop;
  1581. __u8 r[3];
  1582. __be32 diagval;
  1583. } diags;
  1584. union fw_port_dcb {
  1585. struct fw_port_dcb_pgid {
  1586. __u8 type;
  1587. __u8 apply_pkd;
  1588. __u8 r10_lo[2];
  1589. __be32 pgid;
  1590. __be64 r11;
  1591. } pgid;
  1592. struct fw_port_dcb_pgrate {
  1593. __u8 type;
  1594. __u8 apply_pkd;
  1595. __u8 r10_lo[5];
  1596. __u8 num_tcs_supported;
  1597. __u8 pgrate[8];
  1598. __u8 tsa[8];
  1599. } pgrate;
  1600. struct fw_port_dcb_priorate {
  1601. __u8 type;
  1602. __u8 apply_pkd;
  1603. __u8 r10_lo[6];
  1604. __u8 strict_priorate[8];
  1605. } priorate;
  1606. struct fw_port_dcb_pfc {
  1607. __u8 type;
  1608. __u8 pfcen;
  1609. __u8 r10[5];
  1610. __u8 max_pfc_tcs;
  1611. __be64 r11;
  1612. } pfc;
  1613. struct fw_port_app_priority {
  1614. __u8 type;
  1615. __u8 r10[2];
  1616. __u8 idx;
  1617. __u8 user_prio_map;
  1618. __u8 sel_field;
  1619. __be16 protocolid;
  1620. __be64 r12;
  1621. } app_priority;
  1622. struct fw_port_dcb_control {
  1623. __u8 type;
  1624. __u8 all_syncd_pkd;
  1625. __be16 dcb_version_to_app_state;
  1626. __be32 r11;
  1627. __be64 r12;
  1628. } control;
  1629. } dcb;
  1630. } u;
  1631. };
  1632. #define FW_PORT_CMD_READ (1U << 22)
  1633. #define FW_PORT_CMD_PORTID(x) ((x) << 0)
  1634. #define FW_PORT_CMD_PORTID_GET(x) (((x) >> 0) & 0xf)
  1635. #define FW_PORT_CMD_ACTION(x) ((x) << 16)
  1636. #define FW_PORT_CMD_ACTION_GET(x) (((x) >> 16) & 0xffff)
  1637. #define FW_PORT_CMD_CTLBF(x) ((x) << 10)
  1638. #define FW_PORT_CMD_OVLAN3(x) ((x) << 7)
  1639. #define FW_PORT_CMD_OVLAN2(x) ((x) << 6)
  1640. #define FW_PORT_CMD_OVLAN1(x) ((x) << 5)
  1641. #define FW_PORT_CMD_OVLAN0(x) ((x) << 4)
  1642. #define FW_PORT_CMD_IVLAN0(x) ((x) << 3)
  1643. #define FW_PORT_CMD_TXIPG(x) ((x) << 19)
  1644. #define FW_PORT_CMD_LSTATUS (1U << 31)
  1645. #define FW_PORT_CMD_LSTATUS_GET(x) (((x) >> 31) & 0x1)
  1646. #define FW_PORT_CMD_LSPEED(x) ((x) << 24)
  1647. #define FW_PORT_CMD_LSPEED_GET(x) (((x) >> 24) & 0x3f)
  1648. #define FW_PORT_CMD_TXPAUSE (1U << 23)
  1649. #define FW_PORT_CMD_RXPAUSE (1U << 22)
  1650. #define FW_PORT_CMD_MDIOCAP (1U << 21)
  1651. #define FW_PORT_CMD_MDIOADDR_GET(x) (((x) >> 16) & 0x1f)
  1652. #define FW_PORT_CMD_LPTXPAUSE (1U << 15)
  1653. #define FW_PORT_CMD_LPRXPAUSE (1U << 14)
  1654. #define FW_PORT_CMD_PTYPE_MASK 0x1f
  1655. #define FW_PORT_CMD_PTYPE_GET(x) (((x) >> 8) & FW_PORT_CMD_PTYPE_MASK)
  1656. #define FW_PORT_CMD_MODTYPE_MASK 0x1f
  1657. #define FW_PORT_CMD_MODTYPE_GET(x) (((x) >> 0) & FW_PORT_CMD_MODTYPE_MASK)
  1658. #define FW_PORT_CMD_DCBXDIS (1U << 7)
  1659. #define FW_PORT_CMD_APPLY (1U << 7)
  1660. #define FW_PORT_CMD_ALL_SYNCD (1U << 7)
  1661. #define FW_PORT_CMD_DCB_VERSION_GET(x) (((x) >> 8) & 0xf)
  1662. #define FW_PORT_CMD_PPPEN(x) ((x) << 31)
  1663. #define FW_PORT_CMD_TPSRC(x) ((x) << 28)
  1664. #define FW_PORT_CMD_NCSISRC(x) ((x) << 24)
  1665. #define FW_PORT_CMD_CH0(x) ((x) << 20)
  1666. #define FW_PORT_CMD_CH1(x) ((x) << 16)
  1667. #define FW_PORT_CMD_CH2(x) ((x) << 12)
  1668. #define FW_PORT_CMD_CH3(x) ((x) << 8)
  1669. #define FW_PORT_CMD_NCSICH(x) ((x) << 4)
  1670. enum fw_port_type {
  1671. FW_PORT_TYPE_FIBER_XFI,
  1672. FW_PORT_TYPE_FIBER_XAUI,
  1673. FW_PORT_TYPE_BT_SGMII,
  1674. FW_PORT_TYPE_BT_XFI,
  1675. FW_PORT_TYPE_BT_XAUI,
  1676. FW_PORT_TYPE_KX4,
  1677. FW_PORT_TYPE_CX4,
  1678. FW_PORT_TYPE_KX,
  1679. FW_PORT_TYPE_KR,
  1680. FW_PORT_TYPE_SFP,
  1681. FW_PORT_TYPE_BP_AP,
  1682. FW_PORT_TYPE_BP4_AP,
  1683. FW_PORT_TYPE_QSFP_10G,
  1684. FW_PORT_TYPE_QSFP,
  1685. FW_PORT_TYPE_BP40_BA,
  1686. FW_PORT_TYPE_NONE = FW_PORT_CMD_PTYPE_MASK
  1687. };
  1688. enum fw_port_module_type {
  1689. FW_PORT_MOD_TYPE_NA,
  1690. FW_PORT_MOD_TYPE_LR,
  1691. FW_PORT_MOD_TYPE_SR,
  1692. FW_PORT_MOD_TYPE_ER,
  1693. FW_PORT_MOD_TYPE_TWINAX_PASSIVE,
  1694. FW_PORT_MOD_TYPE_TWINAX_ACTIVE,
  1695. FW_PORT_MOD_TYPE_LRM,
  1696. FW_PORT_MOD_TYPE_ERROR = FW_PORT_CMD_MODTYPE_MASK - 3,
  1697. FW_PORT_MOD_TYPE_UNKNOWN = FW_PORT_CMD_MODTYPE_MASK - 2,
  1698. FW_PORT_MOD_TYPE_NOTSUPPORTED = FW_PORT_CMD_MODTYPE_MASK - 1,
  1699. FW_PORT_MOD_TYPE_NONE = FW_PORT_CMD_MODTYPE_MASK
  1700. };
  1701. enum fw_port_mod_sub_type {
  1702. FW_PORT_MOD_SUB_TYPE_NA,
  1703. FW_PORT_MOD_SUB_TYPE_MV88E114X = 0x1,
  1704. FW_PORT_MOD_SUB_TYPE_TN8022 = 0x2,
  1705. FW_PORT_MOD_SUB_TYPE_AQ1202 = 0x3,
  1706. FW_PORT_MOD_SUB_TYPE_88x3120 = 0x4,
  1707. FW_PORT_MOD_SUB_TYPE_BCM84834 = 0x5,
  1708. FW_PORT_MOD_SUB_TYPE_BT_VSC8634 = 0x8,
  1709. /* The following will never been in the VPD. They are TWINAX cable
  1710. * lengths decoded from SFP+ module i2c PROMs. These should
  1711. * almost certainly go somewhere else ...
  1712. */
  1713. FW_PORT_MOD_SUB_TYPE_TWINAX_1 = 0x9,
  1714. FW_PORT_MOD_SUB_TYPE_TWINAX_3 = 0xA,
  1715. FW_PORT_MOD_SUB_TYPE_TWINAX_5 = 0xB,
  1716. FW_PORT_MOD_SUB_TYPE_TWINAX_7 = 0xC,
  1717. };
  1718. /* port stats */
  1719. #define FW_NUM_PORT_STATS 50
  1720. #define FW_NUM_PORT_TX_STATS 23
  1721. #define FW_NUM_PORT_RX_STATS 27
  1722. enum fw_port_stats_tx_index {
  1723. FW_STAT_TX_PORT_BYTES_IX,
  1724. FW_STAT_TX_PORT_FRAMES_IX,
  1725. FW_STAT_TX_PORT_BCAST_IX,
  1726. FW_STAT_TX_PORT_MCAST_IX,
  1727. FW_STAT_TX_PORT_UCAST_IX,
  1728. FW_STAT_TX_PORT_ERROR_IX,
  1729. FW_STAT_TX_PORT_64B_IX,
  1730. FW_STAT_TX_PORT_65B_127B_IX,
  1731. FW_STAT_TX_PORT_128B_255B_IX,
  1732. FW_STAT_TX_PORT_256B_511B_IX,
  1733. FW_STAT_TX_PORT_512B_1023B_IX,
  1734. FW_STAT_TX_PORT_1024B_1518B_IX,
  1735. FW_STAT_TX_PORT_1519B_MAX_IX,
  1736. FW_STAT_TX_PORT_DROP_IX,
  1737. FW_STAT_TX_PORT_PAUSE_IX,
  1738. FW_STAT_TX_PORT_PPP0_IX,
  1739. FW_STAT_TX_PORT_PPP1_IX,
  1740. FW_STAT_TX_PORT_PPP2_IX,
  1741. FW_STAT_TX_PORT_PPP3_IX,
  1742. FW_STAT_TX_PORT_PPP4_IX,
  1743. FW_STAT_TX_PORT_PPP5_IX,
  1744. FW_STAT_TX_PORT_PPP6_IX,
  1745. FW_STAT_TX_PORT_PPP7_IX
  1746. };
  1747. enum fw_port_stat_rx_index {
  1748. FW_STAT_RX_PORT_BYTES_IX,
  1749. FW_STAT_RX_PORT_FRAMES_IX,
  1750. FW_STAT_RX_PORT_BCAST_IX,
  1751. FW_STAT_RX_PORT_MCAST_IX,
  1752. FW_STAT_RX_PORT_UCAST_IX,
  1753. FW_STAT_RX_PORT_MTU_ERROR_IX,
  1754. FW_STAT_RX_PORT_MTU_CRC_ERROR_IX,
  1755. FW_STAT_RX_PORT_CRC_ERROR_IX,
  1756. FW_STAT_RX_PORT_LEN_ERROR_IX,
  1757. FW_STAT_RX_PORT_SYM_ERROR_IX,
  1758. FW_STAT_RX_PORT_64B_IX,
  1759. FW_STAT_RX_PORT_65B_127B_IX,
  1760. FW_STAT_RX_PORT_128B_255B_IX,
  1761. FW_STAT_RX_PORT_256B_511B_IX,
  1762. FW_STAT_RX_PORT_512B_1023B_IX,
  1763. FW_STAT_RX_PORT_1024B_1518B_IX,
  1764. FW_STAT_RX_PORT_1519B_MAX_IX,
  1765. FW_STAT_RX_PORT_PAUSE_IX,
  1766. FW_STAT_RX_PORT_PPP0_IX,
  1767. FW_STAT_RX_PORT_PPP1_IX,
  1768. FW_STAT_RX_PORT_PPP2_IX,
  1769. FW_STAT_RX_PORT_PPP3_IX,
  1770. FW_STAT_RX_PORT_PPP4_IX,
  1771. FW_STAT_RX_PORT_PPP5_IX,
  1772. FW_STAT_RX_PORT_PPP6_IX,
  1773. FW_STAT_RX_PORT_PPP7_IX,
  1774. FW_STAT_RX_PORT_LESS_64B_IX
  1775. };
  1776. struct fw_port_stats_cmd {
  1777. __be32 op_to_portid;
  1778. __be32 retval_len16;
  1779. union fw_port_stats {
  1780. struct fw_port_stats_ctl {
  1781. u8 nstats_bg_bm;
  1782. u8 tx_ix;
  1783. __be16 r6;
  1784. __be32 r7;
  1785. __be64 stat0;
  1786. __be64 stat1;
  1787. __be64 stat2;
  1788. __be64 stat3;
  1789. __be64 stat4;
  1790. __be64 stat5;
  1791. } ctl;
  1792. struct fw_port_stats_all {
  1793. __be64 tx_bytes;
  1794. __be64 tx_frames;
  1795. __be64 tx_bcast;
  1796. __be64 tx_mcast;
  1797. __be64 tx_ucast;
  1798. __be64 tx_error;
  1799. __be64 tx_64b;
  1800. __be64 tx_65b_127b;
  1801. __be64 tx_128b_255b;
  1802. __be64 tx_256b_511b;
  1803. __be64 tx_512b_1023b;
  1804. __be64 tx_1024b_1518b;
  1805. __be64 tx_1519b_max;
  1806. __be64 tx_drop;
  1807. __be64 tx_pause;
  1808. __be64 tx_ppp0;
  1809. __be64 tx_ppp1;
  1810. __be64 tx_ppp2;
  1811. __be64 tx_ppp3;
  1812. __be64 tx_ppp4;
  1813. __be64 tx_ppp5;
  1814. __be64 tx_ppp6;
  1815. __be64 tx_ppp7;
  1816. __be64 rx_bytes;
  1817. __be64 rx_frames;
  1818. __be64 rx_bcast;
  1819. __be64 rx_mcast;
  1820. __be64 rx_ucast;
  1821. __be64 rx_mtu_error;
  1822. __be64 rx_mtu_crc_error;
  1823. __be64 rx_crc_error;
  1824. __be64 rx_len_error;
  1825. __be64 rx_sym_error;
  1826. __be64 rx_64b;
  1827. __be64 rx_65b_127b;
  1828. __be64 rx_128b_255b;
  1829. __be64 rx_256b_511b;
  1830. __be64 rx_512b_1023b;
  1831. __be64 rx_1024b_1518b;
  1832. __be64 rx_1519b_max;
  1833. __be64 rx_pause;
  1834. __be64 rx_ppp0;
  1835. __be64 rx_ppp1;
  1836. __be64 rx_ppp2;
  1837. __be64 rx_ppp3;
  1838. __be64 rx_ppp4;
  1839. __be64 rx_ppp5;
  1840. __be64 rx_ppp6;
  1841. __be64 rx_ppp7;
  1842. __be64 rx_less_64b;
  1843. __be64 rx_bg_drop;
  1844. __be64 rx_bg_trunc;
  1845. } all;
  1846. } u;
  1847. };
  1848. #define FW_PORT_STATS_CMD_NSTATS(x) ((x) << 4)
  1849. #define FW_PORT_STATS_CMD_BG_BM(x) ((x) << 0)
  1850. #define FW_PORT_STATS_CMD_TX(x) ((x) << 7)
  1851. #define FW_PORT_STATS_CMD_IX(x) ((x) << 0)
  1852. /* port loopback stats */
  1853. #define FW_NUM_LB_STATS 16
  1854. enum fw_port_lb_stats_index {
  1855. FW_STAT_LB_PORT_BYTES_IX,
  1856. FW_STAT_LB_PORT_FRAMES_IX,
  1857. FW_STAT_LB_PORT_BCAST_IX,
  1858. FW_STAT_LB_PORT_MCAST_IX,
  1859. FW_STAT_LB_PORT_UCAST_IX,
  1860. FW_STAT_LB_PORT_ERROR_IX,
  1861. FW_STAT_LB_PORT_64B_IX,
  1862. FW_STAT_LB_PORT_65B_127B_IX,
  1863. FW_STAT_LB_PORT_128B_255B_IX,
  1864. FW_STAT_LB_PORT_256B_511B_IX,
  1865. FW_STAT_LB_PORT_512B_1023B_IX,
  1866. FW_STAT_LB_PORT_1024B_1518B_IX,
  1867. FW_STAT_LB_PORT_1519B_MAX_IX,
  1868. FW_STAT_LB_PORT_DROP_FRAMES_IX
  1869. };
  1870. struct fw_port_lb_stats_cmd {
  1871. __be32 op_to_lbport;
  1872. __be32 retval_len16;
  1873. union fw_port_lb_stats {
  1874. struct fw_port_lb_stats_ctl {
  1875. u8 nstats_bg_bm;
  1876. u8 ix_pkd;
  1877. __be16 r6;
  1878. __be32 r7;
  1879. __be64 stat0;
  1880. __be64 stat1;
  1881. __be64 stat2;
  1882. __be64 stat3;
  1883. __be64 stat4;
  1884. __be64 stat5;
  1885. } ctl;
  1886. struct fw_port_lb_stats_all {
  1887. __be64 tx_bytes;
  1888. __be64 tx_frames;
  1889. __be64 tx_bcast;
  1890. __be64 tx_mcast;
  1891. __be64 tx_ucast;
  1892. __be64 tx_error;
  1893. __be64 tx_64b;
  1894. __be64 tx_65b_127b;
  1895. __be64 tx_128b_255b;
  1896. __be64 tx_256b_511b;
  1897. __be64 tx_512b_1023b;
  1898. __be64 tx_1024b_1518b;
  1899. __be64 tx_1519b_max;
  1900. __be64 rx_lb_drop;
  1901. __be64 rx_lb_trunc;
  1902. } all;
  1903. } u;
  1904. };
  1905. #define FW_PORT_LB_STATS_CMD_LBPORT(x) ((x) << 0)
  1906. #define FW_PORT_LB_STATS_CMD_NSTATS(x) ((x) << 4)
  1907. #define FW_PORT_LB_STATS_CMD_BG_BM(x) ((x) << 0)
  1908. #define FW_PORT_LB_STATS_CMD_IX(x) ((x) << 0)
  1909. struct fw_rss_ind_tbl_cmd {
  1910. __be32 op_to_viid;
  1911. #define FW_RSS_IND_TBL_CMD_VIID(x) ((x) << 0)
  1912. __be32 retval_len16;
  1913. __be16 niqid;
  1914. __be16 startidx;
  1915. __be32 r3;
  1916. __be32 iq0_to_iq2;
  1917. #define FW_RSS_IND_TBL_CMD_IQ0(x) ((x) << 20)
  1918. #define FW_RSS_IND_TBL_CMD_IQ1(x) ((x) << 10)
  1919. #define FW_RSS_IND_TBL_CMD_IQ2(x) ((x) << 0)
  1920. __be32 iq3_to_iq5;
  1921. __be32 iq6_to_iq8;
  1922. __be32 iq9_to_iq11;
  1923. __be32 iq12_to_iq14;
  1924. __be32 iq15_to_iq17;
  1925. __be32 iq18_to_iq20;
  1926. __be32 iq21_to_iq23;
  1927. __be32 iq24_to_iq26;
  1928. __be32 iq27_to_iq29;
  1929. __be32 iq30_iq31;
  1930. __be32 r15_lo;
  1931. };
  1932. struct fw_rss_glb_config_cmd {
  1933. __be32 op_to_write;
  1934. __be32 retval_len16;
  1935. union fw_rss_glb_config {
  1936. struct fw_rss_glb_config_manual {
  1937. __be32 mode_pkd;
  1938. __be32 r3;
  1939. __be64 r4;
  1940. __be64 r5;
  1941. } manual;
  1942. struct fw_rss_glb_config_basicvirtual {
  1943. __be32 mode_pkd;
  1944. __be32 synmapen_to_hashtoeplitz;
  1945. #define FW_RSS_GLB_CONFIG_CMD_SYNMAPEN (1U << 8)
  1946. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV6 (1U << 7)
  1947. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV6 (1U << 6)
  1948. #define FW_RSS_GLB_CONFIG_CMD_SYN4TUPENIPV4 (1U << 5)
  1949. #define FW_RSS_GLB_CONFIG_CMD_SYN2TUPENIPV4 (1U << 4)
  1950. #define FW_RSS_GLB_CONFIG_CMD_OFDMAPEN (1U << 3)
  1951. #define FW_RSS_GLB_CONFIG_CMD_TNLMAPEN (1U << 2)
  1952. #define FW_RSS_GLB_CONFIG_CMD_TNLALLLKP (1U << 1)
  1953. #define FW_RSS_GLB_CONFIG_CMD_HASHTOEPLITZ (1U << 0)
  1954. __be64 r8;
  1955. __be64 r9;
  1956. } basicvirtual;
  1957. } u;
  1958. };
  1959. #define FW_RSS_GLB_CONFIG_CMD_MODE(x) ((x) << 28)
  1960. #define FW_RSS_GLB_CONFIG_CMD_MODE_GET(x) (((x) >> 28) & 0xf)
  1961. #define FW_RSS_GLB_CONFIG_CMD_MODE_MANUAL 0
  1962. #define FW_RSS_GLB_CONFIG_CMD_MODE_BASICVIRTUAL 1
  1963. struct fw_rss_vi_config_cmd {
  1964. __be32 op_to_viid;
  1965. #define FW_RSS_VI_CONFIG_CMD_VIID(x) ((x) << 0)
  1966. __be32 retval_len16;
  1967. union fw_rss_vi_config {
  1968. struct fw_rss_vi_config_manual {
  1969. __be64 r3;
  1970. __be64 r4;
  1971. __be64 r5;
  1972. } manual;
  1973. struct fw_rss_vi_config_basicvirtual {
  1974. __be32 r6;
  1975. __be32 defaultq_to_udpen;
  1976. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ(x) ((x) << 16)
  1977. #define FW_RSS_VI_CONFIG_CMD_DEFAULTQ_GET(x) (((x) >> 16) & 0x3ff)
  1978. #define FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN (1U << 4)
  1979. #define FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN (1U << 3)
  1980. #define FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN (1U << 2)
  1981. #define FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN (1U << 1)
  1982. #define FW_RSS_VI_CONFIG_CMD_UDPEN (1U << 0)
  1983. __be64 r9;
  1984. __be64 r10;
  1985. } basicvirtual;
  1986. } u;
  1987. };
  1988. struct fw_clip_cmd {
  1989. __be32 op_to_write;
  1990. __be32 alloc_to_len16;
  1991. __be64 ip_hi;
  1992. __be64 ip_lo;
  1993. __be32 r4[2];
  1994. };
  1995. #define S_FW_CLIP_CMD_ALLOC 31
  1996. #define M_FW_CLIP_CMD_ALLOC 0x1
  1997. #define V_FW_CLIP_CMD_ALLOC(x) ((x) << S_FW_CLIP_CMD_ALLOC)
  1998. #define G_FW_CLIP_CMD_ALLOC(x) \
  1999. (((x) >> S_FW_CLIP_CMD_ALLOC) & M_FW_CLIP_CMD_ALLOC)
  2000. #define F_FW_CLIP_CMD_ALLOC V_FW_CLIP_CMD_ALLOC(1U)
  2001. #define S_FW_CLIP_CMD_FREE 30
  2002. #define M_FW_CLIP_CMD_FREE 0x1
  2003. #define V_FW_CLIP_CMD_FREE(x) ((x) << S_FW_CLIP_CMD_FREE)
  2004. #define G_FW_CLIP_CMD_FREE(x) \
  2005. (((x) >> S_FW_CLIP_CMD_FREE) & M_FW_CLIP_CMD_FREE)
  2006. #define F_FW_CLIP_CMD_FREE V_FW_CLIP_CMD_FREE(1U)
  2007. enum fw_error_type {
  2008. FW_ERROR_TYPE_EXCEPTION = 0x0,
  2009. FW_ERROR_TYPE_HWMODULE = 0x1,
  2010. FW_ERROR_TYPE_WR = 0x2,
  2011. FW_ERROR_TYPE_ACL = 0x3,
  2012. };
  2013. struct fw_error_cmd {
  2014. __be32 op_to_type;
  2015. __be32 len16_pkd;
  2016. union fw_error {
  2017. struct fw_error_exception {
  2018. __be32 info[6];
  2019. } exception;
  2020. struct fw_error_hwmodule {
  2021. __be32 regaddr;
  2022. __be32 regval;
  2023. } hwmodule;
  2024. struct fw_error_wr {
  2025. __be16 cidx;
  2026. __be16 pfn_vfn;
  2027. __be32 eqid;
  2028. u8 wrhdr[16];
  2029. } wr;
  2030. struct fw_error_acl {
  2031. __be16 cidx;
  2032. __be16 pfn_vfn;
  2033. __be32 eqid;
  2034. __be16 mv_pkd;
  2035. u8 val[6];
  2036. __be64 r4;
  2037. } acl;
  2038. } u;
  2039. };
  2040. struct fw_debug_cmd {
  2041. __be32 op_type;
  2042. #define FW_DEBUG_CMD_TYPE_GET(x) ((x) & 0xff)
  2043. __be32 len16_pkd;
  2044. union fw_debug {
  2045. struct fw_debug_assert {
  2046. __be32 fcid;
  2047. __be32 line;
  2048. __be32 x;
  2049. __be32 y;
  2050. u8 filename_0_7[8];
  2051. u8 filename_8_15[8];
  2052. __be64 r3;
  2053. } assert;
  2054. struct fw_debug_prt {
  2055. __be16 dprtstridx;
  2056. __be16 r3[3];
  2057. __be32 dprtstrparam0;
  2058. __be32 dprtstrparam1;
  2059. __be32 dprtstrparam2;
  2060. __be32 dprtstrparam3;
  2061. } prt;
  2062. } u;
  2063. };
  2064. #define FW_PCIE_FW_ERR (1U << 31)
  2065. #define FW_PCIE_FW_INIT (1U << 30)
  2066. #define FW_PCIE_FW_HALT (1U << 29)
  2067. #define FW_PCIE_FW_MASTER_VLD (1U << 15)
  2068. #define FW_PCIE_FW_MASTER_MASK 0x7
  2069. #define FW_PCIE_FW_MASTER_SHIFT 12
  2070. #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT)
  2071. #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \
  2072. FW_PCIE_FW_MASTER_MASK)
  2073. #define FW_PCIE_FW_EVAL_MASK 0x7
  2074. #define FW_PCIE_FW_EVAL_SHIFT 24
  2075. #define FW_PCIE_FW_EVAL_GET(x) (((x) >> FW_PCIE_FW_EVAL_SHIFT) & \
  2076. FW_PCIE_FW_EVAL_MASK)
  2077. struct fw_hdr {
  2078. u8 ver;
  2079. u8 chip; /* terminator chip type */
  2080. __be16 len512; /* bin length in units of 512-bytes */
  2081. __be32 fw_ver; /* firmware version */
  2082. __be32 tp_microcode_ver;
  2083. u8 intfver_nic;
  2084. u8 intfver_vnic;
  2085. u8 intfver_ofld;
  2086. u8 intfver_ri;
  2087. u8 intfver_iscsipdu;
  2088. u8 intfver_iscsi;
  2089. u8 intfver_fcoepdu;
  2090. u8 intfver_fcoe;
  2091. __u32 reserved2;
  2092. __u32 reserved3;
  2093. __u32 reserved4;
  2094. __be32 flags;
  2095. __be32 reserved6[23];
  2096. };
  2097. enum fw_hdr_chip {
  2098. FW_HDR_CHIP_T4,
  2099. FW_HDR_CHIP_T5
  2100. };
  2101. #define FW_HDR_FW_VER_MAJOR_GET(x) (((x) >> 24) & 0xff)
  2102. #define FW_HDR_FW_VER_MINOR_GET(x) (((x) >> 16) & 0xff)
  2103. #define FW_HDR_FW_VER_MICRO_GET(x) (((x) >> 8) & 0xff)
  2104. #define FW_HDR_FW_VER_BUILD_GET(x) (((x) >> 0) & 0xff)
  2105. enum fw_hdr_intfver {
  2106. FW_HDR_INTFVER_NIC = 0x00,
  2107. FW_HDR_INTFVER_VNIC = 0x00,
  2108. FW_HDR_INTFVER_OFLD = 0x00,
  2109. FW_HDR_INTFVER_RI = 0x00,
  2110. FW_HDR_INTFVER_ISCSIPDU = 0x00,
  2111. FW_HDR_INTFVER_ISCSI = 0x00,
  2112. FW_HDR_INTFVER_FCOEPDU = 0x00,
  2113. FW_HDR_INTFVER_FCOE = 0x00,
  2114. };
  2115. enum fw_hdr_flags {
  2116. FW_HDR_FLAGS_RESET_HALT = 0x00000001,
  2117. };
  2118. #endif /* _T4FW_INTERFACE_H_ */