be_cmds.h 40 KB

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