be_cmds.h 51 KB

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