be_cmds.h 61 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392
  1. /*
  2. * Copyright (C) 2005 - 2015 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 BIT(31)
  44. #define CQE_FLAGS_ASYNC_MASK BIT(30)
  45. #define CQE_FLAGS_COMPLETED_MASK BIT(28)
  46. #define CQE_FLAGS_CONSUMED_MASK BIT(27)
  47. /* Completion Status */
  48. enum mcc_base_status {
  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. MCC_STATUS_FEATURE_NOT_SUPPORTED = 68
  57. };
  58. /* Additional status */
  59. enum mcc_addl_status {
  60. MCC_ADDL_STATUS_INSUFFICIENT_RESOURCES = 0x16,
  61. MCC_ADDL_STATUS_FLASH_IMAGE_CRC_MISMATCH = 0x4d,
  62. MCC_ADDL_STATUS_TOO_MANY_INTERFACES = 0x4a,
  63. MCC_ADDL_STATUS_INSUFFICIENT_VLANS = 0xab
  64. };
  65. #define CQE_BASE_STATUS_MASK 0xFFFF
  66. #define CQE_BASE_STATUS_SHIFT 0 /* bits 0 - 15 */
  67. #define CQE_ADDL_STATUS_MASK 0xFF
  68. #define CQE_ADDL_STATUS_SHIFT 16 /* bits 16 - 31 */
  69. #define base_status(status) \
  70. ((enum mcc_base_status) \
  71. (status > 0 ? (status & CQE_BASE_STATUS_MASK) : 0))
  72. #define addl_status(status) \
  73. ((enum mcc_addl_status) \
  74. (status > 0 ? (status >> CQE_ADDL_STATUS_SHIFT) & \
  75. CQE_ADDL_STATUS_MASK : 0))
  76. struct be_mcc_compl {
  77. u32 status; /* dword 0 */
  78. u32 tag0; /* dword 1 */
  79. u32 tag1; /* dword 2 */
  80. u32 flags; /* dword 3 */
  81. };
  82. /* When the async bit of mcc_compl flags is set, flags
  83. * is interpreted as follows:
  84. */
  85. #define ASYNC_EVENT_CODE_SHIFT 8 /* bits 8 - 15 */
  86. #define ASYNC_EVENT_CODE_MASK 0xFF
  87. #define ASYNC_EVENT_TYPE_SHIFT 16
  88. #define ASYNC_EVENT_TYPE_MASK 0xFF
  89. #define ASYNC_EVENT_CODE_LINK_STATE 0x1
  90. #define ASYNC_EVENT_CODE_GRP_5 0x5
  91. #define ASYNC_EVENT_QOS_SPEED 0x1
  92. #define ASYNC_EVENT_COS_PRIORITY 0x2
  93. #define ASYNC_EVENT_PVID_STATE 0x3
  94. #define ASYNC_EVENT_CODE_QNQ 0x6
  95. #define ASYNC_DEBUG_EVENT_TYPE_QNQ 1
  96. #define ASYNC_EVENT_CODE_SLIPORT 0x11
  97. #define ASYNC_EVENT_PORT_MISCONFIG 0x9
  98. #define ASYNC_EVENT_FW_CONTROL 0x5
  99. enum {
  100. LINK_DOWN = 0x0,
  101. LINK_UP = 0x1
  102. };
  103. #define LINK_STATUS_MASK 0x1
  104. #define LOGICAL_LINK_STATUS_MASK 0x2
  105. /* When the event code of compl->flags is link-state, the mcc_compl
  106. * must be interpreted as follows
  107. */
  108. struct be_async_event_link_state {
  109. u8 physical_port;
  110. u8 port_link_status;
  111. u8 port_duplex;
  112. u8 port_speed;
  113. u8 port_fault;
  114. u8 rsvd0[7];
  115. u32 flags;
  116. } __packed;
  117. /* When the event code of compl->flags is GRP-5 and event_type is QOS_SPEED
  118. * the mcc_compl must be interpreted as follows
  119. */
  120. struct be_async_event_grp5_qos_link_speed {
  121. u8 physical_port;
  122. u8 rsvd[5];
  123. u16 qos_link_speed;
  124. u32 event_tag;
  125. u32 flags;
  126. } __packed;
  127. /* When the event code of compl->flags is GRP5 and event type is
  128. * CoS-Priority, the mcc_compl must be interpreted as follows
  129. */
  130. struct be_async_event_grp5_cos_priority {
  131. u8 physical_port;
  132. u8 available_priority_bmap;
  133. u8 reco_default_priority;
  134. u8 valid;
  135. u8 rsvd0;
  136. u8 event_tag;
  137. u32 flags;
  138. } __packed;
  139. /* When the event code of compl->flags is GRP5 and event type is
  140. * PVID state, the mcc_compl must be interpreted as follows
  141. */
  142. struct be_async_event_grp5_pvid_state {
  143. u8 enabled;
  144. u8 rsvd0;
  145. u16 tag;
  146. u32 event_tag;
  147. u32 rsvd1;
  148. u32 flags;
  149. } __packed;
  150. /* async event indicating outer VLAN tag in QnQ */
  151. struct be_async_event_qnq {
  152. u8 valid; /* Indicates if outer VLAN is valid */
  153. u8 rsvd0;
  154. u16 vlan_tag;
  155. u32 event_tag;
  156. u8 rsvd1[4];
  157. u32 flags;
  158. } __packed;
  159. #define INCOMPATIBLE_SFP 0x3
  160. /* async event indicating misconfigured port */
  161. struct be_async_event_misconfig_port {
  162. u32 event_data_word1;
  163. u32 event_data_word2;
  164. u32 rsvd0;
  165. u32 flags;
  166. } __packed;
  167. #define BMC_FILT_BROADCAST_ARP BIT(0)
  168. #define BMC_FILT_BROADCAST_DHCP_CLIENT BIT(1)
  169. #define BMC_FILT_BROADCAST_DHCP_SERVER BIT(2)
  170. #define BMC_FILT_BROADCAST_NET_BIOS BIT(3)
  171. #define BMC_FILT_BROADCAST BIT(7)
  172. #define BMC_FILT_MULTICAST_IPV6_NEIGH_ADVER BIT(8)
  173. #define BMC_FILT_MULTICAST_IPV6_RA BIT(9)
  174. #define BMC_FILT_MULTICAST_IPV6_RAS BIT(10)
  175. #define BMC_FILT_MULTICAST BIT(15)
  176. struct be_async_fw_control {
  177. u32 event_data_word1;
  178. u32 event_data_word2;
  179. u32 evt_tag;
  180. u32 event_data_word4;
  181. } __packed;
  182. struct be_mcc_mailbox {
  183. struct be_mcc_wrb wrb;
  184. struct be_mcc_compl compl;
  185. };
  186. #define CMD_SUBSYSTEM_COMMON 0x1
  187. #define CMD_SUBSYSTEM_ETH 0x3
  188. #define CMD_SUBSYSTEM_LOWLEVEL 0xb
  189. #define OPCODE_COMMON_NTWK_MAC_QUERY 1
  190. #define OPCODE_COMMON_NTWK_MAC_SET 2
  191. #define OPCODE_COMMON_NTWK_MULTICAST_SET 3
  192. #define OPCODE_COMMON_NTWK_VLAN_CONFIG 4
  193. #define OPCODE_COMMON_NTWK_LINK_STATUS_QUERY 5
  194. #define OPCODE_COMMON_READ_FLASHROM 6
  195. #define OPCODE_COMMON_WRITE_FLASHROM 7
  196. #define OPCODE_COMMON_CQ_CREATE 12
  197. #define OPCODE_COMMON_EQ_CREATE 13
  198. #define OPCODE_COMMON_MCC_CREATE 21
  199. #define OPCODE_COMMON_SET_QOS 28
  200. #define OPCODE_COMMON_MCC_CREATE_EXT 90
  201. #define OPCODE_COMMON_SEEPROM_READ 30
  202. #define OPCODE_COMMON_GET_CNTL_ATTRIBUTES 32
  203. #define OPCODE_COMMON_NTWK_RX_FILTER 34
  204. #define OPCODE_COMMON_GET_FW_VERSION 35
  205. #define OPCODE_COMMON_SET_FLOW_CONTROL 36
  206. #define OPCODE_COMMON_GET_FLOW_CONTROL 37
  207. #define OPCODE_COMMON_SET_FRAME_SIZE 39
  208. #define OPCODE_COMMON_MODIFY_EQ_DELAY 41
  209. #define OPCODE_COMMON_FIRMWARE_CONFIG 42
  210. #define OPCODE_COMMON_NTWK_INTERFACE_CREATE 50
  211. #define OPCODE_COMMON_NTWK_INTERFACE_DESTROY 51
  212. #define OPCODE_COMMON_MCC_DESTROY 53
  213. #define OPCODE_COMMON_CQ_DESTROY 54
  214. #define OPCODE_COMMON_EQ_DESTROY 55
  215. #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
  216. #define OPCODE_COMMON_NTWK_PMAC_ADD 59
  217. #define OPCODE_COMMON_NTWK_PMAC_DEL 60
  218. #define OPCODE_COMMON_FUNCTION_RESET 61
  219. #define OPCODE_COMMON_MANAGE_FAT 68
  220. #define OPCODE_COMMON_ENABLE_DISABLE_BEACON 69
  221. #define OPCODE_COMMON_GET_BEACON_STATE 70
  222. #define OPCODE_COMMON_READ_TRANSRECV_DATA 73
  223. #define OPCODE_COMMON_GET_PORT_NAME 77
  224. #define OPCODE_COMMON_SET_LOGICAL_LINK_CONFIG 80
  225. #define OPCODE_COMMON_SET_INTERRUPT_ENABLE 89
  226. #define OPCODE_COMMON_SET_FN_PRIVILEGES 100
  227. #define OPCODE_COMMON_GET_PHY_DETAILS 102
  228. #define OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP 103
  229. #define OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES 121
  230. #define OPCODE_COMMON_GET_EXT_FAT_CAPABILITES 125
  231. #define OPCODE_COMMON_SET_EXT_FAT_CAPABILITES 126
  232. #define OPCODE_COMMON_GET_MAC_LIST 147
  233. #define OPCODE_COMMON_SET_MAC_LIST 148
  234. #define OPCODE_COMMON_GET_HSW_CONFIG 152
  235. #define OPCODE_COMMON_GET_FUNC_CONFIG 160
  236. #define OPCODE_COMMON_GET_PROFILE_CONFIG 164
  237. #define OPCODE_COMMON_SET_PROFILE_CONFIG 165
  238. #define OPCODE_COMMON_GET_ACTIVE_PROFILE 167
  239. #define OPCODE_COMMON_SET_HSW_CONFIG 153
  240. #define OPCODE_COMMON_GET_FN_PRIVILEGES 170
  241. #define OPCODE_COMMON_READ_OBJECT 171
  242. #define OPCODE_COMMON_WRITE_OBJECT 172
  243. #define OPCODE_COMMON_DELETE_OBJECT 174
  244. #define OPCODE_COMMON_MANAGE_IFACE_FILTERS 193
  245. #define OPCODE_COMMON_GET_IFACE_LIST 194
  246. #define OPCODE_COMMON_ENABLE_DISABLE_VF 196
  247. #define OPCODE_ETH_RSS_CONFIG 1
  248. #define OPCODE_ETH_ACPI_CONFIG 2
  249. #define OPCODE_ETH_PROMISCUOUS 3
  250. #define OPCODE_ETH_GET_STATISTICS 4
  251. #define OPCODE_ETH_TX_CREATE 7
  252. #define OPCODE_ETH_RX_CREATE 8
  253. #define OPCODE_ETH_TX_DESTROY 9
  254. #define OPCODE_ETH_RX_DESTROY 10
  255. #define OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG 12
  256. #define OPCODE_ETH_GET_PPORT_STATS 18
  257. #define OPCODE_LOWLEVEL_HOST_DDR_DMA 17
  258. #define OPCODE_LOWLEVEL_LOOPBACK_TEST 18
  259. #define OPCODE_LOWLEVEL_SET_LOOPBACK_MODE 19
  260. struct be_cmd_req_hdr {
  261. u8 opcode; /* dword 0 */
  262. u8 subsystem; /* dword 0 */
  263. u8 port_number; /* dword 0 */
  264. u8 domain; /* dword 0 */
  265. u32 timeout; /* dword 1 */
  266. u32 request_length; /* dword 2 */
  267. u8 version; /* dword 3 */
  268. u8 rsvd[3]; /* dword 3 */
  269. };
  270. #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
  271. #define RESP_HDR_INFO_SUBSYS_SHIFT 8 /* bits 8 - 15 */
  272. struct be_cmd_resp_hdr {
  273. u8 opcode; /* dword 0 */
  274. u8 subsystem; /* dword 0 */
  275. u8 rsvd[2]; /* dword 0 */
  276. u8 base_status; /* dword 1 */
  277. u8 addl_status; /* dword 1 */
  278. u8 rsvd1[2]; /* dword 1 */
  279. u32 response_length; /* dword 2 */
  280. u32 actual_resp_len; /* dword 3 */
  281. };
  282. struct phys_addr {
  283. u32 lo;
  284. u32 hi;
  285. };
  286. /**************************
  287. * BE Command definitions *
  288. **************************/
  289. /* Pseudo amap definition in which each bit of the actual structure is defined
  290. * as a byte: used to calculate offset/shift/mask of each field */
  291. struct amap_eq_context {
  292. u8 cidx[13]; /* dword 0*/
  293. u8 rsvd0[3]; /* dword 0*/
  294. u8 epidx[13]; /* dword 0*/
  295. u8 valid; /* dword 0*/
  296. u8 rsvd1; /* dword 0*/
  297. u8 size; /* dword 0*/
  298. u8 pidx[13]; /* dword 1*/
  299. u8 rsvd2[3]; /* dword 1*/
  300. u8 pd[10]; /* dword 1*/
  301. u8 count[3]; /* dword 1*/
  302. u8 solevent; /* dword 1*/
  303. u8 stalled; /* dword 1*/
  304. u8 armed; /* dword 1*/
  305. u8 rsvd3[4]; /* dword 2*/
  306. u8 func[8]; /* dword 2*/
  307. u8 rsvd4; /* dword 2*/
  308. u8 delaymult[10]; /* dword 2*/
  309. u8 rsvd5[2]; /* dword 2*/
  310. u8 phase[2]; /* dword 2*/
  311. u8 nodelay; /* dword 2*/
  312. u8 rsvd6[4]; /* dword 2*/
  313. u8 rsvd7[32]; /* dword 3*/
  314. } __packed;
  315. struct be_cmd_req_eq_create {
  316. struct be_cmd_req_hdr hdr;
  317. u16 num_pages; /* sword */
  318. u16 rsvd0; /* sword */
  319. u8 context[sizeof(struct amap_eq_context) / 8];
  320. struct phys_addr pages[8];
  321. } __packed;
  322. struct be_cmd_resp_eq_create {
  323. struct be_cmd_resp_hdr resp_hdr;
  324. u16 eq_id; /* sword */
  325. u16 msix_idx; /* available only in v2 */
  326. } __packed;
  327. /******************** Mac query ***************************/
  328. enum {
  329. MAC_ADDRESS_TYPE_STORAGE = 0x0,
  330. MAC_ADDRESS_TYPE_NETWORK = 0x1,
  331. MAC_ADDRESS_TYPE_PD = 0x2,
  332. MAC_ADDRESS_TYPE_MANAGEMENT = 0x3
  333. };
  334. struct mac_addr {
  335. u16 size_of_struct;
  336. u8 addr[ETH_ALEN];
  337. } __packed;
  338. struct be_cmd_req_mac_query {
  339. struct be_cmd_req_hdr hdr;
  340. u8 type;
  341. u8 permanent;
  342. u16 if_id;
  343. u32 pmac_id;
  344. } __packed;
  345. struct be_cmd_resp_mac_query {
  346. struct be_cmd_resp_hdr hdr;
  347. struct mac_addr mac;
  348. };
  349. /******************** PMac Add ***************************/
  350. struct be_cmd_req_pmac_add {
  351. struct be_cmd_req_hdr hdr;
  352. u32 if_id;
  353. u8 mac_address[ETH_ALEN];
  354. u8 rsvd0[2];
  355. } __packed;
  356. struct be_cmd_resp_pmac_add {
  357. struct be_cmd_resp_hdr hdr;
  358. u32 pmac_id;
  359. };
  360. /******************** PMac Del ***************************/
  361. struct be_cmd_req_pmac_del {
  362. struct be_cmd_req_hdr hdr;
  363. u32 if_id;
  364. u32 pmac_id;
  365. };
  366. /******************** Create CQ ***************************/
  367. /* Pseudo amap definition in which each bit of the actual structure is defined
  368. * as a byte: used to calculate offset/shift/mask of each field */
  369. struct amap_cq_context_be {
  370. u8 cidx[11]; /* dword 0*/
  371. u8 rsvd0; /* dword 0*/
  372. u8 coalescwm[2]; /* dword 0*/
  373. u8 nodelay; /* dword 0*/
  374. u8 epidx[11]; /* dword 0*/
  375. u8 rsvd1; /* dword 0*/
  376. u8 count[2]; /* dword 0*/
  377. u8 valid; /* dword 0*/
  378. u8 solevent; /* dword 0*/
  379. u8 eventable; /* dword 0*/
  380. u8 pidx[11]; /* dword 1*/
  381. u8 rsvd2; /* dword 1*/
  382. u8 pd[10]; /* dword 1*/
  383. u8 eqid[8]; /* dword 1*/
  384. u8 stalled; /* dword 1*/
  385. u8 armed; /* dword 1*/
  386. u8 rsvd3[4]; /* dword 2*/
  387. u8 func[8]; /* dword 2*/
  388. u8 rsvd4[20]; /* dword 2*/
  389. u8 rsvd5[32]; /* dword 3*/
  390. } __packed;
  391. struct amap_cq_context_v2 {
  392. u8 rsvd0[12]; /* dword 0*/
  393. u8 coalescwm[2]; /* dword 0*/
  394. u8 nodelay; /* dword 0*/
  395. u8 rsvd1[12]; /* dword 0*/
  396. u8 count[2]; /* dword 0*/
  397. u8 valid; /* dword 0*/
  398. u8 rsvd2; /* dword 0*/
  399. u8 eventable; /* dword 0*/
  400. u8 eqid[16]; /* dword 1*/
  401. u8 rsvd3[15]; /* dword 1*/
  402. u8 armed; /* dword 1*/
  403. u8 rsvd4[32]; /* dword 2*/
  404. u8 rsvd5[32]; /* dword 3*/
  405. } __packed;
  406. struct be_cmd_req_cq_create {
  407. struct be_cmd_req_hdr hdr;
  408. u16 num_pages;
  409. u8 page_size;
  410. u8 rsvd0;
  411. u8 context[sizeof(struct amap_cq_context_be) / 8];
  412. struct phys_addr pages[8];
  413. } __packed;
  414. struct be_cmd_resp_cq_create {
  415. struct be_cmd_resp_hdr hdr;
  416. u16 cq_id;
  417. u16 rsvd0;
  418. } __packed;
  419. struct be_cmd_req_get_fat {
  420. struct be_cmd_req_hdr hdr;
  421. u32 fat_operation;
  422. u32 read_log_offset;
  423. u32 read_log_length;
  424. u32 data_buffer_size;
  425. u32 data_buffer[1];
  426. } __packed;
  427. struct be_cmd_resp_get_fat {
  428. struct be_cmd_resp_hdr hdr;
  429. u32 log_size;
  430. u32 read_log_length;
  431. u32 rsvd[2];
  432. u32 data_buffer[1];
  433. } __packed;
  434. /******************** Create MCCQ ***************************/
  435. /* Pseudo amap definition in which each bit of the actual structure is defined
  436. * as a byte: used to calculate offset/shift/mask of each field */
  437. struct amap_mcc_context_be {
  438. u8 con_index[14];
  439. u8 rsvd0[2];
  440. u8 ring_size[4];
  441. u8 fetch_wrb;
  442. u8 fetch_r2t;
  443. u8 cq_id[10];
  444. u8 prod_index[14];
  445. u8 fid[8];
  446. u8 pdid[9];
  447. u8 valid;
  448. u8 rsvd1[32];
  449. u8 rsvd2[32];
  450. } __packed;
  451. struct amap_mcc_context_v1 {
  452. u8 async_cq_id[16];
  453. u8 ring_size[4];
  454. u8 rsvd0[12];
  455. u8 rsvd1[31];
  456. u8 valid;
  457. u8 async_cq_valid[1];
  458. u8 rsvd2[31];
  459. u8 rsvd3[32];
  460. } __packed;
  461. struct be_cmd_req_mcc_create {
  462. struct be_cmd_req_hdr hdr;
  463. u16 num_pages;
  464. u16 cq_id;
  465. u8 context[sizeof(struct amap_mcc_context_be) / 8];
  466. struct phys_addr pages[8];
  467. } __packed;
  468. struct be_cmd_req_mcc_ext_create {
  469. struct be_cmd_req_hdr hdr;
  470. u16 num_pages;
  471. u16 cq_id;
  472. u32 async_event_bitmap[1];
  473. u8 context[sizeof(struct amap_mcc_context_v1) / 8];
  474. struct phys_addr pages[8];
  475. } __packed;
  476. struct be_cmd_resp_mcc_create {
  477. struct be_cmd_resp_hdr hdr;
  478. u16 id;
  479. u16 rsvd0;
  480. } __packed;
  481. /******************** Create TxQ ***************************/
  482. #define BE_ETH_TX_RING_TYPE_STANDARD 2
  483. #define BE_ULP1_NUM 1
  484. struct be_cmd_req_eth_tx_create {
  485. struct be_cmd_req_hdr hdr;
  486. u8 num_pages;
  487. u8 ulp_num;
  488. u16 type;
  489. u16 if_id;
  490. u8 queue_size;
  491. u8 rsvd0;
  492. u32 rsvd1;
  493. u16 cq_id;
  494. u16 rsvd2;
  495. u32 rsvd3[13];
  496. struct phys_addr pages[8];
  497. } __packed;
  498. struct be_cmd_resp_eth_tx_create {
  499. struct be_cmd_resp_hdr hdr;
  500. u16 cid;
  501. u16 rid;
  502. u32 db_offset;
  503. u32 rsvd0[4];
  504. } __packed;
  505. /******************** Create RxQ ***************************/
  506. struct be_cmd_req_eth_rx_create {
  507. struct be_cmd_req_hdr hdr;
  508. u16 cq_id;
  509. u8 frag_size;
  510. u8 num_pages;
  511. struct phys_addr pages[2];
  512. u32 interface_id;
  513. u16 max_frame_size;
  514. u16 rsvd0;
  515. u32 rss_queue;
  516. } __packed;
  517. struct be_cmd_resp_eth_rx_create {
  518. struct be_cmd_resp_hdr hdr;
  519. u16 id;
  520. u8 rss_id;
  521. u8 rsvd0;
  522. } __packed;
  523. /******************** Q Destroy ***************************/
  524. /* Type of Queue to be destroyed */
  525. enum {
  526. QTYPE_EQ = 1,
  527. QTYPE_CQ,
  528. QTYPE_TXQ,
  529. QTYPE_RXQ,
  530. QTYPE_MCCQ
  531. };
  532. struct be_cmd_req_q_destroy {
  533. struct be_cmd_req_hdr hdr;
  534. u16 id;
  535. u16 bypass_flush; /* valid only for rx q destroy */
  536. } __packed;
  537. /************ I/f Create (it's actually I/f Config Create)**********/
  538. /* Capability flags for the i/f */
  539. enum be_if_flags {
  540. BE_IF_FLAGS_RSS = 0x4,
  541. BE_IF_FLAGS_PROMISCUOUS = 0x8,
  542. BE_IF_FLAGS_BROADCAST = 0x10,
  543. BE_IF_FLAGS_UNTAGGED = 0x20,
  544. BE_IF_FLAGS_ULP = 0x40,
  545. BE_IF_FLAGS_VLAN_PROMISCUOUS = 0x80,
  546. BE_IF_FLAGS_VLAN = 0x100,
  547. BE_IF_FLAGS_MCAST_PROMISCUOUS = 0x200,
  548. BE_IF_FLAGS_PASS_L2_ERRORS = 0x400,
  549. BE_IF_FLAGS_PASS_L3L4_ERRORS = 0x800,
  550. BE_IF_FLAGS_MULTICAST = 0x1000,
  551. BE_IF_FLAGS_DEFQ_RSS = 0x1000000
  552. };
  553. #define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\
  554. BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\
  555. BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\
  556. BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\
  557. BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_DEFQ_RSS)
  558. #define BE_IF_FLAGS_ALL_PROMISCUOUS (BE_IF_FLAGS_PROMISCUOUS | \
  559. BE_IF_FLAGS_VLAN_PROMISCUOUS |\
  560. BE_IF_FLAGS_MCAST_PROMISCUOUS)
  561. /* An RX interface is an object with one or more MAC addresses and
  562. * filtering capabilities. */
  563. struct be_cmd_req_if_create {
  564. struct be_cmd_req_hdr hdr;
  565. u32 version; /* ignore currently */
  566. u32 capability_flags;
  567. u32 enable_flags;
  568. u8 mac_addr[ETH_ALEN];
  569. u8 rsvd0;
  570. u8 pmac_invalid; /* if set, don't attach the mac addr to the i/f */
  571. u32 vlan_tag; /* not used currently */
  572. } __packed;
  573. struct be_cmd_resp_if_create {
  574. struct be_cmd_resp_hdr hdr;
  575. u32 interface_id;
  576. u32 pmac_id;
  577. };
  578. /****** I/f Destroy(it's actually I/f Config Destroy )**********/
  579. struct be_cmd_req_if_destroy {
  580. struct be_cmd_req_hdr hdr;
  581. u32 interface_id;
  582. };
  583. /*************** HW Stats Get **********************************/
  584. struct be_port_rxf_stats_v0 {
  585. u32 rx_bytes_lsd; /* dword 0*/
  586. u32 rx_bytes_msd; /* dword 1*/
  587. u32 rx_total_frames; /* dword 2*/
  588. u32 rx_unicast_frames; /* dword 3*/
  589. u32 rx_multicast_frames; /* dword 4*/
  590. u32 rx_broadcast_frames; /* dword 5*/
  591. u32 rx_crc_errors; /* dword 6*/
  592. u32 rx_alignment_symbol_errors; /* dword 7*/
  593. u32 rx_pause_frames; /* dword 8*/
  594. u32 rx_control_frames; /* dword 9*/
  595. u32 rx_in_range_errors; /* dword 10*/
  596. u32 rx_out_range_errors; /* dword 11*/
  597. u32 rx_frame_too_long; /* dword 12*/
  598. u32 rx_address_filtered; /* dword 13*/
  599. u32 rx_vlan_filtered; /* dword 14*/
  600. u32 rx_dropped_too_small; /* dword 15*/
  601. u32 rx_dropped_too_short; /* dword 16*/
  602. u32 rx_dropped_header_too_small; /* dword 17*/
  603. u32 rx_dropped_tcp_length; /* dword 18*/
  604. u32 rx_dropped_runt; /* dword 19*/
  605. u32 rx_64_byte_packets; /* dword 20*/
  606. u32 rx_65_127_byte_packets; /* dword 21*/
  607. u32 rx_128_256_byte_packets; /* dword 22*/
  608. u32 rx_256_511_byte_packets; /* dword 23*/
  609. u32 rx_512_1023_byte_packets; /* dword 24*/
  610. u32 rx_1024_1518_byte_packets; /* dword 25*/
  611. u32 rx_1519_2047_byte_packets; /* dword 26*/
  612. u32 rx_2048_4095_byte_packets; /* dword 27*/
  613. u32 rx_4096_8191_byte_packets; /* dword 28*/
  614. u32 rx_8192_9216_byte_packets; /* dword 29*/
  615. u32 rx_ip_checksum_errs; /* dword 30*/
  616. u32 rx_tcp_checksum_errs; /* dword 31*/
  617. u32 rx_udp_checksum_errs; /* dword 32*/
  618. u32 rx_non_rss_packets; /* dword 33*/
  619. u32 rx_ipv4_packets; /* dword 34*/
  620. u32 rx_ipv6_packets; /* dword 35*/
  621. u32 rx_ipv4_bytes_lsd; /* dword 36*/
  622. u32 rx_ipv4_bytes_msd; /* dword 37*/
  623. u32 rx_ipv6_bytes_lsd; /* dword 38*/
  624. u32 rx_ipv6_bytes_msd; /* dword 39*/
  625. u32 rx_chute1_packets; /* dword 40*/
  626. u32 rx_chute2_packets; /* dword 41*/
  627. u32 rx_chute3_packets; /* dword 42*/
  628. u32 rx_management_packets; /* dword 43*/
  629. u32 rx_switched_unicast_packets; /* dword 44*/
  630. u32 rx_switched_multicast_packets; /* dword 45*/
  631. u32 rx_switched_broadcast_packets; /* dword 46*/
  632. u32 tx_bytes_lsd; /* dword 47*/
  633. u32 tx_bytes_msd; /* dword 48*/
  634. u32 tx_unicastframes; /* dword 49*/
  635. u32 tx_multicastframes; /* dword 50*/
  636. u32 tx_broadcastframes; /* dword 51*/
  637. u32 tx_pauseframes; /* dword 52*/
  638. u32 tx_controlframes; /* dword 53*/
  639. u32 tx_64_byte_packets; /* dword 54*/
  640. u32 tx_65_127_byte_packets; /* dword 55*/
  641. u32 tx_128_256_byte_packets; /* dword 56*/
  642. u32 tx_256_511_byte_packets; /* dword 57*/
  643. u32 tx_512_1023_byte_packets; /* dword 58*/
  644. u32 tx_1024_1518_byte_packets; /* dword 59*/
  645. u32 tx_1519_2047_byte_packets; /* dword 60*/
  646. u32 tx_2048_4095_byte_packets; /* dword 61*/
  647. u32 tx_4096_8191_byte_packets; /* dword 62*/
  648. u32 tx_8192_9216_byte_packets; /* dword 63*/
  649. u32 rx_fifo_overflow; /* dword 64*/
  650. u32 rx_input_fifo_overflow; /* dword 65*/
  651. };
  652. struct be_rxf_stats_v0 {
  653. struct be_port_rxf_stats_v0 port[2];
  654. u32 rx_drops_no_pbuf; /* dword 132*/
  655. u32 rx_drops_no_txpb; /* dword 133*/
  656. u32 rx_drops_no_erx_descr; /* dword 134*/
  657. u32 rx_drops_no_tpre_descr; /* dword 135*/
  658. u32 management_rx_port_packets; /* dword 136*/
  659. u32 management_rx_port_bytes; /* dword 137*/
  660. u32 management_rx_port_pause_frames; /* dword 138*/
  661. u32 management_rx_port_errors; /* dword 139*/
  662. u32 management_tx_port_packets; /* dword 140*/
  663. u32 management_tx_port_bytes; /* dword 141*/
  664. u32 management_tx_port_pause; /* dword 142*/
  665. u32 management_rx_port_rxfifo_overflow; /* dword 143*/
  666. u32 rx_drops_too_many_frags; /* dword 144*/
  667. u32 rx_drops_invalid_ring; /* dword 145*/
  668. u32 forwarded_packets; /* dword 146*/
  669. u32 rx_drops_mtu; /* dword 147*/
  670. u32 rsvd0[7];
  671. u32 port0_jabber_events;
  672. u32 port1_jabber_events;
  673. u32 rsvd1[6];
  674. };
  675. struct be_erx_stats_v0 {
  676. u32 rx_drops_no_fragments[44]; /* dwordS 0 to 43*/
  677. u32 rsvd[4];
  678. };
  679. struct be_pmem_stats {
  680. u32 eth_red_drops;
  681. u32 rsvd[5];
  682. };
  683. struct be_hw_stats_v0 {
  684. struct be_rxf_stats_v0 rxf;
  685. u32 rsvd[48];
  686. struct be_erx_stats_v0 erx;
  687. struct be_pmem_stats pmem;
  688. };
  689. struct be_cmd_req_get_stats_v0 {
  690. struct be_cmd_req_hdr hdr;
  691. u8 rsvd[sizeof(struct be_hw_stats_v0)];
  692. };
  693. struct be_cmd_resp_get_stats_v0 {
  694. struct be_cmd_resp_hdr hdr;
  695. struct be_hw_stats_v0 hw_stats;
  696. };
  697. struct lancer_pport_stats {
  698. u32 tx_packets_lo;
  699. u32 tx_packets_hi;
  700. u32 tx_unicast_packets_lo;
  701. u32 tx_unicast_packets_hi;
  702. u32 tx_multicast_packets_lo;
  703. u32 tx_multicast_packets_hi;
  704. u32 tx_broadcast_packets_lo;
  705. u32 tx_broadcast_packets_hi;
  706. u32 tx_bytes_lo;
  707. u32 tx_bytes_hi;
  708. u32 tx_unicast_bytes_lo;
  709. u32 tx_unicast_bytes_hi;
  710. u32 tx_multicast_bytes_lo;
  711. u32 tx_multicast_bytes_hi;
  712. u32 tx_broadcast_bytes_lo;
  713. u32 tx_broadcast_bytes_hi;
  714. u32 tx_discards_lo;
  715. u32 tx_discards_hi;
  716. u32 tx_errors_lo;
  717. u32 tx_errors_hi;
  718. u32 tx_pause_frames_lo;
  719. u32 tx_pause_frames_hi;
  720. u32 tx_pause_on_frames_lo;
  721. u32 tx_pause_on_frames_hi;
  722. u32 tx_pause_off_frames_lo;
  723. u32 tx_pause_off_frames_hi;
  724. u32 tx_internal_mac_errors_lo;
  725. u32 tx_internal_mac_errors_hi;
  726. u32 tx_control_frames_lo;
  727. u32 tx_control_frames_hi;
  728. u32 tx_packets_64_bytes_lo;
  729. u32 tx_packets_64_bytes_hi;
  730. u32 tx_packets_65_to_127_bytes_lo;
  731. u32 tx_packets_65_to_127_bytes_hi;
  732. u32 tx_packets_128_to_255_bytes_lo;
  733. u32 tx_packets_128_to_255_bytes_hi;
  734. u32 tx_packets_256_to_511_bytes_lo;
  735. u32 tx_packets_256_to_511_bytes_hi;
  736. u32 tx_packets_512_to_1023_bytes_lo;
  737. u32 tx_packets_512_to_1023_bytes_hi;
  738. u32 tx_packets_1024_to_1518_bytes_lo;
  739. u32 tx_packets_1024_to_1518_bytes_hi;
  740. u32 tx_packets_1519_to_2047_bytes_lo;
  741. u32 tx_packets_1519_to_2047_bytes_hi;
  742. u32 tx_packets_2048_to_4095_bytes_lo;
  743. u32 tx_packets_2048_to_4095_bytes_hi;
  744. u32 tx_packets_4096_to_8191_bytes_lo;
  745. u32 tx_packets_4096_to_8191_bytes_hi;
  746. u32 tx_packets_8192_to_9216_bytes_lo;
  747. u32 tx_packets_8192_to_9216_bytes_hi;
  748. u32 tx_lso_packets_lo;
  749. u32 tx_lso_packets_hi;
  750. u32 rx_packets_lo;
  751. u32 rx_packets_hi;
  752. u32 rx_unicast_packets_lo;
  753. u32 rx_unicast_packets_hi;
  754. u32 rx_multicast_packets_lo;
  755. u32 rx_multicast_packets_hi;
  756. u32 rx_broadcast_packets_lo;
  757. u32 rx_broadcast_packets_hi;
  758. u32 rx_bytes_lo;
  759. u32 rx_bytes_hi;
  760. u32 rx_unicast_bytes_lo;
  761. u32 rx_unicast_bytes_hi;
  762. u32 rx_multicast_bytes_lo;
  763. u32 rx_multicast_bytes_hi;
  764. u32 rx_broadcast_bytes_lo;
  765. u32 rx_broadcast_bytes_hi;
  766. u32 rx_unknown_protos;
  767. u32 rsvd_69; /* Word 69 is reserved */
  768. u32 rx_discards_lo;
  769. u32 rx_discards_hi;
  770. u32 rx_errors_lo;
  771. u32 rx_errors_hi;
  772. u32 rx_crc_errors_lo;
  773. u32 rx_crc_errors_hi;
  774. u32 rx_alignment_errors_lo;
  775. u32 rx_alignment_errors_hi;
  776. u32 rx_symbol_errors_lo;
  777. u32 rx_symbol_errors_hi;
  778. u32 rx_pause_frames_lo;
  779. u32 rx_pause_frames_hi;
  780. u32 rx_pause_on_frames_lo;
  781. u32 rx_pause_on_frames_hi;
  782. u32 rx_pause_off_frames_lo;
  783. u32 rx_pause_off_frames_hi;
  784. u32 rx_frames_too_long_lo;
  785. u32 rx_frames_too_long_hi;
  786. u32 rx_internal_mac_errors_lo;
  787. u32 rx_internal_mac_errors_hi;
  788. u32 rx_undersize_packets;
  789. u32 rx_oversize_packets;
  790. u32 rx_fragment_packets;
  791. u32 rx_jabbers;
  792. u32 rx_control_frames_lo;
  793. u32 rx_control_frames_hi;
  794. u32 rx_control_frames_unknown_opcode_lo;
  795. u32 rx_control_frames_unknown_opcode_hi;
  796. u32 rx_in_range_errors;
  797. u32 rx_out_of_range_errors;
  798. u32 rx_address_filtered;
  799. u32 rx_vlan_filtered;
  800. u32 rx_dropped_too_small;
  801. u32 rx_dropped_too_short;
  802. u32 rx_dropped_header_too_small;
  803. u32 rx_dropped_invalid_tcp_length;
  804. u32 rx_dropped_runt;
  805. u32 rx_ip_checksum_errors;
  806. u32 rx_tcp_checksum_errors;
  807. u32 rx_udp_checksum_errors;
  808. u32 rx_non_rss_packets;
  809. u32 rsvd_111;
  810. u32 rx_ipv4_packets_lo;
  811. u32 rx_ipv4_packets_hi;
  812. u32 rx_ipv6_packets_lo;
  813. u32 rx_ipv6_packets_hi;
  814. u32 rx_ipv4_bytes_lo;
  815. u32 rx_ipv4_bytes_hi;
  816. u32 rx_ipv6_bytes_lo;
  817. u32 rx_ipv6_bytes_hi;
  818. u32 rx_nic_packets_lo;
  819. u32 rx_nic_packets_hi;
  820. u32 rx_tcp_packets_lo;
  821. u32 rx_tcp_packets_hi;
  822. u32 rx_iscsi_packets_lo;
  823. u32 rx_iscsi_packets_hi;
  824. u32 rx_management_packets_lo;
  825. u32 rx_management_packets_hi;
  826. u32 rx_switched_unicast_packets_lo;
  827. u32 rx_switched_unicast_packets_hi;
  828. u32 rx_switched_multicast_packets_lo;
  829. u32 rx_switched_multicast_packets_hi;
  830. u32 rx_switched_broadcast_packets_lo;
  831. u32 rx_switched_broadcast_packets_hi;
  832. u32 num_forwards_lo;
  833. u32 num_forwards_hi;
  834. u32 rx_fifo_overflow;
  835. u32 rx_input_fifo_overflow;
  836. u32 rx_drops_too_many_frags_lo;
  837. u32 rx_drops_too_many_frags_hi;
  838. u32 rx_drops_invalid_queue;
  839. u32 rsvd_141;
  840. u32 rx_drops_mtu_lo;
  841. u32 rx_drops_mtu_hi;
  842. u32 rx_packets_64_bytes_lo;
  843. u32 rx_packets_64_bytes_hi;
  844. u32 rx_packets_65_to_127_bytes_lo;
  845. u32 rx_packets_65_to_127_bytes_hi;
  846. u32 rx_packets_128_to_255_bytes_lo;
  847. u32 rx_packets_128_to_255_bytes_hi;
  848. u32 rx_packets_256_to_511_bytes_lo;
  849. u32 rx_packets_256_to_511_bytes_hi;
  850. u32 rx_packets_512_to_1023_bytes_lo;
  851. u32 rx_packets_512_to_1023_bytes_hi;
  852. u32 rx_packets_1024_to_1518_bytes_lo;
  853. u32 rx_packets_1024_to_1518_bytes_hi;
  854. u32 rx_packets_1519_to_2047_bytes_lo;
  855. u32 rx_packets_1519_to_2047_bytes_hi;
  856. u32 rx_packets_2048_to_4095_bytes_lo;
  857. u32 rx_packets_2048_to_4095_bytes_hi;
  858. u32 rx_packets_4096_to_8191_bytes_lo;
  859. u32 rx_packets_4096_to_8191_bytes_hi;
  860. u32 rx_packets_8192_to_9216_bytes_lo;
  861. u32 rx_packets_8192_to_9216_bytes_hi;
  862. };
  863. struct pport_stats_params {
  864. u16 pport_num;
  865. u8 rsvd;
  866. u8 reset_stats;
  867. };
  868. struct lancer_cmd_req_pport_stats {
  869. struct be_cmd_req_hdr hdr;
  870. union {
  871. struct pport_stats_params params;
  872. u8 rsvd[sizeof(struct lancer_pport_stats)];
  873. } cmd_params;
  874. };
  875. struct lancer_cmd_resp_pport_stats {
  876. struct be_cmd_resp_hdr hdr;
  877. struct lancer_pport_stats pport_stats;
  878. };
  879. static inline struct lancer_pport_stats*
  880. pport_stats_from_cmd(struct be_adapter *adapter)
  881. {
  882. struct lancer_cmd_resp_pport_stats *cmd = adapter->stats_cmd.va;
  883. return &cmd->pport_stats;
  884. }
  885. struct be_cmd_req_get_cntl_addnl_attribs {
  886. struct be_cmd_req_hdr hdr;
  887. u8 rsvd[8];
  888. };
  889. struct be_cmd_resp_get_cntl_addnl_attribs {
  890. struct be_cmd_resp_hdr hdr;
  891. u16 ipl_file_number;
  892. u8 ipl_file_version;
  893. u8 rsvd0;
  894. u8 on_die_temperature; /* in degrees centigrade*/
  895. u8 rsvd1[3];
  896. };
  897. struct be_cmd_req_vlan_config {
  898. struct be_cmd_req_hdr hdr;
  899. u8 interface_id;
  900. u8 promiscuous;
  901. u8 untagged;
  902. u8 num_vlan;
  903. u16 normal_vlan[64];
  904. } __packed;
  905. /******************* RX FILTER ******************************/
  906. #define BE_MAX_MC 64 /* set mcast promisc if > 64 */
  907. struct macaddr {
  908. u8 byte[ETH_ALEN];
  909. };
  910. struct be_cmd_req_rx_filter {
  911. struct be_cmd_req_hdr hdr;
  912. u32 global_flags_mask;
  913. u32 global_flags;
  914. u32 if_flags_mask;
  915. u32 if_flags;
  916. u32 if_id;
  917. u32 mcast_num;
  918. struct macaddr mcast_mac[BE_MAX_MC];
  919. };
  920. /******************** Link Status Query *******************/
  921. struct be_cmd_req_link_status {
  922. struct be_cmd_req_hdr hdr;
  923. u32 rsvd;
  924. };
  925. enum {
  926. PHY_LINK_DUPLEX_NONE = 0x0,
  927. PHY_LINK_DUPLEX_HALF = 0x1,
  928. PHY_LINK_DUPLEX_FULL = 0x2
  929. };
  930. enum {
  931. PHY_LINK_SPEED_ZERO = 0x0, /* => No link */
  932. PHY_LINK_SPEED_10MBPS = 0x1,
  933. PHY_LINK_SPEED_100MBPS = 0x2,
  934. PHY_LINK_SPEED_1GBPS = 0x3,
  935. PHY_LINK_SPEED_10GBPS = 0x4,
  936. PHY_LINK_SPEED_20GBPS = 0x5,
  937. PHY_LINK_SPEED_25GBPS = 0x6,
  938. PHY_LINK_SPEED_40GBPS = 0x7
  939. };
  940. struct be_cmd_resp_link_status {
  941. struct be_cmd_resp_hdr hdr;
  942. u8 physical_port;
  943. u8 mac_duplex;
  944. u8 mac_speed;
  945. u8 mac_fault;
  946. u8 mgmt_mac_duplex;
  947. u8 mgmt_mac_speed;
  948. u16 link_speed;
  949. u8 logical_link_status;
  950. u8 rsvd1[3];
  951. } __packed;
  952. /******************** Port Identification ***************************/
  953. /* Identifies the type of port attached to NIC */
  954. struct be_cmd_req_port_type {
  955. struct be_cmd_req_hdr hdr;
  956. __le32 page_num;
  957. __le32 port;
  958. };
  959. enum {
  960. TR_PAGE_A0 = 0xa0,
  961. TR_PAGE_A2 = 0xa2
  962. };
  963. /* From SFF-8436 QSFP+ spec */
  964. #define QSFP_PLUS_CABLE_TYPE_OFFSET 0x83
  965. #define QSFP_PLUS_CR4_CABLE 0x8
  966. #define QSFP_PLUS_SR4_CABLE 0x4
  967. #define QSFP_PLUS_LR4_CABLE 0x2
  968. /* From SFF-8472 spec */
  969. #define SFP_PLUS_SFF_8472_COMP 0x5E
  970. #define SFP_PLUS_CABLE_TYPE_OFFSET 0x8
  971. #define SFP_PLUS_COPPER_CABLE 0x4
  972. #define SFP_VENDOR_NAME_OFFSET 0x14
  973. #define SFP_VENDOR_PN_OFFSET 0x28
  974. #define PAGE_DATA_LEN 256
  975. struct be_cmd_resp_port_type {
  976. struct be_cmd_resp_hdr hdr;
  977. u32 page_num;
  978. u32 port;
  979. u8 page_data[PAGE_DATA_LEN];
  980. };
  981. /******************** Get FW Version *******************/
  982. struct be_cmd_req_get_fw_version {
  983. struct be_cmd_req_hdr hdr;
  984. u8 rsvd0[FW_VER_LEN];
  985. u8 rsvd1[FW_VER_LEN];
  986. } __packed;
  987. struct be_cmd_resp_get_fw_version {
  988. struct be_cmd_resp_hdr hdr;
  989. u8 firmware_version_string[FW_VER_LEN];
  990. u8 fw_on_flash_version_string[FW_VER_LEN];
  991. } __packed;
  992. /******************** Set Flow Contrl *******************/
  993. struct be_cmd_req_set_flow_control {
  994. struct be_cmd_req_hdr hdr;
  995. u16 tx_flow_control;
  996. u16 rx_flow_control;
  997. } __packed;
  998. /******************** Get Flow Contrl *******************/
  999. struct be_cmd_req_get_flow_control {
  1000. struct be_cmd_req_hdr hdr;
  1001. u32 rsvd;
  1002. };
  1003. struct be_cmd_resp_get_flow_control {
  1004. struct be_cmd_resp_hdr hdr;
  1005. u16 tx_flow_control;
  1006. u16 rx_flow_control;
  1007. } __packed;
  1008. /******************** Modify EQ Delay *******************/
  1009. struct be_set_eqd {
  1010. u32 eq_id;
  1011. u32 phase;
  1012. u32 delay_multiplier;
  1013. };
  1014. struct be_cmd_req_modify_eq_delay {
  1015. struct be_cmd_req_hdr hdr;
  1016. u32 num_eq;
  1017. struct be_set_eqd set_eqd[MAX_EVT_QS];
  1018. } __packed;
  1019. /******************** Get FW Config *******************/
  1020. /* The HW can come up in either of the following multi-channel modes
  1021. * based on the skew/IPL.
  1022. */
  1023. #define RDMA_ENABLED 0x4
  1024. #define QNQ_MODE 0x400
  1025. #define VNIC_MODE 0x20000
  1026. #define UMC_ENABLED 0x1000000
  1027. struct be_cmd_req_query_fw_cfg {
  1028. struct be_cmd_req_hdr hdr;
  1029. u32 rsvd[31];
  1030. };
  1031. struct be_cmd_resp_query_fw_cfg {
  1032. struct be_cmd_resp_hdr hdr;
  1033. u32 be_config_number;
  1034. u32 asic_revision;
  1035. u32 phys_port;
  1036. u32 function_mode;
  1037. u32 rsvd[26];
  1038. u32 function_caps;
  1039. };
  1040. /******************** RSS Config ****************************************/
  1041. /* RSS type Input parameters used to compute RX hash
  1042. * RSS_ENABLE_IPV4 SRC IPv4, DST IPv4
  1043. * RSS_ENABLE_TCP_IPV4 SRC IPv4, DST IPv4, TCP SRC PORT, TCP DST PORT
  1044. * RSS_ENABLE_IPV6 SRC IPv6, DST IPv6
  1045. * RSS_ENABLE_TCP_IPV6 SRC IPv6, DST IPv6, TCP SRC PORT, TCP DST PORT
  1046. * RSS_ENABLE_UDP_IPV4 SRC IPv4, DST IPv4, UDP SRC PORT, UDP DST PORT
  1047. * RSS_ENABLE_UDP_IPV6 SRC IPv6, DST IPv6, UDP SRC PORT, UDP DST PORT
  1048. *
  1049. * When multiple RSS types are enabled, HW picks the best hash policy
  1050. * based on the type of the received packet.
  1051. */
  1052. #define RSS_ENABLE_NONE 0x0
  1053. #define RSS_ENABLE_IPV4 0x1
  1054. #define RSS_ENABLE_TCP_IPV4 0x2
  1055. #define RSS_ENABLE_IPV6 0x4
  1056. #define RSS_ENABLE_TCP_IPV6 0x8
  1057. #define RSS_ENABLE_UDP_IPV4 0x10
  1058. #define RSS_ENABLE_UDP_IPV6 0x20
  1059. #define L3_RSS_FLAGS (RXH_IP_DST | RXH_IP_SRC)
  1060. #define L4_RSS_FLAGS (RXH_L4_B_0_1 | RXH_L4_B_2_3)
  1061. struct be_cmd_req_rss_config {
  1062. struct be_cmd_req_hdr hdr;
  1063. u32 if_id;
  1064. u16 enable_rss;
  1065. u16 cpu_table_size_log2;
  1066. u32 hash[10];
  1067. u8 cpu_table[128];
  1068. u8 flush;
  1069. u8 rsvd0[3];
  1070. };
  1071. /******************** Port Beacon ***************************/
  1072. #define BEACON_STATE_ENABLED 0x1
  1073. #define BEACON_STATE_DISABLED 0x0
  1074. struct be_cmd_req_enable_disable_beacon {
  1075. struct be_cmd_req_hdr hdr;
  1076. u8 port_num;
  1077. u8 beacon_state;
  1078. u8 beacon_duration;
  1079. u8 status_duration;
  1080. } __packed;
  1081. struct be_cmd_req_get_beacon_state {
  1082. struct be_cmd_req_hdr hdr;
  1083. u8 port_num;
  1084. u8 rsvd0;
  1085. u16 rsvd1;
  1086. } __packed;
  1087. struct be_cmd_resp_get_beacon_state {
  1088. struct be_cmd_resp_hdr resp_hdr;
  1089. u8 beacon_state;
  1090. u8 rsvd0[3];
  1091. } __packed;
  1092. /* Flashrom related descriptors */
  1093. #define MAX_FLASH_COMP 32
  1094. #define OPTYPE_ISCSI_ACTIVE 0
  1095. #define OPTYPE_REDBOOT 1
  1096. #define OPTYPE_BIOS 2
  1097. #define OPTYPE_PXE_BIOS 3
  1098. #define OPTYPE_OFFSET_SPECIFIED 7
  1099. #define OPTYPE_FCOE_BIOS 8
  1100. #define OPTYPE_ISCSI_BACKUP 9
  1101. #define OPTYPE_FCOE_FW_ACTIVE 10
  1102. #define OPTYPE_FCOE_FW_BACKUP 11
  1103. #define OPTYPE_NCSI_FW 13
  1104. #define OPTYPE_REDBOOT_DIR 18
  1105. #define OPTYPE_REDBOOT_CONFIG 19
  1106. #define OPTYPE_SH_PHY_FW 21
  1107. #define OPTYPE_FLASHISM_JUMPVECTOR 22
  1108. #define OPTYPE_UFI_DIR 23
  1109. #define OPTYPE_PHY_FW 99
  1110. #define FLASH_BIOS_IMAGE_MAX_SIZE_g2 262144 /* Max OPTION ROM image sz */
  1111. #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g2 262144 /* Max Redboot image sz */
  1112. #define FLASH_IMAGE_MAX_SIZE_g2 1310720 /* Max firmware image size */
  1113. #define FLASH_NCSI_IMAGE_MAX_SIZE_g3 262144
  1114. #define FLASH_PHY_FW_IMAGE_MAX_SIZE_g3 262144
  1115. #define FLASH_BIOS_IMAGE_MAX_SIZE_g3 524288 /* Max OPTION ROM image sz */
  1116. #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 1048576 /* Max Redboot image sz */
  1117. #define FLASH_IMAGE_MAX_SIZE_g3 2097152 /* Max firmware image size */
  1118. /* Offsets for components on Flash. */
  1119. #define FLASH_REDBOOT_START_g2 0
  1120. #define FLASH_FCoE_BIOS_START_g2 524288
  1121. #define FLASH_iSCSI_PRIMARY_IMAGE_START_g2 1048576
  1122. #define FLASH_iSCSI_BACKUP_IMAGE_START_g2 2359296
  1123. #define FLASH_FCoE_PRIMARY_IMAGE_START_g2 3670016
  1124. #define FLASH_FCoE_BACKUP_IMAGE_START_g2 4980736
  1125. #define FLASH_iSCSI_BIOS_START_g2 7340032
  1126. #define FLASH_PXE_BIOS_START_g2 7864320
  1127. #define FLASH_REDBOOT_START_g3 262144
  1128. #define FLASH_PHY_FW_START_g3 1310720
  1129. #define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 2097152
  1130. #define FLASH_iSCSI_BACKUP_IMAGE_START_g3 4194304
  1131. #define FLASH_FCoE_PRIMARY_IMAGE_START_g3 6291456
  1132. #define FLASH_FCoE_BACKUP_IMAGE_START_g3 8388608
  1133. #define FLASH_iSCSI_BIOS_START_g3 12582912
  1134. #define FLASH_PXE_BIOS_START_g3 13107200
  1135. #define FLASH_FCoE_BIOS_START_g3 13631488
  1136. #define FLASH_NCSI_START_g3 15990784
  1137. #define IMAGE_NCSI 16
  1138. #define IMAGE_OPTION_ROM_PXE 32
  1139. #define IMAGE_OPTION_ROM_FCoE 33
  1140. #define IMAGE_OPTION_ROM_ISCSI 34
  1141. #define IMAGE_FLASHISM_JUMPVECTOR 48
  1142. #define IMAGE_FIRMWARE_iSCSI 160
  1143. #define IMAGE_FIRMWARE_FCoE 162
  1144. #define IMAGE_FIRMWARE_BACKUP_iSCSI 176
  1145. #define IMAGE_FIRMWARE_BACKUP_FCoE 178
  1146. #define IMAGE_FIRMWARE_PHY 192
  1147. #define IMAGE_REDBOOT_DIR 208
  1148. #define IMAGE_REDBOOT_CONFIG 209
  1149. #define IMAGE_UFI_DIR 210
  1150. #define IMAGE_BOOT_CODE 224
  1151. struct controller_id {
  1152. u32 vendor;
  1153. u32 device;
  1154. u32 subvendor;
  1155. u32 subdevice;
  1156. };
  1157. struct flash_comp {
  1158. unsigned long offset;
  1159. int optype;
  1160. int size;
  1161. int img_type;
  1162. };
  1163. struct image_hdr {
  1164. u32 imageid;
  1165. u32 imageoffset;
  1166. u32 imagelength;
  1167. u32 image_checksum;
  1168. u8 image_version[32];
  1169. };
  1170. struct flash_file_hdr_g2 {
  1171. u8 sign[32];
  1172. u32 cksum;
  1173. u32 antidote;
  1174. struct controller_id cont_id;
  1175. u32 file_len;
  1176. u32 chunk_num;
  1177. u32 total_chunks;
  1178. u32 num_imgs;
  1179. u8 build[24];
  1180. };
  1181. /* First letter of the build version of the image */
  1182. #define BLD_STR_UFI_TYPE_BE2 '2'
  1183. #define BLD_STR_UFI_TYPE_BE3 '3'
  1184. #define BLD_STR_UFI_TYPE_SH '4'
  1185. struct flash_file_hdr_g3 {
  1186. u8 sign[52];
  1187. u8 ufi_version[4];
  1188. u32 file_len;
  1189. u32 cksum;
  1190. u32 antidote;
  1191. u32 num_imgs;
  1192. u8 build[24];
  1193. u8 asic_type_rev;
  1194. u8 rsvd[31];
  1195. };
  1196. struct flash_section_hdr {
  1197. u32 format_rev;
  1198. u32 cksum;
  1199. u32 antidote;
  1200. u32 num_images;
  1201. u8 id_string[128];
  1202. u32 rsvd[4];
  1203. } __packed;
  1204. struct flash_section_hdr_g2 {
  1205. u32 format_rev;
  1206. u32 cksum;
  1207. u32 antidote;
  1208. u32 build_num;
  1209. u8 id_string[128];
  1210. u32 rsvd[8];
  1211. } __packed;
  1212. struct flash_section_entry {
  1213. u32 type;
  1214. u32 offset;
  1215. u32 pad_size;
  1216. u32 image_size;
  1217. u32 cksum;
  1218. u32 entry_point;
  1219. u16 optype;
  1220. u16 rsvd0;
  1221. u32 rsvd1;
  1222. u8 ver_data[32];
  1223. } __packed;
  1224. struct flash_section_info {
  1225. u8 cookie[32];
  1226. struct flash_section_hdr fsec_hdr;
  1227. struct flash_section_entry fsec_entry[32];
  1228. } __packed;
  1229. struct flash_section_info_g2 {
  1230. u8 cookie[32];
  1231. struct flash_section_hdr_g2 fsec_hdr;
  1232. struct flash_section_entry fsec_entry[32];
  1233. } __packed;
  1234. /****************** Firmware Flash ******************/
  1235. #define FLASHROM_OPER_FLASH 1
  1236. #define FLASHROM_OPER_SAVE 2
  1237. #define FLASHROM_OPER_REPORT 4
  1238. #define FLASHROM_OPER_PHY_FLASH 9
  1239. #define FLASHROM_OPER_PHY_SAVE 10
  1240. struct flashrom_params {
  1241. u32 op_code;
  1242. u32 op_type;
  1243. u32 data_buf_size;
  1244. u32 offset;
  1245. };
  1246. struct be_cmd_write_flashrom {
  1247. struct be_cmd_req_hdr hdr;
  1248. struct flashrom_params params;
  1249. u8 data_buf[32768];
  1250. u8 rsvd[4];
  1251. } __packed;
  1252. /* cmd to read flash crc */
  1253. struct be_cmd_read_flash_crc {
  1254. struct be_cmd_req_hdr hdr;
  1255. struct flashrom_params params;
  1256. u8 crc[4];
  1257. u8 rsvd[4];
  1258. } __packed;
  1259. /**************** Lancer Firmware Flash ************/
  1260. struct amap_lancer_write_obj_context {
  1261. u8 write_length[24];
  1262. u8 reserved1[7];
  1263. u8 eof;
  1264. } __packed;
  1265. struct lancer_cmd_req_write_object {
  1266. struct be_cmd_req_hdr hdr;
  1267. u8 context[sizeof(struct amap_lancer_write_obj_context) / 8];
  1268. u32 write_offset;
  1269. u8 object_name[104];
  1270. u32 descriptor_count;
  1271. u32 buf_len;
  1272. u32 addr_low;
  1273. u32 addr_high;
  1274. };
  1275. #define LANCER_NO_RESET_NEEDED 0x00
  1276. #define LANCER_FW_RESET_NEEDED 0x02
  1277. struct lancer_cmd_resp_write_object {
  1278. u8 opcode;
  1279. u8 subsystem;
  1280. u8 rsvd1[2];
  1281. u8 status;
  1282. u8 additional_status;
  1283. u8 rsvd2[2];
  1284. u32 resp_len;
  1285. u32 actual_resp_len;
  1286. u32 actual_write_len;
  1287. u8 change_status;
  1288. u8 rsvd3[3];
  1289. };
  1290. /************************ Lancer Read FW info **************/
  1291. #define LANCER_READ_FILE_CHUNK (32*1024)
  1292. #define LANCER_READ_FILE_EOF_MASK 0x80000000
  1293. #define LANCER_FW_DUMP_FILE "/dbg/dump.bin"
  1294. #define LANCER_VPD_PF_FILE "/vpd/ntr_pf.vpd"
  1295. #define LANCER_VPD_VF_FILE "/vpd/ntr_vf.vpd"
  1296. struct lancer_cmd_req_read_object {
  1297. struct be_cmd_req_hdr hdr;
  1298. u32 desired_read_len;
  1299. u32 read_offset;
  1300. u8 object_name[104];
  1301. u32 descriptor_count;
  1302. u32 buf_len;
  1303. u32 addr_low;
  1304. u32 addr_high;
  1305. };
  1306. struct lancer_cmd_resp_read_object {
  1307. u8 opcode;
  1308. u8 subsystem;
  1309. u8 rsvd1[2];
  1310. u8 status;
  1311. u8 additional_status;
  1312. u8 rsvd2[2];
  1313. u32 resp_len;
  1314. u32 actual_resp_len;
  1315. u32 actual_read_len;
  1316. u32 eof;
  1317. };
  1318. struct lancer_cmd_req_delete_object {
  1319. struct be_cmd_req_hdr hdr;
  1320. u32 rsvd1;
  1321. u32 rsvd2;
  1322. u8 object_name[104];
  1323. };
  1324. /************************ WOL *******************************/
  1325. struct be_cmd_req_acpi_wol_magic_config{
  1326. struct be_cmd_req_hdr hdr;
  1327. u32 rsvd0[145];
  1328. u8 magic_mac[6];
  1329. u8 rsvd2[2];
  1330. } __packed;
  1331. struct be_cmd_req_acpi_wol_magic_config_v1 {
  1332. struct be_cmd_req_hdr hdr;
  1333. u8 rsvd0[2];
  1334. u8 query_options;
  1335. u8 rsvd1[5];
  1336. u32 rsvd2[288];
  1337. u8 magic_mac[6];
  1338. u8 rsvd3[22];
  1339. } __packed;
  1340. struct be_cmd_resp_acpi_wol_magic_config_v1 {
  1341. struct be_cmd_resp_hdr hdr;
  1342. u8 rsvd0[2];
  1343. u8 wol_settings;
  1344. u8 rsvd1[5];
  1345. u32 rsvd2[295];
  1346. } __packed;
  1347. #define BE_GET_WOL_CAP 2
  1348. #define BE_WOL_CAP 0x1
  1349. #define BE_PME_D0_CAP 0x8
  1350. #define BE_PME_D1_CAP 0x10
  1351. #define BE_PME_D2_CAP 0x20
  1352. #define BE_PME_D3HOT_CAP 0x40
  1353. #define BE_PME_D3COLD_CAP 0x80
  1354. /********************** LoopBack test *********************/
  1355. struct be_cmd_req_loopback_test {
  1356. struct be_cmd_req_hdr hdr;
  1357. u32 loopback_type;
  1358. u32 num_pkts;
  1359. u64 pattern;
  1360. u32 src_port;
  1361. u32 dest_port;
  1362. u32 pkt_size;
  1363. };
  1364. struct be_cmd_resp_loopback_test {
  1365. struct be_cmd_resp_hdr resp_hdr;
  1366. u32 status;
  1367. u32 num_txfer;
  1368. u32 num_rx;
  1369. u32 miscomp_off;
  1370. u32 ticks_compl;
  1371. };
  1372. struct be_cmd_req_set_lmode {
  1373. struct be_cmd_req_hdr hdr;
  1374. u8 src_port;
  1375. u8 dest_port;
  1376. u8 loopback_type;
  1377. u8 loopback_state;
  1378. };
  1379. /********************** DDR DMA test *********************/
  1380. struct be_cmd_req_ddrdma_test {
  1381. struct be_cmd_req_hdr hdr;
  1382. u64 pattern;
  1383. u32 byte_count;
  1384. u32 rsvd0;
  1385. u8 snd_buff[4096];
  1386. u8 rsvd1[4096];
  1387. };
  1388. struct be_cmd_resp_ddrdma_test {
  1389. struct be_cmd_resp_hdr hdr;
  1390. u64 pattern;
  1391. u32 byte_cnt;
  1392. u32 snd_err;
  1393. u8 rsvd0[4096];
  1394. u8 rcv_buff[4096];
  1395. };
  1396. /*********************** SEEPROM Read ***********************/
  1397. #define BE_READ_SEEPROM_LEN 1024
  1398. struct be_cmd_req_seeprom_read {
  1399. struct be_cmd_req_hdr hdr;
  1400. u8 rsvd0[BE_READ_SEEPROM_LEN];
  1401. };
  1402. struct be_cmd_resp_seeprom_read {
  1403. struct be_cmd_req_hdr hdr;
  1404. u8 seeprom_data[BE_READ_SEEPROM_LEN];
  1405. };
  1406. enum {
  1407. PHY_TYPE_CX4_10GB = 0,
  1408. PHY_TYPE_XFP_10GB,
  1409. PHY_TYPE_SFP_1GB,
  1410. PHY_TYPE_SFP_PLUS_10GB,
  1411. PHY_TYPE_KR_10GB,
  1412. PHY_TYPE_KX4_10GB,
  1413. PHY_TYPE_BASET_10GB,
  1414. PHY_TYPE_BASET_1GB,
  1415. PHY_TYPE_BASEX_1GB,
  1416. PHY_TYPE_SGMII,
  1417. PHY_TYPE_QSFP,
  1418. PHY_TYPE_KR4_40GB,
  1419. PHY_TYPE_KR2_20GB,
  1420. PHY_TYPE_TN_8022,
  1421. PHY_TYPE_DISABLED = 255
  1422. };
  1423. #define BE_SUPPORTED_SPEED_NONE 0
  1424. #define BE_SUPPORTED_SPEED_10MBPS 1
  1425. #define BE_SUPPORTED_SPEED_100MBPS 2
  1426. #define BE_SUPPORTED_SPEED_1GBPS 4
  1427. #define BE_SUPPORTED_SPEED_10GBPS 8
  1428. #define BE_SUPPORTED_SPEED_20GBPS 0x10
  1429. #define BE_SUPPORTED_SPEED_40GBPS 0x20
  1430. #define BE_AN_EN 0x2
  1431. #define BE_PAUSE_SYM_EN 0x80
  1432. /* MAC speed valid values */
  1433. #define SPEED_DEFAULT 0x0
  1434. #define SPEED_FORCED_10GB 0x1
  1435. #define SPEED_FORCED_1GB 0x2
  1436. #define SPEED_AUTONEG_10GB 0x3
  1437. #define SPEED_AUTONEG_1GB 0x4
  1438. #define SPEED_AUTONEG_100MB 0x5
  1439. #define SPEED_AUTONEG_10GB_1GB 0x6
  1440. #define SPEED_AUTONEG_10GB_1GB_100MB 0x7
  1441. #define SPEED_AUTONEG_1GB_100MB 0x8
  1442. #define SPEED_AUTONEG_10MB 0x9
  1443. #define SPEED_AUTONEG_1GB_100MB_10MB 0xa
  1444. #define SPEED_AUTONEG_100MB_10MB 0xb
  1445. #define SPEED_FORCED_100MB 0xc
  1446. #define SPEED_FORCED_10MB 0xd
  1447. struct be_cmd_req_get_phy_info {
  1448. struct be_cmd_req_hdr hdr;
  1449. u8 rsvd0[24];
  1450. };
  1451. struct be_phy_info {
  1452. u16 phy_type;
  1453. u16 interface_type;
  1454. u32 misc_params;
  1455. u16 ext_phy_details;
  1456. u16 rsvd;
  1457. u16 auto_speeds_supported;
  1458. u16 fixed_speeds_supported;
  1459. u32 future_use[2];
  1460. };
  1461. struct be_cmd_resp_get_phy_info {
  1462. struct be_cmd_req_hdr hdr;
  1463. struct be_phy_info phy_info;
  1464. };
  1465. /*********************** Set QOS ***********************/
  1466. #define BE_QOS_BITS_NIC 1
  1467. struct be_cmd_req_set_qos {
  1468. struct be_cmd_req_hdr hdr;
  1469. u32 valid_bits;
  1470. u32 max_bps_nic;
  1471. u32 rsvd[7];
  1472. };
  1473. /*********************** Controller Attributes ***********************/
  1474. struct mgmt_hba_attribs {
  1475. u32 rsvd0[24];
  1476. u8 controller_model_number[32];
  1477. u32 rsvd1[79];
  1478. u8 rsvd2[3];
  1479. u8 phy_port;
  1480. u32 rsvd3[13];
  1481. } __packed;
  1482. struct mgmt_controller_attrib {
  1483. struct mgmt_hba_attribs hba_attribs;
  1484. u32 rsvd0[10];
  1485. } __packed;
  1486. struct be_cmd_req_cntl_attribs {
  1487. struct be_cmd_req_hdr hdr;
  1488. };
  1489. struct be_cmd_resp_cntl_attribs {
  1490. struct be_cmd_resp_hdr hdr;
  1491. struct mgmt_controller_attrib attribs;
  1492. };
  1493. /*********************** Set driver function ***********************/
  1494. #define CAPABILITY_SW_TIMESTAMPS 2
  1495. #define CAPABILITY_BE3_NATIVE_ERX_API 4
  1496. struct be_cmd_req_set_func_cap {
  1497. struct be_cmd_req_hdr hdr;
  1498. u32 valid_cap_flags;
  1499. u32 cap_flags;
  1500. u8 rsvd[212];
  1501. };
  1502. struct be_cmd_resp_set_func_cap {
  1503. struct be_cmd_resp_hdr hdr;
  1504. u32 valid_cap_flags;
  1505. u32 cap_flags;
  1506. u8 rsvd[212];
  1507. };
  1508. /*********************** Function Privileges ***********************/
  1509. enum {
  1510. BE_PRIV_DEFAULT = 0x1,
  1511. BE_PRIV_LNKQUERY = 0x2,
  1512. BE_PRIV_LNKSTATS = 0x4,
  1513. BE_PRIV_LNKMGMT = 0x8,
  1514. BE_PRIV_LNKDIAG = 0x10,
  1515. BE_PRIV_UTILQUERY = 0x20,
  1516. BE_PRIV_FILTMGMT = 0x40,
  1517. BE_PRIV_IFACEMGMT = 0x80,
  1518. BE_PRIV_VHADM = 0x100,
  1519. BE_PRIV_DEVCFG = 0x200,
  1520. BE_PRIV_DEVSEC = 0x400
  1521. };
  1522. #define MAX_PRIVILEGES (BE_PRIV_VHADM | BE_PRIV_DEVCFG | \
  1523. BE_PRIV_DEVSEC)
  1524. #define MIN_PRIVILEGES BE_PRIV_DEFAULT
  1525. struct be_cmd_priv_map {
  1526. u8 opcode;
  1527. u8 subsystem;
  1528. u32 priv_mask;
  1529. };
  1530. struct be_cmd_req_get_fn_privileges {
  1531. struct be_cmd_req_hdr hdr;
  1532. u32 rsvd;
  1533. };
  1534. struct be_cmd_resp_get_fn_privileges {
  1535. struct be_cmd_resp_hdr hdr;
  1536. u32 privilege_mask;
  1537. };
  1538. struct be_cmd_req_set_fn_privileges {
  1539. struct be_cmd_req_hdr hdr;
  1540. u32 privileges; /* Used by BE3, SH-R */
  1541. u32 privileges_lancer; /* Used by Lancer */
  1542. };
  1543. /******************** GET/SET_MACLIST **************************/
  1544. #define BE_MAX_MAC 64
  1545. struct be_cmd_req_get_mac_list {
  1546. struct be_cmd_req_hdr hdr;
  1547. u8 mac_type;
  1548. u8 perm_override;
  1549. u16 iface_id;
  1550. u32 mac_id;
  1551. u32 rsvd[3];
  1552. } __packed;
  1553. struct get_list_macaddr {
  1554. u16 mac_addr_size;
  1555. union {
  1556. u8 macaddr[6];
  1557. struct {
  1558. u8 rsvd[2];
  1559. u32 mac_id;
  1560. } __packed s_mac_id;
  1561. } __packed mac_addr_id;
  1562. } __packed;
  1563. struct be_cmd_resp_get_mac_list {
  1564. struct be_cmd_resp_hdr hdr;
  1565. struct get_list_macaddr fd_macaddr; /* Factory default mac */
  1566. struct get_list_macaddr macid_macaddr; /* soft mac */
  1567. u8 true_mac_count;
  1568. u8 pseudo_mac_count;
  1569. u8 mac_list_size;
  1570. u8 rsvd;
  1571. /* perm override mac */
  1572. struct get_list_macaddr macaddr_list[BE_MAX_MAC];
  1573. } __packed;
  1574. struct be_cmd_req_set_mac_list {
  1575. struct be_cmd_req_hdr hdr;
  1576. u8 mac_count;
  1577. u8 rsvd1;
  1578. u16 rsvd2;
  1579. struct macaddr mac[BE_MAX_MAC];
  1580. } __packed;
  1581. /*********************** HSW Config ***********************/
  1582. #define PORT_FWD_TYPE_VEPA 0x3
  1583. #define PORT_FWD_TYPE_VEB 0x2
  1584. #define ENABLE_MAC_SPOOFCHK 0x2
  1585. #define DISABLE_MAC_SPOOFCHK 0x3
  1586. struct amap_set_hsw_context {
  1587. u8 interface_id[16];
  1588. u8 rsvd0[8];
  1589. u8 mac_spoofchk[2];
  1590. u8 rsvd1[4];
  1591. u8 pvid_valid;
  1592. u8 pport;
  1593. u8 rsvd2[6];
  1594. u8 port_fwd_type[3];
  1595. u8 rsvd3[5];
  1596. u8 vlan_spoofchk[2];
  1597. u8 pvid[16];
  1598. u8 rsvd4[32];
  1599. u8 rsvd5[32];
  1600. u8 rsvd6[32];
  1601. } __packed;
  1602. struct be_cmd_req_set_hsw_config {
  1603. struct be_cmd_req_hdr hdr;
  1604. u8 context[sizeof(struct amap_set_hsw_context) / 8];
  1605. } __packed;
  1606. struct amap_get_hsw_req_context {
  1607. u8 interface_id[16];
  1608. u8 rsvd0[14];
  1609. u8 pvid_valid;
  1610. u8 pport;
  1611. } __packed;
  1612. struct amap_get_hsw_resp_context {
  1613. u8 rsvd0[6];
  1614. u8 port_fwd_type[3];
  1615. u8 rsvd1[5];
  1616. u8 spoofchk;
  1617. u8 rsvd2;
  1618. u8 pvid[16];
  1619. u8 rsvd3[32];
  1620. u8 rsvd4[32];
  1621. u8 rsvd5[32];
  1622. } __packed;
  1623. struct be_cmd_req_get_hsw_config {
  1624. struct be_cmd_req_hdr hdr;
  1625. u8 context[sizeof(struct amap_get_hsw_req_context) / 8];
  1626. } __packed;
  1627. struct be_cmd_resp_get_hsw_config {
  1628. struct be_cmd_resp_hdr hdr;
  1629. u8 context[sizeof(struct amap_get_hsw_resp_context) / 8];
  1630. u32 rsvd;
  1631. };
  1632. /******************* get port names ***************/
  1633. struct be_cmd_req_get_port_name {
  1634. struct be_cmd_req_hdr hdr;
  1635. u32 rsvd0;
  1636. };
  1637. struct be_cmd_resp_get_port_name {
  1638. struct be_cmd_req_hdr hdr;
  1639. u8 port_name[4];
  1640. };
  1641. /*************** HW Stats Get v1 **********************************/
  1642. #define BE_TXP_SW_SZ 48
  1643. struct be_port_rxf_stats_v1 {
  1644. u32 rsvd0[12];
  1645. u32 rx_crc_errors;
  1646. u32 rx_alignment_symbol_errors;
  1647. u32 rx_pause_frames;
  1648. u32 rx_priority_pause_frames;
  1649. u32 rx_control_frames;
  1650. u32 rx_in_range_errors;
  1651. u32 rx_out_range_errors;
  1652. u32 rx_frame_too_long;
  1653. u32 rx_address_filtered;
  1654. u32 rx_dropped_too_small;
  1655. u32 rx_dropped_too_short;
  1656. u32 rx_dropped_header_too_small;
  1657. u32 rx_dropped_tcp_length;
  1658. u32 rx_dropped_runt;
  1659. u32 rsvd1[10];
  1660. u32 rx_ip_checksum_errs;
  1661. u32 rx_tcp_checksum_errs;
  1662. u32 rx_udp_checksum_errs;
  1663. u32 rsvd2[7];
  1664. u32 rx_switched_unicast_packets;
  1665. u32 rx_switched_multicast_packets;
  1666. u32 rx_switched_broadcast_packets;
  1667. u32 rsvd3[3];
  1668. u32 tx_pauseframes;
  1669. u32 tx_priority_pauseframes;
  1670. u32 tx_controlframes;
  1671. u32 rsvd4[10];
  1672. u32 rxpp_fifo_overflow_drop;
  1673. u32 rx_input_fifo_overflow_drop;
  1674. u32 pmem_fifo_overflow_drop;
  1675. u32 jabber_events;
  1676. u32 rsvd5[3];
  1677. };
  1678. struct be_rxf_stats_v1 {
  1679. struct be_port_rxf_stats_v1 port[4];
  1680. u32 rsvd0[2];
  1681. u32 rx_drops_no_pbuf;
  1682. u32 rx_drops_no_txpb;
  1683. u32 rx_drops_no_erx_descr;
  1684. u32 rx_drops_no_tpre_descr;
  1685. u32 rsvd1[6];
  1686. u32 rx_drops_too_many_frags;
  1687. u32 rx_drops_invalid_ring;
  1688. u32 forwarded_packets;
  1689. u32 rx_drops_mtu;
  1690. u32 rsvd2[14];
  1691. };
  1692. struct be_erx_stats_v1 {
  1693. u32 rx_drops_no_fragments[68]; /* dwordS 0 to 67*/
  1694. u32 rsvd[4];
  1695. };
  1696. struct be_port_rxf_stats_v2 {
  1697. u32 rsvd0[10];
  1698. u32 roce_bytes_received_lsd;
  1699. u32 roce_bytes_received_msd;
  1700. u32 rsvd1[5];
  1701. u32 roce_frames_received;
  1702. u32 rx_crc_errors;
  1703. u32 rx_alignment_symbol_errors;
  1704. u32 rx_pause_frames;
  1705. u32 rx_priority_pause_frames;
  1706. u32 rx_control_frames;
  1707. u32 rx_in_range_errors;
  1708. u32 rx_out_range_errors;
  1709. u32 rx_frame_too_long;
  1710. u32 rx_address_filtered;
  1711. u32 rx_dropped_too_small;
  1712. u32 rx_dropped_too_short;
  1713. u32 rx_dropped_header_too_small;
  1714. u32 rx_dropped_tcp_length;
  1715. u32 rx_dropped_runt;
  1716. u32 rsvd2[10];
  1717. u32 rx_ip_checksum_errs;
  1718. u32 rx_tcp_checksum_errs;
  1719. u32 rx_udp_checksum_errs;
  1720. u32 rsvd3[7];
  1721. u32 rx_switched_unicast_packets;
  1722. u32 rx_switched_multicast_packets;
  1723. u32 rx_switched_broadcast_packets;
  1724. u32 rsvd4[3];
  1725. u32 tx_pauseframes;
  1726. u32 tx_priority_pauseframes;
  1727. u32 tx_controlframes;
  1728. u32 rsvd5[10];
  1729. u32 rxpp_fifo_overflow_drop;
  1730. u32 rx_input_fifo_overflow_drop;
  1731. u32 pmem_fifo_overflow_drop;
  1732. u32 jabber_events;
  1733. u32 rsvd6[3];
  1734. u32 rx_drops_payload_size;
  1735. u32 rx_drops_clipped_header;
  1736. u32 rx_drops_crc;
  1737. u32 roce_drops_payload_len;
  1738. u32 roce_drops_crc;
  1739. u32 rsvd7[19];
  1740. };
  1741. struct be_rxf_stats_v2 {
  1742. struct be_port_rxf_stats_v2 port[4];
  1743. u32 rsvd0[2];
  1744. u32 rx_drops_no_pbuf;
  1745. u32 rx_drops_no_txpb;
  1746. u32 rx_drops_no_erx_descr;
  1747. u32 rx_drops_no_tpre_descr;
  1748. u32 rsvd1[6];
  1749. u32 rx_drops_too_many_frags;
  1750. u32 rx_drops_invalid_ring;
  1751. u32 forwarded_packets;
  1752. u32 rx_drops_mtu;
  1753. u32 rsvd2[35];
  1754. };
  1755. struct be_hw_stats_v1 {
  1756. struct be_rxf_stats_v1 rxf;
  1757. u32 rsvd0[BE_TXP_SW_SZ];
  1758. struct be_erx_stats_v1 erx;
  1759. struct be_pmem_stats pmem;
  1760. u32 rsvd1[18];
  1761. };
  1762. struct be_cmd_req_get_stats_v1 {
  1763. struct be_cmd_req_hdr hdr;
  1764. u8 rsvd[sizeof(struct be_hw_stats_v1)];
  1765. };
  1766. struct be_cmd_resp_get_stats_v1 {
  1767. struct be_cmd_resp_hdr hdr;
  1768. struct be_hw_stats_v1 hw_stats;
  1769. };
  1770. struct be_erx_stats_v2 {
  1771. u32 rx_drops_no_fragments[136]; /* dwordS 0 to 135*/
  1772. u32 rsvd[3];
  1773. };
  1774. struct be_hw_stats_v2 {
  1775. struct be_rxf_stats_v2 rxf;
  1776. u32 rsvd0[BE_TXP_SW_SZ];
  1777. struct be_erx_stats_v2 erx;
  1778. struct be_pmem_stats pmem;
  1779. u32 rsvd1[18];
  1780. };
  1781. struct be_cmd_req_get_stats_v2 {
  1782. struct be_cmd_req_hdr hdr;
  1783. u8 rsvd[sizeof(struct be_hw_stats_v2)];
  1784. };
  1785. struct be_cmd_resp_get_stats_v2 {
  1786. struct be_cmd_resp_hdr hdr;
  1787. struct be_hw_stats_v2 hw_stats;
  1788. };
  1789. /************** get fat capabilites *******************/
  1790. #define MAX_MODULES 27
  1791. #define MAX_MODES 4
  1792. #define MODE_UART 0
  1793. #define FW_LOG_LEVEL_DEFAULT 48
  1794. #define FW_LOG_LEVEL_FATAL 64
  1795. struct ext_fat_mode {
  1796. u8 mode;
  1797. u8 rsvd0;
  1798. u16 port_mask;
  1799. u32 dbg_lvl;
  1800. u64 fun_mask;
  1801. } __packed;
  1802. struct ext_fat_modules {
  1803. u8 modules_str[32];
  1804. u32 modules_id;
  1805. u32 num_modes;
  1806. struct ext_fat_mode trace_lvl[MAX_MODES];
  1807. } __packed;
  1808. struct be_fat_conf_params {
  1809. u32 max_log_entries;
  1810. u32 log_entry_size;
  1811. u8 log_type;
  1812. u8 max_log_funs;
  1813. u8 max_log_ports;
  1814. u8 rsvd0;
  1815. u32 supp_modes;
  1816. u32 num_modules;
  1817. struct ext_fat_modules module[MAX_MODULES];
  1818. } __packed;
  1819. struct be_cmd_req_get_ext_fat_caps {
  1820. struct be_cmd_req_hdr hdr;
  1821. u32 parameter_type;
  1822. };
  1823. struct be_cmd_resp_get_ext_fat_caps {
  1824. struct be_cmd_resp_hdr hdr;
  1825. struct be_fat_conf_params get_params;
  1826. };
  1827. struct be_cmd_req_set_ext_fat_caps {
  1828. struct be_cmd_req_hdr hdr;
  1829. struct be_fat_conf_params set_params;
  1830. };
  1831. #define RESOURCE_DESC_SIZE_V0 72
  1832. #define RESOURCE_DESC_SIZE_V1 88
  1833. #define PCIE_RESOURCE_DESC_TYPE_V0 0x40
  1834. #define NIC_RESOURCE_DESC_TYPE_V0 0x41
  1835. #define PCIE_RESOURCE_DESC_TYPE_V1 0x50
  1836. #define NIC_RESOURCE_DESC_TYPE_V1 0x51
  1837. #define PORT_RESOURCE_DESC_TYPE_V1 0x55
  1838. #define MAX_RESOURCE_DESC 264
  1839. #define IF_CAPS_FLAGS_VALID_SHIFT 0 /* IF caps valid */
  1840. #define VFT_SHIFT 3 /* VF template */
  1841. #define IMM_SHIFT 6 /* Immediate */
  1842. #define NOSV_SHIFT 7 /* No save */
  1843. struct be_res_desc_hdr {
  1844. u8 desc_type;
  1845. u8 desc_len;
  1846. } __packed;
  1847. struct be_port_res_desc {
  1848. struct be_res_desc_hdr hdr;
  1849. u8 rsvd0;
  1850. u8 flags;
  1851. u8 link_num;
  1852. u8 mc_type;
  1853. u16 rsvd1;
  1854. #define NV_TYPE_MASK 0x3 /* bits 0-1 */
  1855. #define NV_TYPE_DISABLED 1
  1856. #define NV_TYPE_VXLAN 3
  1857. #define SOCVID_SHIFT 2 /* Strip outer vlan */
  1858. #define RCVID_SHIFT 4 /* Report vlan */
  1859. u8 nv_flags;
  1860. u8 rsvd2;
  1861. __le16 nv_port; /* vxlan/gre port */
  1862. u32 rsvd3[19];
  1863. } __packed;
  1864. struct be_pcie_res_desc {
  1865. struct be_res_desc_hdr hdr;
  1866. u8 rsvd0;
  1867. u8 flags;
  1868. u16 rsvd1;
  1869. u8 pf_num;
  1870. u8 rsvd2;
  1871. u32 rsvd3;
  1872. u8 sriov_state;
  1873. u8 pf_state;
  1874. u8 pf_type;
  1875. u8 rsvd4;
  1876. u16 num_vfs;
  1877. u16 rsvd5;
  1878. u32 rsvd6[17];
  1879. } __packed;
  1880. struct be_nic_res_desc {
  1881. struct be_res_desc_hdr hdr;
  1882. u8 rsvd1;
  1883. #define QUN_SHIFT 4 /* QoS is in absolute units */
  1884. u8 flags;
  1885. u8 vf_num;
  1886. u8 rsvd2;
  1887. u8 pf_num;
  1888. u8 rsvd3;
  1889. u16 unicast_mac_count;
  1890. u8 rsvd4[6];
  1891. u16 mcc_count;
  1892. u16 vlan_count;
  1893. u16 mcast_mac_count;
  1894. u16 txq_count;
  1895. u16 rq_count;
  1896. u16 rssq_count;
  1897. u16 lro_count;
  1898. u16 cq_count;
  1899. u16 toe_conn_count;
  1900. u16 eq_count;
  1901. u16 vlan_id;
  1902. u16 iface_count;
  1903. u32 cap_flags;
  1904. u8 link_param;
  1905. u8 rsvd6;
  1906. u16 channel_id_param;
  1907. u32 bw_min;
  1908. u32 bw_max;
  1909. u8 acpi_params;
  1910. u8 wol_param;
  1911. u16 rsvd7;
  1912. u16 tunnel_iface_count;
  1913. u16 direct_tenant_iface_count;
  1914. u32 rsvd8[6];
  1915. } __packed;
  1916. /************ Multi-Channel type ***********/
  1917. enum mc_type {
  1918. MC_NONE = 0x01,
  1919. UMC = 0x02,
  1920. FLEX10 = 0x03,
  1921. vNIC1 = 0x04,
  1922. nPAR = 0x05,
  1923. UFP = 0x06,
  1924. vNIC2 = 0x07
  1925. };
  1926. /* Is BE in a multi-channel mode */
  1927. static inline bool be_is_mc(struct be_adapter *adapter)
  1928. {
  1929. return adapter->mc_type > MC_NONE;
  1930. }
  1931. struct be_cmd_req_get_func_config {
  1932. struct be_cmd_req_hdr hdr;
  1933. };
  1934. struct be_cmd_resp_get_func_config {
  1935. struct be_cmd_resp_hdr hdr;
  1936. u32 desc_count;
  1937. u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE_V1];
  1938. };
  1939. enum {
  1940. RESOURCE_LIMITS,
  1941. RESOURCE_MODIFIABLE
  1942. };
  1943. struct be_cmd_req_get_profile_config {
  1944. struct be_cmd_req_hdr hdr;
  1945. u8 rsvd;
  1946. #define ACTIVE_PROFILE_TYPE 0x2
  1947. #define QUERY_MODIFIABLE_FIELDS_TYPE BIT(3)
  1948. u8 type;
  1949. u16 rsvd1;
  1950. };
  1951. struct be_cmd_resp_get_profile_config {
  1952. struct be_cmd_resp_hdr hdr;
  1953. __le16 desc_count;
  1954. u16 rsvd;
  1955. u8 func_param[MAX_RESOURCE_DESC * RESOURCE_DESC_SIZE_V1];
  1956. };
  1957. #define FIELD_MODIFIABLE 0xFFFF
  1958. struct be_cmd_req_set_profile_config {
  1959. struct be_cmd_req_hdr hdr;
  1960. u32 rsvd;
  1961. u32 desc_count;
  1962. u8 desc[2 * RESOURCE_DESC_SIZE_V1];
  1963. } __packed;
  1964. struct be_cmd_req_get_active_profile {
  1965. struct be_cmd_req_hdr hdr;
  1966. u32 rsvd;
  1967. } __packed;
  1968. struct be_cmd_resp_get_active_profile {
  1969. struct be_cmd_resp_hdr hdr;
  1970. u16 active_profile_id;
  1971. u16 next_profile_id;
  1972. } __packed;
  1973. struct be_cmd_enable_disable_vf {
  1974. struct be_cmd_req_hdr hdr;
  1975. u8 enable;
  1976. u8 rsvd[3];
  1977. };
  1978. struct be_cmd_req_intr_set {
  1979. struct be_cmd_req_hdr hdr;
  1980. u8 intr_enabled;
  1981. u8 rsvd[3];
  1982. };
  1983. static inline bool check_privilege(struct be_adapter *adapter, u32 flags)
  1984. {
  1985. return flags & adapter->cmd_privileges ? true : false;
  1986. }
  1987. /************** Get IFACE LIST *******************/
  1988. struct be_if_desc {
  1989. u32 if_id;
  1990. u32 cap_flags;
  1991. u32 en_flags;
  1992. };
  1993. struct be_cmd_req_get_iface_list {
  1994. struct be_cmd_req_hdr hdr;
  1995. };
  1996. struct be_cmd_resp_get_iface_list {
  1997. struct be_cmd_req_hdr hdr;
  1998. u32 if_cnt;
  1999. struct be_if_desc if_desc;
  2000. };
  2001. /*************** Set logical link ********************/
  2002. #define PLINK_TRACK_SHIFT 8
  2003. struct be_cmd_req_set_ll_link {
  2004. struct be_cmd_req_hdr hdr;
  2005. u32 link_config; /* Bit 0: UP_DOWN, Bit 9: PLINK */
  2006. };
  2007. /************** Manage IFACE Filters *******************/
  2008. #define OP_CONVERT_NORMAL_TO_TUNNEL 0
  2009. #define OP_CONVERT_TUNNEL_TO_NORMAL 1
  2010. struct be_cmd_req_manage_iface_filters {
  2011. struct be_cmd_req_hdr hdr;
  2012. u8 op;
  2013. u8 rsvd0;
  2014. u8 flags;
  2015. u8 rsvd1;
  2016. u32 tunnel_iface_id;
  2017. u32 target_iface_id;
  2018. u8 mac[6];
  2019. u16 vlan_tag;
  2020. u32 tenant_id;
  2021. u32 filter_id;
  2022. u32 cap_flags;
  2023. u32 cap_control_flags;
  2024. } __packed;
  2025. int be_pci_fnum_get(struct be_adapter *adapter);
  2026. int be_fw_wait_ready(struct be_adapter *adapter);
  2027. int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
  2028. bool permanent, u32 if_handle, u32 pmac_id);
  2029. int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, u32 if_id,
  2030. u32 *pmac_id, u32 domain);
  2031. int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, int pmac_id,
  2032. u32 domain);
  2033. int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
  2034. u32 *if_handle, u32 domain);
  2035. int be_cmd_if_destroy(struct be_adapter *adapter, int if_handle, u32 domain);
  2036. int be_cmd_eq_create(struct be_adapter *adapter, struct be_eq_obj *eqo);
  2037. int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq,
  2038. struct be_queue_info *eq, bool no_delay,
  2039. int num_cqe_dma_coalesce);
  2040. int be_cmd_mccq_create(struct be_adapter *adapter, struct be_queue_info *mccq,
  2041. struct be_queue_info *cq);
  2042. int be_cmd_txq_create(struct be_adapter *adapter, struct be_tx_obj *txo);
  2043. int be_cmd_rxq_create(struct be_adapter *adapter, struct be_queue_info *rxq,
  2044. u16 cq_id, u16 frag_size, u32 if_id, u32 rss, u8 *rss_id);
  2045. int be_cmd_q_destroy(struct be_adapter *adapter, struct be_queue_info *q,
  2046. int type);
  2047. int be_cmd_rxq_destroy(struct be_adapter *adapter, struct be_queue_info *q);
  2048. int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
  2049. u8 *link_status, u32 dom);
  2050. int be_cmd_reset(struct be_adapter *adapter);
  2051. int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd);
  2052. int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
  2053. struct be_dma_mem *nonemb_cmd);
  2054. int be_cmd_get_fw_ver(struct be_adapter *adapter);
  2055. int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num);
  2056. int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
  2057. u32 num, u32 domain);
  2058. int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
  2059. int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc);
  2060. int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc);
  2061. int be_cmd_query_fw_cfg(struct be_adapter *adapter);
  2062. int be_cmd_reset_function(struct be_adapter *adapter);
  2063. int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
  2064. u32 rss_hash_opts, u16 table_size, const u8 *rss_hkey);
  2065. int be_process_mcc(struct be_adapter *adapter);
  2066. int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, u8 beacon,
  2067. u8 status, u8 state);
  2068. int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num,
  2069. u32 *state);
  2070. int be_cmd_read_port_transceiver_data(struct be_adapter *adapter,
  2071. u8 page_num, u8 *data);
  2072. int be_cmd_query_cable_type(struct be_adapter *adapter);
  2073. int be_cmd_query_sfp_info(struct be_adapter *adapter);
  2074. int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
  2075. u32 flash_oper, u32 flash_opcode, u32 img_offset,
  2076. u32 buf_size);
  2077. int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
  2078. u32 data_size, u32 data_offset,
  2079. const char *obj_name, u32 *data_written,
  2080. u8 *change_status, u8 *addn_status);
  2081. int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
  2082. u32 data_size, u32 data_offset, const char *obj_name,
  2083. u32 *data_read, u32 *eof, u8 *addn_status);
  2084. int lancer_cmd_delete_object(struct be_adapter *adapter, const char *obj_name);
  2085. int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc,
  2086. u16 img_optype, u32 img_offset, u32 crc_offset);
  2087. int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
  2088. struct be_dma_mem *nonemb_cmd);
  2089. int be_cmd_fw_init(struct be_adapter *adapter);
  2090. int be_cmd_fw_clean(struct be_adapter *adapter);
  2091. void be_async_mcc_enable(struct be_adapter *adapter);
  2092. void be_async_mcc_disable(struct be_adapter *adapter);
  2093. int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
  2094. u32 loopback_type, u32 pkt_size, u32 num_pkts,
  2095. u64 pattern);
  2096. int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, u32 byte_cnt,
  2097. struct be_dma_mem *cmd);
  2098. int be_cmd_get_seeprom_data(struct be_adapter *adapter,
  2099. struct be_dma_mem *nonemb_cmd);
  2100. int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
  2101. u8 loopback_type, u8 enable);
  2102. int be_cmd_get_phy_info(struct be_adapter *adapter);
  2103. int be_cmd_config_qos(struct be_adapter *adapter, u32 max_rate,
  2104. u16 link_speed, u8 domain);
  2105. void be_detect_error(struct be_adapter *adapter);
  2106. int be_cmd_get_die_temperature(struct be_adapter *adapter);
  2107. int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
  2108. int be_cmd_req_native_mode(struct be_adapter *adapter);
  2109. int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size);
  2110. int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf);
  2111. int be_cmd_get_fn_privileges(struct be_adapter *adapter, u32 *privilege,
  2112. u32 domain);
  2113. int be_cmd_set_fn_privileges(struct be_adapter *adapter, u32 privileges,
  2114. u32 vf_num);
  2115. int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
  2116. bool *pmac_id_active, u32 *pmac_id,
  2117. u32 if_handle, u8 domain);
  2118. int be_cmd_get_active_mac(struct be_adapter *adapter, u32 pmac_id, u8 *mac,
  2119. u32 if_handle, bool active, u32 domain);
  2120. int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac);
  2121. int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, u8 mac_count,
  2122. u32 domain);
  2123. int be_cmd_set_mac(struct be_adapter *adapter, u8 *mac, int if_id, u32 dom);
  2124. int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, u32 domain,
  2125. u16 intf_id, u16 hsw_mode, u8 spoofchk);
  2126. int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, u32 domain,
  2127. u16 intf_id, u8 *mode, bool *spoofchk);
  2128. int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter);
  2129. int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level);
  2130. int be_cmd_get_fw_log_level(struct be_adapter *adapter);
  2131. int be_cmd_get_ext_fat_capabilites(struct be_adapter *adapter,
  2132. struct be_dma_mem *cmd);
  2133. int be_cmd_set_ext_fat_capabilites(struct be_adapter *adapter,
  2134. struct be_dma_mem *cmd,
  2135. struct be_fat_conf_params *cfgs);
  2136. int lancer_physdev_ctrl(struct be_adapter *adapter, u32 mask);
  2137. int lancer_initiate_dump(struct be_adapter *adapter);
  2138. int lancer_delete_dump(struct be_adapter *adapter);
  2139. bool dump_present(struct be_adapter *adapter);
  2140. int lancer_test_and_set_rdy_state(struct be_adapter *adapter);
  2141. int be_cmd_query_port_name(struct be_adapter *adapter);
  2142. int be_cmd_get_func_config(struct be_adapter *adapter,
  2143. struct be_resources *res);
  2144. int be_cmd_get_profile_config(struct be_adapter *adapter,
  2145. struct be_resources *res, u8 query, u8 domain);
  2146. int be_cmd_get_active_profile(struct be_adapter *adapter, u16 *profile);
  2147. int be_cmd_get_if_id(struct be_adapter *adapter, struct be_vf_cfg *vf_cfg,
  2148. int vf_num);
  2149. int be_cmd_enable_vf(struct be_adapter *adapter, u8 domain);
  2150. int be_cmd_intr_set(struct be_adapter *adapter, bool intr_enable);
  2151. int be_cmd_set_logical_link_config(struct be_adapter *adapter,
  2152. int link_state, u8 domain);
  2153. int be_cmd_set_vxlan_port(struct be_adapter *adapter, __be16 port);
  2154. int be_cmd_manage_iface(struct be_adapter *adapter, u32 iface, u8 op);
  2155. int be_cmd_set_sriov_config(struct be_adapter *adapter,
  2156. struct be_resources res, u16 num_vfs,
  2157. u16 num_vf_qs);