be_cmds.h 62 KB

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