be_cmds.h 53 KB

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