be_cmds.h 60 KB

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