be_cmds.h 41 KB

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