be_cmds.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509
  1. /*
  2. * Copyright (C) 2005 - 2011 Emulex
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License version 2
  7. * as published by the Free Software Foundation. The full GNU General
  8. * Public License is included in this distribution in the file called COPYING.
  9. *
  10. * Contact Information:
  11. * linux-drivers@emulex.com
  12. *
  13. * Emulex
  14. * 3333 Susan Street
  15. * Costa Mesa, CA 92626
  16. */
  17. /*
  18. * The driver sends configuration and managements command requests to the
  19. * firmware in the BE. These requests are communicated to the processor
  20. * using Work Request Blocks (WRBs) submitted to the MCC-WRB ring or via one
  21. * WRB inside a MAILBOX.
  22. * The commands are serviced by the ARM processor in the BladeEngine's MPU.
  23. */
  24. struct be_sge {
  25. u32 pa_lo;
  26. u32 pa_hi;
  27. u32 len;
  28. };
  29. #define MCC_WRB_EMBEDDED_MASK 1 /* bit 0 of dword 0*/
  30. #define MCC_WRB_SGE_CNT_SHIFT 3 /* bits 3 - 7 of dword 0 */
  31. #define MCC_WRB_SGE_CNT_MASK 0x1F /* bits 3 - 7 of dword 0 */
  32. struct be_mcc_wrb {
  33. u32 embedded; /* dword 0 */
  34. u32 payload_length; /* dword 1 */
  35. u32 tag0; /* dword 2 */
  36. u32 tag1; /* dword 3 */
  37. u32 rsvd; /* dword 4 */
  38. union {
  39. u8 embedded_payload[236]; /* used by embedded cmds */
  40. struct be_sge sgl[19]; /* used by non-embedded cmds */
  41. } payload;
  42. };
  43. #define CQE_FLAGS_VALID_MASK (1 << 31)
  44. #define CQE_FLAGS_ASYNC_MASK (1 << 30)
  45. #define CQE_FLAGS_COMPLETED_MASK (1 << 28)
  46. #define CQE_FLAGS_CONSUMED_MASK (1 << 27)
  47. /* Completion Status */
  48. enum {
  49. MCC_STATUS_SUCCESS = 0,
  50. MCC_STATUS_FAILED = 1,
  51. MCC_STATUS_ILLEGAL_REQUEST = 2,
  52. MCC_STATUS_ILLEGAL_FIELD = 3,
  53. MCC_STATUS_INSUFFICIENT_BUFFER = 4,
  54. MCC_STATUS_UNAUTHORIZED_REQUEST = 5,
  55. MCC_STATUS_NOT_SUPPORTED = 66
  56. };
  57. #define CQE_STATUS_COMPL_MASK 0xFFFF
  58. #define CQE_STATUS_COMPL_SHIFT 0 /* bits 0 - 15 */
  59. #define CQE_STATUS_EXTD_MASK 0xFFFF
  60. #define CQE_STATUS_EXTD_SHIFT 16 /* bits 16 - 31 */
  61. struct be_mcc_compl {
  62. u32 status; /* dword 0 */
  63. u32 tag0; /* dword 1 */
  64. u32 tag1; /* dword 2 */
  65. u32 flags; /* dword 3 */
  66. };
  67. /* When the async bit of mcc_compl is set, the last 4 bytes of
  68. * mcc_compl is interpreted as follows:
  69. */
  70. #define ASYNC_TRAILER_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
  71. #define ASYNC_TRAILER_EVENT_CODE_MASK 0xFF
  72. #define ASYNC_TRAILER_EVENT_TYPE_SHIFT 16
  73. #define ASYNC_TRAILER_EVENT_TYPE_MASK 0xFF
  74. #define ASYNC_EVENT_CODE_LINK_STATE 0x1
  75. #define ASYNC_EVENT_CODE_GRP_5 0x5
  76. #define ASYNC_EVENT_QOS_SPEED 0x1
  77. #define ASYNC_EVENT_COS_PRIORITY 0x2
  78. #define ASYNC_EVENT_PVID_STATE 0x3
  79. struct be_async_event_trailer {
  80. u32 code;
  81. };
  82. enum {
  83. LINK_DOWN = 0x0,
  84. LINK_UP = 0x1
  85. };
  86. #define LINK_STATUS_MASK 0x1
  87. /* When the event code of an async trailer is link-state, the mcc_compl
  88. * must be interpreted as follows
  89. */
  90. struct be_async_event_link_state {
  91. u8 physical_port;
  92. u8 port_link_status;
  93. u8 port_duplex;
  94. u8 port_speed;
  95. u8 port_fault;
  96. u8 rsvd0[7];
  97. struct be_async_event_trailer trailer;
  98. } __packed;
  99. /* When the event code of an async trailer is GRP-5 and event_type is QOS_SPEED
  100. * the mcc_compl must be interpreted as follows
  101. */
  102. struct be_async_event_grp5_qos_link_speed {
  103. u8 physical_port;
  104. u8 rsvd[5];
  105. u16 qos_link_speed;
  106. u32 event_tag;
  107. struct be_async_event_trailer trailer;
  108. } __packed;
  109. /* When the event code of an async trailer is GRP5 and event type is
  110. * CoS-Priority, the mcc_compl must be interpreted as follows
  111. */
  112. struct be_async_event_grp5_cos_priority {
  113. u8 physical_port;
  114. u8 available_priority_bmap;
  115. u8 reco_default_priority;
  116. u8 valid;
  117. u8 rsvd0;
  118. u8 event_tag;
  119. struct be_async_event_trailer trailer;
  120. } __packed;
  121. /* When the event code of an async trailer is GRP5 and event type is
  122. * PVID state, the mcc_compl must be interpreted as follows
  123. */
  124. struct be_async_event_grp5_pvid_state {
  125. u8 enabled;
  126. u8 rsvd0;
  127. u16 tag;
  128. u32 event_tag;
  129. u32 rsvd1;
  130. struct be_async_event_trailer trailer;
  131. } __packed;
  132. struct be_mcc_mailbox {
  133. struct be_mcc_wrb wrb;
  134. struct be_mcc_compl compl;
  135. };
  136. #define CMD_SUBSYSTEM_COMMON 0x1
  137. #define CMD_SUBSYSTEM_ETH 0x3
  138. #define CMD_SUBSYSTEM_LOWLEVEL 0xb
  139. #define OPCODE_COMMON_NTWK_MAC_QUERY 1
  140. #define OPCODE_COMMON_NTWK_MAC_SET 2
  141. #define OPCODE_COMMON_NTWK_MULTICAST_SET 3
  142. #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
  143. #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
  144. #define OPCODE_COMMON_READ_FLASHROM 6
  145. #define OPCODE_COMMON_WRITE_FLASHROM 7
  146. #define OPCODE_COMMON_CQ_CREATE 12
  147. #define OPCODE_COMMON_EQ_CREATE 13
  148. #define OPCODE_COMMON_MCC_CREATE 21
  149. #define OPCODE_COMMON_SET_QOS 28
  150. #define OPCODE_COMMON_MCC_CREATE_EXT 90
  151. #define OPCODE_COMMON_SEEPROM_READ 30
  152. #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
  153. #define OPCODE_COMMON_NTWK_RX_FILTER 34
  154. #define OPCODE_COMMON_GET_FW_VERSION 35
  155. #define OPCODE_COMMON_SET_FLOW_CONTROL 36
  156. #define OPCODE_COMMON_GET_FLOW_CONTROL 37
  157. #define OPCODE_COMMON_SET_FRAME_SIZE 39
  158. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  159. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  160. #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50
  161. #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51
  162. #define OPCODE_COMMON_MCC_DESTROY 53
  163. #define OPCODE_COMMON_CQ_DESTROY 54
  164. #define OPCODE_COMMON_EQ_DESTROY 55
  165. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  166. #define OPCODE_COMMON_NTWK_PMAC_ADD 59
  167. #define OPCODE_COMMON_NTWK_PMAC_DEL 60
  168. #define OPCODE_COMMON_FUNCTION_RESET 61
  169. #define OPCODE_COMMON_MANAGE_FAT 68
  170. #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69
  171. #define OPCODE_COMMON_GET_BEACON_STATE 70
  172. #define OPCODE_COMMON_READ_TRANSRECV_DATA 73
  173. #define OPCODE_COMMON_GET_PHY_DETAILS 102
  174. #define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103
  175. #define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
  176. #define OPCODE_COMMON_WRITE_OBJECT 172
  177. #define OPCODE_ETH_RSS_CONFIG 1
  178. #define OPCODE_ETH_ACPI_CONFIG 2
  179. #define OPCODE_ETH_PROMISCUOUS 3
  180. #define OPCODE_ETH_GET_STATISTICS 4
  181. #define OPCODE_ETH_TX_CREATE 7
  182. #define OPCODE_ETH_RX_CREATE 8
  183. #define OPCODE_ETH_TX_DESTROY 9
  184. #define OPCODE_ETH_RX_DESTROY 10
  185. #define OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG 12
  186. #define OPCODE_ETH_GET_PPORT_STATS 18
  187. #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17
  188. #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18
  189. #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19
  190. struct be_cmd_req_hdr {
  191. u8 opcode; /* dword 0 */
  192. u8 subsystem; /* dword 0 */
  193. u8 port_number; /* dword 0 */
  194. u8 domain; /* dword 0 */
  195. u32 timeout; /* dword 1 */
  196. u32 request_length; /* dword 2 */
  197. u8 version; /* dword 3 */
  198. u8 rsvd[3]; /* dword 3 */
  199. };
  200. #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
  201. #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */
  202. struct be_cmd_resp_hdr {
  203. u32 info; /* dword 0 */
  204. u32 status; /* dword 1 */
  205. u32 response_length; /* dword 2 */
  206. u32 actual_resp_len; /* dword 3 */
  207. };
  208. struct phys_addr {
  209. u32 lo;
  210. u32 hi;
  211. };
  212. /**************************
  213. * BE Command definitions *
  214. **************************/
  215. /* Pseudo amap definition in which each bit of the actual structure is defined
  216. * as a byte: used to calculate offset/shift/mask of each field */
  217. struct amap_eq_context {
  218. u8 cidx[13]; /* dword 0*/
  219. u8 rsvd0[3]; /* dword 0*/
  220. u8 epidx[13]; /* dword 0*/
  221. u8 valid; /* dword 0*/
  222. u8 rsvd1; /* dword 0*/
  223. u8 size; /* dword 0*/
  224. u8 pidx[13]; /* dword 1*/
  225. u8 rsvd2[3]; /* dword 1*/
  226. u8 pd[10]; /* dword 1*/
  227. u8 count[3]; /* dword 1*/
  228. u8 solevent; /* dword 1*/
  229. u8 stalled; /* dword 1*/
  230. u8 armed; /* dword 1*/
  231. u8 rsvd3[4]; /* dword 2*/
  232. u8 func[8]; /* dword 2*/
  233. u8 rsvd4; /* dword 2*/
  234. u8 delaymult[10]; /* dword 2*/
  235. u8 rsvd5[2]; /* dword 2*/
  236. u8 phase[2]; /* dword 2*/
  237. u8 nodelay; /* dword 2*/
  238. u8 rsvd6[4]; /* dword 2*/
  239. u8 rsvd7[32]; /* dword 3*/
  240. } __packed;
  241. struct be_cmd_req_eq_create {
  242. struct be_cmd_req_hdr hdr;
  243. u16 num_pages; /* sword */
  244. u16 rsvd0; /* sword */
  245. u8 context[sizeof(struct amap_eq_context) / 8];
  246. struct phys_addr pages[8];
  247. } __packed;
  248. struct be_cmd_resp_eq_create {
  249. struct be_cmd_resp_hdr resp_hdr;
  250. u16 eq_id; /* sword */
  251. u16 rsvd0; /* sword */
  252. } __packed;
  253. /******************** Mac query ***************************/
  254. enum {
  255. MAC_ADDRESS_TYPE_STORAGE = 0x0,
  256. MAC_ADDRESS_TYPE_NETWORK = 0x1,
  257. MAC_ADDRESS_TYPE_PD = 0x2,
  258. MAC_ADDRESS_TYPE_MANAGEMENT = 0x3
  259. };
  260. struct mac_addr {
  261. u16 size_of_struct;
  262. u8 addr[ETH_ALEN];
  263. } __packed;
  264. struct be_cmd_req_mac_query {
  265. struct be_cmd_req_hdr hdr;
  266. u8 type;
  267. u8 permanent;
  268. u16 if_id;
  269. } __packed;
  270. struct be_cmd_resp_mac_query {
  271. struct be_cmd_resp_hdr hdr;
  272. struct mac_addr mac;
  273. };
  274. /******************** PMac Add ***************************/
  275. struct be_cmd_req_pmac_add {
  276. struct be_cmd_req_hdr hdr;
  277. u32 if_id;
  278. u8 mac_address[ETH_ALEN];
  279. u8 rsvd0[2];
  280. } __packed;
  281. struct be_cmd_resp_pmac_add {
  282. struct be_cmd_resp_hdr hdr;
  283. u32 pmac_id;
  284. };
  285. /******************** PMac Del ***************************/
  286. struct be_cmd_req_pmac_del {
  287. struct be_cmd_req_hdr hdr;
  288. u32 if_id;
  289. u32 pmac_id;
  290. };
  291. /******************** Create CQ ***************************/
  292. /* Pseudo amap definition in which each bit of the actual structure is defined
  293. * as a byte: used to calculate offset/shift/mask of each field */
  294. struct amap_cq_context_be {
  295. u8 cidx[11]; /* dword 0*/
  296. u8 rsvd0; /* dword 0*/
  297. u8 coalescwm[2]; /* dword 0*/
  298. u8 nodelay; /* dword 0*/
  299. u8 epidx[11]; /* dword 0*/
  300. u8 rsvd1; /* dword 0*/
  301. u8 count[2]; /* dword 0*/
  302. u8 valid; /* dword 0*/
  303. u8 solevent; /* dword 0*/
  304. u8 eventable; /* dword 0*/
  305. u8 pidx[11]; /* dword 1*/
  306. u8 rsvd2; /* dword 1*/
  307. u8 pd[10]; /* dword 1*/
  308. u8 eqid[8]; /* dword 1*/
  309. u8 stalled; /* dword 1*/
  310. u8 armed; /* dword 1*/
  311. u8 rsvd3[4]; /* dword 2*/
  312. u8 func[8]; /* dword 2*/
  313. u8 rsvd4[20]; /* dword 2*/
  314. u8 rsvd5[32]; /* dword 3*/
  315. } __packed;
  316. struct amap_cq_context_lancer {
  317. u8 rsvd0[12]; /* dword 0*/
  318. u8 coalescwm[2]; /* dword 0*/
  319. u8 nodelay; /* dword 0*/
  320. u8 rsvd1[12]; /* dword 0*/
  321. u8 count[2]; /* dword 0*/
  322. u8 valid; /* dword 0*/
  323. u8 rsvd2; /* dword 0*/
  324. u8 eventable; /* dword 0*/
  325. u8 eqid[16]; /* dword 1*/
  326. u8 rsvd3[15]; /* dword 1*/
  327. u8 armed; /* dword 1*/
  328. u8 rsvd4[32]; /* dword 2*/
  329. u8 rsvd5[32]; /* dword 3*/
  330. } __packed;
  331. struct be_cmd_req_cq_create {
  332. struct be_cmd_req_hdr hdr;
  333. u16 num_pages;
  334. u8 page_size;
  335. u8 rsvd0;
  336. u8 context[sizeof(struct amap_cq_context_be) / 8];
  337. struct phys_addr pages[8];
  338. } __packed;
  339. struct be_cmd_resp_cq_create {
  340. struct be_cmd_resp_hdr hdr;
  341. u16 cq_id;
  342. u16 rsvd0;
  343. } __packed;
  344. struct be_cmd_req_get_fat {
  345. struct be_cmd_req_hdr hdr;
  346. u32 fat_operation;
  347. u32 read_log_offset;
  348. u32 read_log_length;
  349. u32 data_buffer_size;
  350. u32 data_buffer[1];
  351. } __packed;
  352. struct be_cmd_resp_get_fat {
  353. struct be_cmd_resp_hdr hdr;
  354. u32 log_size;
  355. u32 read_log_length;
  356. u32 rsvd[2];
  357. u32 data_buffer[1];
  358. } __packed;
  359. /******************** Create MCCQ ***************************/
  360. /* Pseudo amap definition in which each bit of the actual structure is defined
  361. * as a byte: used to calculate offset/shift/mask of each field */
  362. struct amap_mcc_context_be {
  363. u8 con_index[14];
  364. u8 rsvd0[2];
  365. u8 ring_size[4];
  366. u8 fetch_wrb;
  367. u8 fetch_r2t;
  368. u8 cq_id[10];
  369. u8 prod_index[14];
  370. u8 fid[8];
  371. u8 pdid[9];
  372. u8 valid;
  373. u8 rsvd1[32];
  374. u8 rsvd2[32];
  375. } __packed;
  376. struct amap_mcc_context_lancer {
  377. u8 async_cq_id[16];
  378. u8 ring_size[4];
  379. u8 rsvd0[12];
  380. u8 rsvd1[31];
  381. u8 valid;
  382. u8 async_cq_valid[1];
  383. u8 rsvd2[31];
  384. u8 rsvd3[32];
  385. } __packed;
  386. struct be_cmd_req_mcc_create {
  387. struct be_cmd_req_hdr hdr;
  388. u16 num_pages;
  389. u16 cq_id;
  390. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  391. struct phys_addr pages[8];
  392. } __packed;
  393. struct be_cmd_req_mcc_ext_create {
  394. struct be_cmd_req_hdr hdr;
  395. u16 num_pages;
  396. u16 cq_id;
  397. u32 async_event_bitmap[1];
  398. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  399. struct phys_addr pages[8];
  400. } __packed;
  401. struct be_cmd_resp_mcc_create {
  402. struct be_cmd_resp_hdr hdr;
  403. u16 id;
  404. u16 rsvd0;
  405. } __packed;
  406. /******************** Create TxQ ***************************/
  407. #define BE_ETH_TX_RING_TYPE_STANDARD 2
  408. #define BE_ULP1_NUM 1
  409. /* Pseudo amap definition in which each bit of the actual structure is defined
  410. * as a byte: used to calculate offset/shift/mask of each field */
  411. struct amap_tx_context {
  412. u8 if_id[16]; /* dword 0 */
  413. u8 tx_ring_size[4]; /* dword 0 */
  414. u8 rsvd1[26]; /* dword 0 */
  415. u8 pci_func_id[8]; /* dword 1 */
  416. u8 rsvd2[9]; /* dword 1 */
  417. u8 ctx_valid; /* dword 1 */
  418. u8 cq_id_send[16]; /* dword 2 */
  419. u8 rsvd3[16]; /* dword 2 */
  420. u8 rsvd4[32]; /* dword 3 */
  421. u8 rsvd5[32]; /* dword 4 */
  422. u8 rsvd6[32]; /* dword 5 */
  423. u8 rsvd7[32]; /* dword 6 */
  424. u8 rsvd8[32]; /* dword 7 */
  425. u8 rsvd9[32]; /* dword 8 */
  426. u8 rsvd10[32]; /* dword 9 */
  427. u8 rsvd11[32]; /* dword 10 */
  428. u8 rsvd12[32]; /* dword 11 */
  429. u8 rsvd13[32]; /* dword 12 */
  430. u8 rsvd14[32]; /* dword 13 */
  431. u8 rsvd15[32]; /* dword 14 */
  432. u8 rsvd16[32]; /* dword 15 */
  433. } __packed;
  434. struct be_cmd_req_eth_tx_create {
  435. struct be_cmd_req_hdr hdr;
  436. u8 num_pages;
  437. u8 ulp_num;
  438. u8 type;
  439. u8 bound_port;
  440. u8 context[sizeof(struct amap_tx_context) / 8];
  441. struct phys_addr pages[8];
  442. } __packed;
  443. struct be_cmd_resp_eth_tx_create {
  444. struct be_cmd_resp_hdr hdr;
  445. u16 cid;
  446. u16 rsvd0;
  447. } __packed;
  448. /******************** Create RxQ ***************************/
  449. struct be_cmd_req_eth_rx_create {
  450. struct be_cmd_req_hdr hdr;
  451. u16 cq_id;
  452. u8 frag_size;
  453. u8 num_pages;
  454. struct phys_addr pages[2];
  455. u32 interface_id;
  456. u16 max_frame_size;
  457. u16 rsvd0;
  458. u32 rss_queue;
  459. } __packed;
  460. struct be_cmd_resp_eth_rx_create {
  461. struct be_cmd_resp_hdr hdr;
  462. u16 id;
  463. u8 rss_id;
  464. u8 rsvd0;
  465. } __packed;
  466. /******************** Q Destroy ***************************/
  467. /* Type of Queue to be destroyed */
  468. enum {
  469. QTYPE_EQ = 1,
  470. QTYPE_CQ,
  471. QTYPE_TXQ,
  472. QTYPE_RXQ,
  473. QTYPE_MCCQ
  474. };
  475. struct be_cmd_req_q_destroy {
  476. struct be_cmd_req_hdr hdr;
  477. u16 id;
  478. u16 bypass_flush; /* valid only for rx q destroy */
  479. } __packed;
  480. /************ I/f Create (it's actually I/f Config Create)**********/
  481. /* Capability flags for the i/f */
  482. enum be_if_flags {
  483. BE_IF_FLAGS_RSS = 0x4,
  484. BE_IF_FLAGS_PROMISCUOUS = 0x8,
  485. BE_IF_FLAGS_BROADCAST = 0x10,
  486. BE_IF_FLAGS_UNTAGGED = 0x20,
  487. BE_IF_FLAGS_ULP = 0x40,
  488. BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80,
  489. BE_IF_FLAGS_VLAN = 0x100,
  490. BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200,
  491. BE_IF_FLAGS_PASS_L2_ERRORS = 0x400,
  492. BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800,
  493. BE_IF_FLAGS_MULTICAST = 0x1000
  494. };
  495. /* An RX interface is an object with one or more MAC addresses and
  496. * filtering capabilities. */
  497. struct be_cmd_req_if_create {
  498. struct be_cmd_req_hdr hdr;
  499. u32 version; /* ignore currently */
  500. u32 capability_flags;
  501. u32 enable_flags;
  502. u8 mac_addr[ETH_ALEN];
  503. u8 rsvd0;
  504. u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */
  505. u32 vlan_tag; /* not used currently */
  506. } __packed;
  507. struct be_cmd_resp_if_create {
  508. struct be_cmd_resp_hdr hdr;
  509. u32 interface_id;
  510. u32 pmac_id;
  511. };
  512. /****** I/f Destroy(it's actually I/f Config Destroy )**********/
  513. struct be_cmd_req_if_destroy {
  514. struct be_cmd_req_hdr hdr;
  515. u32 interface_id;
  516. };
  517. /*************** HW Stats Get **********************************/
  518. struct be_port_rxf_stats_v0 {
  519. u32 rx_bytes_lsd; /* dword 0*/
  520. u32 rx_bytes_msd; /* dword 1*/
  521. u32 rx_total_frames; /* dword 2*/
  522. u32 rx_unicast_frames; /* dword 3*/
  523. u32 rx_multicast_frames; /* dword 4*/
  524. u32 rx_broadcast_frames; /* dword 5*/
  525. u32 rx_crc_errors; /* dword 6*/
  526. u32 rx_alignment_symbol_errors; /* dword 7*/
  527. u32 rx_pause_frames; /* dword 8*/
  528. u32 rx_control_frames; /* dword 9*/
  529. u32 rx_in_range_errors; /* dword 10*/
  530. u32 rx_out_range_errors; /* dword 11*/
  531. u32 rx_frame_too_long; /* dword 12*/
  532. u32 rx_address_match_errors; /* dword 13*/
  533. u32 rx_vlan_mismatch; /* dword 14*/
  534. u32 rx_dropped_too_small; /* dword 15*/
  535. u32 rx_dropped_too_short; /* dword 16*/
  536. u32 rx_dropped_header_too_small; /* dword 17*/
  537. u32 rx_dropped_tcp_length; /* dword 18*/
  538. u32 rx_dropped_runt; /* dword 19*/
  539. u32 rx_64_byte_packets; /* dword 20*/
  540. u32 rx_65_127_byte_packets; /* dword 21*/
  541. u32 rx_128_256_byte_packets; /* dword 22*/
  542. u32 rx_256_511_byte_packets; /* dword 23*/
  543. u32 rx_512_1023_byte_packets; /* dword 24*/
  544. u32 rx_1024_1518_byte_packets; /* dword 25*/
  545. u32 rx_1519_2047_byte_packets; /* dword 26*/
  546. u32 rx_2048_4095_byte_packets; /* dword 27*/
  547. u32 rx_4096_8191_byte_packets; /* dword 28*/
  548. u32 rx_8192_9216_byte_packets; /* dword 29*/
  549. u32 rx_ip_checksum_errs; /* dword 30*/
  550. u32 rx_tcp_checksum_errs; /* dword 31*/
  551. u32 rx_udp_checksum_errs; /* dword 32*/
  552. u32 rx_non_rss_packets; /* dword 33*/
  553. u32 rx_ipv4_packets; /* dword 34*/
  554. u32 rx_ipv6_packets; /* dword 35*/
  555. u32 rx_ipv4_bytes_lsd; /* dword 36*/
  556. u32 rx_ipv4_bytes_msd; /* dword 37*/
  557. u32 rx_ipv6_bytes_lsd; /* dword 38*/
  558. u32 rx_ipv6_bytes_msd; /* dword 39*/
  559. u32 rx_chute1_packets; /* dword 40*/
  560. u32 rx_chute2_packets; /* dword 41*/
  561. u32 rx_chute3_packets; /* dword 42*/
  562. u32 rx_management_packets; /* dword 43*/
  563. u32 rx_switched_unicast_packets; /* dword 44*/
  564. u32 rx_switched_multicast_packets; /* dword 45*/
  565. u32 rx_switched_broadcast_packets; /* dword 46*/
  566. u32 tx_bytes_lsd; /* dword 47*/
  567. u32 tx_bytes_msd; /* dword 48*/
  568. u32 tx_unicastframes; /* dword 49*/
  569. u32 tx_multicastframes; /* dword 50*/
  570. u32 tx_broadcastframes; /* dword 51*/
  571. u32 tx_pauseframes; /* dword 52*/
  572. u32 tx_controlframes; /* dword 53*/
  573. u32 tx_64_byte_packets; /* dword 54*/
  574. u32 tx_65_127_byte_packets; /* dword 55*/
  575. u32 tx_128_256_byte_packets; /* dword 56*/
  576. u32 tx_256_511_byte_packets; /* dword 57*/
  577. u32 tx_512_1023_byte_packets; /* dword 58*/
  578. u32 tx_1024_1518_byte_packets; /* dword 59*/
  579. u32 tx_1519_2047_byte_packets; /* dword 60*/
  580. u32 tx_2048_4095_byte_packets; /* dword 61*/
  581. u32 tx_4096_8191_byte_packets; /* dword 62*/
  582. u32 tx_8192_9216_byte_packets; /* dword 63*/
  583. u32 rx_fifo_overflow; /* dword 64*/
  584. u32 rx_input_fifo_overflow; /* dword 65*/
  585. };
  586. struct be_rxf_stats_v0 {
  587. struct be_port_rxf_stats_v0 port[2];
  588. u32 rx_drops_no_pbuf; /* dword 132*/
  589. u32 rx_drops_no_txpb; /* dword 133*/
  590. u32 rx_drops_no_erx_descr; /* dword 134*/
  591. u32 rx_drops_no_tpre_descr; /* dword 135*/
  592. u32 management_rx_port_packets; /* dword 136*/
  593. u32 management_rx_port_bytes; /* dword 137*/
  594. u32 management_rx_port_pause_frames; /* dword 138*/
  595. u32 management_rx_port_errors; /* dword 139*/
  596. u32 management_tx_port_packets; /* dword 140*/
  597. u32 management_tx_port_bytes; /* dword 141*/
  598. u32 management_tx_port_pause; /* dword 142*/
  599. u32 management_rx_port_rxfifo_overflow; /* dword 143*/
  600. u32 rx_drops_too_many_frags; /* dword 144*/
  601. u32 rx_drops_invalid_ring; /* dword 145*/
  602. u32 forwarded_packets; /* dword 146*/
  603. u32 rx_drops_mtu; /* dword 147*/
  604. u32 rsvd0[7];
  605. u32 port0_jabber_events;
  606. u32 port1_jabber_events;
  607. u32 rsvd1[6];
  608. };
  609. struct be_erx_stats_v0 {
  610. u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/
  611. u32 rsvd[4];
  612. };
  613. struct be_pmem_stats {
  614. u32 eth_red_drops;
  615. u32 rsvd[5];
  616. };
  617. struct be_hw_stats_v0 {
  618. struct be_rxf_stats_v0 rxf;
  619. u32 rsvd[48];
  620. struct be_erx_stats_v0 erx;
  621. struct be_pmem_stats pmem;
  622. };
  623. struct be_cmd_req_get_stats_v0 {
  624. struct be_cmd_req_hdr hdr;
  625. u8 rsvd[sizeof(struct be_hw_stats_v0)];
  626. };
  627. struct be_cmd_resp_get_stats_v0 {
  628. struct be_cmd_resp_hdr hdr;
  629. struct be_hw_stats_v0 hw_stats;
  630. };
  631. struct lancer_pport_stats {
  632. u32 tx_packets_lo;
  633. u32 tx_packets_hi;
  634. u32 tx_unicast_packets_lo;
  635. u32 tx_unicast_packets_hi;
  636. u32 tx_multicast_packets_lo;
  637. u32 tx_multicast_packets_hi;
  638. u32 tx_broadcast_packets_lo;
  639. u32 tx_broadcast_packets_hi;
  640. u32 tx_bytes_lo;
  641. u32 tx_bytes_hi;
  642. u32 tx_unicast_bytes_lo;
  643. u32 tx_unicast_bytes_hi;
  644. u32 tx_multicast_bytes_lo;
  645. u32 tx_multicast_bytes_hi;
  646. u32 tx_broadcast_bytes_lo;
  647. u32 tx_broadcast_bytes_hi;
  648. u32 tx_discards_lo;
  649. u32 tx_discards_hi;
  650. u32 tx_errors_lo;
  651. u32 tx_errors_hi;
  652. u32 tx_pause_frames_lo;
  653. u32 tx_pause_frames_hi;
  654. u32 tx_pause_on_frames_lo;
  655. u32 tx_pause_on_frames_hi;
  656. u32 tx_pause_off_frames_lo;
  657. u32 tx_pause_off_frames_hi;
  658. u32 tx_internal_mac_errors_lo;
  659. u32 tx_internal_mac_errors_hi;
  660. u32 tx_control_frames_lo;
  661. u32 tx_control_frames_hi;
  662. u32 tx_packets_64_bytes_lo;
  663. u32 tx_packets_64_bytes_hi;
  664. u32 tx_packets_65_to_127_bytes_lo;
  665. u32 tx_packets_65_to_127_bytes_hi;
  666. u32 tx_packets_128_to_255_bytes_lo;
  667. u32 tx_packets_128_to_255_bytes_hi;
  668. u32 tx_packets_256_to_511_bytes_lo;
  669. u32 tx_packets_256_to_511_bytes_hi;
  670. u32 tx_packets_512_to_1023_bytes_lo;
  671. u32 tx_packets_512_to_1023_bytes_hi;
  672. u32 tx_packets_1024_to_1518_bytes_lo;
  673. u32 tx_packets_1024_to_1518_bytes_hi;
  674. u32 tx_packets_1519_to_2047_bytes_lo;
  675. u32 tx_packets_1519_to_2047_bytes_hi;
  676. u32 tx_packets_2048_to_4095_bytes_lo;
  677. u32 tx_packets_2048_to_4095_bytes_hi;
  678. u32 tx_packets_4096_to_8191_bytes_lo;
  679. u32 tx_packets_4096_to_8191_bytes_hi;
  680. u32 tx_packets_8192_to_9216_bytes_lo;
  681. u32 tx_packets_8192_to_9216_bytes_hi;
  682. u32 tx_lso_packets_lo;
  683. u32 tx_lso_packets_hi;
  684. u32 rx_packets_lo;
  685. u32 rx_packets_hi;
  686. u32 rx_unicast_packets_lo;
  687. u32 rx_unicast_packets_hi;
  688. u32 rx_multicast_packets_lo;
  689. u32 rx_multicast_packets_hi;
  690. u32 rx_broadcast_packets_lo;
  691. u32 rx_broadcast_packets_hi;
  692. u32 rx_bytes_lo;
  693. u32 rx_bytes_hi;
  694. u32 rx_unicast_bytes_lo;
  695. u32 rx_unicast_bytes_hi;
  696. u32 rx_multicast_bytes_lo;
  697. u32 rx_multicast_bytes_hi;
  698. u32 rx_broadcast_bytes_lo;
  699. u32 rx_broadcast_bytes_hi;
  700. u32 rx_unknown_protos;
  701. u32 rsvd_69; /* Word 69 is reserved */
  702. u32 rx_discards_lo;
  703. u32 rx_discards_hi;
  704. u32 rx_errors_lo;
  705. u32 rx_errors_hi;
  706. u32 rx_crc_errors_lo;
  707. u32 rx_crc_errors_hi;
  708. u32 rx_alignment_errors_lo;
  709. u32 rx_alignment_errors_hi;
  710. u32 rx_symbol_errors_lo;
  711. u32 rx_symbol_errors_hi;
  712. u32 rx_pause_frames_lo;
  713. u32 rx_pause_frames_hi;
  714. u32 rx_pause_on_frames_lo;
  715. u32 rx_pause_on_frames_hi;
  716. u32 rx_pause_off_frames_lo;
  717. u32 rx_pause_off_frames_hi;
  718. u32 rx_frames_too_long_lo;
  719. u32 rx_frames_too_long_hi;
  720. u32 rx_internal_mac_errors_lo;
  721. u32 rx_internal_mac_errors_hi;
  722. u32 rx_undersize_packets;
  723. u32 rx_oversize_packets;
  724. u32 rx_fragment_packets;
  725. u32 rx_jabbers;
  726. u32 rx_control_frames_lo;
  727. u32 rx_control_frames_hi;
  728. u32 rx_control_frames_unknown_opcode_lo;
  729. u32 rx_control_frames_unknown_opcode_hi;
  730. u32 rx_in_range_errors;
  731. u32 rx_out_of_range_errors;
  732. u32 rx_address_match_errors;
  733. u32 rx_vlan_mismatch_errors;
  734. u32 rx_dropped_too_small;
  735. u32 rx_dropped_too_short;
  736. u32 rx_dropped_header_too_small;
  737. u32 rx_dropped_invalid_tcp_length;
  738. u32 rx_dropped_runt;
  739. u32 rx_ip_checksum_errors;
  740. u32 rx_tcp_checksum_errors;
  741. u32 rx_udp_checksum_errors;
  742. u32 rx_non_rss_packets;
  743. u32 rsvd_111;
  744. u32 rx_ipv4_packets_lo;
  745. u32 rx_ipv4_packets_hi;
  746. u32 rx_ipv6_packets_lo;
  747. u32 rx_ipv6_packets_hi;
  748. u32 rx_ipv4_bytes_lo;
  749. u32 rx_ipv4_bytes_hi;
  750. u32 rx_ipv6_bytes_lo;
  751. u32 rx_ipv6_bytes_hi;
  752. u32 rx_nic_packets_lo;
  753. u32 rx_nic_packets_hi;
  754. u32 rx_tcp_packets_lo;
  755. u32 rx_tcp_packets_hi;
  756. u32 rx_iscsi_packets_lo;
  757. u32 rx_iscsi_packets_hi;
  758. u32 rx_management_packets_lo;
  759. u32 rx_management_packets_hi;
  760. u32 rx_switched_unicast_packets_lo;
  761. u32 rx_switched_unicast_packets_hi;
  762. u32 rx_switched_multicast_packets_lo;
  763. u32 rx_switched_multicast_packets_hi;
  764. u32 rx_switched_broadcast_packets_lo;
  765. u32 rx_switched_broadcast_packets_hi;
  766. u32 num_forwards_lo;
  767. u32 num_forwards_hi;
  768. u32 rx_fifo_overflow;
  769. u32 rx_input_fifo_overflow;
  770. u32 rx_drops_too_many_frags_lo;
  771. u32 rx_drops_too_many_frags_hi;
  772. u32 rx_drops_invalid_queue;
  773. u32 rsvd_141;
  774. u32 rx_drops_mtu_lo;
  775. u32 rx_drops_mtu_hi;
  776. u32 rx_packets_64_bytes_lo;
  777. u32 rx_packets_64_bytes_hi;
  778. u32 rx_packets_65_to_127_bytes_lo;
  779. u32 rx_packets_65_to_127_bytes_hi;
  780. u32 rx_packets_128_to_255_bytes_lo;
  781. u32 rx_packets_128_to_255_bytes_hi;
  782. u32 rx_packets_256_to_511_bytes_lo;
  783. u32 rx_packets_256_to_511_bytes_hi;
  784. u32 rx_packets_512_to_1023_bytes_lo;
  785. u32 rx_packets_512_to_1023_bytes_hi;
  786. u32 rx_packets_1024_to_1518_bytes_lo;
  787. u32 rx_packets_1024_to_1518_bytes_hi;
  788. u32 rx_packets_1519_to_2047_bytes_lo;
  789. u32 rx_packets_1519_to_2047_bytes_hi;
  790. u32 rx_packets_2048_to_4095_bytes_lo;
  791. u32 rx_packets_2048_to_4095_bytes_hi;
  792. u32 rx_packets_4096_to_8191_bytes_lo;
  793. u32 rx_packets_4096_to_8191_bytes_hi;
  794. u32 rx_packets_8192_to_9216_bytes_lo;
  795. u32 rx_packets_8192_to_9216_bytes_hi;
  796. };
  797. struct pport_stats_params {
  798. u16 pport_num;
  799. u8 rsvd;
  800. u8 reset_stats;
  801. };
  802. struct lancer_cmd_req_pport_stats {
  803. struct be_cmd_req_hdr hdr;
  804. union {
  805. struct pport_stats_params params;
  806. u8 rsvd[sizeof(struct lancer_pport_stats)];
  807. } cmd_params;
  808. };
  809. struct lancer_cmd_resp_pport_stats {
  810. struct be_cmd_resp_hdr hdr;
  811. struct lancer_pport_stats pport_stats;
  812. };
  813. static inline struct lancer_pport_stats*
  814. pport_stats_from_cmd(struct be_adapter *adapter)
  815. {
  816. struct lancer_cmd_resp_pport_stats *cmd = adapter->stats_cmd.va;
  817. return &cmd->pport_stats;
  818. }
  819. struct be_cmd_req_get_cntl_addnl_attribs {
  820. struct be_cmd_req_hdr hdr;
  821. u8 rsvd[8];
  822. };
  823. struct be_cmd_resp_get_cntl_addnl_attribs {
  824. struct be_cmd_resp_hdr hdr;
  825. u16 ipl_file_number;
  826. u8 ipl_file_version;
  827. u8 rsvd0;
  828. u8 on_die_temperature; /* in degrees centigrade*/
  829. u8 rsvd1[3];
  830. };
  831. struct be_cmd_req_vlan_config {
  832. struct be_cmd_req_hdr hdr;
  833. u8 interface_id;
  834. u8 promiscuous;
  835. u8 untagged;
  836. u8 num_vlan;
  837. u16 normal_vlan[64];
  838. } __packed;
  839. /******************* RX FILTER ******************************/
  840. #define BE_MAX_MC 64 /* set mcast promisc if > 64 */
  841. struct macaddr {
  842. u8 byte[ETH_ALEN];
  843. };
  844. struct be_cmd_req_rx_filter {
  845. struct be_cmd_req_hdr hdr;
  846. u32 global_flags_mask;
  847. u32 global_flags;
  848. u32 if_flags_mask;
  849. u32 if_flags;
  850. u32 if_id;
  851. u32 mcast_num;
  852. struct macaddr mcast_mac[BE_MAX_MC];
  853. };
  854. /******************** Link Status Query *******************/
  855. struct be_cmd_req_link_status {
  856. struct be_cmd_req_hdr hdr;
  857. u32 rsvd;
  858. };
  859. enum {
  860. PHY_LINK_DUPLEX_NONE = 0x0,
  861. PHY_LINK_DUPLEX_HALF = 0x1,
  862. PHY_LINK_DUPLEX_FULL = 0x2
  863. };
  864. enum {
  865. PHY_LINK_SPEED_ZERO = 0x0, /* => No link */
  866. PHY_LINK_SPEED_10MBPS = 0x1,
  867. PHY_LINK_SPEED_100MBPS = 0x2,
  868. PHY_LINK_SPEED_1GBPS = 0x3,
  869. PHY_LINK_SPEED_10GBPS = 0x4
  870. };
  871. struct be_cmd_resp_link_status {
  872. struct be_cmd_resp_hdr hdr;
  873. u8 physical_port;
  874. u8 mac_duplex;
  875. u8 mac_speed;
  876. u8 mac_fault;
  877. u8 mgmt_mac_duplex;
  878. u8 mgmt_mac_speed;
  879. u16 link_speed;
  880. u32 rsvd0;
  881. } __packed;
  882. /******************** Port Identification ***************************/
  883. /* Identifies the type of port attached to NIC */
  884. struct be_cmd_req_port_type {
  885. struct be_cmd_req_hdr hdr;
  886. u32 page_num;
  887. u32 port;
  888. };
  889. enum {
  890. TR_PAGE_A0 = 0xa0,
  891. TR_PAGE_A2 = 0xa2
  892. };
  893. struct be_cmd_resp_port_type {
  894. struct be_cmd_resp_hdr hdr;
  895. u32 page_num;
  896. u32 port;
  897. struct data {
  898. u8 identifier;
  899. u8 identifier_ext;
  900. u8 connector;
  901. u8 transceiver[8];
  902. u8 rsvd0[3];
  903. u8 length_km;
  904. u8 length_hm;
  905. u8 length_om1;
  906. u8 length_om2;
  907. u8 length_cu;
  908. u8 length_cu_m;
  909. u8 vendor_name[16];
  910. u8 rsvd;
  911. u8 vendor_oui[3];
  912. u8 vendor_pn[16];
  913. u8 vendor_rev[4];
  914. } data;
  915. };
  916. /******************** Get FW Version *******************/
  917. struct be_cmd_req_get_fw_version {
  918. struct be_cmd_req_hdr hdr;
  919. u8 rsvd0[FW_VER_LEN];
  920. u8 rsvd1[FW_VER_LEN];
  921. } __packed;
  922. struct be_cmd_resp_get_fw_version {
  923. struct be_cmd_resp_hdr hdr;
  924. u8 firmware_version_string[FW_VER_LEN];
  925. u8 fw_on_flash_version_string[FW_VER_LEN];
  926. } __packed;
  927. /******************** Set Flow Contrl *******************/
  928. struct be_cmd_req_set_flow_control {
  929. struct be_cmd_req_hdr hdr;
  930. u16 tx_flow_control;
  931. u16 rx_flow_control;
  932. } __packed;
  933. /******************** Get Flow Contrl *******************/
  934. struct be_cmd_req_get_flow_control {
  935. struct be_cmd_req_hdr hdr;
  936. u32 rsvd;
  937. };
  938. struct be_cmd_resp_get_flow_control {
  939. struct be_cmd_resp_hdr hdr;
  940. u16 tx_flow_control;
  941. u16 rx_flow_control;
  942. } __packed;
  943. /******************** Modify EQ Delay *******************/
  944. struct be_cmd_req_modify_eq_delay {
  945. struct be_cmd_req_hdr hdr;
  946. u32 num_eq;
  947. struct {
  948. u32 eq_id;
  949. u32 phase;
  950. u32 delay_multiplier;
  951. } delay[8];
  952. } __packed;
  953. struct be_cmd_resp_modify_eq_delay {
  954. struct be_cmd_resp_hdr hdr;
  955. u32 rsvd0;
  956. } __packed;
  957. /******************** Get FW Config *******************/
  958. #define BE_FUNCTION_CAPS_RSS 0x2
  959. /* The HW can come up in either of the following multi-channel modes
  960. * based on the skew/IPL.
  961. */
  962. #define FLEX10_MODE 0x400
  963. #define VNIC_MODE 0x20000
  964. #define UMC_ENABLED 0x1000000
  965. struct be_cmd_req_query_fw_cfg {
  966. struct be_cmd_req_hdr hdr;
  967. u32 rsvd[31];
  968. };
  969. struct be_cmd_resp_query_fw_cfg {
  970. struct be_cmd_resp_hdr hdr;
  971. u32 be_config_number;
  972. u32 asic_revision;
  973. u32 phys_port;
  974. u32 function_mode;
  975. u32 rsvd[26];
  976. u32 function_caps;
  977. };
  978. /******************** RSS Config *******************/
  979. /* RSS types */
  980. #define RSS_ENABLE_NONE 0x0
  981. #define RSS_ENABLE_IPV4 0x1
  982. #define RSS_ENABLE_TCP_IPV4 0x2
  983. #define RSS_ENABLE_IPV6 0x4
  984. #define RSS_ENABLE_TCP_IPV6 0x8
  985. struct be_cmd_req_rss_config {
  986. struct be_cmd_req_hdr hdr;
  987. u32 if_id;
  988. u16 enable_rss;
  989. u16 cpu_table_size_log2;
  990. u32 hash[10];
  991. u8 cpu_table[128];
  992. u8 flush;
  993. u8 rsvd0[3];
  994. };
  995. /******************** Port Beacon ***************************/
  996. #define BEACON_STATE_ENABLED 0x1
  997. #define BEACON_STATE_DISABLED 0x0
  998. struct be_cmd_req_enable_disable_beacon {
  999. struct be_cmd_req_hdr hdr;
  1000. u8 port_num;
  1001. u8 beacon_state;
  1002. u8 beacon_duration;
  1003. u8 status_duration;
  1004. } __packed;
  1005. struct be_cmd_resp_enable_disable_beacon {
  1006. struct be_cmd_resp_hdr resp_hdr;
  1007. u32 rsvd0;
  1008. } __packed;
  1009. struct be_cmd_req_get_beacon_state {
  1010. struct be_cmd_req_hdr hdr;
  1011. u8 port_num;
  1012. u8 rsvd0;
  1013. u16 rsvd1;
  1014. } __packed;
  1015. struct be_cmd_resp_get_beacon_state {
  1016. struct be_cmd_resp_hdr resp_hdr;
  1017. u8 beacon_state;
  1018. u8 rsvd0[3];
  1019. } __packed;
  1020. /****************** Firmware Flash ******************/
  1021. struct flashrom_params {
  1022. u32 op_code;
  1023. u32 op_type;
  1024. u32 data_buf_size;
  1025. u32 offset;
  1026. u8 data_buf[4];
  1027. };
  1028. struct be_cmd_write_flashrom {
  1029. struct be_cmd_req_hdr hdr;
  1030. struct flashrom_params params;
  1031. };
  1032. /**************** Lancer Firmware Flash ************/
  1033. struct amap_lancer_write_obj_context {
  1034. u8 write_length[24];
  1035. u8 reserved1[7];
  1036. u8 eof;
  1037. } __packed;
  1038. struct lancer_cmd_req_write_object {
  1039. struct be_cmd_req_hdr hdr;
  1040. u8 context[sizeof(struct amap_lancer_write_obj_context) / 8];
  1041. u32 write_offset;
  1042. u8 object_name[104];
  1043. u32 descriptor_count;
  1044. u32 buf_len;
  1045. u32 addr_low;
  1046. u32 addr_high;
  1047. };
  1048. struct lancer_cmd_resp_write_object {
  1049. u8 opcode;
  1050. u8 subsystem;
  1051. u8 rsvd1[2];
  1052. u8 status;
  1053. u8 additional_status;
  1054. u8 rsvd2[2];
  1055. u32 resp_len;
  1056. u32 actual_resp_len;
  1057. u32 actual_write_len;
  1058. };
  1059. /************************ WOL *******************************/
  1060. struct be_cmd_req_acpi_wol_magic_config{
  1061. struct be_cmd_req_hdr hdr;
  1062. u32 rsvd0[145];
  1063. u8 magic_mac[6];
  1064. u8 rsvd2[2];
  1065. } __packed;
  1066. /********************** LoopBack test *********************/
  1067. struct be_cmd_req_loopback_test {
  1068. struct be_cmd_req_hdr hdr;
  1069. u32 loopback_type;
  1070. u32 num_pkts;
  1071. u64 pattern;
  1072. u32 src_port;
  1073. u32 dest_port;
  1074. u32 pkt_size;
  1075. };
  1076. struct be_cmd_resp_loopback_test {
  1077. struct be_cmd_resp_hdr resp_hdr;
  1078. u32 status;
  1079. u32 num_txfer;
  1080. u32 num_rx;
  1081. u32 miscomp_off;
  1082. u32 ticks_compl;
  1083. };
  1084. struct be_cmd_req_set_lmode {
  1085. struct be_cmd_req_hdr hdr;
  1086. u8 src_port;
  1087. u8 dest_port;
  1088. u8 loopback_type;
  1089. u8 loopback_state;
  1090. };
  1091. struct be_cmd_resp_set_lmode {
  1092. struct be_cmd_resp_hdr resp_hdr;
  1093. u8 rsvd0[4];
  1094. };
  1095. /********************** DDR DMA test *********************/
  1096. struct be_cmd_req_ddrdma_test {
  1097. struct be_cmd_req_hdr hdr;
  1098. u64 pattern;
  1099. u32 byte_count;
  1100. u32 rsvd0;
  1101. u8 snd_buff[4096];
  1102. u8 rsvd1[4096];
  1103. };
  1104. struct be_cmd_resp_ddrdma_test {
  1105. struct be_cmd_resp_hdr hdr;
  1106. u64 pattern;
  1107. u32 byte_cnt;
  1108. u32 snd_err;
  1109. u8 rsvd0[4096];
  1110. u8 rcv_buff[4096];
  1111. };
  1112. /*********************** SEEPROM Read ***********************/
  1113. #define BE_READ_SEEPROM_LEN 1024
  1114. struct be_cmd_req_seeprom_read {
  1115. struct be_cmd_req_hdr hdr;
  1116. u8 rsvd0[BE_READ_SEEPROM_LEN];
  1117. };
  1118. struct be_cmd_resp_seeprom_read {
  1119. struct be_cmd_req_hdr hdr;
  1120. u8 seeprom_data[BE_READ_SEEPROM_LEN];
  1121. };
  1122. enum {
  1123. PHY_TYPE_CX4_10GB = 0,
  1124. PHY_TYPE_XFP_10GB,
  1125. PHY_TYPE_SFP_1GB,
  1126. PHY_TYPE_SFP_PLUS_10GB,
  1127. PHY_TYPE_KR_10GB,
  1128. PHY_TYPE_KX4_10GB,
  1129. PHY_TYPE_BASET_10GB,
  1130. PHY_TYPE_BASET_1GB,
  1131. PHY_TYPE_DISABLED = 255
  1132. };
  1133. struct be_cmd_req_get_phy_info {
  1134. struct be_cmd_req_hdr hdr;
  1135. u8 rsvd0[24];
  1136. };
  1137. struct be_phy_info {
  1138. u16 phy_type;
  1139. u16 interface_type;
  1140. u32 misc_params;
  1141. u32 future_use[4];
  1142. };
  1143. struct be_cmd_resp_get_phy_info {
  1144. struct be_cmd_req_hdr hdr;
  1145. struct be_phy_info phy_info;
  1146. };
  1147. /*********************** Set QOS ***********************/
  1148. #define BE_QOS_BITS_NIC 1
  1149. struct be_cmd_req_set_qos {
  1150. struct be_cmd_req_hdr hdr;
  1151. u32 valid_bits;
  1152. u32 max_bps_nic;
  1153. u32 rsvd[7];
  1154. };
  1155. struct be_cmd_resp_set_qos {
  1156. struct be_cmd_resp_hdr hdr;
  1157. u32 rsvd;
  1158. };
  1159. /*********************** Controller Attributes ***********************/
  1160. struct be_cmd_req_cntl_attribs {
  1161. struct be_cmd_req_hdr hdr;
  1162. };
  1163. struct be_cmd_resp_cntl_attribs {
  1164. struct be_cmd_resp_hdr hdr;
  1165. struct mgmt_controller_attrib attribs;
  1166. };
  1167. /*********************** Set driver function ***********************/
  1168. #define CAPABILITY_SW_TIMESTAMPS 2
  1169. #define CAPABILITY_BE3_NATIVE_ERX_API 4
  1170. struct be_cmd_req_set_func_cap {
  1171. struct be_cmd_req_hdr hdr;
  1172. u32 valid_cap_flags;
  1173. u32 cap_flags;
  1174. u8 rsvd[212];
  1175. };
  1176. struct be_cmd_resp_set_func_cap {
  1177. struct be_cmd_resp_hdr hdr;
  1178. u32 valid_cap_flags;
  1179. u32 cap_flags;
  1180. u8 rsvd[212];
  1181. };
  1182. /*************** HW Stats Get v1 **********************************/
  1183. #define BE_TXP_SW_SZ 48
  1184. struct be_port_rxf_stats_v1 {
  1185. u32 rsvd0[12];
  1186. u32 rx_crc_errors;
  1187. u32 rx_alignment_symbol_errors;
  1188. u32 rx_pause_frames;
  1189. u32 rx_priority_pause_frames;
  1190. u32 rx_control_frames;
  1191. u32 rx_in_range_errors;
  1192. u32 rx_out_range_errors;
  1193. u32 rx_frame_too_long;
  1194. u32 rx_address_match_errors;
  1195. u32 rx_dropped_too_small;
  1196. u32 rx_dropped_too_short;
  1197. u32 rx_dropped_header_too_small;
  1198. u32 rx_dropped_tcp_length;
  1199. u32 rx_dropped_runt;
  1200. u32 rsvd1[10];
  1201. u32 rx_ip_checksum_errs;
  1202. u32 rx_tcp_checksum_errs;
  1203. u32 rx_udp_checksum_errs;
  1204. u32 rsvd2[7];
  1205. u32 rx_switched_unicast_packets;
  1206. u32 rx_switched_multicast_packets;
  1207. u32 rx_switched_broadcast_packets;
  1208. u32 rsvd3[3];
  1209. u32 tx_pauseframes;
  1210. u32 tx_priority_pauseframes;
  1211. u32 tx_controlframes;
  1212. u32 rsvd4[10];
  1213. u32 rxpp_fifo_overflow_drop;
  1214. u32 rx_input_fifo_overflow_drop;
  1215. u32 pmem_fifo_overflow_drop;
  1216. u32 jabber_events;
  1217. u32 rsvd5[3];
  1218. };
  1219. struct be_rxf_stats_v1 {
  1220. struct be_port_rxf_stats_v1 port[4];
  1221. u32 rsvd0[2];
  1222. u32 rx_drops_no_pbuf;
  1223. u32 rx_drops_no_txpb;
  1224. u32 rx_drops_no_erx_descr;
  1225. u32 rx_drops_no_tpre_descr;
  1226. u32 rsvd1[6];
  1227. u32 rx_drops_too_many_frags;
  1228. u32 rx_drops_invalid_ring;
  1229. u32 forwarded_packets;
  1230. u32 rx_drops_mtu;
  1231. u32 rsvd2[14];
  1232. };
  1233. struct be_erx_stats_v1 {
  1234. u32 rx_drops_no_fragments[68]; /* dwordS 0 to 67*/
  1235. u32 rsvd[4];
  1236. };
  1237. struct be_hw_stats_v1 {
  1238. struct be_rxf_stats_v1 rxf;
  1239. u32 rsvd0[BE_TXP_SW_SZ];
  1240. struct be_erx_stats_v1 erx;
  1241. struct be_pmem_stats pmem;
  1242. u32 rsvd1[3];
  1243. };
  1244. struct be_cmd_req_get_stats_v1 {
  1245. struct be_cmd_req_hdr hdr;
  1246. u8 rsvd[sizeof(struct be_hw_stats_v1)];
  1247. };
  1248. struct be_cmd_resp_get_stats_v1 {
  1249. struct be_cmd_resp_hdr hdr;
  1250. struct be_hw_stats_v1 hw_stats;
  1251. };
  1252. static inline void *hw_stats_from_cmd(struct be_adapter *adapter)
  1253. {
  1254. if (adapter->generation == BE_GEN3) {
  1255. struct be_cmd_resp_get_stats_v1 *cmd = adapter->stats_cmd.va;
  1256. return &cmd->hw_stats;
  1257. } else {
  1258. struct be_cmd_resp_get_stats_v0 *cmd = adapter->stats_cmd.va;
  1259. return &cmd->hw_stats;
  1260. }
  1261. }
  1262. static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter)
  1263. {
  1264. if (adapter->generation == BE_GEN3) {
  1265. struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
  1266. return &hw_stats->erx;
  1267. } else {
  1268. struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
  1269. return &hw_stats->erx;
  1270. }
  1271. }
  1272. extern int be_pci_fnum_get(struct be_adapter *adapter);
  1273. extern int be_cmd_POST(struct be_adapter *adapter);
  1274. extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
  1275. u8 type, bool permanent, u32 if_handle);
  1276. extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
  1277. u32 if_id, u32 *pmac_id, u32 domain);
  1278. extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id,
  1279. u32 pmac_id, u32 domain);
  1280. extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags,
  1281. u32 en_flags, u8 *mac, u32 *if_handle, u32 *pmac_id,
  1282. u32 domain);
  1283. extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle,
  1284. u32 domain);
  1285. extern int be_cmd_eq_create(struct be_adapter *adapter,
  1286. struct be_queue_info *eq, int eq_delay);
  1287. extern int be_cmd_cq_create(struct be_adapter *adapter,
  1288. struct be_queue_info *cq, struct be_queue_info *eq,
  1289. bool sol_evts, bool no_delay,
  1290. int num_cqe_dma_coalesce);
  1291. extern int be_cmd_mccq_create(struct be_adapter *adapter,
  1292. struct be_queue_info *mccq,
  1293. struct be_queue_info *cq);
  1294. extern int be_cmd_txq_create(struct be_adapter *adapter,
  1295. struct be_queue_info *txq,
  1296. struct be_queue_info *cq);
  1297. extern int be_cmd_rxq_create(struct be_adapter *adapter,
  1298. struct be_queue_info *rxq, u16 cq_id,
  1299. u16 frag_size, u16 max_frame_size, u32 if_id,
  1300. u32 rss, u8 *rss_id);
  1301. extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
  1302. int type);
  1303. extern int be_cmd_rxq_destroy(struct be_adapter *adapter,
  1304. struct be_queue_info *q);
  1305. extern int be_cmd_link_status_query(struct be_adapter *adapter,
  1306. u8 *mac_speed, u16 *link_speed, u32 dom);
  1307. extern int be_cmd_reset(struct be_adapter *adapter);
  1308. extern int be_cmd_get_stats(struct be_adapter *adapter,
  1309. struct be_dma_mem *nonemb_cmd);
  1310. extern int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
  1311. struct be_dma_mem *nonemb_cmd);
  1312. extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
  1313. char *fw_on_flash);
  1314. extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
  1315. extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
  1316. u16 *vtag_array, u32 num, bool untagged,
  1317. bool promiscuous);
  1318. extern int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
  1319. extern int be_cmd_set_flow_control(struct be_adapter *adapter,
  1320. u32 tx_fc, u32 rx_fc);
  1321. extern int be_cmd_get_flow_control(struct be_adapter *adapter,
  1322. u32 *tx_fc, u32 *rx_fc);
  1323. extern int be_cmd_query_fw_cfg(struct be_adapter *adapter,
  1324. u32 *port_num, u32 *function_mode, u32 *function_caps);
  1325. extern int be_cmd_reset_function(struct be_adapter *adapter);
  1326. extern int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
  1327. u16 table_size);
  1328. extern int be_process_mcc(struct be_adapter *adapter, int *status);
  1329. extern int be_cmd_set_beacon_state(struct be_adapter *adapter,
  1330. u8 port_num, u8 beacon, u8 status, u8 state);
  1331. extern int be_cmd_get_beacon_state(struct be_adapter *adapter,
  1332. u8 port_num, u32 *state);
  1333. extern int be_cmd_write_flashrom(struct be_adapter *adapter,
  1334. struct be_dma_mem *cmd, u32 flash_oper,
  1335. u32 flash_opcode, u32 buf_size);
  1336. extern int lancer_cmd_write_object(struct be_adapter *adapter,
  1337. struct be_dma_mem *cmd,
  1338. u32 data_size, u32 data_offset,
  1339. const char *obj_name,
  1340. u32 *data_written, u8 *addn_status);
  1341. int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
  1342. int offset);
  1343. extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
  1344. struct be_dma_mem *nonemb_cmd);
  1345. extern int be_cmd_fw_init(struct be_adapter *adapter);
  1346. extern int be_cmd_fw_clean(struct be_adapter *adapter);
  1347. extern void be_async_mcc_enable(struct be_adapter *adapter);
  1348. extern void be_async_mcc_disable(struct be_adapter *adapter);
  1349. extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
  1350. u32 loopback_type, u32 pkt_size,
  1351. u32 num_pkts, u64 pattern);
  1352. extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern,
  1353. u32 byte_cnt, struct be_dma_mem *cmd);
  1354. extern int be_cmd_get_seeprom_data(struct be_adapter *adapter,
  1355. struct be_dma_mem *nonemb_cmd);
  1356. extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
  1357. u8 loopback_type, u8 enable);
  1358. extern int be_cmd_get_phy_info(struct be_adapter *adapter,
  1359. struct be_phy_info *phy_info);
  1360. extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
  1361. extern void be_detect_dump_ue(struct be_adapter *adapter);
  1362. extern int be_cmd_get_die_temperature(struct be_adapter *adapter);
  1363. extern int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
  1364. extern int be_cmd_req_native_mode(struct be_adapter *adapter);
  1365. extern int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
  1366. extern void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);