be_cmds.h 51 KB

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