be_cmds.h 49 KB

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