be_cmds.h 48 KB

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