t4fw_api.h 65 KB

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