be_cmds.h 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069
  1. /*
  2. * Copyright (C) 2005 - 2013 Emulex
  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 (1 << 31)
  44. #define CQE_FLAGS_ASYNC_MASK (1 << 30)
  45. #define CQE_FLAGS_COMPLETED_MASK (1 << 28)
  46. #define CQE_FLAGS_CONSUMED_MASK (1 << 27)
  47. /* Completion Status */
  48. enum {
  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. };
  57. #define MCC_ADDL_STS_INSUFFICIENT_RESOURCES 0x16
  58. #define CQE_STATUS_COMPL_MASK 0xFFFF
  59. #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
  60. #define CQE_STATUS_EXTD_MASK 0xFFFF
  61. #define CQE_STATUS_EXTD_SHIFT 16 /* bits 16 - 31 */
  62. struct be_mcc_compl {
  63. u32 status; /* dword 0 */
  64. u32 tag0; /* dword 1 */
  65. u32 tag1; /* dword 2 */
  66. u32 flags; /* dword 3 */
  67. };
  68. /* When the async bit of mcc_compl is set, the last 4 bytes of
  69. * mcc_compl is interpreted as follows:
  70. */
  71. #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
  72. #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
  73. #define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16
  74. #define ASYNC_TRAILER_EVENT_TYPE_MASK 0xFF
  75. #define ASYNC_EVENT_CODE_LINK_STATE 0x1
  76. #define ASYNC_EVENT_CODE_GRP_5 0x5
  77. #define ASYNC_EVENT_QOS_SPEED 0x1
  78. #define ASYNC_EVENT_COS_PRIORITY 0x2
  79. #define ASYNC_EVENT_PVID_STATE 0x3
  80. #define ASYNC_EVENT_CODE_QNQ 0x6
  81. #define ASYNC_DEBUG_EVENT_TYPE_QNQ 1
  82. struct be_async_event_trailer {
  83. u32 code;
  84. };
  85. enum {
  86. LINK_DOWN = 0x0,
  87. LINK_UP = 0x1
  88. };
  89. #define LINK_STATUS_MASK 0x1
  90. #define LOGICAL_LINK_STATUS_MASK 0x2
  91. /* When the event code of an async trailer is link-state, the mcc_compl
  92. * must be interpreted as follows
  93. */
  94. struct be_async_event_link_state {
  95. u8 physical_port;
  96. u8 port_link_status;
  97. u8 port_duplex;
  98. u8 port_speed;
  99. u8 port_fault;
  100. u8 rsvd0[7];
  101. struct be_async_event_trailer trailer;
  102. } __packed;
  103. /* When the event code of an async trailer is GRP-5 and event_type is QOS_SPEED
  104. * the mcc_compl must be interpreted as follows
  105. */
  106. struct be_async_event_grp5_qos_link_speed {
  107. u8 physical_port;
  108. u8 rsvd[5];
  109. u16 qos_link_speed;
  110. u32 event_tag;
  111. struct be_async_event_trailer trailer;
  112. } __packed;
  113. /* When the event code of an async trailer is GRP5 and event type is
  114. * CoS-Priority, the mcc_compl must be interpreted as follows
  115. */
  116. struct be_async_event_grp5_cos_priority {
  117. u8 physical_port;
  118. u8 available_priority_bmap;
  119. u8 reco_default_priority;
  120. u8 valid;
  121. u8 rsvd0;
  122. u8 event_tag;
  123. struct be_async_event_trailer trailer;
  124. } __packed;
  125. /* When the event code of an async trailer is GRP5 and event type is
  126. * PVID state, the mcc_compl must be interpreted as follows
  127. */
  128. struct be_async_event_grp5_pvid_state {
  129. u8 enabled;
  130. u8 rsvd0;
  131. u16 tag;
  132. u32 event_tag;
  133. u32 rsvd1;
  134. struct be_async_event_trailer trailer;
  135. } __packed;
  136. /* async event indicating outer VLAN tag in QnQ */
  137. struct be_async_event_qnq {
  138. u8 valid; /* Indicates if outer VLAN is valid */
  139. u8 rsvd0;
  140. u16 vlan_tag;
  141. u32 event_tag;
  142. u8 rsvd1[4];
  143. struct be_async_event_trailer trailer;
  144. } __packed;
  145. struct be_mcc_mailbox {
  146. struct be_mcc_wrb wrb;
  147. struct be_mcc_compl compl;
  148. };
  149. #define CMD_SUBSYSTEM_COMMON 0x1
  150. #define CMD_SUBSYSTEM_ETH 0x3
  151. #define CMD_SUBSYSTEM_LOWLEVEL 0xb
  152. #define OPCODE_COMMON_NTWK_MAC_QUERY 1
  153. #define OPCODE_COMMON_NTWK_MAC_SET 2
  154. #define OPCODE_COMMON_NTWK_MULTICAST_SET 3
  155. #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
  156. #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
  157. #define OPCODE_COMMON_READ_FLASHROM 6
  158. #define OPCODE_COMMON_WRITE_FLASHROM 7
  159. #define OPCODE_COMMON_CQ_CREATE 12
  160. #define OPCODE_COMMON_EQ_CREATE 13
  161. #define OPCODE_COMMON_MCC_CREATE 21
  162. #define OPCODE_COMMON_SET_QOS 28
  163. #define OPCODE_COMMON_MCC_CREATE_EXT 90
  164. #define OPCODE_COMMON_SEEPROM_READ 30
  165. #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
  166. #define OPCODE_COMMON_NTWK_RX_FILTER 34
  167. #define OPCODE_COMMON_GET_FW_VERSION 35
  168. #define OPCODE_COMMON_SET_FLOW_CONTROL 36
  169. #define OPCODE_COMMON_GET_FLOW_CONTROL 37
  170. #define OPCODE_COMMON_SET_FRAME_SIZE 39
  171. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  172. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  173. #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50
  174. #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51
  175. #define OPCODE_COMMON_MCC_DESTROY 53
  176. #define OPCODE_COMMON_CQ_DESTROY 54
  177. #define OPCODE_COMMON_EQ_DESTROY 55
  178. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  179. #define OPCODE_COMMON_NTWK_PMAC_ADD 59
  180. #define OPCODE_COMMON_NTWK_PMAC_DEL 60
  181. #define OPCODE_COMMON_FUNCTION_RESET 61
  182. #define OPCODE_COMMON_MANAGE_FAT 68
  183. #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69
  184. #define OPCODE_COMMON_GET_BEACON_STATE 70
  185. #define OPCODE_COMMON_READ_TRANSRECV_DATA 73
  186. #define OPCODE_COMMON_GET_PORT_NAME 77
  187. #define OPCODE_COMMON_SET_INTERRUPT_ENABLE 89
  188. #define OPCODE_COMMON_SET_FN_PRIVILEGES 100
  189. #define OPCODE_COMMON_GET_PHY_DETAILS 102
  190. #define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103
  191. #define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
  192. #define OPCODE_COMMON_GET_EXT_FAT_CAPABILITES 125
  193. #define OPCODE_COMMON_SET_EXT_FAT_CAPABILITES 126
  194. #define OPCODE_COMMON_GET_MAC_LIST 147
  195. #define OPCODE_COMMON_SET_MAC_LIST 148
  196. #define OPCODE_COMMON_GET_HSW_CONFIG 152
  197. #define OPCODE_COMMON_GET_FUNC_CONFIG 160
  198. #define OPCODE_COMMON_GET_PROFILE_CONFIG 164
  199. #define OPCODE_COMMON_SET_PROFILE_CONFIG 165
  200. #define OPCODE_COMMON_SET_HSW_CONFIG 153
  201. #define OPCODE_COMMON_GET_FN_PRIVILEGES 170
  202. #define OPCODE_COMMON_READ_OBJECT 171
  203. #define OPCODE_COMMON_WRITE_OBJECT 172
  204. #define OPCODE_COMMON_GET_IFACE_LIST 194
  205. #define OPCODE_COMMON_ENABLE_DISABLE_VF 196
  206. #define OPCODE_ETH_RSS_CONFIG 1
  207. #define OPCODE_ETH_ACPI_CONFIG 2
  208. #define OPCODE_ETH_PROMISCUOUS 3
  209. #define OPCODE_ETH_GET_STATISTICS 4
  210. #define OPCODE_ETH_TX_CREATE 7
  211. #define OPCODE_ETH_RX_CREATE 8
  212. #define OPCODE_ETH_TX_DESTROY 9
  213. #define OPCODE_ETH_RX_DESTROY 10
  214. #define OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG 12
  215. #define OPCODE_ETH_GET_PPORT_STATS 18
  216. #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17
  217. #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18
  218. #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19
  219. struct be_cmd_req_hdr {
  220. u8 opcode; /* dword 0 */
  221. u8 subsystem; /* dword 0 */
  222. u8 port_number; /* dword 0 */
  223. u8 domain; /* dword 0 */
  224. u32 timeout; /* dword 1 */
  225. u32 request_length; /* dword 2 */
  226. u8 version; /* dword 3 */
  227. u8 rsvd[3]; /* dword 3 */
  228. };
  229. #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
  230. #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */
  231. struct be_cmd_resp_hdr {
  232. u8 opcode; /* dword 0 */
  233. u8 subsystem; /* dword 0 */
  234. u8 rsvd[2]; /* dword 0 */
  235. u8 status; /* dword 1 */
  236. u8 add_status; /* dword 1 */
  237. u8 rsvd1[2]; /* dword 1 */
  238. u32 response_length; /* dword 2 */
  239. u32 actual_resp_len; /* dword 3 */
  240. };
  241. struct phys_addr {
  242. u32 lo;
  243. u32 hi;
  244. };
  245. /**************************
  246. * BE Command definitions *
  247. **************************/
  248. /* Pseudo amap definition in which each bit of the actual structure is defined
  249. * as a byte: used to calculate offset/shift/mask of each field */
  250. struct amap_eq_context {
  251. u8 cidx[13]; /* dword 0*/
  252. u8 rsvd0[3]; /* dword 0*/
  253. u8 epidx[13]; /* dword 0*/
  254. u8 valid; /* dword 0*/
  255. u8 rsvd1; /* dword 0*/
  256. u8 size; /* dword 0*/
  257. u8 pidx[13]; /* dword 1*/
  258. u8 rsvd2[3]; /* dword 1*/
  259. u8 pd[10]; /* dword 1*/
  260. u8 count[3]; /* dword 1*/
  261. u8 solevent; /* dword 1*/
  262. u8 stalled; /* dword 1*/
  263. u8 armed; /* dword 1*/
  264. u8 rsvd3[4]; /* dword 2*/
  265. u8 func[8]; /* dword 2*/
  266. u8 rsvd4; /* dword 2*/
  267. u8 delaymult[10]; /* dword 2*/
  268. u8 rsvd5[2]; /* dword 2*/
  269. u8 phase[2]; /* dword 2*/
  270. u8 nodelay; /* dword 2*/
  271. u8 rsvd6[4]; /* dword 2*/
  272. u8 rsvd7[32]; /* dword 3*/
  273. } __packed;
  274. struct be_cmd_req_eq_create {
  275. struct be_cmd_req_hdr hdr;
  276. u16 num_pages; /* sword */
  277. u16 rsvd0; /* sword */
  278. u8 context[sizeof(struct amap_eq_context) / 8];
  279. struct phys_addr pages[8];
  280. } __packed;
  281. struct be_cmd_resp_eq_create {
  282. struct be_cmd_resp_hdr resp_hdr;
  283. u16 eq_id; /* sword */
  284. u16 msix_idx; /* available only in v2 */
  285. } __packed;
  286. /******************** Mac query ***************************/
  287. enum {
  288. MAC_ADDRESS_TYPE_STORAGE = 0x0,
  289. MAC_ADDRESS_TYPE_NETWORK = 0x1,
  290. MAC_ADDRESS_TYPE_PD = 0x2,
  291. MAC_ADDRESS_TYPE_MANAGEMENT = 0x3
  292. };
  293. struct mac_addr {
  294. u16 size_of_struct;
  295. u8 addr[ETH_ALEN];
  296. } __packed;
  297. struct be_cmd_req_mac_query {
  298. struct be_cmd_req_hdr hdr;
  299. u8 type;
  300. u8 permanent;
  301. u16 if_id;
  302. u32 pmac_id;
  303. } __packed;
  304. struct be_cmd_resp_mac_query {
  305. struct be_cmd_resp_hdr hdr;
  306. struct mac_addr mac;
  307. };
  308. /******************** PMac Add ***************************/
  309. struct be_cmd_req_pmac_add {
  310. struct be_cmd_req_hdr hdr;
  311. u32 if_id;
  312. u8 mac_address[ETH_ALEN];
  313. u8 rsvd0[2];
  314. } __packed;
  315. struct be_cmd_resp_pmac_add {
  316. struct be_cmd_resp_hdr hdr;
  317. u32 pmac_id;
  318. };
  319. /******************** PMac Del ***************************/
  320. struct be_cmd_req_pmac_del {
  321. struct be_cmd_req_hdr hdr;
  322. u32 if_id;
  323. u32 pmac_id;
  324. };
  325. /******************** Create CQ ***************************/
  326. /* Pseudo amap definition in which each bit of the actual structure is defined
  327. * as a byte: used to calculate offset/shift/mask of each field */
  328. struct amap_cq_context_be {
  329. u8 cidx[11]; /* dword 0*/
  330. u8 rsvd0; /* dword 0*/
  331. u8 coalescwm[2]; /* dword 0*/
  332. u8 nodelay; /* dword 0*/
  333. u8 epidx[11]; /* dword 0*/
  334. u8 rsvd1; /* dword 0*/
  335. u8 count[2]; /* dword 0*/
  336. u8 valid; /* dword 0*/
  337. u8 solevent; /* dword 0*/
  338. u8 eventable; /* dword 0*/
  339. u8 pidx[11]; /* dword 1*/
  340. u8 rsvd2; /* dword 1*/
  341. u8 pd[10]; /* dword 1*/
  342. u8 eqid[8]; /* dword 1*/
  343. u8 stalled; /* dword 1*/
  344. u8 armed; /* dword 1*/
  345. u8 rsvd3[4]; /* dword 2*/
  346. u8 func[8]; /* dword 2*/
  347. u8 rsvd4[20]; /* dword 2*/
  348. u8 rsvd5[32]; /* dword 3*/
  349. } __packed;
  350. struct amap_cq_context_v2 {
  351. u8 rsvd0[12]; /* dword 0*/
  352. u8 coalescwm[2]; /* dword 0*/
  353. u8 nodelay; /* dword 0*/
  354. u8 rsvd1[12]; /* dword 0*/
  355. u8 count[2]; /* dword 0*/
  356. u8 valid; /* dword 0*/
  357. u8 rsvd2; /* dword 0*/
  358. u8 eventable; /* dword 0*/
  359. u8 eqid[16]; /* dword 1*/
  360. u8 rsvd3[15]; /* dword 1*/
  361. u8 armed; /* dword 1*/
  362. u8 rsvd4[32]; /* dword 2*/
  363. u8 rsvd5[32]; /* dword 3*/
  364. } __packed;
  365. struct be_cmd_req_cq_create {
  366. struct be_cmd_req_hdr hdr;
  367. u16 num_pages;
  368. u8 page_size;
  369. u8 rsvd0;
  370. u8 context[sizeof(struct amap_cq_context_be) / 8];
  371. struct phys_addr pages[8];
  372. } __packed;
  373. struct be_cmd_resp_cq_create {
  374. struct be_cmd_resp_hdr hdr;
  375. u16 cq_id;
  376. u16 rsvd0;
  377. } __packed;
  378. struct be_cmd_req_get_fat {
  379. struct be_cmd_req_hdr hdr;
  380. u32 fat_operation;
  381. u32 read_log_offset;
  382. u32 read_log_length;
  383. u32 data_buffer_size;
  384. u32 data_buffer[1];
  385. } __packed;
  386. struct be_cmd_resp_get_fat {
  387. struct be_cmd_resp_hdr hdr;
  388. u32 log_size;
  389. u32 read_log_length;
  390. u32 rsvd[2];
  391. u32 data_buffer[1];
  392. } __packed;
  393. /******************** Create MCCQ ***************************/
  394. /* Pseudo amap definition in which each bit of the actual structure is defined
  395. * as a byte: used to calculate offset/shift/mask of each field */
  396. struct amap_mcc_context_be {
  397. u8 con_index[14];
  398. u8 rsvd0[2];
  399. u8 ring_size[4];
  400. u8 fetch_wrb;
  401. u8 fetch_r2t;
  402. u8 cq_id[10];
  403. u8 prod_index[14];
  404. u8 fid[8];
  405. u8 pdid[9];
  406. u8 valid;
  407. u8 rsvd1[32];
  408. u8 rsvd2[32];
  409. } __packed;
  410. struct amap_mcc_context_lancer {
  411. u8 async_cq_id[16];
  412. u8 ring_size[4];
  413. u8 rsvd0[12];
  414. u8 rsvd1[31];
  415. u8 valid;
  416. u8 async_cq_valid[1];
  417. u8 rsvd2[31];
  418. u8 rsvd3[32];
  419. } __packed;
  420. struct be_cmd_req_mcc_create {
  421. struct be_cmd_req_hdr hdr;
  422. u16 num_pages;
  423. u16 cq_id;
  424. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  425. struct phys_addr pages[8];
  426. } __packed;
  427. struct be_cmd_req_mcc_ext_create {
  428. struct be_cmd_req_hdr hdr;
  429. u16 num_pages;
  430. u16 cq_id;
  431. u32 async_event_bitmap[1];
  432. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  433. struct phys_addr pages[8];
  434. } __packed;
  435. struct be_cmd_resp_mcc_create {
  436. struct be_cmd_resp_hdr hdr;
  437. u16 id;
  438. u16 rsvd0;
  439. } __packed;
  440. /******************** Create TxQ ***************************/
  441. #define BE_ETH_TX_RING_TYPE_STANDARD 2
  442. #define BE_ULP1_NUM 1
  443. struct be_cmd_req_eth_tx_create {
  444. struct be_cmd_req_hdr hdr;
  445. u8 num_pages;
  446. u8 ulp_num;
  447. u16 type;
  448. u16 if_id;
  449. u8 queue_size;
  450. u8 rsvd0;
  451. u32 rsvd1;
  452. u16 cq_id;
  453. u16 rsvd2;
  454. u32 rsvd3[13];
  455. struct phys_addr pages[8];
  456. } __packed;
  457. struct be_cmd_resp_eth_tx_create {
  458. struct be_cmd_resp_hdr hdr;
  459. u16 cid;
  460. u16 rid;
  461. u32 db_offset;
  462. u32 rsvd0[4];
  463. } __packed;
  464. /******************** Create RxQ ***************************/
  465. struct be_cmd_req_eth_rx_create {
  466. struct be_cmd_req_hdr hdr;
  467. u16 cq_id;
  468. u8 frag_size;
  469. u8 num_pages;
  470. struct phys_addr pages[2];
  471. u32 interface_id;
  472. u16 max_frame_size;
  473. u16 rsvd0;
  474. u32 rss_queue;
  475. } __packed;
  476. struct be_cmd_resp_eth_rx_create {
  477. struct be_cmd_resp_hdr hdr;
  478. u16 id;
  479. u8 rss_id;
  480. u8 rsvd0;
  481. } __packed;
  482. /******************** Q Destroy ***************************/
  483. /* Type of Queue to be destroyed */
  484. enum {
  485. QTYPE_EQ = 1,
  486. QTYPE_CQ,
  487. QTYPE_TXQ,
  488. QTYPE_RXQ,
  489. QTYPE_MCCQ
  490. };
  491. struct be_cmd_req_q_destroy {
  492. struct be_cmd_req_hdr hdr;
  493. u16 id;
  494. u16 bypass_flush; /* valid only for rx q destroy */
  495. } __packed;
  496. /************ I/f Create (it's actually I/f Config Create)**********/
  497. /* Capability flags for the i/f */
  498. enum be_if_flags {
  499. BE_IF_FLAGS_RSS = 0x4,
  500. BE_IF_FLAGS_PROMISCUOUS = 0x8,
  501. BE_IF_FLAGS_BROADCAST = 0x10,
  502. BE_IF_FLAGS_UNTAGGED = 0x20,
  503. BE_IF_FLAGS_ULP = 0x40,
  504. BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80,
  505. BE_IF_FLAGS_VLAN = 0x100,
  506. BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200,
  507. BE_IF_FLAGS_PASS_L2_ERRORS = 0x400,
  508. BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800,
  509. BE_IF_FLAGS_MULTICAST = 0x1000
  510. };
  511. #define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\
  512. BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\
  513. BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\
  514. BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\
  515. BE_IF_FLAGS_UNTAGGED)
  516. /* An RX interface is an object with one or more MAC addresses and
  517. * filtering capabilities. */
  518. struct be_cmd_req_if_create {
  519. struct be_cmd_req_hdr hdr;
  520. u32 version; /* ignore currently */
  521. u32 capability_flags;
  522. u32 enable_flags;
  523. u8 mac_addr[ETH_ALEN];
  524. u8 rsvd0;
  525. u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */
  526. u32 vlan_tag; /* not used currently */
  527. } __packed;
  528. struct be_cmd_resp_if_create {
  529. struct be_cmd_resp_hdr hdr;
  530. u32 interface_id;
  531. u32 pmac_id;
  532. };
  533. /****** I/f Destroy(it's actually I/f Config Destroy )**********/
  534. struct be_cmd_req_if_destroy {
  535. struct be_cmd_req_hdr hdr;
  536. u32 interface_id;
  537. };
  538. /*************** HW Stats Get **********************************/
  539. struct be_port_rxf_stats_v0 {
  540. u32 rx_bytes_lsd; /* dword 0*/
  541. u32 rx_bytes_msd; /* dword 1*/
  542. u32 rx_total_frames; /* dword 2*/
  543. u32 rx_unicast_frames; /* dword 3*/
  544. u32 rx_multicast_frames; /* dword 4*/
  545. u32 rx_broadcast_frames; /* dword 5*/
  546. u32 rx_crc_errors; /* dword 6*/
  547. u32 rx_alignment_symbol_errors; /* dword 7*/
  548. u32 rx_pause_frames; /* dword 8*/
  549. u32 rx_control_frames; /* dword 9*/
  550. u32 rx_in_range_errors; /* dword 10*/
  551. u32 rx_out_range_errors; /* dword 11*/
  552. u32 rx_frame_too_long; /* dword 12*/
  553. u32 rx_address_filtered; /* dword 13*/
  554. u32 rx_vlan_filtered; /* dword 14*/
  555. u32 rx_dropped_too_small; /* dword 15*/
  556. u32 rx_dropped_too_short; /* dword 16*/
  557. u32 rx_dropped_header_too_small; /* dword 17*/
  558. u32 rx_dropped_tcp_length; /* dword 18*/
  559. u32 rx_dropped_runt; /* dword 19*/
  560. u32 rx_64_byte_packets; /* dword 20*/
  561. u32 rx_65_127_byte_packets; /* dword 21*/
  562. u32 rx_128_256_byte_packets; /* dword 22*/
  563. u32 rx_256_511_byte_packets; /* dword 23*/
  564. u32 rx_512_1023_byte_packets; /* dword 24*/
  565. u32 rx_1024_1518_byte_packets; /* dword 25*/
  566. u32 rx_1519_2047_byte_packets; /* dword 26*/
  567. u32 rx_2048_4095_byte_packets; /* dword 27*/
  568. u32 rx_4096_8191_byte_packets; /* dword 28*/
  569. u32 rx_8192_9216_byte_packets; /* dword 29*/
  570. u32 rx_ip_checksum_errs; /* dword 30*/
  571. u32 rx_tcp_checksum_errs; /* dword 31*/
  572. u32 rx_udp_checksum_errs; /* dword 32*/
  573. u32 rx_non_rss_packets; /* dword 33*/
  574. u32 rx_ipv4_packets; /* dword 34*/
  575. u32 rx_ipv6_packets; /* dword 35*/
  576. u32 rx_ipv4_bytes_lsd; /* dword 36*/
  577. u32 rx_ipv4_bytes_msd; /* dword 37*/
  578. u32 rx_ipv6_bytes_lsd; /* dword 38*/
  579. u32 rx_ipv6_bytes_msd; /* dword 39*/
  580. u32 rx_chute1_packets; /* dword 40*/
  581. u32 rx_chute2_packets; /* dword 41*/
  582. u32 rx_chute3_packets; /* dword 42*/
  583. u32 rx_management_packets; /* dword 43*/
  584. u32 rx_switched_unicast_packets; /* dword 44*/
  585. u32 rx_switched_multicast_packets; /* dword 45*/
  586. u32 rx_switched_broadcast_packets; /* dword 46*/
  587. u32 tx_bytes_lsd; /* dword 47*/
  588. u32 tx_bytes_msd; /* dword 48*/
  589. u32 tx_unicastframes; /* dword 49*/
  590. u32 tx_multicastframes; /* dword 50*/
  591. u32 tx_broadcastframes; /* dword 51*/
  592. u32 tx_pauseframes; /* dword 52*/
  593. u32 tx_controlframes; /* dword 53*/
  594. u32 tx_64_byte_packets; /* dword 54*/
  595. u32 tx_65_127_byte_packets; /* dword 55*/
  596. u32 tx_128_256_byte_packets; /* dword 56*/
  597. u32 tx_256_511_byte_packets; /* dword 57*/
  598. u32 tx_512_1023_byte_packets; /* dword 58*/
  599. u32 tx_1024_1518_byte_packets; /* dword 59*/
  600. u32 tx_1519_2047_byte_packets; /* dword 60*/
  601. u32 tx_2048_4095_byte_packets; /* dword 61*/
  602. u32 tx_4096_8191_byte_packets; /* dword 62*/
  603. u32 tx_8192_9216_byte_packets; /* dword 63*/
  604. u32 rx_fifo_overflow; /* dword 64*/
  605. u32 rx_input_fifo_overflow; /* dword 65*/
  606. };
  607. struct be_rxf_stats_v0 {
  608. struct be_port_rxf_stats_v0 port[2];
  609. u32 rx_drops_no_pbuf; /* dword 132*/
  610. u32 rx_drops_no_txpb; /* dword 133*/
  611. u32 rx_drops_no_erx_descr; /* dword 134*/
  612. u32 rx_drops_no_tpre_descr; /* dword 135*/
  613. u32 management_rx_port_packets; /* dword 136*/
  614. u32 management_rx_port_bytes; /* dword 137*/
  615. u32 management_rx_port_pause_frames; /* dword 138*/
  616. u32 management_rx_port_errors; /* dword 139*/
  617. u32 management_tx_port_packets; /* dword 140*/
  618. u32 management_tx_port_bytes; /* dword 141*/
  619. u32 management_tx_port_pause; /* dword 142*/
  620. u32 management_rx_port_rxfifo_overflow; /* dword 143*/
  621. u32 rx_drops_too_many_frags; /* dword 144*/
  622. u32 rx_drops_invalid_ring; /* dword 145*/
  623. u32 forwarded_packets; /* dword 146*/
  624. u32 rx_drops_mtu; /* dword 147*/
  625. u32 rsvd0[7];
  626. u32 port0_jabber_events;
  627. u32 port1_jabber_events;
  628. u32 rsvd1[6];
  629. };
  630. struct be_erx_stats_v0 {
  631. u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/
  632. u32 rsvd[4];
  633. };
  634. struct be_pmem_stats {
  635. u32 eth_red_drops;
  636. u32 rsvd[5];
  637. };
  638. struct be_hw_stats_v0 {
  639. struct be_rxf_stats_v0 rxf;
  640. u32 rsvd[48];
  641. struct be_erx_stats_v0 erx;
  642. struct be_pmem_stats pmem;
  643. };
  644. struct be_cmd_req_get_stats_v0 {
  645. struct be_cmd_req_hdr hdr;
  646. u8 rsvd[sizeof(struct be_hw_stats_v0)];
  647. };
  648. struct be_cmd_resp_get_stats_v0 {
  649. struct be_cmd_resp_hdr hdr;
  650. struct be_hw_stats_v0 hw_stats;
  651. };
  652. struct lancer_pport_stats {
  653. u32 tx_packets_lo;
  654. u32 tx_packets_hi;
  655. u32 tx_unicast_packets_lo;
  656. u32 tx_unicast_packets_hi;
  657. u32 tx_multicast_packets_lo;
  658. u32 tx_multicast_packets_hi;
  659. u32 tx_broadcast_packets_lo;
  660. u32 tx_broadcast_packets_hi;
  661. u32 tx_bytes_lo;
  662. u32 tx_bytes_hi;
  663. u32 tx_unicast_bytes_lo;
  664. u32 tx_unicast_bytes_hi;
  665. u32 tx_multicast_bytes_lo;
  666. u32 tx_multicast_bytes_hi;
  667. u32 tx_broadcast_bytes_lo;
  668. u32 tx_broadcast_bytes_hi;
  669. u32 tx_discards_lo;
  670. u32 tx_discards_hi;
  671. u32 tx_errors_lo;
  672. u32 tx_errors_hi;
  673. u32 tx_pause_frames_lo;
  674. u32 tx_pause_frames_hi;
  675. u32 tx_pause_on_frames_lo;
  676. u32 tx_pause_on_frames_hi;
  677. u32 tx_pause_off_frames_lo;
  678. u32 tx_pause_off_frames_hi;
  679. u32 tx_internal_mac_errors_lo;
  680. u32 tx_internal_mac_errors_hi;
  681. u32 tx_control_frames_lo;
  682. u32 tx_control_frames_hi;
  683. u32 tx_packets_64_bytes_lo;
  684. u32 tx_packets_64_bytes_hi;
  685. u32 tx_packets_65_to_127_bytes_lo;
  686. u32 tx_packets_65_to_127_bytes_hi;
  687. u32 tx_packets_128_to_255_bytes_lo;
  688. u32 tx_packets_128_to_255_bytes_hi;
  689. u32 tx_packets_256_to_511_bytes_lo;
  690. u32 tx_packets_256_to_511_bytes_hi;
  691. u32 tx_packets_512_to_1023_bytes_lo;
  692. u32 tx_packets_512_to_1023_bytes_hi;
  693. u32 tx_packets_1024_to_1518_bytes_lo;
  694. u32 tx_packets_1024_to_1518_bytes_hi;
  695. u32 tx_packets_1519_to_2047_bytes_lo;
  696. u32 tx_packets_1519_to_2047_bytes_hi;
  697. u32 tx_packets_2048_to_4095_bytes_lo;
  698. u32 tx_packets_2048_to_4095_bytes_hi;
  699. u32 tx_packets_4096_to_8191_bytes_lo;
  700. u32 tx_packets_4096_to_8191_bytes_hi;
  701. u32 tx_packets_8192_to_9216_bytes_lo;
  702. u32 tx_packets_8192_to_9216_bytes_hi;
  703. u32 tx_lso_packets_lo;
  704. u32 tx_lso_packets_hi;
  705. u32 rx_packets_lo;
  706. u32 rx_packets_hi;
  707. u32 rx_unicast_packets_lo;
  708. u32 rx_unicast_packets_hi;
  709. u32 rx_multicast_packets_lo;
  710. u32 rx_multicast_packets_hi;
  711. u32 rx_broadcast_packets_lo;
  712. u32 rx_broadcast_packets_hi;
  713. u32 rx_bytes_lo;
  714. u32 rx_bytes_hi;
  715. u32 rx_unicast_bytes_lo;
  716. u32 rx_unicast_bytes_hi;
  717. u32 rx_multicast_bytes_lo;
  718. u32 rx_multicast_bytes_hi;
  719. u32 rx_broadcast_bytes_lo;
  720. u32 rx_broadcast_bytes_hi;
  721. u32 rx_unknown_protos;
  722. u32 rsvd_69; /* Word 69 is reserved */
  723. u32 rx_discards_lo;
  724. u32 rx_discards_hi;
  725. u32 rx_errors_lo;
  726. u32 rx_errors_hi;
  727. u32 rx_crc_errors_lo;
  728. u32 rx_crc_errors_hi;
  729. u32 rx_alignment_errors_lo;
  730. u32 rx_alignment_errors_hi;
  731. u32 rx_symbol_errors_lo;
  732. u32 rx_symbol_errors_hi;
  733. u32 rx_pause_frames_lo;
  734. u32 rx_pause_frames_hi;
  735. u32 rx_pause_on_frames_lo;
  736. u32 rx_pause_on_frames_hi;
  737. u32 rx_pause_off_frames_lo;
  738. u32 rx_pause_off_frames_hi;
  739. u32 rx_frames_too_long_lo;
  740. u32 rx_frames_too_long_hi;
  741. u32 rx_internal_mac_errors_lo;
  742. u32 rx_internal_mac_errors_hi;
  743. u32 rx_undersize_packets;
  744. u32 rx_oversize_packets;
  745. u32 rx_fragment_packets;
  746. u32 rx_jabbers;
  747. u32 rx_control_frames_lo;
  748. u32 rx_control_frames_hi;
  749. u32 rx_control_frames_unknown_opcode_lo;
  750. u32 rx_control_frames_unknown_opcode_hi;
  751. u32 rx_in_range_errors;
  752. u32 rx_out_of_range_errors;
  753. u32 rx_address_filtered;
  754. u32 rx_vlan_filtered;
  755. u32 rx_dropped_too_small;
  756. u32 rx_dropped_too_short;
  757. u32 rx_dropped_header_too_small;
  758. u32 rx_dropped_invalid_tcp_length;
  759. u32 rx_dropped_runt;
  760. u32 rx_ip_checksum_errors;
  761. u32 rx_tcp_checksum_errors;
  762. u32 rx_udp_checksum_errors;
  763. u32 rx_non_rss_packets;
  764. u32 rsvd_111;
  765. u32 rx_ipv4_packets_lo;
  766. u32 rx_ipv4_packets_hi;
  767. u32 rx_ipv6_packets_lo;
  768. u32 rx_ipv6_packets_hi;
  769. u32 rx_ipv4_bytes_lo;
  770. u32 rx_ipv4_bytes_hi;
  771. u32 rx_ipv6_bytes_lo;
  772. u32 rx_ipv6_bytes_hi;
  773. u32 rx_nic_packets_lo;
  774. u32 rx_nic_packets_hi;
  775. u32 rx_tcp_packets_lo;
  776. u32 rx_tcp_packets_hi;
  777. u32 rx_iscsi_packets_lo;
  778. u32 rx_iscsi_packets_hi;
  779. u32 rx_management_packets_lo;
  780. u32 rx_management_packets_hi;
  781. u32 rx_switched_unicast_packets_lo;
  782. u32 rx_switched_unicast_packets_hi;
  783. u32 rx_switched_multicast_packets_lo;
  784. u32 rx_switched_multicast_packets_hi;
  785. u32 rx_switched_broadcast_packets_lo;
  786. u32 rx_switched_broadcast_packets_hi;
  787. u32 num_forwards_lo;
  788. u32 num_forwards_hi;
  789. u32 rx_fifo_overflow;
  790. u32 rx_input_fifo_overflow;
  791. u32 rx_drops_too_many_frags_lo;
  792. u32 rx_drops_too_many_frags_hi;
  793. u32 rx_drops_invalid_queue;
  794. u32 rsvd_141;
  795. u32 rx_drops_mtu_lo;
  796. u32 rx_drops_mtu_hi;
  797. u32 rx_packets_64_bytes_lo;
  798. u32 rx_packets_64_bytes_hi;
  799. u32 rx_packets_65_to_127_bytes_lo;
  800. u32 rx_packets_65_to_127_bytes_hi;
  801. u32 rx_packets_128_to_255_bytes_lo;
  802. u32 rx_packets_128_to_255_bytes_hi;
  803. u32 rx_packets_256_to_511_bytes_lo;
  804. u32 rx_packets_256_to_511_bytes_hi;
  805. u32 rx_packets_512_to_1023_bytes_lo;
  806. u32 rx_packets_512_to_1023_bytes_hi;
  807. u32 rx_packets_1024_to_1518_bytes_lo;
  808. u32 rx_packets_1024_to_1518_bytes_hi;
  809. u32 rx_packets_1519_to_2047_bytes_lo;
  810. u32 rx_packets_1519_to_2047_bytes_hi;
  811. u32 rx_packets_2048_to_4095_bytes_lo;
  812. u32 rx_packets_2048_to_4095_bytes_hi;
  813. u32 rx_packets_4096_to_8191_bytes_lo;
  814. u32 rx_packets_4096_to_8191_bytes_hi;
  815. u32 rx_packets_8192_to_9216_bytes_lo;
  816. u32 rx_packets_8192_to_9216_bytes_hi;
  817. };
  818. struct pport_stats_params {
  819. u16 pport_num;
  820. u8 rsvd;
  821. u8 reset_stats;
  822. };
  823. struct lancer_cmd_req_pport_stats {
  824. struct be_cmd_req_hdr hdr;
  825. union {
  826. struct pport_stats_params params;
  827. u8 rsvd[sizeof(struct lancer_pport_stats)];
  828. } cmd_params;
  829. };
  830. struct lancer_cmd_resp_pport_stats {
  831. struct be_cmd_resp_hdr hdr;
  832. struct lancer_pport_stats pport_stats;
  833. };
  834. static inline struct lancer_pport_stats*
  835. pport_stats_from_cmd(struct be_adapter *adapter)
  836. {
  837. struct lancer_cmd_resp_pport_stats *cmd = adapter->stats_cmd.va;
  838. return &cmd->pport_stats;
  839. }
  840. struct be_cmd_req_get_cntl_addnl_attribs {
  841. struct be_cmd_req_hdr hdr;
  842. u8 rsvd[8];
  843. };
  844. struct be_cmd_resp_get_cntl_addnl_attribs {
  845. struct be_cmd_resp_hdr hdr;
  846. u16 ipl_file_number;
  847. u8 ipl_file_version;
  848. u8 rsvd0;
  849. u8 on_die_temperature; /* in degrees centigrade*/
  850. u8 rsvd1[3];
  851. };
  852. struct be_cmd_req_vlan_config {
  853. struct be_cmd_req_hdr hdr;
  854. u8 interface_id;
  855. u8 promiscuous;
  856. u8 untagged;
  857. u8 num_vlan;
  858. u16 normal_vlan[64];
  859. } __packed;
  860. /******************* RX FILTER ******************************/
  861. #define BE_MAX_MC 64 /* set mcast promisc if > 64 */
  862. struct macaddr {
  863. u8 byte[ETH_ALEN];
  864. };
  865. struct be_cmd_req_rx_filter {
  866. struct be_cmd_req_hdr hdr;
  867. u32 global_flags_mask;
  868. u32 global_flags;
  869. u32 if_flags_mask;
  870. u32 if_flags;
  871. u32 if_id;
  872. u32 mcast_num;
  873. struct macaddr mcast_mac[BE_MAX_MC];
  874. };
  875. /******************** Link Status Query *******************/
  876. struct be_cmd_req_link_status {
  877. struct be_cmd_req_hdr hdr;
  878. u32 rsvd;
  879. };
  880. enum {
  881. PHY_LINK_DUPLEX_NONE = 0x0,
  882. PHY_LINK_DUPLEX_HALF = 0x1,
  883. PHY_LINK_DUPLEX_FULL = 0x2
  884. };
  885. enum {
  886. PHY_LINK_SPEED_ZERO = 0x0, /* => No link */
  887. PHY_LINK_SPEED_10MBPS = 0x1,
  888. PHY_LINK_SPEED_100MBPS = 0x2,
  889. PHY_LINK_SPEED_1GBPS = 0x3,
  890. PHY_LINK_SPEED_10GBPS = 0x4,
  891. PHY_LINK_SPEED_20GBPS = 0x5,
  892. PHY_LINK_SPEED_25GBPS = 0x6,
  893. PHY_LINK_SPEED_40GBPS = 0x7
  894. };
  895. struct be_cmd_resp_link_status {
  896. struct be_cmd_resp_hdr hdr;
  897. u8 physical_port;
  898. u8 mac_duplex;
  899. u8 mac_speed;
  900. u8 mac_fault;
  901. u8 mgmt_mac_duplex;
  902. u8 mgmt_mac_speed;
  903. u16 link_speed;
  904. u8 logical_link_status;
  905. u8 rsvd1[3];
  906. } __packed;
  907. /******************** Port Identification ***************************/
  908. /* Identifies the type of port attached to NIC */
  909. struct be_cmd_req_port_type {
  910. struct be_cmd_req_hdr hdr;
  911. u32 page_num;
  912. u32 port;
  913. };
  914. enum {
  915. TR_PAGE_A0 = 0xa0,
  916. TR_PAGE_A2 = 0xa2
  917. };
  918. struct be_cmd_resp_port_type {
  919. struct be_cmd_resp_hdr hdr;
  920. u32 page_num;
  921. u32 port;
  922. struct data {
  923. u8 identifier;
  924. u8 identifier_ext;
  925. u8 connector;
  926. u8 transceiver[8];
  927. u8 rsvd0[3];
  928. u8 length_km;
  929. u8 length_hm;
  930. u8 length_om1;
  931. u8 length_om2;
  932. u8 length_cu;
  933. u8 length_cu_m;
  934. u8 vendor_name[16];
  935. u8 rsvd;
  936. u8 vendor_oui[3];
  937. u8 vendor_pn[16];
  938. u8 vendor_rev[4];
  939. } data;
  940. };
  941. /******************** Get FW Version *******************/
  942. struct be_cmd_req_get_fw_version {
  943. struct be_cmd_req_hdr hdr;
  944. u8 rsvd0[FW_VER_LEN];
  945. u8 rsvd1[FW_VER_LEN];
  946. } __packed;
  947. struct be_cmd_resp_get_fw_version {
  948. struct be_cmd_resp_hdr hdr;
  949. u8 firmware_version_string[FW_VER_LEN];
  950. u8 fw_on_flash_version_string[FW_VER_LEN];
  951. } __packed;
  952. /******************** Set Flow Contrl *******************/
  953. struct be_cmd_req_set_flow_control {
  954. struct be_cmd_req_hdr hdr;
  955. u16 tx_flow_control;
  956. u16 rx_flow_control;
  957. } __packed;
  958. /******************** Get Flow Contrl *******************/
  959. struct be_cmd_req_get_flow_control {
  960. struct be_cmd_req_hdr hdr;
  961. u32 rsvd;
  962. };
  963. struct be_cmd_resp_get_flow_control {
  964. struct be_cmd_resp_hdr hdr;
  965. u16 tx_flow_control;
  966. u16 rx_flow_control;
  967. } __packed;
  968. /******************** Modify EQ Delay *******************/
  969. struct be_set_eqd {
  970. u32 eq_id;
  971. u32 phase;
  972. u32 delay_multiplier;
  973. };
  974. struct be_cmd_req_modify_eq_delay {
  975. struct be_cmd_req_hdr hdr;
  976. u32 num_eq;
  977. struct be_set_eqd set_eqd[MAX_EVT_QS];
  978. } __packed;
  979. struct be_cmd_resp_modify_eq_delay {
  980. struct be_cmd_resp_hdr hdr;
  981. u32 rsvd0;
  982. } __packed;
  983. /******************** Get FW Config *******************/
  984. /* The HW can come up in either of the following multi-channel modes
  985. * based on the skew/IPL.
  986. */
  987. #define RDMA_ENABLED 0x4
  988. #define FLEX10_MODE 0x400
  989. #define VNIC_MODE 0x20000
  990. #define UMC_ENABLED 0x1000000
  991. struct be_cmd_req_query_fw_cfg {
  992. struct be_cmd_req_hdr hdr;
  993. u32 rsvd[31];
  994. };
  995. struct be_cmd_resp_query_fw_cfg {
  996. struct be_cmd_resp_hdr hdr;
  997. u32 be_config_number;
  998. u32 asic_revision;
  999. u32 phys_port;
  1000. u32 function_mode;
  1001. u32 rsvd[26];
  1002. u32 function_caps;
  1003. };
  1004. /******************** RSS Config ****************************************/
  1005. /* RSS type Input parameters used to compute RX hash
  1006. * RSS_ENABLE_IPV4 SRC IPv4, DST IPv4
  1007. * RSS_ENABLE_TCP_IPV4 SRC IPv4, DST IPv4, TCP SRC PORT, TCP DST PORT
  1008. * RSS_ENABLE_IPV6 SRC IPv6, DST IPv6
  1009. * RSS_ENABLE_TCP_IPV6 SRC IPv6, DST IPv6, TCP SRC PORT, TCP DST PORT
  1010. * RSS_ENABLE_UDP_IPV4 SRC IPv4, DST IPv4, UDP SRC PORT, UDP DST PORT
  1011. * RSS_ENABLE_UDP_IPV6 SRC IPv6, DST IPv6, UDP SRC PORT, UDP DST PORT
  1012. *
  1013. * When multiple RSS types are enabled, HW picks the best hash policy
  1014. * based on the type of the received packet.
  1015. */
  1016. #define RSS_ENABLE_NONE 0x0
  1017. #define RSS_ENABLE_IPV4 0x1
  1018. #define RSS_ENABLE_TCP_IPV4 0x2
  1019. #define RSS_ENABLE_IPV6 0x4
  1020. #define RSS_ENABLE_TCP_IPV6 0x8
  1021. #define RSS_ENABLE_UDP_IPV4 0x10
  1022. #define RSS_ENABLE_UDP_IPV6 0x20
  1023. #define L3_RSS_FLAGS (RXH_IP_DST | RXH_IP_SRC)
  1024. #define L4_RSS_FLAGS (RXH_L4_B_0_1 | RXH_L4_B_2_3)
  1025. struct be_cmd_req_rss_config {
  1026. struct be_cmd_req_hdr hdr;
  1027. u32 if_id;
  1028. u16 enable_rss;
  1029. u16 cpu_table_size_log2;
  1030. u32 hash[10];
  1031. u8 cpu_table[128];
  1032. u8 flush;
  1033. u8 rsvd0[3];
  1034. };
  1035. /******************** Port Beacon ***************************/
  1036. #define BEACON_STATE_ENABLED 0x1
  1037. #define BEACON_STATE_DISABLED 0x0
  1038. struct be_cmd_req_enable_disable_beacon {
  1039. struct be_cmd_req_hdr hdr;
  1040. u8 port_num;
  1041. u8 beacon_state;
  1042. u8 beacon_duration;
  1043. u8 status_duration;
  1044. } __packed;
  1045. struct be_cmd_resp_enable_disable_beacon {
  1046. struct be_cmd_resp_hdr resp_hdr;
  1047. u32 rsvd0;
  1048. } __packed;
  1049. struct be_cmd_req_get_beacon_state {
  1050. struct be_cmd_req_hdr hdr;
  1051. u8 port_num;
  1052. u8 rsvd0;
  1053. u16 rsvd1;
  1054. } __packed;
  1055. struct be_cmd_resp_get_beacon_state {
  1056. struct be_cmd_resp_hdr resp_hdr;
  1057. u8 beacon_state;
  1058. u8 rsvd0[3];
  1059. } __packed;
  1060. /****************** Firmware Flash ******************/
  1061. struct flashrom_params {
  1062. u32 op_code;
  1063. u32 op_type;
  1064. u32 data_buf_size;
  1065. u32 offset;
  1066. };
  1067. struct be_cmd_write_flashrom {
  1068. struct be_cmd_req_hdr hdr;
  1069. struct flashrom_params params;
  1070. u8 data_buf[32768];
  1071. u8 rsvd[4];
  1072. } __packed;
  1073. /* cmd to read flash crc */
  1074. struct be_cmd_read_flash_crc {
  1075. struct be_cmd_req_hdr hdr;
  1076. struct flashrom_params params;
  1077. u8 crc[4];
  1078. u8 rsvd[4];
  1079. };
  1080. /**************** Lancer Firmware Flash ************/
  1081. struct amap_lancer_write_obj_context {
  1082. u8 write_length[24];
  1083. u8 reserved1[7];
  1084. u8 eof;
  1085. } __packed;
  1086. struct lancer_cmd_req_write_object {
  1087. struct be_cmd_req_hdr hdr;
  1088. u8 context[sizeof(struct amap_lancer_write_obj_context) / 8];
  1089. u32 write_offset;
  1090. u8 object_name[104];
  1091. u32 descriptor_count;
  1092. u32 buf_len;
  1093. u32 addr_low;
  1094. u32 addr_high;
  1095. };
  1096. #define LANCER_NO_RESET_NEEDED 0x00
  1097. #define LANCER_FW_RESET_NEEDED 0x02
  1098. struct lancer_cmd_resp_write_object {
  1099. u8 opcode;
  1100. u8 subsystem;
  1101. u8 rsvd1[2];
  1102. u8 status;
  1103. u8 additional_status;
  1104. u8 rsvd2[2];
  1105. u32 resp_len;
  1106. u32 actual_resp_len;
  1107. u32 actual_write_len;
  1108. u8 change_status;
  1109. u8 rsvd3[3];
  1110. };
  1111. /************************ Lancer Read FW info **************/
  1112. #define LANCER_READ_FILE_CHUNK (32*1024)
  1113. #define LANCER_READ_FILE_EOF_MASK 0x80000000
  1114. #define LANCER_FW_DUMP_FILE "/dbg/dump.bin"
  1115. #define LANCER_VPD_PF_FILE "/vpd/ntr_pf.vpd"
  1116. #define LANCER_VPD_VF_FILE "/vpd/ntr_vf.vpd"
  1117. struct lancer_cmd_req_read_object {
  1118. struct be_cmd_req_hdr hdr;
  1119. u32 desired_read_len;
  1120. u32 read_offset;
  1121. u8 object_name[104];
  1122. u32 descriptor_count;
  1123. u32 buf_len;
  1124. u32 addr_low;
  1125. u32 addr_high;
  1126. };
  1127. struct lancer_cmd_resp_read_object {
  1128. u8 opcode;
  1129. u8 subsystem;
  1130. u8 rsvd1[2];
  1131. u8 status;
  1132. u8 additional_status;
  1133. u8 rsvd2[2];
  1134. u32 resp_len;
  1135. u32 actual_resp_len;
  1136. u32 actual_read_len;
  1137. u32 eof;
  1138. };
  1139. /************************ WOL *******************************/
  1140. struct be_cmd_req_acpi_wol_magic_config{
  1141. struct be_cmd_req_hdr hdr;
  1142. u32 rsvd0[145];
  1143. u8 magic_mac[6];
  1144. u8 rsvd2[2];
  1145. } __packed;
  1146. struct be_cmd_req_acpi_wol_magic_config_v1 {
  1147. struct be_cmd_req_hdr hdr;
  1148. u8 rsvd0[2];
  1149. u8 query_options;
  1150. u8 rsvd1[5];
  1151. u32 rsvd2[288];
  1152. u8 magic_mac[6];
  1153. u8 rsvd3[22];
  1154. } __packed;
  1155. struct be_cmd_resp_acpi_wol_magic_config_v1 {
  1156. struct be_cmd_resp_hdr hdr;
  1157. u8 rsvd0[2];
  1158. u8 wol_settings;
  1159. u8 rsvd1[5];
  1160. u32 rsvd2[295];
  1161. } __packed;
  1162. #define BE_GET_WOL_CAP 2
  1163. #define BE_WOL_CAP 0x1
  1164. #define BE_PME_D0_CAP 0x8
  1165. #define BE_PME_D1_CAP 0x10
  1166. #define BE_PME_D2_CAP 0x20
  1167. #define BE_PME_D3HOT_CAP 0x40
  1168. #define BE_PME_D3COLD_CAP 0x80
  1169. /********************** LoopBack test *********************/
  1170. struct be_cmd_req_loopback_test {
  1171. struct be_cmd_req_hdr hdr;
  1172. u32 loopback_type;
  1173. u32 num_pkts;
  1174. u64 pattern;
  1175. u32 src_port;
  1176. u32 dest_port;
  1177. u32 pkt_size;
  1178. };
  1179. struct be_cmd_resp_loopback_test {
  1180. struct be_cmd_resp_hdr resp_hdr;
  1181. u32 status;
  1182. u32 num_txfer;
  1183. u32 num_rx;
  1184. u32 miscomp_off;
  1185. u32 ticks_compl;
  1186. };
  1187. struct be_cmd_req_set_lmode {
  1188. struct be_cmd_req_hdr hdr;
  1189. u8 src_port;
  1190. u8 dest_port;
  1191. u8 loopback_type;
  1192. u8 loopback_state;
  1193. };
  1194. struct be_cmd_resp_set_lmode {
  1195. struct be_cmd_resp_hdr resp_hdr;
  1196. u8 rsvd0[4];
  1197. };
  1198. /********************** DDR DMA test *********************/
  1199. struct be_cmd_req_ddrdma_test {
  1200. struct be_cmd_req_hdr hdr;
  1201. u64 pattern;
  1202. u32 byte_count;
  1203. u32 rsvd0;
  1204. u8 snd_buff[4096];
  1205. u8 rsvd1[4096];
  1206. };
  1207. struct be_cmd_resp_ddrdma_test {
  1208. struct be_cmd_resp_hdr hdr;
  1209. u64 pattern;
  1210. u32 byte_cnt;
  1211. u32 snd_err;
  1212. u8 rsvd0[4096];
  1213. u8 rcv_buff[4096];
  1214. };
  1215. /*********************** SEEPROM Read ***********************/
  1216. #define BE_READ_SEEPROM_LEN 1024
  1217. struct be_cmd_req_seeprom_read {
  1218. struct be_cmd_req_hdr hdr;
  1219. u8 rsvd0[BE_READ_SEEPROM_LEN];
  1220. };
  1221. struct be_cmd_resp_seeprom_read {
  1222. struct be_cmd_req_hdr hdr;
  1223. u8 seeprom_data[BE_READ_SEEPROM_LEN];
  1224. };
  1225. enum {
  1226. PHY_TYPE_CX4_10GB = 0,
  1227. PHY_TYPE_XFP_10GB,
  1228. PHY_TYPE_SFP_1GB,
  1229. PHY_TYPE_SFP_PLUS_10GB,
  1230. PHY_TYPE_KR_10GB,
  1231. PHY_TYPE_KX4_10GB,
  1232. PHY_TYPE_BASET_10GB,
  1233. PHY_TYPE_BASET_1GB,
  1234. PHY_TYPE_BASEX_1GB,
  1235. PHY_TYPE_SGMII,
  1236. PHY_TYPE_DISABLED = 255
  1237. };
  1238. #define BE_SUPPORTED_SPEED_NONE 0
  1239. #define BE_SUPPORTED_SPEED_10MBPS 1
  1240. #define BE_SUPPORTED_SPEED_100MBPS 2
  1241. #define BE_SUPPORTED_SPEED_1GBPS 4
  1242. #define BE_SUPPORTED_SPEED_10GBPS 8
  1243. #define BE_AN_EN 0x2
  1244. #define BE_PAUSE_SYM_EN 0x80
  1245. /* MAC speed valid values */
  1246. #define SPEED_DEFAULT 0x0
  1247. #define SPEED_FORCED_10GB 0x1
  1248. #define SPEED_FORCED_1GB 0x2
  1249. #define SPEED_AUTONEG_10GB 0x3
  1250. #define SPEED_AUTONEG_1GB 0x4
  1251. #define SPEED_AUTONEG_100MB 0x5
  1252. #define SPEED_AUTONEG_10GB_1GB 0x6
  1253. #define SPEED_AUTONEG_10GB_1GB_100MB 0x7
  1254. #define SPEED_AUTONEG_1GB_100MB 0x8
  1255. #define SPEED_AUTONEG_10MB 0x9
  1256. #define SPEED_AUTONEG_1GB_100MB_10MB 0xa
  1257. #define SPEED_AUTONEG_100MB_10MB 0xb
  1258. #define SPEED_FORCED_100MB 0xc
  1259. #define SPEED_FORCED_10MB 0xd
  1260. struct be_cmd_req_get_phy_info {
  1261. struct be_cmd_req_hdr hdr;
  1262. u8 rsvd0[24];
  1263. };
  1264. struct be_phy_info {
  1265. u16 phy_type;
  1266. u16 interface_type;
  1267. u32 misc_params;
  1268. u16 ext_phy_details;
  1269. u16 rsvd;
  1270. u16 auto_speeds_supported;
  1271. u16 fixed_speeds_supported;
  1272. u32 future_use[2];
  1273. };
  1274. struct be_cmd_resp_get_phy_info {
  1275. struct be_cmd_req_hdr hdr;
  1276. struct be_phy_info phy_info;
  1277. };
  1278. /*********************** Set QOS ***********************/
  1279. #define BE_QOS_BITS_NIC 1
  1280. struct be_cmd_req_set_qos {
  1281. struct be_cmd_req_hdr hdr;
  1282. u32 valid_bits;
  1283. u32 max_bps_nic;
  1284. u32 rsvd[7];
  1285. };
  1286. struct be_cmd_resp_set_qos {
  1287. struct be_cmd_resp_hdr hdr;
  1288. u32 rsvd;
  1289. };
  1290. /*********************** Controller Attributes ***********************/
  1291. struct be_cmd_req_cntl_attribs {
  1292. struct be_cmd_req_hdr hdr;
  1293. };
  1294. struct be_cmd_resp_cntl_attribs {
  1295. struct be_cmd_resp_hdr hdr;
  1296. struct mgmt_controller_attrib attribs;
  1297. };
  1298. /*********************** Set driver function ***********************/
  1299. #define CAPABILITY_SW_TIMESTAMPS 2
  1300. #define CAPABILITY_BE3_NATIVE_ERX_API 4
  1301. struct be_cmd_req_set_func_cap {
  1302. struct be_cmd_req_hdr hdr;
  1303. u32 valid_cap_flags;
  1304. u32 cap_flags;
  1305. u8 rsvd[212];
  1306. };
  1307. struct be_cmd_resp_set_func_cap {
  1308. struct be_cmd_resp_hdr hdr;
  1309. u32 valid_cap_flags;
  1310. u32 cap_flags;
  1311. u8 rsvd[212];
  1312. };
  1313. /*********************** Function Privileges ***********************/
  1314. enum {
  1315. BE_PRIV_DEFAULT = 0x1,
  1316. BE_PRIV_LNKQUERY = 0x2,
  1317. BE_PRIV_LNKSTATS = 0x4,
  1318. BE_PRIV_LNKMGMT = 0x8,
  1319. BE_PRIV_LNKDIAG = 0x10,
  1320. BE_PRIV_UTILQUERY = 0x20,
  1321. BE_PRIV_FILTMGMT = 0x40,
  1322. BE_PRIV_IFACEMGMT = 0x80,
  1323. BE_PRIV_VHADM = 0x100,
  1324. BE_PRIV_DEVCFG = 0x200,
  1325. BE_PRIV_DEVSEC = 0x400
  1326. };
  1327. #define MAX_PRIVILEGES (BE_PRIV_VHADM | BE_PRIV_DEVCFG | \
  1328. BE_PRIV_DEVSEC)
  1329. #define MIN_PRIVILEGES BE_PRIV_DEFAULT
  1330. struct be_cmd_priv_map {
  1331. u8 opcode;
  1332. u8 subsystem;
  1333. u32 priv_mask;
  1334. };
  1335. struct be_cmd_req_get_fn_privileges {
  1336. struct be_cmd_req_hdr hdr;
  1337. u32 rsvd;
  1338. };
  1339. struct be_cmd_resp_get_fn_privileges {
  1340. struct be_cmd_resp_hdr hdr;
  1341. u32 privilege_mask;
  1342. };
  1343. struct be_cmd_req_set_fn_privileges {
  1344. struct be_cmd_req_hdr hdr;
  1345. u32 privileges; /* Used by BE3, SH-R */
  1346. u32 privileges_lancer; /* Used by Lancer */
  1347. };
  1348. /******************** GET/SET_MACLIST **************************/
  1349. #define BE_MAX_MAC 64
  1350. struct be_cmd_req_get_mac_list {
  1351. struct be_cmd_req_hdr hdr;
  1352. u8 mac_type;
  1353. u8 perm_override;
  1354. u16 iface_id;
  1355. u32 mac_id;
  1356. u32 rsvd[3];
  1357. } __packed;
  1358. struct get_list_macaddr {
  1359. u16 mac_addr_size;
  1360. union {
  1361. u8 macaddr[6];
  1362. struct {
  1363. u8 rsvd[2];
  1364. u32 mac_id;
  1365. } __packed s_mac_id;
  1366. } __packed mac_addr_id;
  1367. } __packed;
  1368. struct be_cmd_resp_get_mac_list {
  1369. struct be_cmd_resp_hdr hdr;
  1370. struct get_list_macaddr fd_macaddr; /* Factory default mac */
  1371. struct get_list_macaddr macid_macaddr; /* soft mac */
  1372. u8 true_mac_count;
  1373. u8 pseudo_mac_count;
  1374. u8 mac_list_size;
  1375. u8 rsvd;
  1376. /* perm override mac */
  1377. struct get_list_macaddr macaddr_list[BE_MAX_MAC];
  1378. } __packed;
  1379. struct be_cmd_req_set_mac_list {
  1380. struct be_cmd_req_hdr hdr;
  1381. u8 mac_count;
  1382. u8 rsvd1;
  1383. u16 rsvd2;
  1384. struct macaddr mac[BE_MAX_MAC];
  1385. } __packed;
  1386. /*********************** HSW Config ***********************/
  1387. #define PORT_FWD_TYPE_VEPA 0x3
  1388. #define PORT_FWD_TYPE_VEB 0x2
  1389. struct amap_set_hsw_context {
  1390. u8 interface_id[16];
  1391. u8 rsvd0[14];
  1392. u8 pvid_valid;
  1393. u8 pport;
  1394. u8 rsvd1[6];
  1395. u8 port_fwd_type[3];
  1396. u8 rsvd2[7];
  1397. u8 pvid[16];
  1398. u8 rsvd3[32];
  1399. u8 rsvd4[32];
  1400. u8 rsvd5[32];
  1401. } __packed;
  1402. struct be_cmd_req_set_hsw_config {
  1403. struct be_cmd_req_hdr hdr;
  1404. u8 context[sizeof(struct amap_set_hsw_context) / 8];
  1405. } __packed;
  1406. struct be_cmd_resp_set_hsw_config {
  1407. struct be_cmd_resp_hdr hdr;
  1408. u32 rsvd;
  1409. };
  1410. struct amap_get_hsw_req_context {
  1411. u8 interface_id[16];
  1412. u8 rsvd0[14];
  1413. u8 pvid_valid;
  1414. u8 pport;
  1415. } __packed;
  1416. struct amap_get_hsw_resp_context {
  1417. u8 rsvd0[6];
  1418. u8 port_fwd_type[3];
  1419. u8 rsvd1[7];
  1420. u8 pvid[16];
  1421. u8 rsvd2[32];
  1422. u8 rsvd3[32];
  1423. u8 rsvd4[32];
  1424. } __packed;
  1425. struct be_cmd_req_get_hsw_config {
  1426. struct be_cmd_req_hdr hdr;
  1427. u8 context[sizeof(struct amap_get_hsw_req_context) / 8];
  1428. } __packed;
  1429. struct be_cmd_resp_get_hsw_config {
  1430. struct be_cmd_resp_hdr hdr;
  1431. u8 context[sizeof(struct amap_get_hsw_resp_context) / 8];
  1432. u32 rsvd;
  1433. };
  1434. /******************* get port names ***************/
  1435. struct be_cmd_req_get_port_name {
  1436. struct be_cmd_req_hdr hdr;
  1437. u32 rsvd0;
  1438. };
  1439. struct be_cmd_resp_get_port_name {
  1440. struct be_cmd_req_hdr hdr;
  1441. u8 port_name[4];
  1442. };
  1443. /*************** HW Stats Get v1 **********************************/
  1444. #define BE_TXP_SW_SZ 48
  1445. struct be_port_rxf_stats_v1 {
  1446. u32 rsvd0[12];
  1447. u32 rx_crc_errors;
  1448. u32 rx_alignment_symbol_errors;
  1449. u32 rx_pause_frames;
  1450. u32 rx_priority_pause_frames;
  1451. u32 rx_control_frames;
  1452. u32 rx_in_range_errors;
  1453. u32 rx_out_range_errors;
  1454. u32 rx_frame_too_long;
  1455. u32 rx_address_filtered;
  1456. u32 rx_dropped_too_small;
  1457. u32 rx_dropped_too_short;
  1458. u32 rx_dropped_header_too_small;
  1459. u32 rx_dropped_tcp_length;
  1460. u32 rx_dropped_runt;
  1461. u32 rsvd1[10];
  1462. u32 rx_ip_checksum_errs;
  1463. u32 rx_tcp_checksum_errs;
  1464. u32 rx_udp_checksum_errs;
  1465. u32 rsvd2[7];
  1466. u32 rx_switched_unicast_packets;
  1467. u32 rx_switched_multicast_packets;
  1468. u32 rx_switched_broadcast_packets;
  1469. u32 rsvd3[3];
  1470. u32 tx_pauseframes;
  1471. u32 tx_priority_pauseframes;
  1472. u32 tx_controlframes;
  1473. u32 rsvd4[10];
  1474. u32 rxpp_fifo_overflow_drop;
  1475. u32 rx_input_fifo_overflow_drop;
  1476. u32 pmem_fifo_overflow_drop;
  1477. u32 jabber_events;
  1478. u32 rsvd5[3];
  1479. };
  1480. struct be_rxf_stats_v1 {
  1481. struct be_port_rxf_stats_v1 port[4];
  1482. u32 rsvd0[2];
  1483. u32 rx_drops_no_pbuf;
  1484. u32 rx_drops_no_txpb;
  1485. u32 rx_drops_no_erx_descr;
  1486. u32 rx_drops_no_tpre_descr;
  1487. u32 rsvd1[6];
  1488. u32 rx_drops_too_many_frags;
  1489. u32 rx_drops_invalid_ring;
  1490. u32 forwarded_packets;
  1491. u32 rx_drops_mtu;
  1492. u32 rsvd2[14];
  1493. };
  1494. struct be_erx_stats_v1 {
  1495. u32 rx_drops_no_fragments[68]; /* dwordS 0 to 67*/
  1496. u32 rsvd[4];
  1497. };
  1498. struct be_port_rxf_stats_v2 {
  1499. u32 rsvd0[10];
  1500. u32 roce_bytes_received_lsd;
  1501. u32 roce_bytes_received_msd;
  1502. u32 rsvd1[5];
  1503. u32 roce_frames_received;
  1504. u32 rx_crc_errors;
  1505. u32 rx_alignment_symbol_errors;
  1506. u32 rx_pause_frames;
  1507. u32 rx_priority_pause_frames;
  1508. u32 rx_control_frames;
  1509. u32 rx_in_range_errors;
  1510. u32 rx_out_range_errors;
  1511. u32 rx_frame_too_long;
  1512. u32 rx_address_filtered;
  1513. u32 rx_dropped_too_small;
  1514. u32 rx_dropped_too_short;
  1515. u32 rx_dropped_header_too_small;
  1516. u32 rx_dropped_tcp_length;
  1517. u32 rx_dropped_runt;
  1518. u32 rsvd2[10];
  1519. u32 rx_ip_checksum_errs;
  1520. u32 rx_tcp_checksum_errs;
  1521. u32 rx_udp_checksum_errs;
  1522. u32 rsvd3[7];
  1523. u32 rx_switched_unicast_packets;
  1524. u32 rx_switched_multicast_packets;
  1525. u32 rx_switched_broadcast_packets;
  1526. u32 rsvd4[3];
  1527. u32 tx_pauseframes;
  1528. u32 tx_priority_pauseframes;
  1529. u32 tx_controlframes;
  1530. u32 rsvd5[10];
  1531. u32 rxpp_fifo_overflow_drop;
  1532. u32 rx_input_fifo_overflow_drop;
  1533. u32 pmem_fifo_overflow_drop;
  1534. u32 jabber_events;
  1535. u32 rsvd6[3];
  1536. u32 rx_drops_payload_size;
  1537. u32 rx_drops_clipped_header;
  1538. u32 rx_drops_crc;
  1539. u32 roce_drops_payload_len;
  1540. u32 roce_drops_crc;
  1541. u32 rsvd7[19];
  1542. };
  1543. struct be_rxf_stats_v2 {
  1544. struct be_port_rxf_stats_v2 port[4];
  1545. u32 rsvd0[2];
  1546. u32 rx_drops_no_pbuf;
  1547. u32 rx_drops_no_txpb;
  1548. u32 rx_drops_no_erx_descr;
  1549. u32 rx_drops_no_tpre_descr;
  1550. u32 rsvd1[6];
  1551. u32 rx_drops_too_many_frags;
  1552. u32 rx_drops_invalid_ring;
  1553. u32 forwarded_packets;
  1554. u32 rx_drops_mtu;
  1555. u32 rsvd2[35];
  1556. };
  1557. struct be_hw_stats_v1 {
  1558. struct be_rxf_stats_v1 rxf;
  1559. u32 rsvd0[BE_TXP_SW_SZ];
  1560. struct be_erx_stats_v1 erx;
  1561. struct be_pmem_stats pmem;
  1562. u32 rsvd1[18];
  1563. };
  1564. struct be_cmd_req_get_stats_v1 {
  1565. struct be_cmd_req_hdr hdr;
  1566. u8 rsvd[sizeof(struct be_hw_stats_v1)];
  1567. };
  1568. struct be_cmd_resp_get_stats_v1 {
  1569. struct be_cmd_resp_hdr hdr;
  1570. struct be_hw_stats_v1 hw_stats;
  1571. };
  1572. struct be_erx_stats_v2 {
  1573. u32 rx_drops_no_fragments[136]; /* dwordS 0 to 135*/
  1574. u32 rsvd[3];
  1575. };
  1576. struct be_hw_stats_v2 {
  1577. struct be_rxf_stats_v2 rxf;
  1578. u32 rsvd0[BE_TXP_SW_SZ];
  1579. struct be_erx_stats_v2 erx;
  1580. struct be_pmem_stats pmem;
  1581. u32 rsvd1[18];
  1582. };
  1583. struct be_cmd_req_get_stats_v2 {
  1584. struct be_cmd_req_hdr hdr;
  1585. u8 rsvd[sizeof(struct be_hw_stats_v2)];
  1586. };
  1587. struct be_cmd_resp_get_stats_v2 {
  1588. struct be_cmd_resp_hdr hdr;
  1589. struct be_hw_stats_v2 hw_stats;
  1590. };
  1591. /************** get fat capabilites *******************/
  1592. #define MAX_MODULES 27
  1593. #define MAX_MODES 4
  1594. #define MODE_UART 0
  1595. #define FW_LOG_LEVEL_DEFAULT 48
  1596. #define FW_LOG_LEVEL_FATAL 64
  1597. struct ext_fat_mode {
  1598. u8 mode;
  1599. u8 rsvd0;
  1600. u16 port_mask;
  1601. u32 dbg_lvl;
  1602. u64 fun_mask;
  1603. } __packed;
  1604. struct ext_fat_modules {
  1605. u8 modules_str[32];
  1606. u32 modules_id;
  1607. u32 num_modes;
  1608. struct ext_fat_mode trace_lvl[MAX_MODES];
  1609. } __packed;
  1610. struct be_fat_conf_params {
  1611. u32 max_log_entries;
  1612. u32 log_entry_size;
  1613. u8 log_type;
  1614. u8 max_log_funs;
  1615. u8 max_log_ports;
  1616. u8 rsvd0;
  1617. u32 supp_modes;
  1618. u32 num_modules;
  1619. struct ext_fat_modules module[MAX_MODULES];
  1620. } __packed;
  1621. struct be_cmd_req_get_ext_fat_caps {
  1622. struct be_cmd_req_hdr hdr;
  1623. u32 parameter_type;
  1624. };
  1625. struct be_cmd_resp_get_ext_fat_caps {
  1626. struct be_cmd_resp_hdr hdr;
  1627. struct be_fat_conf_params get_params;
  1628. };
  1629. struct be_cmd_req_set_ext_fat_caps {
  1630. struct be_cmd_req_hdr hdr;
  1631. struct be_fat_conf_params set_params;
  1632. };
  1633. #define RESOURCE_DESC_SIZE_V0 72
  1634. #define RESOURCE_DESC_SIZE_V1 88
  1635. #define PCIE_RESOURCE_DESC_TYPE_V0 0x40
  1636. #define NIC_RESOURCE_DESC_TYPE_V0 0x41
  1637. #define PCIE_RESOURCE_DESC_TYPE_V1 0x50
  1638. #define NIC_RESOURCE_DESC_TYPE_V1 0x51
  1639. #define MAX_RESOURCE_DESC 264
  1640. /* QOS unit number */
  1641. #define QUN 4
  1642. /* Immediate */
  1643. #define IMM 6
  1644. /* No save */
  1645. #define NOSV 7
  1646. struct be_res_desc_hdr {
  1647. u8 desc_type;
  1648. u8 desc_len;
  1649. } __packed;
  1650. struct be_pcie_res_desc {
  1651. struct be_res_desc_hdr hdr;
  1652. u8 rsvd0;
  1653. u8 flags;
  1654. u16 rsvd1;
  1655. u8 pf_num;
  1656. u8 rsvd2;
  1657. u32 rsvd3;
  1658. u8 sriov_state;
  1659. u8 pf_state;
  1660. u8 pf_type;
  1661. u8 rsvd4;
  1662. u16 num_vfs;
  1663. u16 rsvd5;
  1664. u32 rsvd6[17];
  1665. } __packed;
  1666. struct be_nic_res_desc {
  1667. struct be_res_desc_hdr hdr;
  1668. u8 rsvd1;
  1669. u8 flags;
  1670. u8 vf_num;
  1671. u8 rsvd2;
  1672. u8 pf_num;
  1673. u8 rsvd3;
  1674. u16 unicast_mac_count;
  1675. u8 rsvd4[6];
  1676. u16 mcc_count;
  1677. u16 vlan_count;
  1678. u16 mcast_mac_count;
  1679. u16 txq_count;
  1680. u16 rq_count;
  1681. u16 rssq_count;
  1682. u16 lro_count;
  1683. u16 cq_count;
  1684. u16 toe_conn_count;
  1685. u16 eq_count;
  1686. u32 rsvd5;
  1687. u32 cap_flags;
  1688. u8 link_param;
  1689. u8 rsvd6[3];
  1690. u32 bw_min;
  1691. u32 bw_max;
  1692. u8 acpi_params;
  1693. u8 wol_param;
  1694. u16 rsvd7;
  1695. u32 rsvd8[7];
  1696. } __packed;
  1697. struct be_cmd_req_get_func_config {
  1698. struct be_cmd_req_hdr hdr;
  1699. };
  1700. struct be_cmd_resp_get_func_config {
  1701. struct be_cmd_resp_hdr hdr;
  1702. u32 desc_count;
  1703. u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE_V1];
  1704. };
  1705. #define ACTIVE_PROFILE_TYPE 0x2
  1706. struct be_cmd_req_get_profile_config {
  1707. struct be_cmd_req_hdr hdr;
  1708. u8 rsvd;
  1709. u8 type;
  1710. u16 rsvd1;
  1711. };
  1712. struct be_cmd_resp_get_profile_config {
  1713. struct be_cmd_resp_hdr hdr;
  1714. u32 desc_count;
  1715. u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE_V1];
  1716. };
  1717. struct be_cmd_req_set_profile_config {
  1718. struct be_cmd_req_hdr hdr;
  1719. u32 rsvd;
  1720. u32 desc_count;
  1721. struct be_nic_res_desc nic_desc;
  1722. };
  1723. struct be_cmd_resp_set_profile_config {
  1724. struct be_cmd_resp_hdr hdr;
  1725. };
  1726. struct be_cmd_enable_disable_vf {
  1727. struct be_cmd_req_hdr hdr;
  1728. u8 enable;
  1729. u8 rsvd[3];
  1730. };
  1731. struct be_cmd_req_intr_set {
  1732. struct be_cmd_req_hdr hdr;
  1733. u8 intr_enabled;
  1734. u8 rsvd[3];
  1735. };
  1736. static inline bool check_privilege(struct be_adapter *adapter, u32 flags)
  1737. {
  1738. return flags & adapter->cmd_privileges ? true : false;
  1739. }
  1740. /************** Get IFACE LIST *******************/
  1741. struct be_if_desc {
  1742. u32 if_id;
  1743. u32 cap_flags;
  1744. u32 en_flags;
  1745. };
  1746. struct be_cmd_req_get_iface_list {
  1747. struct be_cmd_req_hdr hdr;
  1748. };
  1749. struct be_cmd_resp_get_iface_list {
  1750. struct be_cmd_req_hdr hdr;
  1751. u32 if_cnt;
  1752. struct be_if_desc if_desc;
  1753. };
  1754. int be_pci_fnum_get(struct be_adapter *adapter);
  1755. int be_fw_wait_ready(struct be_adapter *adapter);
  1756. int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
  1757. bool permanent, u32 if_handle, u32 pmac_id);
  1758. int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, u32 if_id,
  1759. u32 *pmac_id, u32 domain);
  1760. int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, int pmac_id,
  1761. u32 domain);
  1762. int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
  1763. u32 *if_handle, u32 domain);
  1764. int be_cmd_if_destroy(struct be_adapter *adapter, int if_handle, u32 domain);
  1765. int be_cmd_eq_create(struct be_adapter *adapter, struct be_eq_obj *eqo);
  1766. int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq,
  1767. struct be_queue_info *eq, bool no_delay,
  1768. int num_cqe_dma_coalesce);
  1769. int be_cmd_mccq_create(struct be_adapter *adapter, struct be_queue_info *mccq,
  1770. struct be_queue_info *cq);
  1771. int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo);
  1772. int be_cmd_rxq_create(struct be_adapter *adapter, struct be_queue_info *rxq,
  1773. u16 cq_id, u16 frag_size, u32 if_id, u32 rss, u8 *rss_id);
  1774. int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
  1775. int type);
  1776. int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q);
  1777. int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
  1778. u8 *link_status, u32 dom);
  1779. int be_cmd_reset(struct be_adapter *adapter);
  1780. int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd);
  1781. int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
  1782. struct be_dma_mem *nonemb_cmd);
  1783. int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
  1784. char *fw_on_flash);
  1785. int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num);
  1786. int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
  1787. u32 num, bool untagged, bool promiscuous);
  1788. int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
  1789. int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc);
  1790. int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc);
  1791. int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
  1792. u32 *function_mode, u32 *function_caps, u16 *asic_rev);
  1793. int be_cmd_reset_function(struct be_adapter *adapter);
  1794. int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
  1795. u32 rss_hash_opts, u16 table_size);
  1796. int be_process_mcc(struct be_adapter *adapter);
  1797. int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon,
  1798. u8 status, u8 state);
  1799. int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num,
  1800. u32 *state);
  1801. int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
  1802. u32 flash_oper, u32 flash_opcode, u32 buf_size);
  1803. int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
  1804. u32 data_size, u32 data_offset,
  1805. const char *obj_name, u32 *data_written,
  1806. u8 *change_status, u8 *addn_status);
  1807. int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
  1808. u32 data_size, u32 data_offset, const char *obj_name,
  1809. u32 *data_read, u32 *eof, u8 *addn_status);
  1810. int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
  1811. int offset);
  1812. int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
  1813. struct be_dma_mem *nonemb_cmd);
  1814. int be_cmd_fw_init(struct be_adapter *adapter);
  1815. int be_cmd_fw_clean(struct be_adapter *adapter);
  1816. void be_async_mcc_enable(struct be_adapter *adapter);
  1817. void be_async_mcc_disable(struct be_adapter *adapter);
  1818. int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
  1819. u32 loopback_type, u32 pkt_size, u32 num_pkts,
  1820. u64 pattern);
  1821. int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, u32 byte_cnt,
  1822. struct be_dma_mem *cmd);
  1823. int be_cmd_get_seeprom_data(struct be_adapter *adapter,
  1824. struct be_dma_mem *nonemb_cmd);
  1825. int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
  1826. u8 loopback_type, u8 enable);
  1827. int be_cmd_get_phy_info(struct be_adapter *adapter);
  1828. int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
  1829. void be_detect_error(struct be_adapter *adapter);
  1830. int be_cmd_get_die_temperature(struct be_adapter *adapter);
  1831. int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
  1832. int be_cmd_req_native_mode(struct be_adapter *adapter);
  1833. int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
  1834. void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
  1835. int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
  1836. u32 domain);
  1837. int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
  1838. u32 vf_num);
  1839. int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
  1840. bool *pmac_id_active, u32 *pmac_id, u8 domain);
  1841. int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac);
  1842. int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac);
  1843. int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, u8 mac_count,
  1844. u32 domain);
  1845. int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom);
  1846. int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, u32 domain,
  1847. u16 intf_id, u16 hsw_mode);
  1848. int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, u32 domain,
  1849. u16 intf_id, u8 *mode);
  1850. int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter);
  1851. int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter,
  1852. struct be_dma_mem *cmd);
  1853. int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter,
  1854. struct be_dma_mem *cmd,
  1855. struct be_fat_conf_params *cfgs);
  1856. int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask);
  1857. int lancer_initiate_dump(struct be_adapter *adapter);
  1858. bool dump_present(struct be_adapter *adapter);
  1859. int lancer_test_and_set_rdy_state(struct be_adapter *adapter);
  1860. int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name);
  1861. int be_cmd_get_func_config(struct be_adapter *adapter,
  1862. struct be_resources *res);
  1863. int be_cmd_get_profile_config(struct be_adapter *adapter,
  1864. struct be_resources *res, u8 domain);
  1865. int be_cmd_set_profile_config(struct be_adapter *adapter, u32 bps, u8 domain);
  1866. int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg,
  1867. int vf_num);
  1868. int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain);
  1869. int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable);