be_cmds.h 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516
  1. /*
  2. * Copyright (C) 2005 - 2016 Broadcom
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation. The full GNU General
  8. * Public License is included in this distribution in the file called COPYING.
  9. *
  10. * Contact Information:
  11. * linux-drivers@emulex.com
  12. *
  13. * Emulex
  14. * 3333 Susan Street
  15. * Costa Mesa, CA 92626
  16. */
  17. /*
  18. * The driver sends configuration and managements command requests to the
  19. * firmware in the BE. These requests are communicated to the processor
  20. * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one
  21. * WRB inside a MAILBOX.
  22. * The commands are serviced by the ARM processor in the BladeEngine's MPU.
  23. */
  24. struct be_sge {
  25. u32 pa_lo;
  26. u32 pa_hi;
  27. u32 len;
  28. };
  29. #define MCC_WRB_EMBEDDED_MASK 1 /* bit 0 of dword 0*/
  30. #define MCC_WRB_SGE_CNT_SHIFT 3 /* bits 3 - 7 of dword 0 */
  31. #define MCC_WRB_SGE_CNT_MASK 0x1F /* bits 3 - 7 of dword 0 */
  32. struct be_mcc_wrb {
  33. u32 embedded; /* dword 0 */
  34. u32 payload_length; /* dword 1 */
  35. u32 tag0; /* dword 2 */
  36. u32 tag1; /* dword 3 */
  37. u32 rsvd; /* dword 4 */
  38. union {
  39. u8 embedded_payload[236]; /* used by embedded cmds */
  40. struct be_sge sgl[19]; /* used by non-embedded cmds */
  41. } payload;
  42. };
  43. #define CQE_FLAGS_VALID_MASK BIT(31)
  44. #define CQE_FLAGS_ASYNC_MASK BIT(30)
  45. #define CQE_FLAGS_COMPLETED_MASK BIT(28)
  46. #define CQE_FLAGS_CONSUMED_MASK BIT(27)
  47. /* Completion Status */
  48. enum mcc_base_status {
  49. MCC_STATUS_SUCCESS = 0,
  50. MCC_STATUS_FAILED = 1,
  51. MCC_STATUS_ILLEGAL_REQUEST = 2,
  52. MCC_STATUS_ILLEGAL_FIELD = 3,
  53. MCC_STATUS_INSUFFICIENT_BUFFER = 4,
  54. MCC_STATUS_UNAUTHORIZED_REQUEST = 5,
  55. MCC_STATUS_NOT_SUPPORTED = 66,
  56. MCC_STATUS_FEATURE_NOT_SUPPORTED = 68,
  57. MCC_STATUS_INVALID_LENGTH = 116
  58. };
  59. /* Additional status */
  60. enum mcc_addl_status {
  61. MCC_ADDL_STATUS_INSUFFICIENT_RESOURCES = 0x16,
  62. MCC_ADDL_STATUS_FLASH_IMAGE_CRC_MISMATCH = 0x4d,
  63. MCC_ADDL_STATUS_TOO_MANY_INTERFACES = 0x4a,
  64. MCC_ADDL_STATUS_INSUFFICIENT_VLANS = 0xab,
  65. MCC_ADDL_STATUS_INVALID_SIGNATURE = 0x56,
  66. MCC_ADDL_STATUS_MISSING_SIGNATURE = 0x57,
  67. MCC_ADDL_STATUS_INSUFFICIENT_PRIVILEGES = 0x60
  68. };
  69. #define CQE_BASE_STATUS_MASK 0xFFFF
  70. #define CQE_BASE_STATUS_SHIFT 0 /* bits 0 - 15 */
  71. #define CQE_ADDL_STATUS_MASK 0xFF
  72. #define CQE_ADDL_STATUS_SHIFT 16 /* bits 16 - 31 */
  73. #define base_status(status) \
  74. ((enum mcc_base_status) \
  75. (status > 0 ? (status & CQE_BASE_STATUS_MASK) : 0))
  76. #define addl_status(status) \
  77. ((enum mcc_addl_status) \
  78. (status > 0 ? (status >> CQE_ADDL_STATUS_SHIFT) & \
  79. CQE_ADDL_STATUS_MASK : 0))
  80. struct be_mcc_compl {
  81. u32 status; /* dword 0 */
  82. u32 tag0; /* dword 1 */
  83. u32 tag1; /* dword 2 */
  84. u32 flags; /* dword 3 */
  85. };
  86. /* When the async bit of mcc_compl flags is set, flags
  87. * is interpreted as follows:
  88. */
  89. #define ASYNC_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
  90. #define ASYNC_EVENT_CODE_MASK 0xFF
  91. #define ASYNC_EVENT_TYPE_SHIFT 16
  92. #define ASYNC_EVENT_TYPE_MASK 0xFF
  93. #define ASYNC_EVENT_CODE_LINK_STATE 0x1
  94. #define ASYNC_EVENT_CODE_GRP_5 0x5
  95. #define ASYNC_EVENT_QOS_SPEED 0x1
  96. #define ASYNC_EVENT_COS_PRIORITY 0x2
  97. #define ASYNC_EVENT_PVID_STATE 0x3
  98. #define ASYNC_EVENT_CODE_QNQ 0x6
  99. #define ASYNC_DEBUG_EVENT_TYPE_QNQ 1
  100. #define ASYNC_EVENT_CODE_SLIPORT 0x11
  101. #define ASYNC_EVENT_PORT_MISCONFIG 0x9
  102. #define ASYNC_EVENT_FW_CONTROL 0x5
  103. enum {
  104. LINK_DOWN = 0x0,
  105. LINK_UP = 0x1
  106. };
  107. #define LINK_STATUS_MASK 0x1
  108. #define LOGICAL_LINK_STATUS_MASK 0x2
  109. /* When the event code of compl->flags is link-state, the mcc_compl
  110. * must be interpreted as follows
  111. */
  112. struct be_async_event_link_state {
  113. u8 physical_port;
  114. u8 port_link_status;
  115. u8 port_duplex;
  116. u8 port_speed;
  117. u8 port_fault;
  118. u8 rsvd0[7];
  119. u32 flags;
  120. } __packed;
  121. /* When the event code of compl->flags is GRP-5 and event_type is QOS_SPEED
  122. * the mcc_compl must be interpreted as follows
  123. */
  124. struct be_async_event_grp5_qos_link_speed {
  125. u8 physical_port;
  126. u8 rsvd[5];
  127. u16 qos_link_speed;
  128. u32 event_tag;
  129. u32 flags;
  130. } __packed;
  131. /* When the event code of compl->flags is GRP5 and event type is
  132. * CoS-Priority, the mcc_compl must be interpreted as follows
  133. */
  134. struct be_async_event_grp5_cos_priority {
  135. u8 physical_port;
  136. u8 available_priority_bmap;
  137. u8 reco_default_priority;
  138. u8 valid;
  139. u8 rsvd0;
  140. u8 event_tag;
  141. u32 flags;
  142. } __packed;
  143. /* When the event code of compl->flags is GRP5 and event type is
  144. * PVID state, the mcc_compl must be interpreted as follows
  145. */
  146. struct be_async_event_grp5_pvid_state {
  147. u8 enabled;
  148. u8 rsvd0;
  149. u16 tag;
  150. u32 event_tag;
  151. u32 rsvd1;
  152. u32 flags;
  153. } __packed;
  154. /* async event indicating outer VLAN tag in QnQ */
  155. struct be_async_event_qnq {
  156. u8 valid; /* Indicates if outer VLAN is valid */
  157. u8 rsvd0;
  158. u16 vlan_tag;
  159. u32 event_tag;
  160. u8 rsvd1[4];
  161. u32 flags;
  162. } __packed;
  163. enum {
  164. BE_PHY_FUNCTIONAL = 0,
  165. BE_PHY_NOT_PRESENT = 1,
  166. BE_PHY_DIFF_MEDIA = 2,
  167. BE_PHY_INCOMPATIBLE = 3,
  168. BE_PHY_UNQUALIFIED = 4,
  169. BE_PHY_UNCERTIFIED = 5
  170. };
  171. #define PHY_STATE_MSG_SEVERITY 0x6
  172. #define PHY_STATE_OPER 0x1
  173. #define PHY_STATE_INFO_VALID 0x80
  174. #define PHY_STATE_OPER_MSG_NONE 0x2
  175. #define DEFAULT_MSG_SEVERITY 0x1
  176. #define be_phy_state_unknown(phy_state) (phy_state > BE_PHY_UNCERTIFIED)
  177. #define be_phy_unqualified(phy_state) \
  178. (phy_state == BE_PHY_UNQUALIFIED || \
  179. phy_state == BE_PHY_UNCERTIFIED)
  180. #define be_phy_misconfigured(phy_state) \
  181. (phy_state == BE_PHY_INCOMPATIBLE || \
  182. phy_state == BE_PHY_UNQUALIFIED || \
  183. phy_state == BE_PHY_UNCERTIFIED)
  184. extern const char * const be_misconfig_evt_port_state[];
  185. /* async event indicating misconfigured port */
  186. struct be_async_event_misconfig_port {
  187. /* DATA_WORD1:
  188. * phy state of port 0: bits 7 - 0
  189. * phy state of port 1: bits 15 - 8
  190. * phy state of port 2: bits 23 - 16
  191. * phy state of port 3: bits 31 - 24
  192. */
  193. u32 event_data_word1;
  194. /* DATA_WORD2:
  195. * phy state info of port 0: bits 7 - 0
  196. * phy state info of port 1: bits 15 - 8
  197. * phy state info of port 2: bits 23 - 16
  198. * phy state info of port 3: bits 31 - 24
  199. *
  200. * PHY STATE INFO:
  201. * Link operability :bit 0
  202. * Message severity :bit 2 - 1
  203. * Rsvd :bits 6 - 3
  204. * phy state info valid :bit 7
  205. */
  206. u32 event_data_word2;
  207. u32 rsvd0;
  208. u32 flags;
  209. } __packed;
  210. #define BMC_FILT_BROADCAST_ARP BIT(0)
  211. #define BMC_FILT_BROADCAST_DHCP_CLIENT BIT(1)
  212. #define BMC_FILT_BROADCAST_DHCP_SERVER BIT(2)
  213. #define BMC_FILT_BROADCAST_NET_BIOS BIT(3)
  214. #define BMC_FILT_BROADCAST BIT(7)
  215. #define BMC_FILT_MULTICAST_IPV6_NEIGH_ADVER BIT(8)
  216. #define BMC_FILT_MULTICAST_IPV6_RA BIT(9)
  217. #define BMC_FILT_MULTICAST_IPV6_RAS BIT(10)
  218. #define BMC_FILT_MULTICAST BIT(15)
  219. struct be_async_fw_control {
  220. u32 event_data_word1;
  221. u32 event_data_word2;
  222. u32 evt_tag;
  223. u32 event_data_word4;
  224. } __packed;
  225. struct be_mcc_mailbox {
  226. struct be_mcc_wrb wrb;
  227. struct be_mcc_compl compl;
  228. };
  229. #define CMD_SUBSYSTEM_COMMON 0x1
  230. #define CMD_SUBSYSTEM_ETH 0x3
  231. #define CMD_SUBSYSTEM_LOWLEVEL 0xb
  232. #define OPCODE_COMMON_NTWK_MAC_QUERY 1
  233. #define OPCODE_COMMON_NTWK_MAC_SET 2
  234. #define OPCODE_COMMON_NTWK_MULTICAST_SET 3
  235. #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
  236. #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
  237. #define OPCODE_COMMON_READ_FLASHROM 6
  238. #define OPCODE_COMMON_WRITE_FLASHROM 7
  239. #define OPCODE_COMMON_CQ_CREATE 12
  240. #define OPCODE_COMMON_EQ_CREATE 13
  241. #define OPCODE_COMMON_MCC_CREATE 21
  242. #define OPCODE_COMMON_SET_QOS 28
  243. #define OPCODE_COMMON_MCC_CREATE_EXT 90
  244. #define OPCODE_COMMON_SEEPROM_READ 30
  245. #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
  246. #define OPCODE_COMMON_NTWK_RX_FILTER 34
  247. #define OPCODE_COMMON_GET_FW_VERSION 35
  248. #define OPCODE_COMMON_SET_FLOW_CONTROL 36
  249. #define OPCODE_COMMON_GET_FLOW_CONTROL 37
  250. #define OPCODE_COMMON_SET_FRAME_SIZE 39
  251. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  252. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  253. #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50
  254. #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51
  255. #define OPCODE_COMMON_MCC_DESTROY 53
  256. #define OPCODE_COMMON_CQ_DESTROY 54
  257. #define OPCODE_COMMON_EQ_DESTROY 55
  258. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  259. #define OPCODE_COMMON_NTWK_PMAC_ADD 59
  260. #define OPCODE_COMMON_NTWK_PMAC_DEL 60
  261. #define OPCODE_COMMON_FUNCTION_RESET 61
  262. #define OPCODE_COMMON_MANAGE_FAT 68
  263. #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69
  264. #define OPCODE_COMMON_GET_BEACON_STATE 70
  265. #define OPCODE_COMMON_READ_TRANSRECV_DATA 73
  266. #define OPCODE_COMMON_GET_PORT_NAME 77
  267. #define OPCODE_COMMON_SET_LOGICAL_LINK_CONFIG 80
  268. #define OPCODE_COMMON_SET_INTERRUPT_ENABLE 89
  269. #define OPCODE_COMMON_SET_FN_PRIVILEGES 100
  270. #define OPCODE_COMMON_GET_PHY_DETAILS 102
  271. #define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103
  272. #define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
  273. #define OPCODE_COMMON_GET_EXT_FAT_CAPABILITIES 125
  274. #define OPCODE_COMMON_SET_EXT_FAT_CAPABILITIES 126
  275. #define OPCODE_COMMON_GET_MAC_LIST 147
  276. #define OPCODE_COMMON_SET_MAC_LIST 148
  277. #define OPCODE_COMMON_GET_HSW_CONFIG 152
  278. #define OPCODE_COMMON_GET_FUNC_CONFIG 160
  279. #define OPCODE_COMMON_GET_PROFILE_CONFIG 164
  280. #define OPCODE_COMMON_SET_PROFILE_CONFIG 165
  281. #define OPCODE_COMMON_GET_ACTIVE_PROFILE 167
  282. #define OPCODE_COMMON_SET_HSW_CONFIG 153
  283. #define OPCODE_COMMON_GET_FN_PRIVILEGES 170
  284. #define OPCODE_COMMON_READ_OBJECT 171
  285. #define OPCODE_COMMON_WRITE_OBJECT 172
  286. #define OPCODE_COMMON_DELETE_OBJECT 174
  287. #define OPCODE_COMMON_SET_FEATURES 191
  288. #define OPCODE_COMMON_MANAGE_IFACE_FILTERS 193
  289. #define OPCODE_COMMON_GET_IFACE_LIST 194
  290. #define OPCODE_COMMON_ENABLE_DISABLE_VF 196
  291. #define OPCODE_ETH_RSS_CONFIG 1
  292. #define OPCODE_ETH_ACPI_CONFIG 2
  293. #define OPCODE_ETH_PROMISCUOUS 3
  294. #define OPCODE_ETH_GET_STATISTICS 4
  295. #define OPCODE_ETH_TX_CREATE 7
  296. #define OPCODE_ETH_RX_CREATE 8
  297. #define OPCODE_ETH_TX_DESTROY 9
  298. #define OPCODE_ETH_RX_DESTROY 10
  299. #define OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG 12
  300. #define OPCODE_ETH_GET_PPORT_STATS 18
  301. #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17
  302. #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18
  303. #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19
  304. struct be_cmd_req_hdr {
  305. u8 opcode; /* dword 0 */
  306. u8 subsystem; /* dword 0 */
  307. u8 port_number; /* dword 0 */
  308. u8 domain; /* dword 0 */
  309. u32 timeout; /* dword 1 */
  310. u32 request_length; /* dword 2 */
  311. u8 version; /* dword 3 */
  312. u8 rsvd[3]; /* dword 3 */
  313. };
  314. #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
  315. #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */
  316. struct be_cmd_resp_hdr {
  317. u8 opcode; /* dword 0 */
  318. u8 subsystem; /* dword 0 */
  319. u8 rsvd[2]; /* dword 0 */
  320. u8 base_status; /* dword 1 */
  321. u8 addl_status; /* dword 1 */
  322. u8 rsvd1[2]; /* dword 1 */
  323. u32 response_length; /* dword 2 */
  324. u32 actual_resp_len; /* dword 3 */
  325. };
  326. struct phys_addr {
  327. u32 lo;
  328. u32 hi;
  329. };
  330. /**************************
  331. * BE Command definitions *
  332. **************************/
  333. /* Pseudo amap definition in which each bit of the actual structure is defined
  334. * as a byte: used to calculate offset/shift/mask of each field */
  335. struct amap_eq_context {
  336. u8 cidx[13]; /* dword 0*/
  337. u8 rsvd0[3]; /* dword 0*/
  338. u8 epidx[13]; /* dword 0*/
  339. u8 valid; /* dword 0*/
  340. u8 rsvd1; /* dword 0*/
  341. u8 size; /* dword 0*/
  342. u8 pidx[13]; /* dword 1*/
  343. u8 rsvd2[3]; /* dword 1*/
  344. u8 pd[10]; /* dword 1*/
  345. u8 count[3]; /* dword 1*/
  346. u8 solevent; /* dword 1*/
  347. u8 stalled; /* dword 1*/
  348. u8 armed; /* dword 1*/
  349. u8 rsvd3[4]; /* dword 2*/
  350. u8 func[8]; /* dword 2*/
  351. u8 rsvd4; /* dword 2*/
  352. u8 delaymult[10]; /* dword 2*/
  353. u8 rsvd5[2]; /* dword 2*/
  354. u8 phase[2]; /* dword 2*/
  355. u8 nodelay; /* dword 2*/
  356. u8 rsvd6[4]; /* dword 2*/
  357. u8 rsvd7[32]; /* dword 3*/
  358. } __packed;
  359. struct be_cmd_req_eq_create {
  360. struct be_cmd_req_hdr hdr;
  361. u16 num_pages; /* sword */
  362. u16 rsvd0; /* sword */
  363. u8 context[sizeof(struct amap_eq_context) / 8];
  364. struct phys_addr pages[8];
  365. } __packed;
  366. struct be_cmd_resp_eq_create {
  367. struct be_cmd_resp_hdr resp_hdr;
  368. u16 eq_id; /* sword */
  369. u16 msix_idx; /* available only in v2 */
  370. } __packed;
  371. /******************** Mac query ***************************/
  372. enum {
  373. MAC_ADDRESS_TYPE_STORAGE = 0x0,
  374. MAC_ADDRESS_TYPE_NETWORK = 0x1,
  375. MAC_ADDRESS_TYPE_PD = 0x2,
  376. MAC_ADDRESS_TYPE_MANAGEMENT = 0x3
  377. };
  378. struct mac_addr {
  379. u16 size_of_struct;
  380. u8 addr[ETH_ALEN];
  381. } __packed;
  382. struct be_cmd_req_mac_query {
  383. struct be_cmd_req_hdr hdr;
  384. u8 type;
  385. u8 permanent;
  386. u16 if_id;
  387. u32 pmac_id;
  388. } __packed;
  389. struct be_cmd_resp_mac_query {
  390. struct be_cmd_resp_hdr hdr;
  391. struct mac_addr mac;
  392. };
  393. /******************** PMac Add ***************************/
  394. struct be_cmd_req_pmac_add {
  395. struct be_cmd_req_hdr hdr;
  396. u32 if_id;
  397. u8 mac_address[ETH_ALEN];
  398. u8 rsvd0[2];
  399. } __packed;
  400. struct be_cmd_resp_pmac_add {
  401. struct be_cmd_resp_hdr hdr;
  402. u32 pmac_id;
  403. };
  404. /******************** PMac Del ***************************/
  405. struct be_cmd_req_pmac_del {
  406. struct be_cmd_req_hdr hdr;
  407. u32 if_id;
  408. u32 pmac_id;
  409. };
  410. /******************** Create CQ ***************************/
  411. /* Pseudo amap definition in which each bit of the actual structure is defined
  412. * as a byte: used to calculate offset/shift/mask of each field */
  413. struct amap_cq_context_be {
  414. u8 cidx[11]; /* dword 0*/
  415. u8 rsvd0; /* dword 0*/
  416. u8 coalescwm[2]; /* dword 0*/
  417. u8 nodelay; /* dword 0*/
  418. u8 epidx[11]; /* dword 0*/
  419. u8 rsvd1; /* dword 0*/
  420. u8 count[2]; /* dword 0*/
  421. u8 valid; /* dword 0*/
  422. u8 solevent; /* dword 0*/
  423. u8 eventable; /* dword 0*/
  424. u8 pidx[11]; /* dword 1*/
  425. u8 rsvd2; /* dword 1*/
  426. u8 pd[10]; /* dword 1*/
  427. u8 eqid[8]; /* dword 1*/
  428. u8 stalled; /* dword 1*/
  429. u8 armed; /* dword 1*/
  430. u8 rsvd3[4]; /* dword 2*/
  431. u8 func[8]; /* dword 2*/
  432. u8 rsvd4[20]; /* dword 2*/
  433. u8 rsvd5[32]; /* dword 3*/
  434. } __packed;
  435. struct amap_cq_context_v2 {
  436. u8 rsvd0[12]; /* dword 0*/
  437. u8 coalescwm[2]; /* dword 0*/
  438. u8 nodelay; /* dword 0*/
  439. u8 rsvd1[12]; /* dword 0*/
  440. u8 count[2]; /* dword 0*/
  441. u8 valid; /* dword 0*/
  442. u8 rsvd2; /* dword 0*/
  443. u8 eventable; /* dword 0*/
  444. u8 eqid[16]; /* dword 1*/
  445. u8 rsvd3[15]; /* dword 1*/
  446. u8 armed; /* dword 1*/
  447. u8 rsvd4[32]; /* dword 2*/
  448. u8 rsvd5[32]; /* dword 3*/
  449. } __packed;
  450. struct be_cmd_req_cq_create {
  451. struct be_cmd_req_hdr hdr;
  452. u16 num_pages;
  453. u8 page_size;
  454. u8 rsvd0;
  455. u8 context[sizeof(struct amap_cq_context_be) / 8];
  456. struct phys_addr pages[8];
  457. } __packed;
  458. struct be_cmd_resp_cq_create {
  459. struct be_cmd_resp_hdr hdr;
  460. u16 cq_id;
  461. u16 rsvd0;
  462. } __packed;
  463. struct be_cmd_req_get_fat {
  464. struct be_cmd_req_hdr hdr;
  465. u32 fat_operation;
  466. u32 read_log_offset;
  467. u32 read_log_length;
  468. u32 data_buffer_size;
  469. u32 data_buffer[1];
  470. } __packed;
  471. struct be_cmd_resp_get_fat {
  472. struct be_cmd_resp_hdr hdr;
  473. u32 log_size;
  474. u32 read_log_length;
  475. u32 rsvd[2];
  476. u32 data_buffer[1];
  477. } __packed;
  478. /******************** Create MCCQ ***************************/
  479. /* Pseudo amap definition in which each bit of the actual structure is defined
  480. * as a byte: used to calculate offset/shift/mask of each field */
  481. struct amap_mcc_context_be {
  482. u8 con_index[14];
  483. u8 rsvd0[2];
  484. u8 ring_size[4];
  485. u8 fetch_wrb;
  486. u8 fetch_r2t;
  487. u8 cq_id[10];
  488. u8 prod_index[14];
  489. u8 fid[8];
  490. u8 pdid[9];
  491. u8 valid;
  492. u8 rsvd1[32];
  493. u8 rsvd2[32];
  494. } __packed;
  495. struct amap_mcc_context_v1 {
  496. u8 async_cq_id[16];
  497. u8 ring_size[4];
  498. u8 rsvd0[12];
  499. u8 rsvd1[31];
  500. u8 valid;
  501. u8 async_cq_valid[1];
  502. u8 rsvd2[31];
  503. u8 rsvd3[32];
  504. } __packed;
  505. struct be_cmd_req_mcc_create {
  506. struct be_cmd_req_hdr hdr;
  507. u16 num_pages;
  508. u16 cq_id;
  509. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  510. struct phys_addr pages[8];
  511. } __packed;
  512. struct be_cmd_req_mcc_ext_create {
  513. struct be_cmd_req_hdr hdr;
  514. u16 num_pages;
  515. u16 cq_id;
  516. u32 async_event_bitmap[1];
  517. u8 context[sizeof(struct amap_mcc_context_v1) / 8];
  518. struct phys_addr pages[8];
  519. } __packed;
  520. struct be_cmd_resp_mcc_create {
  521. struct be_cmd_resp_hdr hdr;
  522. u16 id;
  523. u16 rsvd0;
  524. } __packed;
  525. /******************** Create TxQ ***************************/
  526. #define BE_ETH_TX_RING_TYPE_STANDARD 2
  527. #define BE_ULP1_NUM 1
  528. struct be_cmd_req_eth_tx_create {
  529. struct be_cmd_req_hdr hdr;
  530. u8 num_pages;
  531. u8 ulp_num;
  532. u16 type;
  533. u16 if_id;
  534. u8 queue_size;
  535. u8 rsvd0;
  536. u32 rsvd1;
  537. u16 cq_id;
  538. u16 rsvd2;
  539. u32 rsvd3[13];
  540. struct phys_addr pages[8];
  541. } __packed;
  542. struct be_cmd_resp_eth_tx_create {
  543. struct be_cmd_resp_hdr hdr;
  544. u16 cid;
  545. u16 rid;
  546. u32 db_offset;
  547. u32 rsvd0[4];
  548. } __packed;
  549. /******************** Create RxQ ***************************/
  550. struct be_cmd_req_eth_rx_create {
  551. struct be_cmd_req_hdr hdr;
  552. u16 cq_id;
  553. u8 frag_size;
  554. u8 num_pages;
  555. struct phys_addr pages[2];
  556. u32 interface_id;
  557. u16 max_frame_size;
  558. u16 rsvd0;
  559. u32 rss_queue;
  560. } __packed;
  561. struct be_cmd_resp_eth_rx_create {
  562. struct be_cmd_resp_hdr hdr;
  563. u16 id;
  564. u8 rss_id;
  565. u8 rsvd0;
  566. } __packed;
  567. /******************** Q Destroy ***************************/
  568. /* Type of Queue to be destroyed */
  569. enum {
  570. QTYPE_EQ = 1,
  571. QTYPE_CQ,
  572. QTYPE_TXQ,
  573. QTYPE_RXQ,
  574. QTYPE_MCCQ
  575. };
  576. struct be_cmd_req_q_destroy {
  577. struct be_cmd_req_hdr hdr;
  578. u16 id;
  579. u16 bypass_flush; /* valid only for rx q destroy */
  580. } __packed;
  581. /************ I/f Create (it's actually I/f Config Create)**********/
  582. /* Capability flags for the i/f */
  583. enum be_if_flags {
  584. BE_IF_FLAGS_RSS = 0x4,
  585. BE_IF_FLAGS_PROMISCUOUS = 0x8,
  586. BE_IF_FLAGS_BROADCAST = 0x10,
  587. BE_IF_FLAGS_UNTAGGED = 0x20,
  588. BE_IF_FLAGS_ULP = 0x40,
  589. BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80,
  590. BE_IF_FLAGS_VLAN = 0x100,
  591. BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200,
  592. BE_IF_FLAGS_PASS_L2_ERRORS = 0x400,
  593. BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800,
  594. BE_IF_FLAGS_MULTICAST = 0x1000,
  595. BE_IF_FLAGS_DEFQ_RSS = 0x1000000
  596. };
  597. #define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\
  598. BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\
  599. BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\
  600. BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\
  601. BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_DEFQ_RSS)
  602. #define BE_IF_FLAGS_ALL_PROMISCUOUS (BE_IF_FLAGS_PROMISCUOUS | \
  603. BE_IF_FLAGS_VLAN_PROMISCUOUS |\
  604. BE_IF_FLAGS_MCAST_PROMISCUOUS)
  605. #define BE_IF_FILT_FLAGS_BASIC (BE_IF_FLAGS_BROADCAST | \
  606. BE_IF_FLAGS_PASS_L3L4_ERRORS | \
  607. BE_IF_FLAGS_UNTAGGED)
  608. #define BE_IF_ALL_FILT_FLAGS (BE_IF_FILT_FLAGS_BASIC | \
  609. BE_IF_FLAGS_MULTICAST | \
  610. BE_IF_FLAGS_ALL_PROMISCUOUS)
  611. /* An RX interface is an object with one or more MAC addresses and
  612. * filtering capabilities. */
  613. struct be_cmd_req_if_create {
  614. struct be_cmd_req_hdr hdr;
  615. u32 version; /* ignore currently */
  616. u32 capability_flags;
  617. u32 enable_flags;
  618. u8 mac_addr[ETH_ALEN];
  619. u8 rsvd0;
  620. u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */
  621. u32 vlan_tag; /* not used currently */
  622. } __packed;
  623. struct be_cmd_resp_if_create {
  624. struct be_cmd_resp_hdr hdr;
  625. u32 interface_id;
  626. u32 pmac_id;
  627. };
  628. /****** I/f Destroy(it's actually I/f Config Destroy )**********/
  629. struct be_cmd_req_if_destroy {
  630. struct be_cmd_req_hdr hdr;
  631. u32 interface_id;
  632. };
  633. /*************** HW Stats Get **********************************/
  634. struct be_port_rxf_stats_v0 {
  635. u32 rx_bytes_lsd; /* dword 0*/
  636. u32 rx_bytes_msd; /* dword 1*/
  637. u32 rx_total_frames; /* dword 2*/
  638. u32 rx_unicast_frames; /* dword 3*/
  639. u32 rx_multicast_frames; /* dword 4*/
  640. u32 rx_broadcast_frames; /* dword 5*/
  641. u32 rx_crc_errors; /* dword 6*/
  642. u32 rx_alignment_symbol_errors; /* dword 7*/
  643. u32 rx_pause_frames; /* dword 8*/
  644. u32 rx_control_frames; /* dword 9*/
  645. u32 rx_in_range_errors; /* dword 10*/
  646. u32 rx_out_range_errors; /* dword 11*/
  647. u32 rx_frame_too_long; /* dword 12*/
  648. u32 rx_address_filtered; /* dword 13*/
  649. u32 rx_vlan_filtered; /* dword 14*/
  650. u32 rx_dropped_too_small; /* dword 15*/
  651. u32 rx_dropped_too_short; /* dword 16*/
  652. u32 rx_dropped_header_too_small; /* dword 17*/
  653. u32 rx_dropped_tcp_length; /* dword 18*/
  654. u32 rx_dropped_runt; /* dword 19*/
  655. u32 rx_64_byte_packets; /* dword 20*/
  656. u32 rx_65_127_byte_packets; /* dword 21*/
  657. u32 rx_128_256_byte_packets; /* dword 22*/
  658. u32 rx_256_511_byte_packets; /* dword 23*/
  659. u32 rx_512_1023_byte_packets; /* dword 24*/
  660. u32 rx_1024_1518_byte_packets; /* dword 25*/
  661. u32 rx_1519_2047_byte_packets; /* dword 26*/
  662. u32 rx_2048_4095_byte_packets; /* dword 27*/
  663. u32 rx_4096_8191_byte_packets; /* dword 28*/
  664. u32 rx_8192_9216_byte_packets; /* dword 29*/
  665. u32 rx_ip_checksum_errs; /* dword 30*/
  666. u32 rx_tcp_checksum_errs; /* dword 31*/
  667. u32 rx_udp_checksum_errs; /* dword 32*/
  668. u32 rx_non_rss_packets; /* dword 33*/
  669. u32 rx_ipv4_packets; /* dword 34*/
  670. u32 rx_ipv6_packets; /* dword 35*/
  671. u32 rx_ipv4_bytes_lsd; /* dword 36*/
  672. u32 rx_ipv4_bytes_msd; /* dword 37*/
  673. u32 rx_ipv6_bytes_lsd; /* dword 38*/
  674. u32 rx_ipv6_bytes_msd; /* dword 39*/
  675. u32 rx_chute1_packets; /* dword 40*/
  676. u32 rx_chute2_packets; /* dword 41*/
  677. u32 rx_chute3_packets; /* dword 42*/
  678. u32 rx_management_packets; /* dword 43*/
  679. u32 rx_switched_unicast_packets; /* dword 44*/
  680. u32 rx_switched_multicast_packets; /* dword 45*/
  681. u32 rx_switched_broadcast_packets; /* dword 46*/
  682. u32 tx_bytes_lsd; /* dword 47*/
  683. u32 tx_bytes_msd; /* dword 48*/
  684. u32 tx_unicastframes; /* dword 49*/
  685. u32 tx_multicastframes; /* dword 50*/
  686. u32 tx_broadcastframes; /* dword 51*/
  687. u32 tx_pauseframes; /* dword 52*/
  688. u32 tx_controlframes; /* dword 53*/
  689. u32 tx_64_byte_packets; /* dword 54*/
  690. u32 tx_65_127_byte_packets; /* dword 55*/
  691. u32 tx_128_256_byte_packets; /* dword 56*/
  692. u32 tx_256_511_byte_packets; /* dword 57*/
  693. u32 tx_512_1023_byte_packets; /* dword 58*/
  694. u32 tx_1024_1518_byte_packets; /* dword 59*/
  695. u32 tx_1519_2047_byte_packets; /* dword 60*/
  696. u32 tx_2048_4095_byte_packets; /* dword 61*/
  697. u32 tx_4096_8191_byte_packets; /* dword 62*/
  698. u32 tx_8192_9216_byte_packets; /* dword 63*/
  699. u32 rx_fifo_overflow; /* dword 64*/
  700. u32 rx_input_fifo_overflow; /* dword 65*/
  701. };
  702. struct be_rxf_stats_v0 {
  703. struct be_port_rxf_stats_v0 port[2];
  704. u32 rx_drops_no_pbuf; /* dword 132*/
  705. u32 rx_drops_no_txpb; /* dword 133*/
  706. u32 rx_drops_no_erx_descr; /* dword 134*/
  707. u32 rx_drops_no_tpre_descr; /* dword 135*/
  708. u32 management_rx_port_packets; /* dword 136*/
  709. u32 management_rx_port_bytes; /* dword 137*/
  710. u32 management_rx_port_pause_frames; /* dword 138*/
  711. u32 management_rx_port_errors; /* dword 139*/
  712. u32 management_tx_port_packets; /* dword 140*/
  713. u32 management_tx_port_bytes; /* dword 141*/
  714. u32 management_tx_port_pause; /* dword 142*/
  715. u32 management_rx_port_rxfifo_overflow; /* dword 143*/
  716. u32 rx_drops_too_many_frags; /* dword 144*/
  717. u32 rx_drops_invalid_ring; /* dword 145*/
  718. u32 forwarded_packets; /* dword 146*/
  719. u32 rx_drops_mtu; /* dword 147*/
  720. u32 rsvd0[7];
  721. u32 port0_jabber_events;
  722. u32 port1_jabber_events;
  723. u32 rsvd1[6];
  724. };
  725. struct be_erx_stats_v0 {
  726. u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/
  727. u32 rsvd[4];
  728. };
  729. struct be_pmem_stats {
  730. u32 eth_red_drops;
  731. u32 rsvd[5];
  732. };
  733. struct be_hw_stats_v0 {
  734. struct be_rxf_stats_v0 rxf;
  735. u32 rsvd[48];
  736. struct be_erx_stats_v0 erx;
  737. struct be_pmem_stats pmem;
  738. };
  739. struct be_cmd_req_get_stats_v0 {
  740. struct be_cmd_req_hdr hdr;
  741. u8 rsvd[sizeof(struct be_hw_stats_v0)];
  742. };
  743. struct be_cmd_resp_get_stats_v0 {
  744. struct be_cmd_resp_hdr hdr;
  745. struct be_hw_stats_v0 hw_stats;
  746. };
  747. struct lancer_pport_stats {
  748. u32 tx_packets_lo;
  749. u32 tx_packets_hi;
  750. u32 tx_unicast_packets_lo;
  751. u32 tx_unicast_packets_hi;
  752. u32 tx_multicast_packets_lo;
  753. u32 tx_multicast_packets_hi;
  754. u32 tx_broadcast_packets_lo;
  755. u32 tx_broadcast_packets_hi;
  756. u32 tx_bytes_lo;
  757. u32 tx_bytes_hi;
  758. u32 tx_unicast_bytes_lo;
  759. u32 tx_unicast_bytes_hi;
  760. u32 tx_multicast_bytes_lo;
  761. u32 tx_multicast_bytes_hi;
  762. u32 tx_broadcast_bytes_lo;
  763. u32 tx_broadcast_bytes_hi;
  764. u32 tx_discards_lo;
  765. u32 tx_discards_hi;
  766. u32 tx_errors_lo;
  767. u32 tx_errors_hi;
  768. u32 tx_pause_frames_lo;
  769. u32 tx_pause_frames_hi;
  770. u32 tx_pause_on_frames_lo;
  771. u32 tx_pause_on_frames_hi;
  772. u32 tx_pause_off_frames_lo;
  773. u32 tx_pause_off_frames_hi;
  774. u32 tx_internal_mac_errors_lo;
  775. u32 tx_internal_mac_errors_hi;
  776. u32 tx_control_frames_lo;
  777. u32 tx_control_frames_hi;
  778. u32 tx_packets_64_bytes_lo;
  779. u32 tx_packets_64_bytes_hi;
  780. u32 tx_packets_65_to_127_bytes_lo;
  781. u32 tx_packets_65_to_127_bytes_hi;
  782. u32 tx_packets_128_to_255_bytes_lo;
  783. u32 tx_packets_128_to_255_bytes_hi;
  784. u32 tx_packets_256_to_511_bytes_lo;
  785. u32 tx_packets_256_to_511_bytes_hi;
  786. u32 tx_packets_512_to_1023_bytes_lo;
  787. u32 tx_packets_512_to_1023_bytes_hi;
  788. u32 tx_packets_1024_to_1518_bytes_lo;
  789. u32 tx_packets_1024_to_1518_bytes_hi;
  790. u32 tx_packets_1519_to_2047_bytes_lo;
  791. u32 tx_packets_1519_to_2047_bytes_hi;
  792. u32 tx_packets_2048_to_4095_bytes_lo;
  793. u32 tx_packets_2048_to_4095_bytes_hi;
  794. u32 tx_packets_4096_to_8191_bytes_lo;
  795. u32 tx_packets_4096_to_8191_bytes_hi;
  796. u32 tx_packets_8192_to_9216_bytes_lo;
  797. u32 tx_packets_8192_to_9216_bytes_hi;
  798. u32 tx_lso_packets_lo;
  799. u32 tx_lso_packets_hi;
  800. u32 rx_packets_lo;
  801. u32 rx_packets_hi;
  802. u32 rx_unicast_packets_lo;
  803. u32 rx_unicast_packets_hi;
  804. u32 rx_multicast_packets_lo;
  805. u32 rx_multicast_packets_hi;
  806. u32 rx_broadcast_packets_lo;
  807. u32 rx_broadcast_packets_hi;
  808. u32 rx_bytes_lo;
  809. u32 rx_bytes_hi;
  810. u32 rx_unicast_bytes_lo;
  811. u32 rx_unicast_bytes_hi;
  812. u32 rx_multicast_bytes_lo;
  813. u32 rx_multicast_bytes_hi;
  814. u32 rx_broadcast_bytes_lo;
  815. u32 rx_broadcast_bytes_hi;
  816. u32 rx_unknown_protos;
  817. u32 rsvd_69; /* Word 69 is reserved */
  818. u32 rx_discards_lo;
  819. u32 rx_discards_hi;
  820. u32 rx_errors_lo;
  821. u32 rx_errors_hi;
  822. u32 rx_crc_errors_lo;
  823. u32 rx_crc_errors_hi;
  824. u32 rx_alignment_errors_lo;
  825. u32 rx_alignment_errors_hi;
  826. u32 rx_symbol_errors_lo;
  827. u32 rx_symbol_errors_hi;
  828. u32 rx_pause_frames_lo;
  829. u32 rx_pause_frames_hi;
  830. u32 rx_pause_on_frames_lo;
  831. u32 rx_pause_on_frames_hi;
  832. u32 rx_pause_off_frames_lo;
  833. u32 rx_pause_off_frames_hi;
  834. u32 rx_frames_too_long_lo;
  835. u32 rx_frames_too_long_hi;
  836. u32 rx_internal_mac_errors_lo;
  837. u32 rx_internal_mac_errors_hi;
  838. u32 rx_undersize_packets;
  839. u32 rx_oversize_packets;
  840. u32 rx_fragment_packets;
  841. u32 rx_jabbers;
  842. u32 rx_control_frames_lo;
  843. u32 rx_control_frames_hi;
  844. u32 rx_control_frames_unknown_opcode_lo;
  845. u32 rx_control_frames_unknown_opcode_hi;
  846. u32 rx_in_range_errors;
  847. u32 rx_out_of_range_errors;
  848. u32 rx_address_filtered;
  849. u32 rx_vlan_filtered;
  850. u32 rx_dropped_too_small;
  851. u32 rx_dropped_too_short;
  852. u32 rx_dropped_header_too_small;
  853. u32 rx_dropped_invalid_tcp_length;
  854. u32 rx_dropped_runt;
  855. u32 rx_ip_checksum_errors;
  856. u32 rx_tcp_checksum_errors;
  857. u32 rx_udp_checksum_errors;
  858. u32 rx_non_rss_packets;
  859. u32 rsvd_111;
  860. u32 rx_ipv4_packets_lo;
  861. u32 rx_ipv4_packets_hi;
  862. u32 rx_ipv6_packets_lo;
  863. u32 rx_ipv6_packets_hi;
  864. u32 rx_ipv4_bytes_lo;
  865. u32 rx_ipv4_bytes_hi;
  866. u32 rx_ipv6_bytes_lo;
  867. u32 rx_ipv6_bytes_hi;
  868. u32 rx_nic_packets_lo;
  869. u32 rx_nic_packets_hi;
  870. u32 rx_tcp_packets_lo;
  871. u32 rx_tcp_packets_hi;
  872. u32 rx_iscsi_packets_lo;
  873. u32 rx_iscsi_packets_hi;
  874. u32 rx_management_packets_lo;
  875. u32 rx_management_packets_hi;
  876. u32 rx_switched_unicast_packets_lo;
  877. u32 rx_switched_unicast_packets_hi;
  878. u32 rx_switched_multicast_packets_lo;
  879. u32 rx_switched_multicast_packets_hi;
  880. u32 rx_switched_broadcast_packets_lo;
  881. u32 rx_switched_broadcast_packets_hi;
  882. u32 num_forwards_lo;
  883. u32 num_forwards_hi;
  884. u32 rx_fifo_overflow;
  885. u32 rx_input_fifo_overflow;
  886. u32 rx_drops_too_many_frags_lo;
  887. u32 rx_drops_too_many_frags_hi;
  888. u32 rx_drops_invalid_queue;
  889. u32 rsvd_141;
  890. u32 rx_drops_mtu_lo;
  891. u32 rx_drops_mtu_hi;
  892. u32 rx_packets_64_bytes_lo;
  893. u32 rx_packets_64_bytes_hi;
  894. u32 rx_packets_65_to_127_bytes_lo;
  895. u32 rx_packets_65_to_127_bytes_hi;
  896. u32 rx_packets_128_to_255_bytes_lo;
  897. u32 rx_packets_128_to_255_bytes_hi;
  898. u32 rx_packets_256_to_511_bytes_lo;
  899. u32 rx_packets_256_to_511_bytes_hi;
  900. u32 rx_packets_512_to_1023_bytes_lo;
  901. u32 rx_packets_512_to_1023_bytes_hi;
  902. u32 rx_packets_1024_to_1518_bytes_lo;
  903. u32 rx_packets_1024_to_1518_bytes_hi;
  904. u32 rx_packets_1519_to_2047_bytes_lo;
  905. u32 rx_packets_1519_to_2047_bytes_hi;
  906. u32 rx_packets_2048_to_4095_bytes_lo;
  907. u32 rx_packets_2048_to_4095_bytes_hi;
  908. u32 rx_packets_4096_to_8191_bytes_lo;
  909. u32 rx_packets_4096_to_8191_bytes_hi;
  910. u32 rx_packets_8192_to_9216_bytes_lo;
  911. u32 rx_packets_8192_to_9216_bytes_hi;
  912. };
  913. struct pport_stats_params {
  914. u16 pport_num;
  915. u8 rsvd;
  916. u8 reset_stats;
  917. };
  918. struct lancer_cmd_req_pport_stats {
  919. struct be_cmd_req_hdr hdr;
  920. union {
  921. struct pport_stats_params params;
  922. u8 rsvd[sizeof(struct lancer_pport_stats)];
  923. } cmd_params;
  924. };
  925. struct lancer_cmd_resp_pport_stats {
  926. struct be_cmd_resp_hdr hdr;
  927. struct lancer_pport_stats pport_stats;
  928. };
  929. static inline struct lancer_pport_stats*
  930. pport_stats_from_cmd(struct be_adapter *adapter)
  931. {
  932. struct lancer_cmd_resp_pport_stats *cmd = adapter->stats_cmd.va;
  933. return &cmd->pport_stats;
  934. }
  935. struct be_cmd_req_get_cntl_addnl_attribs {
  936. struct be_cmd_req_hdr hdr;
  937. u8 rsvd[8];
  938. };
  939. struct be_cmd_resp_get_cntl_addnl_attribs {
  940. struct be_cmd_resp_hdr hdr;
  941. u16 ipl_file_number;
  942. u8 ipl_file_version;
  943. u8 rsvd0;
  944. u8 on_die_temperature; /* in degrees centigrade*/
  945. u8 rsvd1[3];
  946. };
  947. struct be_cmd_req_vlan_config {
  948. struct be_cmd_req_hdr hdr;
  949. u8 interface_id;
  950. u8 promiscuous;
  951. u8 untagged;
  952. u8 num_vlan;
  953. u16 normal_vlan[64];
  954. } __packed;
  955. /******************* RX FILTER ******************************/
  956. #define BE_MAX_MC 64 /* set mcast promisc if > 64 */
  957. struct macaddr {
  958. u8 byte[ETH_ALEN];
  959. };
  960. struct be_cmd_req_rx_filter {
  961. struct be_cmd_req_hdr hdr;
  962. u32 global_flags_mask;
  963. u32 global_flags;
  964. u32 if_flags_mask;
  965. u32 if_flags;
  966. u32 if_id;
  967. u32 mcast_num;
  968. struct macaddr mcast_mac[BE_MAX_MC];
  969. };
  970. /******************** Link Status Query *******************/
  971. struct be_cmd_req_link_status {
  972. struct be_cmd_req_hdr hdr;
  973. u32 rsvd;
  974. };
  975. enum {
  976. PHY_LINK_DUPLEX_NONE = 0x0,
  977. PHY_LINK_DUPLEX_HALF = 0x1,
  978. PHY_LINK_DUPLEX_FULL = 0x2
  979. };
  980. enum {
  981. PHY_LINK_SPEED_ZERO = 0x0, /* => No link */
  982. PHY_LINK_SPEED_10MBPS = 0x1,
  983. PHY_LINK_SPEED_100MBPS = 0x2,
  984. PHY_LINK_SPEED_1GBPS = 0x3,
  985. PHY_LINK_SPEED_10GBPS = 0x4,
  986. PHY_LINK_SPEED_20GBPS = 0x5,
  987. PHY_LINK_SPEED_25GBPS = 0x6,
  988. PHY_LINK_SPEED_40GBPS = 0x7
  989. };
  990. struct be_cmd_resp_link_status {
  991. struct be_cmd_resp_hdr hdr;
  992. u8 physical_port;
  993. u8 mac_duplex;
  994. u8 mac_speed;
  995. u8 mac_fault;
  996. u8 mgmt_mac_duplex;
  997. u8 mgmt_mac_speed;
  998. u16 link_speed;
  999. u8 logical_link_status;
  1000. u8 rsvd1[3];
  1001. } __packed;
  1002. /******************** Port Identification ***************************/
  1003. /* Identifies the type of port attached to NIC */
  1004. struct be_cmd_req_port_type {
  1005. struct be_cmd_req_hdr hdr;
  1006. __le32 page_num;
  1007. __le32 port;
  1008. };
  1009. enum {
  1010. TR_PAGE_A0 = 0xa0,
  1011. TR_PAGE_A2 = 0xa2
  1012. };
  1013. /* From SFF-8436 QSFP+ spec */
  1014. #define QSFP_PLUS_CABLE_TYPE_OFFSET 0x83
  1015. #define QSFP_PLUS_CR4_CABLE 0x8
  1016. #define QSFP_PLUS_SR4_CABLE 0x4
  1017. #define QSFP_PLUS_LR4_CABLE 0x2
  1018. /* From SFF-8472 spec */
  1019. #define SFP_PLUS_SFF_8472_COMP 0x5E
  1020. #define SFP_PLUS_CABLE_TYPE_OFFSET 0x8
  1021. #define SFP_PLUS_COPPER_CABLE 0x4
  1022. #define SFP_VENDOR_NAME_OFFSET 0x14
  1023. #define SFP_VENDOR_PN_OFFSET 0x28
  1024. #define PAGE_DATA_LEN 256
  1025. struct be_cmd_resp_port_type {
  1026. struct be_cmd_resp_hdr hdr;
  1027. u32 page_num;
  1028. u32 port;
  1029. u8 page_data[PAGE_DATA_LEN];
  1030. };
  1031. /******************** Get FW Version *******************/
  1032. struct be_cmd_req_get_fw_version {
  1033. struct be_cmd_req_hdr hdr;
  1034. u8 rsvd0[FW_VER_LEN];
  1035. u8 rsvd1[FW_VER_LEN];
  1036. } __packed;
  1037. struct be_cmd_resp_get_fw_version {
  1038. struct be_cmd_resp_hdr hdr;
  1039. u8 firmware_version_string[FW_VER_LEN];
  1040. u8 fw_on_flash_version_string[FW_VER_LEN];
  1041. } __packed;
  1042. /******************** Set Flow Contrl *******************/
  1043. struct be_cmd_req_set_flow_control {
  1044. struct be_cmd_req_hdr hdr;
  1045. u16 tx_flow_control;
  1046. u16 rx_flow_control;
  1047. } __packed;
  1048. /******************** Get Flow Contrl *******************/
  1049. struct be_cmd_req_get_flow_control {
  1050. struct be_cmd_req_hdr hdr;
  1051. u32 rsvd;
  1052. };
  1053. struct be_cmd_resp_get_flow_control {
  1054. struct be_cmd_resp_hdr hdr;
  1055. u16 tx_flow_control;
  1056. u16 rx_flow_control;
  1057. } __packed;
  1058. /******************** Modify EQ Delay *******************/
  1059. struct be_set_eqd {
  1060. u32 eq_id;
  1061. u32 phase;
  1062. u32 delay_multiplier;
  1063. };
  1064. struct be_cmd_req_modify_eq_delay {
  1065. struct be_cmd_req_hdr hdr;
  1066. u32 num_eq;
  1067. struct be_set_eqd set_eqd[MAX_EVT_QS];
  1068. } __packed;
  1069. /******************** Get FW Config *******************/
  1070. /* The HW can come up in either of the following multi-channel modes
  1071. * based on the skew/IPL.
  1072. */
  1073. #define RDMA_ENABLED 0x4
  1074. #define QNQ_MODE 0x400
  1075. #define VNIC_MODE 0x20000
  1076. #define UMC_ENABLED 0x1000000
  1077. struct be_cmd_req_query_fw_cfg {
  1078. struct be_cmd_req_hdr hdr;
  1079. u32 rsvd[31];
  1080. };
  1081. struct be_cmd_resp_query_fw_cfg {
  1082. struct be_cmd_resp_hdr hdr;
  1083. u32 be_config_number;
  1084. u32 asic_revision;
  1085. u32 phys_port;
  1086. u32 function_mode;
  1087. u32 rsvd[26];
  1088. u32 function_caps;
  1089. };
  1090. /******************** RSS Config ****************************************/
  1091. /* RSS type Input parameters used to compute RX hash
  1092. * RSS_ENABLE_IPV4 SRC IPv4, DST IPv4
  1093. * RSS_ENABLE_TCP_IPV4 SRC IPv4, DST IPv4, TCP SRC PORT, TCP DST PORT
  1094. * RSS_ENABLE_IPV6 SRC IPv6, DST IPv6
  1095. * RSS_ENABLE_TCP_IPV6 SRC IPv6, DST IPv6, TCP SRC PORT, TCP DST PORT
  1096. * RSS_ENABLE_UDP_IPV4 SRC IPv4, DST IPv4, UDP SRC PORT, UDP DST PORT
  1097. * RSS_ENABLE_UDP_IPV6 SRC IPv6, DST IPv6, UDP SRC PORT, UDP DST PORT
  1098. *
  1099. * When multiple RSS types are enabled, HW picks the best hash policy
  1100. * based on the type of the received packet.
  1101. */
  1102. #define RSS_ENABLE_NONE 0x0
  1103. #define RSS_ENABLE_IPV4 0x1
  1104. #define RSS_ENABLE_TCP_IPV4 0x2
  1105. #define RSS_ENABLE_IPV6 0x4
  1106. #define RSS_ENABLE_TCP_IPV6 0x8
  1107. #define RSS_ENABLE_UDP_IPV4 0x10
  1108. #define RSS_ENABLE_UDP_IPV6 0x20
  1109. #define L3_RSS_FLAGS (RXH_IP_DST | RXH_IP_SRC)
  1110. #define L4_RSS_FLAGS (RXH_L4_B_0_1 | RXH_L4_B_2_3)
  1111. struct be_cmd_req_rss_config {
  1112. struct be_cmd_req_hdr hdr;
  1113. u32 if_id;
  1114. u16 enable_rss;
  1115. u16 cpu_table_size_log2;
  1116. u32 hash[10];
  1117. u8 cpu_table[128];
  1118. u8 flush;
  1119. u8 rsvd0[3];
  1120. };
  1121. /******************** Port Beacon ***************************/
  1122. #define BEACON_STATE_ENABLED 0x1
  1123. #define BEACON_STATE_DISABLED 0x0
  1124. struct be_cmd_req_enable_disable_beacon {
  1125. struct be_cmd_req_hdr hdr;
  1126. u8 port_num;
  1127. u8 beacon_state;
  1128. u8 beacon_duration;
  1129. u8 status_duration;
  1130. } __packed;
  1131. struct be_cmd_req_get_beacon_state {
  1132. struct be_cmd_req_hdr hdr;
  1133. u8 port_num;
  1134. u8 rsvd0;
  1135. u16 rsvd1;
  1136. } __packed;
  1137. struct be_cmd_resp_get_beacon_state {
  1138. struct be_cmd_resp_hdr resp_hdr;
  1139. u8 beacon_state;
  1140. u8 rsvd0[3];
  1141. } __packed;
  1142. /* Flashrom related descriptors */
  1143. #define MAX_FLASH_COMP 32
  1144. /* Optypes of each component in the UFI */
  1145. enum {
  1146. OPTYPE_ISCSI_ACTIVE = 0,
  1147. OPTYPE_REDBOOT = 1,
  1148. OPTYPE_BIOS = 2,
  1149. OPTYPE_PXE_BIOS = 3,
  1150. OPTYPE_OFFSET_SPECIFIED = 7,
  1151. OPTYPE_FCOE_BIOS = 8,
  1152. OPTYPE_ISCSI_BACKUP = 9,
  1153. OPTYPE_FCOE_FW_ACTIVE = 10,
  1154. OPTYPE_FCOE_FW_BACKUP = 11,
  1155. OPTYPE_NCSI_FW = 13,
  1156. OPTYPE_REDBOOT_DIR = 18,
  1157. OPTYPE_REDBOOT_CONFIG = 19,
  1158. OPTYPE_SH_PHY_FW = 21,
  1159. OPTYPE_FLASHISM_JUMPVECTOR = 22,
  1160. OPTYPE_UFI_DIR = 23,
  1161. OPTYPE_PHY_FW = 99
  1162. };
  1163. /* Maximum sizes of components in BE2 FW UFI */
  1164. enum {
  1165. BE2_BIOS_COMP_MAX_SIZE = 0x40000,
  1166. BE2_REDBOOT_COMP_MAX_SIZE = 0x40000,
  1167. BE2_COMP_MAX_SIZE = 0x140000
  1168. };
  1169. /* Maximum sizes of components in BE3 FW UFI */
  1170. enum {
  1171. BE3_NCSI_COMP_MAX_SIZE = 0x40000,
  1172. BE3_PHY_FW_COMP_MAX_SIZE = 0x40000,
  1173. BE3_BIOS_COMP_MAX_SIZE = 0x80000,
  1174. BE3_REDBOOT_COMP_MAX_SIZE = 0x100000,
  1175. BE3_COMP_MAX_SIZE = 0x200000
  1176. };
  1177. /* Offsets for components in BE2 FW UFI */
  1178. enum {
  1179. BE2_REDBOOT_START = 0x8000,
  1180. BE2_FCOE_BIOS_START = 0x80000,
  1181. BE2_ISCSI_PRIMARY_IMAGE_START = 0x100000,
  1182. BE2_ISCSI_BACKUP_IMAGE_START = 0x240000,
  1183. BE2_FCOE_PRIMARY_IMAGE_START = 0x380000,
  1184. BE2_FCOE_BACKUP_IMAGE_START = 0x4c0000,
  1185. BE2_ISCSI_BIOS_START = 0x700000,
  1186. BE2_PXE_BIOS_START = 0x780000
  1187. };
  1188. /* Offsets for components in BE3 FW UFI */
  1189. enum {
  1190. BE3_REDBOOT_START = 0x40000,
  1191. BE3_PHY_FW_START = 0x140000,
  1192. BE3_ISCSI_PRIMARY_IMAGE_START = 0x200000,
  1193. BE3_ISCSI_BACKUP_IMAGE_START = 0x400000,
  1194. BE3_FCOE_PRIMARY_IMAGE_START = 0x600000,
  1195. BE3_FCOE_BACKUP_IMAGE_START = 0x800000,
  1196. BE3_ISCSI_BIOS_START = 0xc00000,
  1197. BE3_PXE_BIOS_START = 0xc80000,
  1198. BE3_FCOE_BIOS_START = 0xd00000,
  1199. BE3_NCSI_START = 0xf40000
  1200. };
  1201. /* Component entry types */
  1202. enum {
  1203. IMAGE_NCSI = 0x10,
  1204. IMAGE_OPTION_ROM_PXE = 0x20,
  1205. IMAGE_OPTION_ROM_FCOE = 0x21,
  1206. IMAGE_OPTION_ROM_ISCSI = 0x22,
  1207. IMAGE_FLASHISM_JUMPVECTOR = 0x30,
  1208. IMAGE_FIRMWARE_ISCSI = 0xa0,
  1209. IMAGE_FIRMWARE_FCOE = 0xa2,
  1210. IMAGE_FIRMWARE_BACKUP_ISCSI = 0xb0,
  1211. IMAGE_FIRMWARE_BACKUP_FCOE = 0xb2,
  1212. IMAGE_FIRMWARE_PHY = 0xc0,
  1213. IMAGE_REDBOOT_DIR = 0xd0,
  1214. IMAGE_REDBOOT_CONFIG = 0xd1,
  1215. IMAGE_UFI_DIR = 0xd2,
  1216. IMAGE_BOOT_CODE = 0xe2
  1217. };
  1218. struct controller_id {
  1219. u32 vendor;
  1220. u32 device;
  1221. u32 subvendor;
  1222. u32 subdevice;
  1223. };
  1224. struct flash_comp {
  1225. unsigned long offset;
  1226. int optype;
  1227. int size;
  1228. int img_type;
  1229. };
  1230. struct image_hdr {
  1231. u32 imageid;
  1232. u32 imageoffset;
  1233. u32 imagelength;
  1234. u32 image_checksum;
  1235. u8 image_version[32];
  1236. };
  1237. struct flash_file_hdr_g2 {
  1238. u8 sign[32];
  1239. u32 cksum;
  1240. u32 antidote;
  1241. struct controller_id cont_id;
  1242. u32 file_len;
  1243. u32 chunk_num;
  1244. u32 total_chunks;
  1245. u32 num_imgs;
  1246. u8 build[24];
  1247. };
  1248. /* First letter of the build version of the image */
  1249. #define BLD_STR_UFI_TYPE_BE2 '2'
  1250. #define BLD_STR_UFI_TYPE_BE3 '3'
  1251. #define BLD_STR_UFI_TYPE_SH '4'
  1252. struct flash_file_hdr_g3 {
  1253. u8 sign[52];
  1254. u8 ufi_version[4];
  1255. u32 file_len;
  1256. u32 cksum;
  1257. u32 antidote;
  1258. u32 num_imgs;
  1259. u8 build[24];
  1260. u8 asic_type_rev;
  1261. u8 rsvd[31];
  1262. };
  1263. struct flash_section_hdr {
  1264. u32 format_rev;
  1265. u32 cksum;
  1266. u32 antidote;
  1267. u32 num_images;
  1268. u8 id_string[128];
  1269. u32 rsvd[4];
  1270. } __packed;
  1271. struct flash_section_hdr_g2 {
  1272. u32 format_rev;
  1273. u32 cksum;
  1274. u32 antidote;
  1275. u32 build_num;
  1276. u8 id_string[128];
  1277. u32 rsvd[8];
  1278. } __packed;
  1279. struct flash_section_entry {
  1280. u32 type;
  1281. u32 offset;
  1282. u32 pad_size;
  1283. u32 image_size;
  1284. u32 cksum;
  1285. u32 entry_point;
  1286. u16 optype;
  1287. u16 rsvd0;
  1288. u32 rsvd1;
  1289. u8 ver_data[32];
  1290. } __packed;
  1291. struct flash_section_info {
  1292. u8 cookie[32];
  1293. struct flash_section_hdr fsec_hdr;
  1294. struct flash_section_entry fsec_entry[32];
  1295. } __packed;
  1296. struct flash_section_info_g2 {
  1297. u8 cookie[32];
  1298. struct flash_section_hdr_g2 fsec_hdr;
  1299. struct flash_section_entry fsec_entry[32];
  1300. } __packed;
  1301. /****************** Firmware Flash ******************/
  1302. #define FLASHROM_OPER_FLASH 1
  1303. #define FLASHROM_OPER_SAVE 2
  1304. #define FLASHROM_OPER_REPORT 4
  1305. #define FLASHROM_OPER_PHY_FLASH 9
  1306. #define FLASHROM_OPER_PHY_SAVE 10
  1307. struct flashrom_params {
  1308. u32 op_code;
  1309. u32 op_type;
  1310. u32 data_buf_size;
  1311. u32 offset;
  1312. };
  1313. struct be_cmd_write_flashrom {
  1314. struct be_cmd_req_hdr hdr;
  1315. struct flashrom_params params;
  1316. u8 data_buf[32768];
  1317. u8 rsvd[4];
  1318. } __packed;
  1319. /* cmd to read flash crc */
  1320. struct be_cmd_read_flash_crc {
  1321. struct be_cmd_req_hdr hdr;
  1322. struct flashrom_params params;
  1323. u8 crc[4];
  1324. u8 rsvd[4];
  1325. } __packed;
  1326. /**************** Lancer Firmware Flash ************/
  1327. #define LANCER_FW_DOWNLOAD_CHUNK (32 * 1024)
  1328. #define LANCER_FW_DOWNLOAD_LOCATION "/prg"
  1329. struct amap_lancer_write_obj_context {
  1330. u8 write_length[24];
  1331. u8 reserved1[7];
  1332. u8 eof;
  1333. } __packed;
  1334. struct lancer_cmd_req_write_object {
  1335. struct be_cmd_req_hdr hdr;
  1336. u8 context[sizeof(struct amap_lancer_write_obj_context) / 8];
  1337. u32 write_offset;
  1338. u8 object_name[104];
  1339. u32 descriptor_count;
  1340. u32 buf_len;
  1341. u32 addr_low;
  1342. u32 addr_high;
  1343. };
  1344. #define LANCER_NO_RESET_NEEDED 0x00
  1345. #define LANCER_FW_RESET_NEEDED 0x02
  1346. struct lancer_cmd_resp_write_object {
  1347. u8 opcode;
  1348. u8 subsystem;
  1349. u8 rsvd1[2];
  1350. u8 status;
  1351. u8 additional_status;
  1352. u8 rsvd2[2];
  1353. u32 resp_len;
  1354. u32 actual_resp_len;
  1355. u32 actual_write_len;
  1356. u8 change_status;
  1357. u8 rsvd3[3];
  1358. };
  1359. /************************ Lancer Read FW info **************/
  1360. #define LANCER_READ_FILE_CHUNK (32*1024)
  1361. #define LANCER_READ_FILE_EOF_MASK 0x80000000
  1362. #define LANCER_FW_DUMP_FILE "/dbg/dump.bin"
  1363. #define LANCER_VPD_PF_FILE "/vpd/ntr_pf.vpd"
  1364. #define LANCER_VPD_VF_FILE "/vpd/ntr_vf.vpd"
  1365. struct lancer_cmd_req_read_object {
  1366. struct be_cmd_req_hdr hdr;
  1367. u32 desired_read_len;
  1368. u32 read_offset;
  1369. u8 object_name[104];
  1370. u32 descriptor_count;
  1371. u32 buf_len;
  1372. u32 addr_low;
  1373. u32 addr_high;
  1374. };
  1375. struct lancer_cmd_resp_read_object {
  1376. u8 opcode;
  1377. u8 subsystem;
  1378. u8 rsvd1[2];
  1379. u8 status;
  1380. u8 additional_status;
  1381. u8 rsvd2[2];
  1382. u32 resp_len;
  1383. u32 actual_resp_len;
  1384. u32 actual_read_len;
  1385. u32 eof;
  1386. };
  1387. struct lancer_cmd_req_delete_object {
  1388. struct be_cmd_req_hdr hdr;
  1389. u32 rsvd1;
  1390. u32 rsvd2;
  1391. u8 object_name[104];
  1392. };
  1393. /************************ WOL *******************************/
  1394. struct be_cmd_req_acpi_wol_magic_config{
  1395. struct be_cmd_req_hdr hdr;
  1396. u32 rsvd0[145];
  1397. u8 magic_mac[6];
  1398. u8 rsvd2[2];
  1399. } __packed;
  1400. struct be_cmd_req_acpi_wol_magic_config_v1 {
  1401. struct be_cmd_req_hdr hdr;
  1402. u8 rsvd0[2];
  1403. u8 query_options;
  1404. u8 rsvd1[5];
  1405. u32 rsvd2[288];
  1406. u8 magic_mac[6];
  1407. u8 rsvd3[22];
  1408. } __packed;
  1409. struct be_cmd_resp_acpi_wol_magic_config_v1 {
  1410. struct be_cmd_resp_hdr hdr;
  1411. u8 rsvd0[2];
  1412. u8 wol_settings;
  1413. u8 rsvd1[5];
  1414. u32 rsvd2[288];
  1415. u8 magic_mac[6];
  1416. u8 rsvd3[22];
  1417. } __packed;
  1418. #define BE_GET_WOL_CAP 2
  1419. #define BE_WOL_CAP 0x1
  1420. #define BE_PME_D0_CAP 0x8
  1421. #define BE_PME_D1_CAP 0x10
  1422. #define BE_PME_D2_CAP 0x20
  1423. #define BE_PME_D3HOT_CAP 0x40
  1424. #define BE_PME_D3COLD_CAP 0x80
  1425. /********************** LoopBack test *********************/
  1426. #define SET_LB_MODE_TIMEOUT 12000
  1427. struct be_cmd_req_loopback_test {
  1428. struct be_cmd_req_hdr hdr;
  1429. u32 loopback_type;
  1430. u32 num_pkts;
  1431. u64 pattern;
  1432. u32 src_port;
  1433. u32 dest_port;
  1434. u32 pkt_size;
  1435. };
  1436. struct be_cmd_resp_loopback_test {
  1437. struct be_cmd_resp_hdr resp_hdr;
  1438. u32 status;
  1439. u32 num_txfer;
  1440. u32 num_rx;
  1441. u32 miscomp_off;
  1442. u32 ticks_compl;
  1443. };
  1444. struct be_cmd_req_set_lmode {
  1445. struct be_cmd_req_hdr hdr;
  1446. u8 src_port;
  1447. u8 dest_port;
  1448. u8 loopback_type;
  1449. u8 loopback_state;
  1450. };
  1451. /********************** DDR DMA test *********************/
  1452. struct be_cmd_req_ddrdma_test {
  1453. struct be_cmd_req_hdr hdr;
  1454. u64 pattern;
  1455. u32 byte_count;
  1456. u32 rsvd0;
  1457. u8 snd_buff[4096];
  1458. u8 rsvd1[4096];
  1459. };
  1460. struct be_cmd_resp_ddrdma_test {
  1461. struct be_cmd_resp_hdr hdr;
  1462. u64 pattern;
  1463. u32 byte_cnt;
  1464. u32 snd_err;
  1465. u8 rsvd0[4096];
  1466. u8 rcv_buff[4096];
  1467. };
  1468. /*********************** SEEPROM Read ***********************/
  1469. #define BE_READ_SEEPROM_LEN 1024
  1470. struct be_cmd_req_seeprom_read {
  1471. struct be_cmd_req_hdr hdr;
  1472. u8 rsvd0[BE_READ_SEEPROM_LEN];
  1473. };
  1474. struct be_cmd_resp_seeprom_read {
  1475. struct be_cmd_req_hdr hdr;
  1476. u8 seeprom_data[BE_READ_SEEPROM_LEN];
  1477. };
  1478. enum {
  1479. PHY_TYPE_CX4_10GB = 0,
  1480. PHY_TYPE_XFP_10GB,
  1481. PHY_TYPE_SFP_1GB,
  1482. PHY_TYPE_SFP_PLUS_10GB,
  1483. PHY_TYPE_KR_10GB,
  1484. PHY_TYPE_KX4_10GB,
  1485. PHY_TYPE_BASET_10GB,
  1486. PHY_TYPE_BASET_1GB,
  1487. PHY_TYPE_BASEX_1GB,
  1488. PHY_TYPE_SGMII,
  1489. PHY_TYPE_QSFP,
  1490. PHY_TYPE_KR4_40GB,
  1491. PHY_TYPE_KR2_20GB,
  1492. PHY_TYPE_TN_8022,
  1493. PHY_TYPE_DISABLED = 255
  1494. };
  1495. #define BE_SUPPORTED_SPEED_NONE 0
  1496. #define BE_SUPPORTED_SPEED_10MBPS 1
  1497. #define BE_SUPPORTED_SPEED_100MBPS 2
  1498. #define BE_SUPPORTED_SPEED_1GBPS 4
  1499. #define BE_SUPPORTED_SPEED_10GBPS 8
  1500. #define BE_SUPPORTED_SPEED_20GBPS 0x10
  1501. #define BE_SUPPORTED_SPEED_40GBPS 0x20
  1502. #define BE_AN_EN 0x2
  1503. #define BE_PAUSE_SYM_EN 0x80
  1504. /* MAC speed valid values */
  1505. #define SPEED_DEFAULT 0x0
  1506. #define SPEED_FORCED_10GB 0x1
  1507. #define SPEED_FORCED_1GB 0x2
  1508. #define SPEED_AUTONEG_10GB 0x3
  1509. #define SPEED_AUTONEG_1GB 0x4
  1510. #define SPEED_AUTONEG_100MB 0x5
  1511. #define SPEED_AUTONEG_10GB_1GB 0x6
  1512. #define SPEED_AUTONEG_10GB_1GB_100MB 0x7
  1513. #define SPEED_AUTONEG_1GB_100MB 0x8
  1514. #define SPEED_AUTONEG_10MB 0x9
  1515. #define SPEED_AUTONEG_1GB_100MB_10MB 0xa
  1516. #define SPEED_AUTONEG_100MB_10MB 0xb
  1517. #define SPEED_FORCED_100MB 0xc
  1518. #define SPEED_FORCED_10MB 0xd
  1519. struct be_cmd_req_get_phy_info {
  1520. struct be_cmd_req_hdr hdr;
  1521. u8 rsvd0[24];
  1522. };
  1523. struct be_phy_info {
  1524. u16 phy_type;
  1525. u16 interface_type;
  1526. u32 misc_params;
  1527. u16 ext_phy_details;
  1528. u16 rsvd;
  1529. u16 auto_speeds_supported;
  1530. u16 fixed_speeds_supported;
  1531. u32 future_use[2];
  1532. };
  1533. struct be_cmd_resp_get_phy_info {
  1534. struct be_cmd_req_hdr hdr;
  1535. struct be_phy_info phy_info;
  1536. };
  1537. /*********************** Set QOS ***********************/
  1538. #define BE_QOS_BITS_NIC 1
  1539. struct be_cmd_req_set_qos {
  1540. struct be_cmd_req_hdr hdr;
  1541. u32 valid_bits;
  1542. u32 max_bps_nic;
  1543. u32 rsvd[7];
  1544. };
  1545. /*********************** Controller Attributes ***********************/
  1546. struct mgmt_hba_attribs {
  1547. u32 rsvd0[24];
  1548. u8 controller_model_number[32];
  1549. u32 rsvd1[16];
  1550. u32 controller_serial_number[8];
  1551. u32 rsvd2[55];
  1552. u8 rsvd3[3];
  1553. u8 phy_port;
  1554. u32 rsvd4[15];
  1555. u8 rsvd5[2];
  1556. u8 pci_funcnum;
  1557. u8 rsvd6;
  1558. u32 rsvd7[6];
  1559. } __packed;
  1560. struct mgmt_controller_attrib {
  1561. struct mgmt_hba_attribs hba_attribs;
  1562. u32 rsvd0[10];
  1563. } __packed;
  1564. struct be_cmd_req_cntl_attribs {
  1565. struct be_cmd_req_hdr hdr;
  1566. };
  1567. struct be_cmd_resp_cntl_attribs {
  1568. struct be_cmd_resp_hdr hdr;
  1569. struct mgmt_controller_attrib attribs;
  1570. };
  1571. /*********************** Set driver function ***********************/
  1572. #define CAPABILITY_SW_TIMESTAMPS 2
  1573. #define CAPABILITY_BE3_NATIVE_ERX_API 4
  1574. struct be_cmd_req_set_func_cap {
  1575. struct be_cmd_req_hdr hdr;
  1576. u32 valid_cap_flags;
  1577. u32 cap_flags;
  1578. u8 rsvd[212];
  1579. };
  1580. struct be_cmd_resp_set_func_cap {
  1581. struct be_cmd_resp_hdr hdr;
  1582. u32 valid_cap_flags;
  1583. u32 cap_flags;
  1584. u8 rsvd[212];
  1585. };
  1586. /*********************** Function Privileges ***********************/
  1587. enum {
  1588. BE_PRIV_DEFAULT = 0x1,
  1589. BE_PRIV_LNKQUERY = 0x2,
  1590. BE_PRIV_LNKSTATS = 0x4,
  1591. BE_PRIV_LNKMGMT = 0x8,
  1592. BE_PRIV_LNKDIAG = 0x10,
  1593. BE_PRIV_UTILQUERY = 0x20,
  1594. BE_PRIV_FILTMGMT = 0x40,
  1595. BE_PRIV_IFACEMGMT = 0x80,
  1596. BE_PRIV_VHADM = 0x100,
  1597. BE_PRIV_DEVCFG = 0x200,
  1598. BE_PRIV_DEVSEC = 0x400
  1599. };
  1600. #define MAX_PRIVILEGES (BE_PRIV_VHADM | BE_PRIV_DEVCFG | \
  1601. BE_PRIV_DEVSEC)
  1602. #define MIN_PRIVILEGES BE_PRIV_DEFAULT
  1603. struct be_cmd_priv_map {
  1604. u8 opcode;
  1605. u8 subsystem;
  1606. u32 priv_mask;
  1607. };
  1608. struct be_cmd_req_get_fn_privileges {
  1609. struct be_cmd_req_hdr hdr;
  1610. u32 rsvd;
  1611. };
  1612. struct be_cmd_resp_get_fn_privileges {
  1613. struct be_cmd_resp_hdr hdr;
  1614. u32 privilege_mask;
  1615. };
  1616. struct be_cmd_req_set_fn_privileges {
  1617. struct be_cmd_req_hdr hdr;
  1618. u32 privileges; /* Used by BE3, SH-R */
  1619. u32 privileges_lancer; /* Used by Lancer */
  1620. };
  1621. /******************** GET/SET_MACLIST **************************/
  1622. #define BE_MAX_MAC 64
  1623. struct be_cmd_req_get_mac_list {
  1624. struct be_cmd_req_hdr hdr;
  1625. u8 mac_type;
  1626. u8 perm_override;
  1627. u16 iface_id;
  1628. u32 mac_id;
  1629. u32 rsvd[3];
  1630. } __packed;
  1631. struct get_list_macaddr {
  1632. u16 mac_addr_size;
  1633. union {
  1634. u8 macaddr[6];
  1635. struct {
  1636. u8 rsvd[2];
  1637. u32 mac_id;
  1638. } __packed s_mac_id;
  1639. } __packed mac_addr_id;
  1640. } __packed;
  1641. struct be_cmd_resp_get_mac_list {
  1642. struct be_cmd_resp_hdr hdr;
  1643. struct get_list_macaddr fd_macaddr; /* Factory default mac */
  1644. struct get_list_macaddr macid_macaddr; /* soft mac */
  1645. u8 true_mac_count;
  1646. u8 pseudo_mac_count;
  1647. u8 mac_list_size;
  1648. u8 rsvd;
  1649. /* perm override mac */
  1650. struct get_list_macaddr macaddr_list[BE_MAX_MAC];
  1651. } __packed;
  1652. struct be_cmd_req_set_mac_list {
  1653. struct be_cmd_req_hdr hdr;
  1654. u8 mac_count;
  1655. u8 rsvd1;
  1656. u16 rsvd2;
  1657. struct macaddr mac[BE_MAX_MAC];
  1658. } __packed;
  1659. /*********************** HSW Config ***********************/
  1660. #define PORT_FWD_TYPE_VEPA 0x3
  1661. #define PORT_FWD_TYPE_VEB 0x2
  1662. #define PORT_FWD_TYPE_PASSTHRU 0x1
  1663. #define ENABLE_MAC_SPOOFCHK 0x2
  1664. #define DISABLE_MAC_SPOOFCHK 0x3
  1665. struct amap_set_hsw_context {
  1666. u8 interface_id[16];
  1667. u8 rsvd0[8];
  1668. u8 mac_spoofchk[2];
  1669. u8 rsvd1[4];
  1670. u8 pvid_valid;
  1671. u8 pport;
  1672. u8 rsvd2[6];
  1673. u8 port_fwd_type[3];
  1674. u8 rsvd3[5];
  1675. u8 vlan_spoofchk[2];
  1676. u8 pvid[16];
  1677. u8 rsvd4[32];
  1678. u8 rsvd5[32];
  1679. u8 rsvd6[32];
  1680. } __packed;
  1681. struct be_cmd_req_set_hsw_config {
  1682. struct be_cmd_req_hdr hdr;
  1683. u8 context[sizeof(struct amap_set_hsw_context) / 8];
  1684. } __packed;
  1685. struct amap_get_hsw_req_context {
  1686. u8 interface_id[16];
  1687. u8 rsvd0[14];
  1688. u8 pvid_valid;
  1689. u8 pport;
  1690. } __packed;
  1691. struct amap_get_hsw_resp_context {
  1692. u8 rsvd0[6];
  1693. u8 port_fwd_type[3];
  1694. u8 rsvd1[5];
  1695. u8 spoofchk;
  1696. u8 rsvd2;
  1697. u8 pvid[16];
  1698. u8 rsvd3[32];
  1699. u8 rsvd4[32];
  1700. u8 rsvd5[32];
  1701. } __packed;
  1702. struct be_cmd_req_get_hsw_config {
  1703. struct be_cmd_req_hdr hdr;
  1704. u8 context[sizeof(struct amap_get_hsw_req_context) / 8];
  1705. } __packed;
  1706. struct be_cmd_resp_get_hsw_config {
  1707. struct be_cmd_resp_hdr hdr;
  1708. u8 context[sizeof(struct amap_get_hsw_resp_context) / 8];
  1709. u32 rsvd;
  1710. };
  1711. /******************* get port names ***************/
  1712. struct be_cmd_req_get_port_name {
  1713. struct be_cmd_req_hdr hdr;
  1714. u32 rsvd0;
  1715. };
  1716. struct be_cmd_resp_get_port_name {
  1717. struct be_cmd_req_hdr hdr;
  1718. u8 port_name[4];
  1719. };
  1720. /*************** HW Stats Get v1 **********************************/
  1721. #define BE_TXP_SW_SZ 48
  1722. struct be_port_rxf_stats_v1 {
  1723. u32 rsvd0[12];
  1724. u32 rx_crc_errors;
  1725. u32 rx_alignment_symbol_errors;
  1726. u32 rx_pause_frames;
  1727. u32 rx_priority_pause_frames;
  1728. u32 rx_control_frames;
  1729. u32 rx_in_range_errors;
  1730. u32 rx_out_range_errors;
  1731. u32 rx_frame_too_long;
  1732. u32 rx_address_filtered;
  1733. u32 rx_dropped_too_small;
  1734. u32 rx_dropped_too_short;
  1735. u32 rx_dropped_header_too_small;
  1736. u32 rx_dropped_tcp_length;
  1737. u32 rx_dropped_runt;
  1738. u32 rsvd1[10];
  1739. u32 rx_ip_checksum_errs;
  1740. u32 rx_tcp_checksum_errs;
  1741. u32 rx_udp_checksum_errs;
  1742. u32 rsvd2[7];
  1743. u32 rx_switched_unicast_packets;
  1744. u32 rx_switched_multicast_packets;
  1745. u32 rx_switched_broadcast_packets;
  1746. u32 rsvd3[3];
  1747. u32 tx_pauseframes;
  1748. u32 tx_priority_pauseframes;
  1749. u32 tx_controlframes;
  1750. u32 rsvd4[10];
  1751. u32 rxpp_fifo_overflow_drop;
  1752. u32 rx_input_fifo_overflow_drop;
  1753. u32 pmem_fifo_overflow_drop;
  1754. u32 jabber_events;
  1755. u32 rsvd5[3];
  1756. };
  1757. struct be_rxf_stats_v1 {
  1758. struct be_port_rxf_stats_v1 port[4];
  1759. u32 rsvd0[2];
  1760. u32 rx_drops_no_pbuf;
  1761. u32 rx_drops_no_txpb;
  1762. u32 rx_drops_no_erx_descr;
  1763. u32 rx_drops_no_tpre_descr;
  1764. u32 rsvd1[6];
  1765. u32 rx_drops_too_many_frags;
  1766. u32 rx_drops_invalid_ring;
  1767. u32 forwarded_packets;
  1768. u32 rx_drops_mtu;
  1769. u32 rsvd2[14];
  1770. };
  1771. struct be_erx_stats_v1 {
  1772. u32 rx_drops_no_fragments[68]; /* dwordS 0 to 67*/
  1773. u32 rsvd[4];
  1774. };
  1775. struct be_port_rxf_stats_v2 {
  1776. u32 rsvd0[10];
  1777. u32 roce_bytes_received_lsd;
  1778. u32 roce_bytes_received_msd;
  1779. u32 rsvd1[5];
  1780. u32 roce_frames_received;
  1781. u32 rx_crc_errors;
  1782. u32 rx_alignment_symbol_errors;
  1783. u32 rx_pause_frames;
  1784. u32 rx_priority_pause_frames;
  1785. u32 rx_control_frames;
  1786. u32 rx_in_range_errors;
  1787. u32 rx_out_range_errors;
  1788. u32 rx_frame_too_long;
  1789. u32 rx_address_filtered;
  1790. u32 rx_dropped_too_small;
  1791. u32 rx_dropped_too_short;
  1792. u32 rx_dropped_header_too_small;
  1793. u32 rx_dropped_tcp_length;
  1794. u32 rx_dropped_runt;
  1795. u32 rsvd2[10];
  1796. u32 rx_ip_checksum_errs;
  1797. u32 rx_tcp_checksum_errs;
  1798. u32 rx_udp_checksum_errs;
  1799. u32 rsvd3[7];
  1800. u32 rx_switched_unicast_packets;
  1801. u32 rx_switched_multicast_packets;
  1802. u32 rx_switched_broadcast_packets;
  1803. u32 rsvd4[3];
  1804. u32 tx_pauseframes;
  1805. u32 tx_priority_pauseframes;
  1806. u32 tx_controlframes;
  1807. u32 rsvd5[10];
  1808. u32 rxpp_fifo_overflow_drop;
  1809. u32 rx_input_fifo_overflow_drop;
  1810. u32 pmem_fifo_overflow_drop;
  1811. u32 jabber_events;
  1812. u32 rsvd6[3];
  1813. u32 rx_drops_payload_size;
  1814. u32 rx_drops_clipped_header;
  1815. u32 rx_drops_crc;
  1816. u32 roce_drops_payload_len;
  1817. u32 roce_drops_crc;
  1818. u32 rsvd7[19];
  1819. };
  1820. struct be_rxf_stats_v2 {
  1821. struct be_port_rxf_stats_v2 port[4];
  1822. u32 rsvd0[2];
  1823. u32 rx_drops_no_pbuf;
  1824. u32 rx_drops_no_txpb;
  1825. u32 rx_drops_no_erx_descr;
  1826. u32 rx_drops_no_tpre_descr;
  1827. u32 rsvd1[6];
  1828. u32 rx_drops_too_many_frags;
  1829. u32 rx_drops_invalid_ring;
  1830. u32 forwarded_packets;
  1831. u32 rx_drops_mtu;
  1832. u32 rsvd2[35];
  1833. };
  1834. struct be_hw_stats_v1 {
  1835. struct be_rxf_stats_v1 rxf;
  1836. u32 rsvd0[BE_TXP_SW_SZ];
  1837. struct be_erx_stats_v1 erx;
  1838. struct be_pmem_stats pmem;
  1839. u32 rsvd1[18];
  1840. };
  1841. struct be_cmd_req_get_stats_v1 {
  1842. struct be_cmd_req_hdr hdr;
  1843. u8 rsvd[sizeof(struct be_hw_stats_v1)];
  1844. };
  1845. struct be_cmd_resp_get_stats_v1 {
  1846. struct be_cmd_resp_hdr hdr;
  1847. struct be_hw_stats_v1 hw_stats;
  1848. };
  1849. struct be_erx_stats_v2 {
  1850. u32 rx_drops_no_fragments[136]; /* dwordS 0 to 135*/
  1851. u32 rsvd[3];
  1852. };
  1853. struct be_hw_stats_v2 {
  1854. struct be_rxf_stats_v2 rxf;
  1855. u32 rsvd0[BE_TXP_SW_SZ];
  1856. struct be_erx_stats_v2 erx;
  1857. struct be_pmem_stats pmem;
  1858. u32 rsvd1[18];
  1859. };
  1860. struct be_cmd_req_get_stats_v2 {
  1861. struct be_cmd_req_hdr hdr;
  1862. u8 rsvd[sizeof(struct be_hw_stats_v2)];
  1863. };
  1864. struct be_cmd_resp_get_stats_v2 {
  1865. struct be_cmd_resp_hdr hdr;
  1866. struct be_hw_stats_v2 hw_stats;
  1867. };
  1868. /************** get fat capabilites *******************/
  1869. #define MAX_MODULES 27
  1870. #define MAX_MODES 4
  1871. #define MODE_UART 0
  1872. #define FW_LOG_LEVEL_DEFAULT 48
  1873. #define FW_LOG_LEVEL_FATAL 64
  1874. struct ext_fat_mode {
  1875. u8 mode;
  1876. u8 rsvd0;
  1877. u16 port_mask;
  1878. u32 dbg_lvl;
  1879. u64 fun_mask;
  1880. } __packed;
  1881. struct ext_fat_modules {
  1882. u8 modules_str[32];
  1883. u32 modules_id;
  1884. u32 num_modes;
  1885. struct ext_fat_mode trace_lvl[MAX_MODES];
  1886. } __packed;
  1887. struct be_fat_conf_params {
  1888. u32 max_log_entries;
  1889. u32 log_entry_size;
  1890. u8 log_type;
  1891. u8 max_log_funs;
  1892. u8 max_log_ports;
  1893. u8 rsvd0;
  1894. u32 supp_modes;
  1895. u32 num_modules;
  1896. struct ext_fat_modules module[MAX_MODULES];
  1897. } __packed;
  1898. struct be_cmd_req_get_ext_fat_caps {
  1899. struct be_cmd_req_hdr hdr;
  1900. u32 parameter_type;
  1901. };
  1902. struct be_cmd_resp_get_ext_fat_caps {
  1903. struct be_cmd_resp_hdr hdr;
  1904. struct be_fat_conf_params get_params;
  1905. };
  1906. struct be_cmd_req_set_ext_fat_caps {
  1907. struct be_cmd_req_hdr hdr;
  1908. struct be_fat_conf_params set_params;
  1909. };
  1910. #define RESOURCE_DESC_SIZE_V0 72
  1911. #define RESOURCE_DESC_SIZE_V1 88
  1912. #define PCIE_RESOURCE_DESC_TYPE_V0 0x40
  1913. #define NIC_RESOURCE_DESC_TYPE_V0 0x41
  1914. #define PCIE_RESOURCE_DESC_TYPE_V1 0x50
  1915. #define NIC_RESOURCE_DESC_TYPE_V1 0x51
  1916. #define PORT_RESOURCE_DESC_TYPE_V1 0x55
  1917. #define MAX_RESOURCE_DESC 264
  1918. #define IF_CAPS_FLAGS_VALID_SHIFT 0 /* IF caps valid */
  1919. #define VFT_SHIFT 3 /* VF template */
  1920. #define IMM_SHIFT 6 /* Immediate */
  1921. #define NOSV_SHIFT 7 /* No save */
  1922. #define MISSION_NIC 1
  1923. #define MISSION_RDMA 8
  1924. struct be_res_desc_hdr {
  1925. u8 desc_type;
  1926. u8 desc_len;
  1927. } __packed;
  1928. struct be_port_res_desc {
  1929. struct be_res_desc_hdr hdr;
  1930. u8 rsvd0;
  1931. u8 flags;
  1932. u8 link_num;
  1933. u8 mc_type;
  1934. u16 rsvd1;
  1935. #define NV_TYPE_MASK 0x3 /* bits 0-1 */
  1936. #define NV_TYPE_DISABLED 1
  1937. #define NV_TYPE_VXLAN 3
  1938. #define SOCVID_SHIFT 2 /* Strip outer vlan */
  1939. #define RCVID_SHIFT 4 /* Report vlan */
  1940. #define PF_NUM_IGNORE 255
  1941. u8 nv_flags;
  1942. u8 rsvd2;
  1943. __le16 nv_port; /* vxlan/gre port */
  1944. u32 rsvd3[19];
  1945. } __packed;
  1946. struct be_pcie_res_desc {
  1947. struct be_res_desc_hdr hdr;
  1948. u8 rsvd0;
  1949. u8 flags;
  1950. u16 rsvd1;
  1951. u8 pf_num;
  1952. u8 rsvd2;
  1953. u32 rsvd3;
  1954. u8 sriov_state;
  1955. u8 pf_state;
  1956. u8 pf_type;
  1957. u8 rsvd4;
  1958. u16 num_vfs;
  1959. u16 rsvd5;
  1960. u32 rsvd6[17];
  1961. } __packed;
  1962. struct be_nic_res_desc {
  1963. struct be_res_desc_hdr hdr;
  1964. u8 rsvd1;
  1965. #define QUN_SHIFT 4 /* QoS is in absolute units */
  1966. u8 flags;
  1967. u8 vf_num;
  1968. u8 rsvd2;
  1969. u8 pf_num;
  1970. u8 rsvd3;
  1971. u16 unicast_mac_count;
  1972. u8 rsvd4[6];
  1973. u16 mcc_count;
  1974. u16 vlan_count;
  1975. u16 mcast_mac_count;
  1976. u16 txq_count;
  1977. u16 rq_count;
  1978. u16 rssq_count;
  1979. u16 lro_count;
  1980. u16 cq_count;
  1981. u16 toe_conn_count;
  1982. u16 eq_count;
  1983. u16 vlan_id;
  1984. u16 iface_count;
  1985. u32 cap_flags;
  1986. u8 link_param;
  1987. u8 rsvd6;
  1988. u16 channel_id_param;
  1989. u32 bw_min;
  1990. u32 bw_max;
  1991. u8 acpi_params;
  1992. u8 wol_param;
  1993. u16 rsvd7;
  1994. u16 tunnel_iface_count;
  1995. u16 direct_tenant_iface_count;
  1996. u32 rsvd8[6];
  1997. } __packed;
  1998. /************ Multi-Channel type ***********/
  1999. enum mc_type {
  2000. MC_NONE = 0x01,
  2001. UMC = 0x02,
  2002. FLEX10 = 0x03,
  2003. vNIC1 = 0x04,
  2004. nPAR = 0x05,
  2005. UFP = 0x06,
  2006. vNIC2 = 0x07
  2007. };
  2008. /* Is BE in a multi-channel mode */
  2009. static inline bool be_is_mc(struct be_adapter *adapter)
  2010. {
  2011. return adapter->mc_type > MC_NONE;
  2012. }
  2013. struct be_cmd_req_get_func_config {
  2014. struct be_cmd_req_hdr hdr;
  2015. };
  2016. struct be_cmd_resp_get_func_config {
  2017. struct be_cmd_resp_hdr hdr;
  2018. u32 desc_count;
  2019. u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE_V1];
  2020. };
  2021. enum {
  2022. RESOURCE_LIMITS,
  2023. RESOURCE_MODIFIABLE
  2024. };
  2025. struct be_cmd_req_get_profile_config {
  2026. struct be_cmd_req_hdr hdr;
  2027. u8 rsvd;
  2028. #define ACTIVE_PROFILE_TYPE 0x2
  2029. #define SAVED_PROFILE_TYPE 0x0
  2030. #define QUERY_MODIFIABLE_FIELDS_TYPE BIT(3)
  2031. u8 type;
  2032. u16 rsvd1;
  2033. };
  2034. struct be_cmd_resp_get_profile_config {
  2035. struct be_cmd_resp_hdr hdr;
  2036. __le16 desc_count;
  2037. u16 rsvd;
  2038. u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE_V1];
  2039. };
  2040. #define FIELD_MODIFIABLE 0xFFFF
  2041. struct be_cmd_req_set_profile_config {
  2042. struct be_cmd_req_hdr hdr;
  2043. u32 rsvd;
  2044. u32 desc_count;
  2045. u8 desc[2 * RESOURCE_DESC_SIZE_V1];
  2046. } __packed;
  2047. struct be_cmd_req_get_active_profile {
  2048. struct be_cmd_req_hdr hdr;
  2049. u32 rsvd;
  2050. } __packed;
  2051. struct be_cmd_resp_get_active_profile {
  2052. struct be_cmd_resp_hdr hdr;
  2053. u16 active_profile_id;
  2054. u16 next_profile_id;
  2055. } __packed;
  2056. struct be_cmd_enable_disable_vf {
  2057. struct be_cmd_req_hdr hdr;
  2058. u8 enable;
  2059. u8 rsvd[3];
  2060. };
  2061. struct be_cmd_req_intr_set {
  2062. struct be_cmd_req_hdr hdr;
  2063. u8 intr_enabled;
  2064. u8 rsvd[3];
  2065. };
  2066. static inline bool check_privilege(struct be_adapter *adapter, u32 flags)
  2067. {
  2068. return flags & adapter->cmd_privileges ? true : false;
  2069. }
  2070. /************** Get IFACE LIST *******************/
  2071. struct be_if_desc {
  2072. u32 if_id;
  2073. u32 cap_flags;
  2074. u32 en_flags;
  2075. };
  2076. struct be_cmd_req_get_iface_list {
  2077. struct be_cmd_req_hdr hdr;
  2078. };
  2079. struct be_cmd_resp_get_iface_list {
  2080. struct be_cmd_req_hdr hdr;
  2081. u32 if_cnt;
  2082. struct be_if_desc if_desc;
  2083. };
  2084. /************** Set Features *******************/
  2085. #define BE_FEATURE_UE_RECOVERY 0x10
  2086. #define BE_UE_RECOVERY_UER_MASK 0x1
  2087. struct be_req_ue_recovery {
  2088. u32 uer;
  2089. u32 rsvd;
  2090. };
  2091. struct be_cmd_req_set_features {
  2092. struct be_cmd_req_hdr hdr;
  2093. u32 features;
  2094. u32 parameter_len;
  2095. union {
  2096. struct be_req_ue_recovery req;
  2097. u32 rsvd[2];
  2098. } parameter;
  2099. };
  2100. struct be_resp_ue_recovery {
  2101. u32 uer;
  2102. u16 ue2rp;
  2103. u16 ue2sr;
  2104. };
  2105. struct be_cmd_resp_set_features {
  2106. struct be_cmd_resp_hdr hdr;
  2107. u32 features;
  2108. u32 parameter_len;
  2109. union {
  2110. struct be_resp_ue_recovery resp;
  2111. u32 rsvd[2];
  2112. } parameter;
  2113. };
  2114. /*************** Set logical link ********************/
  2115. #define PLINK_ENABLE BIT(0)
  2116. #define PLINK_TRACK BIT(8)
  2117. struct be_cmd_req_set_ll_link {
  2118. struct be_cmd_req_hdr hdr;
  2119. u32 link_config; /* Bit 0: UP_DOWN, Bit 9: PLINK */
  2120. };
  2121. /************** Manage IFACE Filters *******************/
  2122. #define OP_CONVERT_NORMAL_TO_TUNNEL 0
  2123. #define OP_CONVERT_TUNNEL_TO_NORMAL 1
  2124. struct be_cmd_req_manage_iface_filters {
  2125. struct be_cmd_req_hdr hdr;
  2126. u8 op;
  2127. u8 rsvd0;
  2128. u8 flags;
  2129. u8 rsvd1;
  2130. u32 tunnel_iface_id;
  2131. u32 target_iface_id;
  2132. u8 mac[6];
  2133. u16 vlan_tag;
  2134. u32 tenant_id;
  2135. u32 filter_id;
  2136. u32 cap_flags;
  2137. u32 cap_control_flags;
  2138. } __packed;
  2139. u16 be_POST_stage_get(struct be_adapter *adapter);
  2140. int be_pci_fnum_get(struct be_adapter *adapter);
  2141. int be_fw_wait_ready(struct be_adapter *adapter);
  2142. int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
  2143. bool permanent, u32 if_handle, u32 pmac_id);
  2144. int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, u32 if_id,
  2145. u32 *pmac_id, u32 domain);
  2146. int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, int pmac_id,
  2147. u32 domain);
  2148. int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
  2149. u32 *if_handle, u32 domain);
  2150. int be_cmd_if_destroy(struct be_adapter *adapter, int if_handle, u32 domain);
  2151. int be_cmd_eq_create(struct be_adapter *adapter, struct be_eq_obj *eqo);
  2152. int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq,
  2153. struct be_queue_info *eq, bool no_delay,
  2154. int num_cqe_dma_coalesce);
  2155. int be_cmd_mccq_create(struct be_adapter *adapter, struct be_queue_info *mccq,
  2156. struct be_queue_info *cq);
  2157. int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo);
  2158. int be_cmd_rxq_create(struct be_adapter *adapter, struct be_queue_info *rxq,
  2159. u16 cq_id, u16 frag_size, u32 if_id, u32 rss, u8 *rss_id);
  2160. int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
  2161. int type);
  2162. int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q);
  2163. int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
  2164. u8 *link_status, u32 dom);
  2165. int be_cmd_reset(struct be_adapter *adapter);
  2166. int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd);
  2167. int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
  2168. struct be_dma_mem *nonemb_cmd);
  2169. int be_cmd_get_fw_ver(struct be_adapter *adapter);
  2170. int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num);
  2171. int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
  2172. u32 num, u32 domain);
  2173. int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
  2174. int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc);
  2175. int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc);
  2176. int be_cmd_query_fw_cfg(struct be_adapter *adapter);
  2177. int be_cmd_reset_function(struct be_adapter *adapter);
  2178. int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
  2179. u32 rss_hash_opts, u16 table_size, const u8 *rss_hkey);
  2180. int be_process_mcc(struct be_adapter *adapter);
  2181. int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon,
  2182. u8 status, u8 state);
  2183. int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num,
  2184. u32 *state);
  2185. int be_cmd_read_port_transceiver_data(struct be_adapter *adapter,
  2186. u8 page_num, u8 *data);
  2187. int be_cmd_query_cable_type(struct be_adapter *adapter);
  2188. int be_cmd_query_sfp_info(struct be_adapter *adapter);
  2189. int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
  2190. u32 data_size, u32 data_offset, const char *obj_name,
  2191. u32 *data_read, u32 *eof, u8 *addn_status);
  2192. int lancer_fw_download(struct be_adapter *adapter, const struct firmware *fw);
  2193. int be_fw_download(struct be_adapter *adapter, const struct firmware *fw);
  2194. int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
  2195. struct be_dma_mem *nonemb_cmd);
  2196. int be_cmd_fw_init(struct be_adapter *adapter);
  2197. int be_cmd_fw_clean(struct be_adapter *adapter);
  2198. void be_async_mcc_enable(struct be_adapter *adapter);
  2199. void be_async_mcc_disable(struct be_adapter *adapter);
  2200. int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
  2201. u32 loopback_type, u32 pkt_size, u32 num_pkts,
  2202. u64 pattern);
  2203. int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, u32 byte_cnt,
  2204. struct be_dma_mem *cmd);
  2205. int be_cmd_get_seeprom_data(struct be_adapter *adapter,
  2206. struct be_dma_mem *nonemb_cmd);
  2207. int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
  2208. u8 loopback_type, u8 enable);
  2209. int be_cmd_get_phy_info(struct be_adapter *adapter);
  2210. int be_cmd_config_qos(struct be_adapter *adapter, u32 max_rate,
  2211. u16 link_speed, u8 domain);
  2212. void be_detect_error(struct be_adapter *adapter);
  2213. int be_cmd_get_die_temperature(struct be_adapter *adapter);
  2214. int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
  2215. int be_cmd_get_fat_dump_len(struct be_adapter *adapter, u32 *dump_size);
  2216. int be_cmd_get_fat_dump(struct be_adapter *adapter, u32 buf_len, void *buf);
  2217. int be_cmd_req_native_mode(struct be_adapter *adapter);
  2218. int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
  2219. u32 domain);
  2220. int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
  2221. u32 vf_num);
  2222. int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
  2223. bool *pmac_id_active, u32 *pmac_id,
  2224. u32 if_handle, u8 domain);
  2225. int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac,
  2226. u32 if_handle, bool active, u32 domain);
  2227. int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac);
  2228. int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, u8 mac_count,
  2229. u32 domain);
  2230. int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom);
  2231. int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, u32 domain,
  2232. u16 intf_id, u16 hsw_mode, u8 spoofchk);
  2233. int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, u32 domain,
  2234. u16 intf_id, u8 *mode, bool *spoofchk);
  2235. int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter);
  2236. int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level);
  2237. int be_cmd_get_fw_log_level(struct be_adapter *adapter);
  2238. int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter,
  2239. struct be_dma_mem *cmd);
  2240. int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter,
  2241. struct be_dma_mem *cmd,
  2242. struct be_fat_conf_params *cfgs);
  2243. int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask);
  2244. int lancer_initiate_dump(struct be_adapter *adapter);
  2245. int lancer_delete_dump(struct be_adapter *adapter);
  2246. bool dump_present(struct be_adapter *adapter);
  2247. int lancer_test_and_set_rdy_state(struct be_adapter *adapter);
  2248. int be_cmd_query_port_name(struct be_adapter *adapter);
  2249. int be_cmd_get_func_config(struct be_adapter *adapter,
  2250. struct be_resources *res);
  2251. int be_cmd_get_profile_config(struct be_adapter *adapter,
  2252. struct be_resources *res,
  2253. struct be_port_resources *port_res,
  2254. u8 profile_type, u8 query, u8 domain);
  2255. int be_cmd_get_active_profile(struct be_adapter *adapter, u16 *profile);
  2256. int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg,
  2257. int vf_num);
  2258. int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain);
  2259. int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable);
  2260. int be_cmd_set_logical_link_config(struct be_adapter *adapter,
  2261. int link_state, u8 domain);
  2262. int be_cmd_set_vxlan_port(struct be_adapter *adapter, __be16 port);
  2263. int be_cmd_manage_iface(struct be_adapter *adapter, u32 iface, u8 op);
  2264. int be_cmd_set_sriov_config(struct be_adapter *adapter,
  2265. struct be_resources res, u16 num_vfs,
  2266. struct be_resources *vft_res);
  2267. int be_cmd_set_features(struct be_adapter *adapter);