be_cmds.h 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551
  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. ASYNC_EVENT_LINK_DOWN = 0x0,
  84. ASYNC_EVENT_LINK_UP = 0x1
  85. };
  86. /* When the event code of an async trailer is link-state, the mcc_compl
  87. * must be interpreted as follows
  88. */
  89. struct be_async_event_link_state {
  90. u8 physical_port;
  91. u8 port_link_status;
  92. u8 port_duplex;
  93. u8 port_speed;
  94. u8 port_fault;
  95. u8 rsvd0[7];
  96. struct be_async_event_trailer trailer;
  97. } __packed;
  98. /* When the event code of an async trailer is GRP-5 and event_type is QOS_SPEED
  99. * the mcc_compl must be interpreted as follows
  100. */
  101. struct be_async_event_grp5_qos_link_speed {
  102. u8 physical_port;
  103. u8 rsvd[5];
  104. u16 qos_link_speed;
  105. u32 event_tag;
  106. struct be_async_event_trailer trailer;
  107. } __packed;
  108. /* When the event code of an async trailer is GRP5 and event type is
  109. * CoS-Priority, the mcc_compl must be interpreted as follows
  110. */
  111. struct be_async_event_grp5_cos_priority {
  112. u8 physical_port;
  113. u8 available_priority_bmap;
  114. u8 reco_default_priority;
  115. u8 valid;
  116. u8 rsvd0;
  117. u8 event_tag;
  118. struct be_async_event_trailer trailer;
  119. } __packed;
  120. /* When the event code of an async trailer is GRP5 and event type is
  121. * PVID state, the mcc_compl must be interpreted as follows
  122. */
  123. struct be_async_event_grp5_pvid_state {
  124. u8 enabled;
  125. u8 rsvd0;
  126. u16 tag;
  127. u32 event_tag;
  128. u32 rsvd1;
  129. struct be_async_event_trailer trailer;
  130. } __packed;
  131. struct be_mcc_mailbox {
  132. struct be_mcc_wrb wrb;
  133. struct be_mcc_compl compl;
  134. };
  135. #define CMD_SUBSYSTEM_COMMON 0x1
  136. #define CMD_SUBSYSTEM_ETH 0x3
  137. #define CMD_SUBSYSTEM_LOWLEVEL 0xb
  138. #define OPCODE_COMMON_NTWK_MAC_QUERY 1
  139. #define OPCODE_COMMON_NTWK_MAC_SET 2
  140. #define OPCODE_COMMON_NTWK_MULTICAST_SET 3
  141. #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
  142. #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
  143. #define OPCODE_COMMON_READ_FLASHROM 6
  144. #define OPCODE_COMMON_WRITE_FLASHROM 7
  145. #define OPCODE_COMMON_CQ_CREATE 12
  146. #define OPCODE_COMMON_EQ_CREATE 13
  147. #define OPCODE_COMMON_MCC_CREATE 21
  148. #define OPCODE_COMMON_SET_QOS 28
  149. #define OPCODE_COMMON_MCC_CREATE_EXT 90
  150. #define OPCODE_COMMON_SEEPROM_READ 30
  151. #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
  152. #define OPCODE_COMMON_NTWK_RX_FILTER 34
  153. #define OPCODE_COMMON_GET_FW_VERSION 35
  154. #define OPCODE_COMMON_SET_FLOW_CONTROL 36
  155. #define OPCODE_COMMON_GET_FLOW_CONTROL 37
  156. #define OPCODE_COMMON_SET_FRAME_SIZE 39
  157. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  158. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  159. #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50
  160. #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51
  161. #define OPCODE_COMMON_MCC_DESTROY 53
  162. #define OPCODE_COMMON_CQ_DESTROY 54
  163. #define OPCODE_COMMON_EQ_DESTROY 55
  164. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  165. #define OPCODE_COMMON_NTWK_PMAC_ADD 59
  166. #define OPCODE_COMMON_NTWK_PMAC_DEL 60
  167. #define OPCODE_COMMON_FUNCTION_RESET 61
  168. #define OPCODE_COMMON_MANAGE_FAT 68
  169. #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69
  170. #define OPCODE_COMMON_GET_BEACON_STATE 70
  171. #define OPCODE_COMMON_READ_TRANSRECV_DATA 73
  172. #define OPCODE_COMMON_GET_PHY_DETAILS 102
  173. #define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103
  174. #define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
  175. #define OPCODE_COMMON_WRITE_OBJECT 172
  176. #define OPCODE_ETH_RSS_CONFIG 1
  177. #define OPCODE_ETH_ACPI_CONFIG 2
  178. #define OPCODE_ETH_PROMISCUOUS 3
  179. #define OPCODE_ETH_GET_STATISTICS 4
  180. #define OPCODE_ETH_TX_CREATE 7
  181. #define OPCODE_ETH_RX_CREATE 8
  182. #define OPCODE_ETH_TX_DESTROY 9
  183. #define OPCODE_ETH_RX_DESTROY 10
  184. #define OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG 12
  185. #define OPCODE_ETH_GET_PPORT_STATS 18
  186. #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17
  187. #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18
  188. #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19
  189. struct be_cmd_req_hdr {
  190. u8 opcode; /* dword 0 */
  191. u8 subsystem; /* dword 0 */
  192. u8 port_number; /* dword 0 */
  193. u8 domain; /* dword 0 */
  194. u32 timeout; /* dword 1 */
  195. u32 request_length; /* dword 2 */
  196. u8 version; /* dword 3 */
  197. u8 rsvd[3]; /* dword 3 */
  198. };
  199. #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
  200. #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */
  201. struct be_cmd_resp_hdr {
  202. u32 info; /* dword 0 */
  203. u32 status; /* dword 1 */
  204. u32 response_length; /* dword 2 */
  205. u32 actual_resp_len; /* dword 3 */
  206. };
  207. struct phys_addr {
  208. u32 lo;
  209. u32 hi;
  210. };
  211. /**************************
  212. * BE Command definitions *
  213. **************************/
  214. /* Pseudo amap definition in which each bit of the actual structure is defined
  215. * as a byte: used to calculate offset/shift/mask of each field */
  216. struct amap_eq_context {
  217. u8 cidx[13]; /* dword 0*/
  218. u8 rsvd0[3]; /* dword 0*/
  219. u8 epidx[13]; /* dword 0*/
  220. u8 valid; /* dword 0*/
  221. u8 rsvd1; /* dword 0*/
  222. u8 size; /* dword 0*/
  223. u8 pidx[13]; /* dword 1*/
  224. u8 rsvd2[3]; /* dword 1*/
  225. u8 pd[10]; /* dword 1*/
  226. u8 count[3]; /* dword 1*/
  227. u8 solevent; /* dword 1*/
  228. u8 stalled; /* dword 1*/
  229. u8 armed; /* dword 1*/
  230. u8 rsvd3[4]; /* dword 2*/
  231. u8 func[8]; /* dword 2*/
  232. u8 rsvd4; /* dword 2*/
  233. u8 delaymult[10]; /* dword 2*/
  234. u8 rsvd5[2]; /* dword 2*/
  235. u8 phase[2]; /* dword 2*/
  236. u8 nodelay; /* dword 2*/
  237. u8 rsvd6[4]; /* dword 2*/
  238. u8 rsvd7[32]; /* dword 3*/
  239. } __packed;
  240. struct be_cmd_req_eq_create {
  241. struct be_cmd_req_hdr hdr;
  242. u16 num_pages; /* sword */
  243. u16 rsvd0; /* sword */
  244. u8 context[sizeof(struct amap_eq_context) / 8];
  245. struct phys_addr pages[8];
  246. } __packed;
  247. struct be_cmd_resp_eq_create {
  248. struct be_cmd_resp_hdr resp_hdr;
  249. u16 eq_id; /* sword */
  250. u16 rsvd0; /* sword */
  251. } __packed;
  252. /******************** Mac query ***************************/
  253. enum {
  254. MAC_ADDRESS_TYPE_STORAGE = 0x0,
  255. MAC_ADDRESS_TYPE_NETWORK = 0x1,
  256. MAC_ADDRESS_TYPE_PD = 0x2,
  257. MAC_ADDRESS_TYPE_MANAGEMENT = 0x3
  258. };
  259. struct mac_addr {
  260. u16 size_of_struct;
  261. u8 addr[ETH_ALEN];
  262. } __packed;
  263. struct be_cmd_req_mac_query {
  264. struct be_cmd_req_hdr hdr;
  265. u8 type;
  266. u8 permanent;
  267. u16 if_id;
  268. } __packed;
  269. struct be_cmd_resp_mac_query {
  270. struct be_cmd_resp_hdr hdr;
  271. struct mac_addr mac;
  272. };
  273. /******************** PMac Add ***************************/
  274. struct be_cmd_req_pmac_add {
  275. struct be_cmd_req_hdr hdr;
  276. u32 if_id;
  277. u8 mac_address[ETH_ALEN];
  278. u8 rsvd0[2];
  279. } __packed;
  280. struct be_cmd_resp_pmac_add {
  281. struct be_cmd_resp_hdr hdr;
  282. u32 pmac_id;
  283. };
  284. /******************** PMac Del ***************************/
  285. struct be_cmd_req_pmac_del {
  286. struct be_cmd_req_hdr hdr;
  287. u32 if_id;
  288. u32 pmac_id;
  289. };
  290. /******************** Create CQ ***************************/
  291. /* Pseudo amap definition in which each bit of the actual structure is defined
  292. * as a byte: used to calculate offset/shift/mask of each field */
  293. struct amap_cq_context_be {
  294. u8 cidx[11]; /* dword 0*/
  295. u8 rsvd0; /* dword 0*/
  296. u8 coalescwm[2]; /* dword 0*/
  297. u8 nodelay; /* dword 0*/
  298. u8 epidx[11]; /* dword 0*/
  299. u8 rsvd1; /* dword 0*/
  300. u8 count[2]; /* dword 0*/
  301. u8 valid; /* dword 0*/
  302. u8 solevent; /* dword 0*/
  303. u8 eventable; /* dword 0*/
  304. u8 pidx[11]; /* dword 1*/
  305. u8 rsvd2; /* dword 1*/
  306. u8 pd[10]; /* dword 1*/
  307. u8 eqid[8]; /* dword 1*/
  308. u8 stalled; /* dword 1*/
  309. u8 armed; /* dword 1*/
  310. u8 rsvd3[4]; /* dword 2*/
  311. u8 func[8]; /* dword 2*/
  312. u8 rsvd4[20]; /* dword 2*/
  313. u8 rsvd5[32]; /* dword 3*/
  314. } __packed;
  315. struct amap_cq_context_lancer {
  316. u8 rsvd0[12]; /* dword 0*/
  317. u8 coalescwm[2]; /* dword 0*/
  318. u8 nodelay; /* dword 0*/
  319. u8 rsvd1[12]; /* dword 0*/
  320. u8 count[2]; /* dword 0*/
  321. u8 valid; /* dword 0*/
  322. u8 rsvd2; /* dword 0*/
  323. u8 eventable; /* dword 0*/
  324. u8 eqid[16]; /* dword 1*/
  325. u8 rsvd3[15]; /* dword 1*/
  326. u8 armed; /* dword 1*/
  327. u8 rsvd4[32]; /* dword 2*/
  328. u8 rsvd5[32]; /* dword 3*/
  329. } __packed;
  330. struct be_cmd_req_cq_create {
  331. struct be_cmd_req_hdr hdr;
  332. u16 num_pages;
  333. u8 page_size;
  334. u8 rsvd0;
  335. u8 context[sizeof(struct amap_cq_context_be) / 8];
  336. struct phys_addr pages[8];
  337. } __packed;
  338. struct be_cmd_resp_cq_create {
  339. struct be_cmd_resp_hdr hdr;
  340. u16 cq_id;
  341. u16 rsvd0;
  342. } __packed;
  343. struct be_cmd_req_get_fat {
  344. struct be_cmd_req_hdr hdr;
  345. u32 fat_operation;
  346. u32 read_log_offset;
  347. u32 read_log_length;
  348. u32 data_buffer_size;
  349. u32 data_buffer[1];
  350. } __packed;
  351. struct be_cmd_resp_get_fat {
  352. struct be_cmd_resp_hdr hdr;
  353. u32 log_size;
  354. u32 read_log_length;
  355. u32 rsvd[2];
  356. u32 data_buffer[1];
  357. } __packed;
  358. /******************** Create MCCQ ***************************/
  359. /* Pseudo amap definition in which each bit of the actual structure is defined
  360. * as a byte: used to calculate offset/shift/mask of each field */
  361. struct amap_mcc_context_be {
  362. u8 con_index[14];
  363. u8 rsvd0[2];
  364. u8 ring_size[4];
  365. u8 fetch_wrb;
  366. u8 fetch_r2t;
  367. u8 cq_id[10];
  368. u8 prod_index[14];
  369. u8 fid[8];
  370. u8 pdid[9];
  371. u8 valid;
  372. u8 rsvd1[32];
  373. u8 rsvd2[32];
  374. } __packed;
  375. struct amap_mcc_context_lancer {
  376. u8 async_cq_id[16];
  377. u8 ring_size[4];
  378. u8 rsvd0[12];
  379. u8 rsvd1[31];
  380. u8 valid;
  381. u8 async_cq_valid[1];
  382. u8 rsvd2[31];
  383. u8 rsvd3[32];
  384. } __packed;
  385. struct be_cmd_req_mcc_create {
  386. struct be_cmd_req_hdr hdr;
  387. u16 num_pages;
  388. u16 cq_id;
  389. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  390. struct phys_addr pages[8];
  391. } __packed;
  392. struct be_cmd_req_mcc_ext_create {
  393. struct be_cmd_req_hdr hdr;
  394. u16 num_pages;
  395. u16 cq_id;
  396. u32 async_event_bitmap[1];
  397. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  398. struct phys_addr pages[8];
  399. } __packed;
  400. struct be_cmd_resp_mcc_create {
  401. struct be_cmd_resp_hdr hdr;
  402. u16 id;
  403. u16 rsvd0;
  404. } __packed;
  405. /******************** Create TxQ ***************************/
  406. #define BE_ETH_TX_RING_TYPE_STANDARD 2
  407. #define BE_ULP1_NUM 1
  408. /* Pseudo amap definition in which each bit of the actual structure is defined
  409. * as a byte: used to calculate offset/shift/mask of each field */
  410. struct amap_tx_context {
  411. u8 if_id[16]; /* dword 0 */
  412. u8 tx_ring_size[4]; /* dword 0 */
  413. u8 rsvd1[26]; /* dword 0 */
  414. u8 pci_func_id[8]; /* dword 1 */
  415. u8 rsvd2[9]; /* dword 1 */
  416. u8 ctx_valid; /* dword 1 */
  417. u8 cq_id_send[16]; /* dword 2 */
  418. u8 rsvd3[16]; /* dword 2 */
  419. u8 rsvd4[32]; /* dword 3 */
  420. u8 rsvd5[32]; /* dword 4 */
  421. u8 rsvd6[32]; /* dword 5 */
  422. u8 rsvd7[32]; /* dword 6 */
  423. u8 rsvd8[32]; /* dword 7 */
  424. u8 rsvd9[32]; /* dword 8 */
  425. u8 rsvd10[32]; /* dword 9 */
  426. u8 rsvd11[32]; /* dword 10 */
  427. u8 rsvd12[32]; /* dword 11 */
  428. u8 rsvd13[32]; /* dword 12 */
  429. u8 rsvd14[32]; /* dword 13 */
  430. u8 rsvd15[32]; /* dword 14 */
  431. u8 rsvd16[32]; /* dword 15 */
  432. } __packed;
  433. struct be_cmd_req_eth_tx_create {
  434. struct be_cmd_req_hdr hdr;
  435. u8 num_pages;
  436. u8 ulp_num;
  437. u8 type;
  438. u8 bound_port;
  439. u8 context[sizeof(struct amap_tx_context) / 8];
  440. struct phys_addr pages[8];
  441. } __packed;
  442. struct be_cmd_resp_eth_tx_create {
  443. struct be_cmd_resp_hdr hdr;
  444. u16 cid;
  445. u16 rsvd0;
  446. } __packed;
  447. /******************** Create RxQ ***************************/
  448. struct be_cmd_req_eth_rx_create {
  449. struct be_cmd_req_hdr hdr;
  450. u16 cq_id;
  451. u8 frag_size;
  452. u8 num_pages;
  453. struct phys_addr pages[2];
  454. u32 interface_id;
  455. u16 max_frame_size;
  456. u16 rsvd0;
  457. u32 rss_queue;
  458. } __packed;
  459. struct be_cmd_resp_eth_rx_create {
  460. struct be_cmd_resp_hdr hdr;
  461. u16 id;
  462. u8 rss_id;
  463. u8 rsvd0;
  464. } __packed;
  465. /******************** Q Destroy ***************************/
  466. /* Type of Queue to be destroyed */
  467. enum {
  468. QTYPE_EQ = 1,
  469. QTYPE_CQ,
  470. QTYPE_TXQ,
  471. QTYPE_RXQ,
  472. QTYPE_MCCQ
  473. };
  474. struct be_cmd_req_q_destroy {
  475. struct be_cmd_req_hdr hdr;
  476. u16 id;
  477. u16 bypass_flush; /* valid only for rx q destroy */
  478. } __packed;
  479. /************ I/f Create (it's actually I/f Config Create)**********/
  480. /* Capability flags for the i/f */
  481. enum be_if_flags {
  482. BE_IF_FLAGS_RSS = 0x4,
  483. BE_IF_FLAGS_PROMISCUOUS = 0x8,
  484. BE_IF_FLAGS_BROADCAST = 0x10,
  485. BE_IF_FLAGS_UNTAGGED = 0x20,
  486. BE_IF_FLAGS_ULP = 0x40,
  487. BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80,
  488. BE_IF_FLAGS_VLAN = 0x100,
  489. BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200,
  490. BE_IF_FLAGS_PASS_L2_ERRORS = 0x400,
  491. BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800,
  492. BE_IF_FLAGS_MULTICAST = 0x1000
  493. };
  494. /* An RX interface is an object with one or more MAC addresses and
  495. * filtering capabilities. */
  496. struct be_cmd_req_if_create {
  497. struct be_cmd_req_hdr hdr;
  498. u32 version; /* ignore currently */
  499. u32 capability_flags;
  500. u32 enable_flags;
  501. u8 mac_addr[ETH_ALEN];
  502. u8 rsvd0;
  503. u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */
  504. u32 vlan_tag; /* not used currently */
  505. } __packed;
  506. struct be_cmd_resp_if_create {
  507. struct be_cmd_resp_hdr hdr;
  508. u32 interface_id;
  509. u32 pmac_id;
  510. };
  511. /****** I/f Destroy(it's actually I/f Config Destroy )**********/
  512. struct be_cmd_req_if_destroy {
  513. struct be_cmd_req_hdr hdr;
  514. u32 interface_id;
  515. };
  516. /*************** HW Stats Get **********************************/
  517. struct be_port_rxf_stats_v0 {
  518. u32 rx_bytes_lsd; /* dword 0*/
  519. u32 rx_bytes_msd; /* dword 1*/
  520. u32 rx_total_frames; /* dword 2*/
  521. u32 rx_unicast_frames; /* dword 3*/
  522. u32 rx_multicast_frames; /* dword 4*/
  523. u32 rx_broadcast_frames; /* dword 5*/
  524. u32 rx_crc_errors; /* dword 6*/
  525. u32 rx_alignment_symbol_errors; /* dword 7*/
  526. u32 rx_pause_frames; /* dword 8*/
  527. u32 rx_control_frames; /* dword 9*/
  528. u32 rx_in_range_errors; /* dword 10*/
  529. u32 rx_out_range_errors; /* dword 11*/
  530. u32 rx_frame_too_long; /* dword 12*/
  531. u32 rx_address_match_errors; /* dword 13*/
  532. u32 rx_vlan_mismatch; /* dword 14*/
  533. u32 rx_dropped_too_small; /* dword 15*/
  534. u32 rx_dropped_too_short; /* dword 16*/
  535. u32 rx_dropped_header_too_small; /* dword 17*/
  536. u32 rx_dropped_tcp_length; /* dword 18*/
  537. u32 rx_dropped_runt; /* dword 19*/
  538. u32 rx_64_byte_packets; /* dword 20*/
  539. u32 rx_65_127_byte_packets; /* dword 21*/
  540. u32 rx_128_256_byte_packets; /* dword 22*/
  541. u32 rx_256_511_byte_packets; /* dword 23*/
  542. u32 rx_512_1023_byte_packets; /* dword 24*/
  543. u32 rx_1024_1518_byte_packets; /* dword 25*/
  544. u32 rx_1519_2047_byte_packets; /* dword 26*/
  545. u32 rx_2048_4095_byte_packets; /* dword 27*/
  546. u32 rx_4096_8191_byte_packets; /* dword 28*/
  547. u32 rx_8192_9216_byte_packets; /* dword 29*/
  548. u32 rx_ip_checksum_errs; /* dword 30*/
  549. u32 rx_tcp_checksum_errs; /* dword 31*/
  550. u32 rx_udp_checksum_errs; /* dword 32*/
  551. u32 rx_non_rss_packets; /* dword 33*/
  552. u32 rx_ipv4_packets; /* dword 34*/
  553. u32 rx_ipv6_packets; /* dword 35*/
  554. u32 rx_ipv4_bytes_lsd; /* dword 36*/
  555. u32 rx_ipv4_bytes_msd; /* dword 37*/
  556. u32 rx_ipv6_bytes_lsd; /* dword 38*/
  557. u32 rx_ipv6_bytes_msd; /* dword 39*/
  558. u32 rx_chute1_packets; /* dword 40*/
  559. u32 rx_chute2_packets; /* dword 41*/
  560. u32 rx_chute3_packets; /* dword 42*/
  561. u32 rx_management_packets; /* dword 43*/
  562. u32 rx_switched_unicast_packets; /* dword 44*/
  563. u32 rx_switched_multicast_packets; /* dword 45*/
  564. u32 rx_switched_broadcast_packets; /* dword 46*/
  565. u32 tx_bytes_lsd; /* dword 47*/
  566. u32 tx_bytes_msd; /* dword 48*/
  567. u32 tx_unicastframes; /* dword 49*/
  568. u32 tx_multicastframes; /* dword 50*/
  569. u32 tx_broadcastframes; /* dword 51*/
  570. u32 tx_pauseframes; /* dword 52*/
  571. u32 tx_controlframes; /* dword 53*/
  572. u32 tx_64_byte_packets; /* dword 54*/
  573. u32 tx_65_127_byte_packets; /* dword 55*/
  574. u32 tx_128_256_byte_packets; /* dword 56*/
  575. u32 tx_256_511_byte_packets; /* dword 57*/
  576. u32 tx_512_1023_byte_packets; /* dword 58*/
  577. u32 tx_1024_1518_byte_packets; /* dword 59*/
  578. u32 tx_1519_2047_byte_packets; /* dword 60*/
  579. u32 tx_2048_4095_byte_packets; /* dword 61*/
  580. u32 tx_4096_8191_byte_packets; /* dword 62*/
  581. u32 tx_8192_9216_byte_packets; /* dword 63*/
  582. u32 rx_fifo_overflow; /* dword 64*/
  583. u32 rx_input_fifo_overflow; /* dword 65*/
  584. };
  585. struct be_rxf_stats_v0 {
  586. struct be_port_rxf_stats_v0 port[2];
  587. u32 rx_drops_no_pbuf; /* dword 132*/
  588. u32 rx_drops_no_txpb; /* dword 133*/
  589. u32 rx_drops_no_erx_descr; /* dword 134*/
  590. u32 rx_drops_no_tpre_descr; /* dword 135*/
  591. u32 management_rx_port_packets; /* dword 136*/
  592. u32 management_rx_port_bytes; /* dword 137*/
  593. u32 management_rx_port_pause_frames; /* dword 138*/
  594. u32 management_rx_port_errors; /* dword 139*/
  595. u32 management_tx_port_packets; /* dword 140*/
  596. u32 management_tx_port_bytes; /* dword 141*/
  597. u32 management_tx_port_pause; /* dword 142*/
  598. u32 management_rx_port_rxfifo_overflow; /* dword 143*/
  599. u32 rx_drops_too_many_frags; /* dword 144*/
  600. u32 rx_drops_invalid_ring; /* dword 145*/
  601. u32 forwarded_packets; /* dword 146*/
  602. u32 rx_drops_mtu; /* dword 147*/
  603. u32 rsvd0[7];
  604. u32 port0_jabber_events;
  605. u32 port1_jabber_events;
  606. u32 rsvd1[6];
  607. };
  608. struct be_erx_stats_v0 {
  609. u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/
  610. u32 rsvd[4];
  611. };
  612. struct be_pmem_stats {
  613. u32 eth_red_drops;
  614. u32 rsvd[5];
  615. };
  616. struct be_hw_stats_v0 {
  617. struct be_rxf_stats_v0 rxf;
  618. u32 rsvd[48];
  619. struct be_erx_stats_v0 erx;
  620. struct be_pmem_stats pmem;
  621. };
  622. struct be_cmd_req_get_stats_v0 {
  623. struct be_cmd_req_hdr hdr;
  624. u8 rsvd[sizeof(struct be_hw_stats_v0)];
  625. };
  626. struct be_cmd_resp_get_stats_v0 {
  627. struct be_cmd_resp_hdr hdr;
  628. struct be_hw_stats_v0 hw_stats;
  629. };
  630. #define make_64bit_val(hi_32, lo_32) (((u64)hi_32<<32) | lo_32)
  631. struct lancer_cmd_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_cmd_pport_stats)];
  807. } cmd_params;
  808. };
  809. struct lancer_cmd_resp_pport_stats {
  810. struct be_cmd_resp_hdr hdr;
  811. struct lancer_cmd_pport_stats pport_stats;
  812. };
  813. static inline struct lancer_cmd_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. /******************** Multicast MAC Config *******************/
  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_mcast_mac_config {
  845. struct be_cmd_req_hdr hdr;
  846. u16 num_mac;
  847. u8 promiscuous;
  848. u8 interface_id;
  849. struct macaddr mac[BE_MAX_MC];
  850. } __packed;
  851. /******************* RX FILTER ******************************/
  852. struct be_cmd_req_rx_filter {
  853. struct be_cmd_req_hdr hdr;
  854. u32 global_flags_mask;
  855. u32 global_flags;
  856. u32 if_flags_mask;
  857. u32 if_flags;
  858. u32 if_id;
  859. u32 multicast_num;
  860. struct macaddr mac[BE_MAX_MC];
  861. };
  862. /******************** Link Status Query *******************/
  863. struct be_cmd_req_link_status {
  864. struct be_cmd_req_hdr hdr;
  865. u32 rsvd;
  866. };
  867. enum {
  868. PHY_LINK_DUPLEX_NONE = 0x0,
  869. PHY_LINK_DUPLEX_HALF = 0x1,
  870. PHY_LINK_DUPLEX_FULL = 0x2
  871. };
  872. enum {
  873. PHY_LINK_SPEED_ZERO = 0x0, /* => No link */
  874. PHY_LINK_SPEED_10MBPS = 0x1,
  875. PHY_LINK_SPEED_100MBPS = 0x2,
  876. PHY_LINK_SPEED_1GBPS = 0x3,
  877. PHY_LINK_SPEED_10GBPS = 0x4
  878. };
  879. struct be_cmd_resp_link_status {
  880. struct be_cmd_resp_hdr hdr;
  881. u8 physical_port;
  882. u8 mac_duplex;
  883. u8 mac_speed;
  884. u8 mac_fault;
  885. u8 mgmt_mac_duplex;
  886. u8 mgmt_mac_speed;
  887. u16 link_speed;
  888. u32 rsvd0;
  889. } __packed;
  890. /******************** Port Identification ***************************/
  891. /* Identifies the type of port attached to NIC */
  892. struct be_cmd_req_port_type {
  893. struct be_cmd_req_hdr hdr;
  894. u32 page_num;
  895. u32 port;
  896. };
  897. enum {
  898. TR_PAGE_A0 = 0xa0,
  899. TR_PAGE_A2 = 0xa2
  900. };
  901. struct be_cmd_resp_port_type {
  902. struct be_cmd_resp_hdr hdr;
  903. u32 page_num;
  904. u32 port;
  905. struct data {
  906. u8 identifier;
  907. u8 identifier_ext;
  908. u8 connector;
  909. u8 transceiver[8];
  910. u8 rsvd0[3];
  911. u8 length_km;
  912. u8 length_hm;
  913. u8 length_om1;
  914. u8 length_om2;
  915. u8 length_cu;
  916. u8 length_cu_m;
  917. u8 vendor_name[16];
  918. u8 rsvd;
  919. u8 vendor_oui[3];
  920. u8 vendor_pn[16];
  921. u8 vendor_rev[4];
  922. } data;
  923. };
  924. /******************** Get FW Version *******************/
  925. struct be_cmd_req_get_fw_version {
  926. struct be_cmd_req_hdr hdr;
  927. u8 rsvd0[FW_VER_LEN];
  928. u8 rsvd1[FW_VER_LEN];
  929. } __packed;
  930. struct be_cmd_resp_get_fw_version {
  931. struct be_cmd_resp_hdr hdr;
  932. u8 firmware_version_string[FW_VER_LEN];
  933. u8 fw_on_flash_version_string[FW_VER_LEN];
  934. } __packed;
  935. /******************** Set Flow Contrl *******************/
  936. struct be_cmd_req_set_flow_control {
  937. struct be_cmd_req_hdr hdr;
  938. u16 tx_flow_control;
  939. u16 rx_flow_control;
  940. } __packed;
  941. /******************** Get Flow Contrl *******************/
  942. struct be_cmd_req_get_flow_control {
  943. struct be_cmd_req_hdr hdr;
  944. u32 rsvd;
  945. };
  946. struct be_cmd_resp_get_flow_control {
  947. struct be_cmd_resp_hdr hdr;
  948. u16 tx_flow_control;
  949. u16 rx_flow_control;
  950. } __packed;
  951. /******************** Modify EQ Delay *******************/
  952. struct be_cmd_req_modify_eq_delay {
  953. struct be_cmd_req_hdr hdr;
  954. u32 num_eq;
  955. struct {
  956. u32 eq_id;
  957. u32 phase;
  958. u32 delay_multiplier;
  959. } delay[8];
  960. } __packed;
  961. struct be_cmd_resp_modify_eq_delay {
  962. struct be_cmd_resp_hdr hdr;
  963. u32 rsvd0;
  964. } __packed;
  965. /******************** Get FW Config *******************/
  966. #define BE_FUNCTION_CAPS_RSS 0x2
  967. struct be_cmd_req_query_fw_cfg {
  968. struct be_cmd_req_hdr hdr;
  969. u32 rsvd[31];
  970. };
  971. struct be_cmd_resp_query_fw_cfg {
  972. struct be_cmd_resp_hdr hdr;
  973. u32 be_config_number;
  974. u32 asic_revision;
  975. u32 phys_port;
  976. u32 function_mode;
  977. u32 rsvd[26];
  978. u32 function_caps;
  979. };
  980. /******************** RSS Config *******************/
  981. /* RSS types */
  982. #define RSS_ENABLE_NONE 0x0
  983. #define RSS_ENABLE_IPV4 0x1
  984. #define RSS_ENABLE_TCP_IPV4 0x2
  985. #define RSS_ENABLE_IPV6 0x4
  986. #define RSS_ENABLE_TCP_IPV6 0x8
  987. struct be_cmd_req_rss_config {
  988. struct be_cmd_req_hdr hdr;
  989. u32 if_id;
  990. u16 enable_rss;
  991. u16 cpu_table_size_log2;
  992. u32 hash[10];
  993. u8 cpu_table[128];
  994. u8 flush;
  995. u8 rsvd0[3];
  996. };
  997. /******************** Port Beacon ***************************/
  998. #define BEACON_STATE_ENABLED 0x1
  999. #define BEACON_STATE_DISABLED 0x0
  1000. struct be_cmd_req_enable_disable_beacon {
  1001. struct be_cmd_req_hdr hdr;
  1002. u8 port_num;
  1003. u8 beacon_state;
  1004. u8 beacon_duration;
  1005. u8 status_duration;
  1006. } __packed;
  1007. struct be_cmd_resp_enable_disable_beacon {
  1008. struct be_cmd_resp_hdr resp_hdr;
  1009. u32 rsvd0;
  1010. } __packed;
  1011. struct be_cmd_req_get_beacon_state {
  1012. struct be_cmd_req_hdr hdr;
  1013. u8 port_num;
  1014. u8 rsvd0;
  1015. u16 rsvd1;
  1016. } __packed;
  1017. struct be_cmd_resp_get_beacon_state {
  1018. struct be_cmd_resp_hdr resp_hdr;
  1019. u8 beacon_state;
  1020. u8 rsvd0[3];
  1021. } __packed;
  1022. /****************** Firmware Flash ******************/
  1023. struct flashrom_params {
  1024. u32 op_code;
  1025. u32 op_type;
  1026. u32 data_buf_size;
  1027. u32 offset;
  1028. u8 data_buf[4];
  1029. };
  1030. struct be_cmd_write_flashrom {
  1031. struct be_cmd_req_hdr hdr;
  1032. struct flashrom_params params;
  1033. };
  1034. /**************** Lancer Firmware Flash ************/
  1035. struct amap_lancer_write_obj_context {
  1036. u8 write_length[24];
  1037. u8 reserved1[7];
  1038. u8 eof;
  1039. } __packed;
  1040. struct lancer_cmd_req_write_object {
  1041. struct be_cmd_req_hdr hdr;
  1042. u8 context[sizeof(struct amap_lancer_write_obj_context) / 8];
  1043. u32 write_offset;
  1044. u8 object_name[104];
  1045. u32 descriptor_count;
  1046. u32 buf_len;
  1047. u32 addr_low;
  1048. u32 addr_high;
  1049. };
  1050. struct lancer_cmd_resp_write_object {
  1051. u8 opcode;
  1052. u8 subsystem;
  1053. u8 rsvd1[2];
  1054. u8 status;
  1055. u8 additional_status;
  1056. u8 rsvd2[2];
  1057. u32 resp_len;
  1058. u32 actual_resp_len;
  1059. u32 actual_write_len;
  1060. };
  1061. /************************ WOL *******************************/
  1062. struct be_cmd_req_acpi_wol_magic_config{
  1063. struct be_cmd_req_hdr hdr;
  1064. u32 rsvd0[145];
  1065. u8 magic_mac[6];
  1066. u8 rsvd2[2];
  1067. } __packed;
  1068. /********************** LoopBack test *********************/
  1069. struct be_cmd_req_loopback_test {
  1070. struct be_cmd_req_hdr hdr;
  1071. u32 loopback_type;
  1072. u32 num_pkts;
  1073. u64 pattern;
  1074. u32 src_port;
  1075. u32 dest_port;
  1076. u32 pkt_size;
  1077. };
  1078. struct be_cmd_resp_loopback_test {
  1079. struct be_cmd_resp_hdr resp_hdr;
  1080. u32 status;
  1081. u32 num_txfer;
  1082. u32 num_rx;
  1083. u32 miscomp_off;
  1084. u32 ticks_compl;
  1085. };
  1086. struct be_cmd_req_set_lmode {
  1087. struct be_cmd_req_hdr hdr;
  1088. u8 src_port;
  1089. u8 dest_port;
  1090. u8 loopback_type;
  1091. u8 loopback_state;
  1092. };
  1093. struct be_cmd_resp_set_lmode {
  1094. struct be_cmd_resp_hdr resp_hdr;
  1095. u8 rsvd0[4];
  1096. };
  1097. /********************** DDR DMA test *********************/
  1098. struct be_cmd_req_ddrdma_test {
  1099. struct be_cmd_req_hdr hdr;
  1100. u64 pattern;
  1101. u32 byte_count;
  1102. u32 rsvd0;
  1103. u8 snd_buff[4096];
  1104. u8 rsvd1[4096];
  1105. };
  1106. struct be_cmd_resp_ddrdma_test {
  1107. struct be_cmd_resp_hdr hdr;
  1108. u64 pattern;
  1109. u32 byte_cnt;
  1110. u32 snd_err;
  1111. u8 rsvd0[4096];
  1112. u8 rcv_buff[4096];
  1113. };
  1114. /*********************** SEEPROM Read ***********************/
  1115. #define BE_READ_SEEPROM_LEN 1024
  1116. struct be_cmd_req_seeprom_read {
  1117. struct be_cmd_req_hdr hdr;
  1118. u8 rsvd0[BE_READ_SEEPROM_LEN];
  1119. };
  1120. struct be_cmd_resp_seeprom_read {
  1121. struct be_cmd_req_hdr hdr;
  1122. u8 seeprom_data[BE_READ_SEEPROM_LEN];
  1123. };
  1124. enum {
  1125. PHY_TYPE_CX4_10GB = 0,
  1126. PHY_TYPE_XFP_10GB,
  1127. PHY_TYPE_SFP_1GB,
  1128. PHY_TYPE_SFP_PLUS_10GB,
  1129. PHY_TYPE_KR_10GB,
  1130. PHY_TYPE_KX4_10GB,
  1131. PHY_TYPE_BASET_10GB,
  1132. PHY_TYPE_BASET_1GB,
  1133. PHY_TYPE_DISABLED = 255
  1134. };
  1135. struct be_cmd_req_get_phy_info {
  1136. struct be_cmd_req_hdr hdr;
  1137. u8 rsvd0[24];
  1138. };
  1139. struct be_cmd_resp_get_phy_info {
  1140. struct be_cmd_req_hdr hdr;
  1141. u16 phy_type;
  1142. u16 interface_type;
  1143. u32 misc_params;
  1144. u32 future_use[4];
  1145. };
  1146. /*********************** Set QOS ***********************/
  1147. #define BE_QOS_BITS_NIC 1
  1148. struct be_cmd_req_set_qos {
  1149. struct be_cmd_req_hdr hdr;
  1150. u32 valid_bits;
  1151. u32 max_bps_nic;
  1152. u32 rsvd[7];
  1153. };
  1154. struct be_cmd_resp_set_qos {
  1155. struct be_cmd_resp_hdr hdr;
  1156. u32 rsvd;
  1157. };
  1158. /*********************** Controller Attributes ***********************/
  1159. struct be_cmd_req_cntl_attribs {
  1160. struct be_cmd_req_hdr hdr;
  1161. };
  1162. struct be_cmd_resp_cntl_attribs {
  1163. struct be_cmd_resp_hdr hdr;
  1164. struct mgmt_controller_attrib attribs;
  1165. };
  1166. /*********************** Set driver function ***********************/
  1167. #define CAPABILITY_SW_TIMESTAMPS 2
  1168. #define CAPABILITY_BE3_NATIVE_ERX_API 4
  1169. struct be_cmd_req_set_func_cap {
  1170. struct be_cmd_req_hdr hdr;
  1171. u32 valid_cap_flags;
  1172. u32 cap_flags;
  1173. u8 rsvd[212];
  1174. };
  1175. struct be_cmd_resp_set_func_cap {
  1176. struct be_cmd_resp_hdr hdr;
  1177. u32 valid_cap_flags;
  1178. u32 cap_flags;
  1179. u8 rsvd[212];
  1180. };
  1181. /*************** HW Stats Get v1 **********************************/
  1182. #define BE_TXP_SW_SZ 48
  1183. struct be_port_rxf_stats_v1 {
  1184. u32 rsvd0[12];
  1185. u32 rx_crc_errors;
  1186. u32 rx_alignment_symbol_errors;
  1187. u32 rx_pause_frames;
  1188. u32 rx_priority_pause_frames;
  1189. u32 rx_control_frames;
  1190. u32 rx_in_range_errors;
  1191. u32 rx_out_range_errors;
  1192. u32 rx_frame_too_long;
  1193. u32 rx_address_match_errors;
  1194. u32 rx_dropped_too_small;
  1195. u32 rx_dropped_too_short;
  1196. u32 rx_dropped_header_too_small;
  1197. u32 rx_dropped_tcp_length;
  1198. u32 rx_dropped_runt;
  1199. u32 rsvd1[10];
  1200. u32 rx_ip_checksum_errs;
  1201. u32 rx_tcp_checksum_errs;
  1202. u32 rx_udp_checksum_errs;
  1203. u32 rsvd2[7];
  1204. u32 rx_switched_unicast_packets;
  1205. u32 rx_switched_multicast_packets;
  1206. u32 rx_switched_broadcast_packets;
  1207. u32 rsvd3[3];
  1208. u32 tx_pauseframes;
  1209. u32 tx_priority_pauseframes;
  1210. u32 tx_controlframes;
  1211. u32 rsvd4[10];
  1212. u32 rxpp_fifo_overflow_drop;
  1213. u32 rx_input_fifo_overflow_drop;
  1214. u32 pmem_fifo_overflow_drop;
  1215. u32 jabber_events;
  1216. u32 rsvd5[3];
  1217. };
  1218. struct be_rxf_stats_v1 {
  1219. struct be_port_rxf_stats_v1 port[4];
  1220. u32 rsvd0[2];
  1221. u32 rx_drops_no_pbuf;
  1222. u32 rx_drops_no_txpb;
  1223. u32 rx_drops_no_erx_descr;
  1224. u32 rx_drops_no_tpre_descr;
  1225. u32 rsvd1[6];
  1226. u32 rx_drops_too_many_frags;
  1227. u32 rx_drops_invalid_ring;
  1228. u32 forwarded_packets;
  1229. u32 rx_drops_mtu;
  1230. u32 rsvd2[14];
  1231. };
  1232. struct be_erx_stats_v1 {
  1233. u32 rx_drops_no_fragments[68]; /* dwordS 0 to 67*/
  1234. u32 rsvd[4];
  1235. };
  1236. struct be_hw_stats_v1 {
  1237. struct be_rxf_stats_v1 rxf;
  1238. u32 rsvd0[BE_TXP_SW_SZ];
  1239. struct be_erx_stats_v1 erx;
  1240. struct be_pmem_stats pmem;
  1241. u32 rsvd1[3];
  1242. };
  1243. struct be_cmd_req_get_stats_v1 {
  1244. struct be_cmd_req_hdr hdr;
  1245. u8 rsvd[sizeof(struct be_hw_stats_v1)];
  1246. };
  1247. struct be_cmd_resp_get_stats_v1 {
  1248. struct be_cmd_resp_hdr hdr;
  1249. struct be_hw_stats_v1 hw_stats;
  1250. };
  1251. static inline void *
  1252. 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_port_rxf_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. struct be_rxf_stats_v1 *rxf_stats = &hw_stats->rxf;
  1267. return &rxf_stats->port[adapter->port_num];
  1268. } else {
  1269. struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
  1270. struct be_rxf_stats_v0 *rxf_stats = &hw_stats->rxf;
  1271. return &rxf_stats->port[adapter->port_num];
  1272. }
  1273. }
  1274. static inline void *be_rxf_stats_from_cmd(struct be_adapter *adapter)
  1275. {
  1276. if (adapter->generation == BE_GEN3) {
  1277. struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
  1278. return &hw_stats->rxf;
  1279. } else {
  1280. struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
  1281. return &hw_stats->rxf;
  1282. }
  1283. }
  1284. static inline void *be_erx_stats_from_cmd(struct be_adapter *adapter)
  1285. {
  1286. if (adapter->generation == BE_GEN3) {
  1287. struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
  1288. return &hw_stats->erx;
  1289. } else {
  1290. struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
  1291. return &hw_stats->erx;
  1292. }
  1293. }
  1294. static inline void *be_pmem_stats_from_cmd(struct be_adapter *adapter)
  1295. {
  1296. if (adapter->generation == BE_GEN3) {
  1297. struct be_hw_stats_v1 *hw_stats = hw_stats_from_cmd(adapter);
  1298. return &hw_stats->pmem;
  1299. } else {
  1300. struct be_hw_stats_v0 *hw_stats = hw_stats_from_cmd(adapter);
  1301. return &hw_stats->pmem;
  1302. }
  1303. }
  1304. extern int be_pci_fnum_get(struct be_adapter *adapter);
  1305. extern int be_cmd_POST(struct be_adapter *adapter);
  1306. extern int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
  1307. u8 type, bool permanent, u32 if_handle);
  1308. extern int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
  1309. u32 if_id, u32 *pmac_id, u32 domain);
  1310. extern int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id,
  1311. u32 pmac_id, u32 domain);
  1312. extern int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags,
  1313. u32 en_flags, u8 *mac, bool pmac_invalid,
  1314. u32 *if_handle, u32 *pmac_id, u32 domain);
  1315. extern int be_cmd_if_destroy(struct be_adapter *adapter, u32 if_handle,
  1316. u32 domain);
  1317. extern int be_cmd_eq_create(struct be_adapter *adapter,
  1318. struct be_queue_info *eq, int eq_delay);
  1319. extern int be_cmd_cq_create(struct be_adapter *adapter,
  1320. struct be_queue_info *cq, struct be_queue_info *eq,
  1321. bool sol_evts, bool no_delay,
  1322. int num_cqe_dma_coalesce);
  1323. extern int be_cmd_mccq_create(struct be_adapter *adapter,
  1324. struct be_queue_info *mccq,
  1325. struct be_queue_info *cq);
  1326. extern int be_cmd_txq_create(struct be_adapter *adapter,
  1327. struct be_queue_info *txq,
  1328. struct be_queue_info *cq);
  1329. extern int be_cmd_rxq_create(struct be_adapter *adapter,
  1330. struct be_queue_info *rxq, u16 cq_id,
  1331. u16 frag_size, u16 max_frame_size, u32 if_id,
  1332. u32 rss, u8 *rss_id);
  1333. extern int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
  1334. int type);
  1335. extern int be_cmd_rxq_destroy(struct be_adapter *adapter,
  1336. struct be_queue_info *q);
  1337. extern int be_cmd_link_status_query(struct be_adapter *adapter,
  1338. bool *link_up, u8 *mac_speed, u16 *link_speed, u32 dom);
  1339. extern int be_cmd_reset(struct be_adapter *adapter);
  1340. extern int be_cmd_get_stats(struct be_adapter *adapter,
  1341. struct be_dma_mem *nonemb_cmd);
  1342. extern int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
  1343. struct be_dma_mem *nonemb_cmd);
  1344. extern int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver);
  1345. extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
  1346. extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
  1347. u16 *vtag_array, u32 num, bool untagged,
  1348. bool promiscuous);
  1349. extern int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en);
  1350. extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
  1351. struct net_device *netdev, struct be_dma_mem *mem);
  1352. extern int be_cmd_set_flow_control(struct be_adapter *adapter,
  1353. u32 tx_fc, u32 rx_fc);
  1354. extern int be_cmd_get_flow_control(struct be_adapter *adapter,
  1355. u32 *tx_fc, u32 *rx_fc);
  1356. extern int be_cmd_query_fw_cfg(struct be_adapter *adapter,
  1357. u32 *port_num, u32 *function_mode, u32 *function_caps);
  1358. extern int be_cmd_reset_function(struct be_adapter *adapter);
  1359. extern int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
  1360. u16 table_size);
  1361. extern int be_process_mcc(struct be_adapter *adapter, int *status);
  1362. extern int be_cmd_set_beacon_state(struct be_adapter *adapter,
  1363. u8 port_num, u8 beacon, u8 status, u8 state);
  1364. extern int be_cmd_get_beacon_state(struct be_adapter *adapter,
  1365. u8 port_num, u32 *state);
  1366. extern int be_cmd_write_flashrom(struct be_adapter *adapter,
  1367. struct be_dma_mem *cmd, u32 flash_oper,
  1368. u32 flash_opcode, u32 buf_size);
  1369. extern int lancer_cmd_write_object(struct be_adapter *adapter,
  1370. struct be_dma_mem *cmd,
  1371. u32 data_size, u32 data_offset,
  1372. const char *obj_name,
  1373. u32 *data_written, u8 *addn_status);
  1374. int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
  1375. int offset);
  1376. extern int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
  1377. struct be_dma_mem *nonemb_cmd);
  1378. extern int be_cmd_fw_init(struct be_adapter *adapter);
  1379. extern int be_cmd_fw_clean(struct be_adapter *adapter);
  1380. extern void be_async_mcc_enable(struct be_adapter *adapter);
  1381. extern void be_async_mcc_disable(struct be_adapter *adapter);
  1382. extern int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
  1383. u32 loopback_type, u32 pkt_size,
  1384. u32 num_pkts, u64 pattern);
  1385. extern int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern,
  1386. u32 byte_cnt, struct be_dma_mem *cmd);
  1387. extern int be_cmd_get_seeprom_data(struct be_adapter *adapter,
  1388. struct be_dma_mem *nonemb_cmd);
  1389. extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
  1390. u8 loopback_type, u8 enable);
  1391. extern int be_cmd_get_phy_info(struct be_adapter *adapter,
  1392. struct be_dma_mem *cmd);
  1393. extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
  1394. extern void be_detect_dump_ue(struct be_adapter *adapter);
  1395. extern int be_cmd_get_die_temperature(struct be_adapter *adapter);
  1396. extern int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
  1397. extern int be_cmd_req_native_mode(struct be_adapter *adapter);
  1398. extern int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
  1399. extern void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);