i40e_adminq_cmd.h 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553
  1. /*******************************************************************************
  2. *
  3. * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
  4. * Copyright(c) 2013 - 2016 Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * The full GNU General Public License is included in this distribution in
  19. * the file called "COPYING".
  20. *
  21. * Contact Information:
  22. * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. ******************************************************************************/
  26. #ifndef _I40E_ADMINQ_CMD_H_
  27. #define _I40E_ADMINQ_CMD_H_
  28. /* This header file defines the i40e Admin Queue commands and is shared between
  29. * i40e Firmware and Software.
  30. *
  31. * This file needs to comply with the Linux Kernel coding style.
  32. */
  33. #define I40E_FW_API_VERSION_MAJOR 0x0001
  34. #define I40E_FW_API_VERSION_MINOR 0x0005
  35. struct i40e_aq_desc {
  36. __le16 flags;
  37. __le16 opcode;
  38. __le16 datalen;
  39. __le16 retval;
  40. __le32 cookie_high;
  41. __le32 cookie_low;
  42. union {
  43. struct {
  44. __le32 param0;
  45. __le32 param1;
  46. __le32 param2;
  47. __le32 param3;
  48. } internal;
  49. struct {
  50. __le32 param0;
  51. __le32 param1;
  52. __le32 addr_high;
  53. __le32 addr_low;
  54. } external;
  55. u8 raw[16];
  56. } params;
  57. };
  58. /* Flags sub-structure
  59. * |0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |10 |11 |12 |13 |14 |15 |
  60. * |DD |CMP|ERR|VFE| * * RESERVED * * |LB |RD |VFC|BUF|SI |EI |FE |
  61. */
  62. /* command flags and offsets*/
  63. #define I40E_AQ_FLAG_DD_SHIFT 0
  64. #define I40E_AQ_FLAG_CMP_SHIFT 1
  65. #define I40E_AQ_FLAG_ERR_SHIFT 2
  66. #define I40E_AQ_FLAG_VFE_SHIFT 3
  67. #define I40E_AQ_FLAG_LB_SHIFT 9
  68. #define I40E_AQ_FLAG_RD_SHIFT 10
  69. #define I40E_AQ_FLAG_VFC_SHIFT 11
  70. #define I40E_AQ_FLAG_BUF_SHIFT 12
  71. #define I40E_AQ_FLAG_SI_SHIFT 13
  72. #define I40E_AQ_FLAG_EI_SHIFT 14
  73. #define I40E_AQ_FLAG_FE_SHIFT 15
  74. #define I40E_AQ_FLAG_DD BIT(I40E_AQ_FLAG_DD_SHIFT) /* 0x1 */
  75. #define I40E_AQ_FLAG_CMP BIT(I40E_AQ_FLAG_CMP_SHIFT) /* 0x2 */
  76. #define I40E_AQ_FLAG_ERR BIT(I40E_AQ_FLAG_ERR_SHIFT) /* 0x4 */
  77. #define I40E_AQ_FLAG_VFE BIT(I40E_AQ_FLAG_VFE_SHIFT) /* 0x8 */
  78. #define I40E_AQ_FLAG_LB BIT(I40E_AQ_FLAG_LB_SHIFT) /* 0x200 */
  79. #define I40E_AQ_FLAG_RD BIT(I40E_AQ_FLAG_RD_SHIFT) /* 0x400 */
  80. #define I40E_AQ_FLAG_VFC BIT(I40E_AQ_FLAG_VFC_SHIFT) /* 0x800 */
  81. #define I40E_AQ_FLAG_BUF BIT(I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */
  82. #define I40E_AQ_FLAG_SI BIT(I40E_AQ_FLAG_SI_SHIFT) /* 0x2000 */
  83. #define I40E_AQ_FLAG_EI BIT(I40E_AQ_FLAG_EI_SHIFT) /* 0x4000 */
  84. #define I40E_AQ_FLAG_FE BIT(I40E_AQ_FLAG_FE_SHIFT) /* 0x8000 */
  85. /* error codes */
  86. enum i40e_admin_queue_err {
  87. I40E_AQ_RC_OK = 0, /* success */
  88. I40E_AQ_RC_EPERM = 1, /* Operation not permitted */
  89. I40E_AQ_RC_ENOENT = 2, /* No such element */
  90. I40E_AQ_RC_ESRCH = 3, /* Bad opcode */
  91. I40E_AQ_RC_EINTR = 4, /* operation interrupted */
  92. I40E_AQ_RC_EIO = 5, /* I/O error */
  93. I40E_AQ_RC_ENXIO = 6, /* No such resource */
  94. I40E_AQ_RC_E2BIG = 7, /* Arg too long */
  95. I40E_AQ_RC_EAGAIN = 8, /* Try again */
  96. I40E_AQ_RC_ENOMEM = 9, /* Out of memory */
  97. I40E_AQ_RC_EACCES = 10, /* Permission denied */
  98. I40E_AQ_RC_EFAULT = 11, /* Bad address */
  99. I40E_AQ_RC_EBUSY = 12, /* Device or resource busy */
  100. I40E_AQ_RC_EEXIST = 13, /* object already exists */
  101. I40E_AQ_RC_EINVAL = 14, /* Invalid argument */
  102. I40E_AQ_RC_ENOTTY = 15, /* Not a typewriter */
  103. I40E_AQ_RC_ENOSPC = 16, /* No space left or alloc failure */
  104. I40E_AQ_RC_ENOSYS = 17, /* Function not implemented */
  105. I40E_AQ_RC_ERANGE = 18, /* Parameter out of range */
  106. I40E_AQ_RC_EFLUSHED = 19, /* Cmd flushed due to prev cmd error */
  107. I40E_AQ_RC_BAD_ADDR = 20, /* Descriptor contains a bad pointer */
  108. I40E_AQ_RC_EMODE = 21, /* Op not allowed in current dev mode */
  109. I40E_AQ_RC_EFBIG = 22, /* File too large */
  110. };
  111. /* Admin Queue command opcodes */
  112. enum i40e_admin_queue_opc {
  113. /* aq commands */
  114. i40e_aqc_opc_get_version = 0x0001,
  115. i40e_aqc_opc_driver_version = 0x0002,
  116. i40e_aqc_opc_queue_shutdown = 0x0003,
  117. i40e_aqc_opc_set_pf_context = 0x0004,
  118. /* resource ownership */
  119. i40e_aqc_opc_request_resource = 0x0008,
  120. i40e_aqc_opc_release_resource = 0x0009,
  121. i40e_aqc_opc_list_func_capabilities = 0x000A,
  122. i40e_aqc_opc_list_dev_capabilities = 0x000B,
  123. /* Proxy commands */
  124. i40e_aqc_opc_set_proxy_config = 0x0104,
  125. i40e_aqc_opc_set_ns_proxy_table_entry = 0x0105,
  126. /* LAA */
  127. i40e_aqc_opc_mac_address_read = 0x0107,
  128. i40e_aqc_opc_mac_address_write = 0x0108,
  129. /* PXE */
  130. i40e_aqc_opc_clear_pxe_mode = 0x0110,
  131. /* WoL commands */
  132. i40e_aqc_opc_set_wol_filter = 0x0120,
  133. i40e_aqc_opc_get_wake_reason = 0x0121,
  134. /* internal switch commands */
  135. i40e_aqc_opc_get_switch_config = 0x0200,
  136. i40e_aqc_opc_add_statistics = 0x0201,
  137. i40e_aqc_opc_remove_statistics = 0x0202,
  138. i40e_aqc_opc_set_port_parameters = 0x0203,
  139. i40e_aqc_opc_get_switch_resource_alloc = 0x0204,
  140. i40e_aqc_opc_set_switch_config = 0x0205,
  141. i40e_aqc_opc_rx_ctl_reg_read = 0x0206,
  142. i40e_aqc_opc_rx_ctl_reg_write = 0x0207,
  143. i40e_aqc_opc_add_vsi = 0x0210,
  144. i40e_aqc_opc_update_vsi_parameters = 0x0211,
  145. i40e_aqc_opc_get_vsi_parameters = 0x0212,
  146. i40e_aqc_opc_add_pv = 0x0220,
  147. i40e_aqc_opc_update_pv_parameters = 0x0221,
  148. i40e_aqc_opc_get_pv_parameters = 0x0222,
  149. i40e_aqc_opc_add_veb = 0x0230,
  150. i40e_aqc_opc_update_veb_parameters = 0x0231,
  151. i40e_aqc_opc_get_veb_parameters = 0x0232,
  152. i40e_aqc_opc_delete_element = 0x0243,
  153. i40e_aqc_opc_add_macvlan = 0x0250,
  154. i40e_aqc_opc_remove_macvlan = 0x0251,
  155. i40e_aqc_opc_add_vlan = 0x0252,
  156. i40e_aqc_opc_remove_vlan = 0x0253,
  157. i40e_aqc_opc_set_vsi_promiscuous_modes = 0x0254,
  158. i40e_aqc_opc_add_tag = 0x0255,
  159. i40e_aqc_opc_remove_tag = 0x0256,
  160. i40e_aqc_opc_add_multicast_etag = 0x0257,
  161. i40e_aqc_opc_remove_multicast_etag = 0x0258,
  162. i40e_aqc_opc_update_tag = 0x0259,
  163. i40e_aqc_opc_add_control_packet_filter = 0x025A,
  164. i40e_aqc_opc_remove_control_packet_filter = 0x025B,
  165. i40e_aqc_opc_add_cloud_filters = 0x025C,
  166. i40e_aqc_opc_remove_cloud_filters = 0x025D,
  167. i40e_aqc_opc_clear_wol_switch_filters = 0x025E,
  168. i40e_aqc_opc_add_mirror_rule = 0x0260,
  169. i40e_aqc_opc_delete_mirror_rule = 0x0261,
  170. /* Pipeline Personalization Profile */
  171. i40e_aqc_opc_write_personalization_profile = 0x0270,
  172. i40e_aqc_opc_get_personalization_profile_list = 0x0271,
  173. /* DCB commands */
  174. i40e_aqc_opc_dcb_ignore_pfc = 0x0301,
  175. i40e_aqc_opc_dcb_updated = 0x0302,
  176. /* TX scheduler */
  177. i40e_aqc_opc_configure_vsi_bw_limit = 0x0400,
  178. i40e_aqc_opc_configure_vsi_ets_sla_bw_limit = 0x0406,
  179. i40e_aqc_opc_configure_vsi_tc_bw = 0x0407,
  180. i40e_aqc_opc_query_vsi_bw_config = 0x0408,
  181. i40e_aqc_opc_query_vsi_ets_sla_config = 0x040A,
  182. i40e_aqc_opc_configure_switching_comp_bw_limit = 0x0410,
  183. i40e_aqc_opc_enable_switching_comp_ets = 0x0413,
  184. i40e_aqc_opc_modify_switching_comp_ets = 0x0414,
  185. i40e_aqc_opc_disable_switching_comp_ets = 0x0415,
  186. i40e_aqc_opc_configure_switching_comp_ets_bw_limit = 0x0416,
  187. i40e_aqc_opc_configure_switching_comp_bw_config = 0x0417,
  188. i40e_aqc_opc_query_switching_comp_ets_config = 0x0418,
  189. i40e_aqc_opc_query_port_ets_config = 0x0419,
  190. i40e_aqc_opc_query_switching_comp_bw_config = 0x041A,
  191. i40e_aqc_opc_suspend_port_tx = 0x041B,
  192. i40e_aqc_opc_resume_port_tx = 0x041C,
  193. i40e_aqc_opc_configure_partition_bw = 0x041D,
  194. /* hmc */
  195. i40e_aqc_opc_query_hmc_resource_profile = 0x0500,
  196. i40e_aqc_opc_set_hmc_resource_profile = 0x0501,
  197. /* phy commands*/
  198. i40e_aqc_opc_get_phy_abilities = 0x0600,
  199. i40e_aqc_opc_set_phy_config = 0x0601,
  200. i40e_aqc_opc_set_mac_config = 0x0603,
  201. i40e_aqc_opc_set_link_restart_an = 0x0605,
  202. i40e_aqc_opc_get_link_status = 0x0607,
  203. i40e_aqc_opc_set_phy_int_mask = 0x0613,
  204. i40e_aqc_opc_get_local_advt_reg = 0x0614,
  205. i40e_aqc_opc_set_local_advt_reg = 0x0615,
  206. i40e_aqc_opc_get_partner_advt = 0x0616,
  207. i40e_aqc_opc_set_lb_modes = 0x0618,
  208. i40e_aqc_opc_get_phy_wol_caps = 0x0621,
  209. i40e_aqc_opc_set_phy_debug = 0x0622,
  210. i40e_aqc_opc_upload_ext_phy_fm = 0x0625,
  211. i40e_aqc_opc_run_phy_activity = 0x0626,
  212. /* NVM commands */
  213. i40e_aqc_opc_nvm_read = 0x0701,
  214. i40e_aqc_opc_nvm_erase = 0x0702,
  215. i40e_aqc_opc_nvm_update = 0x0703,
  216. i40e_aqc_opc_nvm_config_read = 0x0704,
  217. i40e_aqc_opc_nvm_config_write = 0x0705,
  218. i40e_aqc_opc_oem_post_update = 0x0720,
  219. i40e_aqc_opc_thermal_sensor = 0x0721,
  220. /* virtualization commands */
  221. i40e_aqc_opc_send_msg_to_pf = 0x0801,
  222. i40e_aqc_opc_send_msg_to_vf = 0x0802,
  223. i40e_aqc_opc_send_msg_to_peer = 0x0803,
  224. /* alternate structure */
  225. i40e_aqc_opc_alternate_write = 0x0900,
  226. i40e_aqc_opc_alternate_write_indirect = 0x0901,
  227. i40e_aqc_opc_alternate_read = 0x0902,
  228. i40e_aqc_opc_alternate_read_indirect = 0x0903,
  229. i40e_aqc_opc_alternate_write_done = 0x0904,
  230. i40e_aqc_opc_alternate_set_mode = 0x0905,
  231. i40e_aqc_opc_alternate_clear_port = 0x0906,
  232. /* LLDP commands */
  233. i40e_aqc_opc_lldp_get_mib = 0x0A00,
  234. i40e_aqc_opc_lldp_update_mib = 0x0A01,
  235. i40e_aqc_opc_lldp_add_tlv = 0x0A02,
  236. i40e_aqc_opc_lldp_update_tlv = 0x0A03,
  237. i40e_aqc_opc_lldp_delete_tlv = 0x0A04,
  238. i40e_aqc_opc_lldp_stop = 0x0A05,
  239. i40e_aqc_opc_lldp_start = 0x0A06,
  240. /* Tunnel commands */
  241. i40e_aqc_opc_add_udp_tunnel = 0x0B00,
  242. i40e_aqc_opc_del_udp_tunnel = 0x0B01,
  243. i40e_aqc_opc_set_rss_key = 0x0B02,
  244. i40e_aqc_opc_set_rss_lut = 0x0B03,
  245. i40e_aqc_opc_get_rss_key = 0x0B04,
  246. i40e_aqc_opc_get_rss_lut = 0x0B05,
  247. /* Async Events */
  248. i40e_aqc_opc_event_lan_overflow = 0x1001,
  249. /* OEM commands */
  250. i40e_aqc_opc_oem_parameter_change = 0xFE00,
  251. i40e_aqc_opc_oem_device_status_change = 0xFE01,
  252. i40e_aqc_opc_oem_ocsd_initialize = 0xFE02,
  253. i40e_aqc_opc_oem_ocbb_initialize = 0xFE03,
  254. /* debug commands */
  255. i40e_aqc_opc_debug_read_reg = 0xFF03,
  256. i40e_aqc_opc_debug_write_reg = 0xFF04,
  257. i40e_aqc_opc_debug_modify_reg = 0xFF07,
  258. i40e_aqc_opc_debug_dump_internals = 0xFF08,
  259. };
  260. /* command structures and indirect data structures */
  261. /* Structure naming conventions:
  262. * - no suffix for direct command descriptor structures
  263. * - _data for indirect sent data
  264. * - _resp for indirect return data (data which is both will use _data)
  265. * - _completion for direct return data
  266. * - _element_ for repeated elements (may also be _data or _resp)
  267. *
  268. * Command structures are expected to overlay the params.raw member of the basic
  269. * descriptor, and as such cannot exceed 16 bytes in length.
  270. */
  271. /* This macro is used to generate a compilation error if a structure
  272. * is not exactly the correct length. It gives a divide by zero error if the
  273. * structure is not of the correct size, otherwise it creates an enum that is
  274. * never used.
  275. */
  276. #define I40E_CHECK_STRUCT_LEN(n, X) enum i40e_static_assert_enum_##X \
  277. { i40e_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
  278. /* This macro is used extensively to ensure that command structures are 16
  279. * bytes in length as they have to map to the raw array of that size.
  280. */
  281. #define I40E_CHECK_CMD_LENGTH(X) I40E_CHECK_STRUCT_LEN(16, X)
  282. /* internal (0x00XX) commands */
  283. /* Get version (direct 0x0001) */
  284. struct i40e_aqc_get_version {
  285. __le32 rom_ver;
  286. __le32 fw_build;
  287. __le16 fw_major;
  288. __le16 fw_minor;
  289. __le16 api_major;
  290. __le16 api_minor;
  291. };
  292. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_version);
  293. /* Send driver version (indirect 0x0002) */
  294. struct i40e_aqc_driver_version {
  295. u8 driver_major_ver;
  296. u8 driver_minor_ver;
  297. u8 driver_build_ver;
  298. u8 driver_subbuild_ver;
  299. u8 reserved[4];
  300. __le32 address_high;
  301. __le32 address_low;
  302. };
  303. I40E_CHECK_CMD_LENGTH(i40e_aqc_driver_version);
  304. /* Queue Shutdown (direct 0x0003) */
  305. struct i40e_aqc_queue_shutdown {
  306. __le32 driver_unloading;
  307. #define I40E_AQ_DRIVER_UNLOADING 0x1
  308. u8 reserved[12];
  309. };
  310. I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown);
  311. /* Set PF context (0x0004, direct) */
  312. struct i40e_aqc_set_pf_context {
  313. u8 pf_id;
  314. u8 reserved[15];
  315. };
  316. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_pf_context);
  317. /* Request resource ownership (direct 0x0008)
  318. * Release resource ownership (direct 0x0009)
  319. */
  320. #define I40E_AQ_RESOURCE_NVM 1
  321. #define I40E_AQ_RESOURCE_SDP 2
  322. #define I40E_AQ_RESOURCE_ACCESS_READ 1
  323. #define I40E_AQ_RESOURCE_ACCESS_WRITE 2
  324. #define I40E_AQ_RESOURCE_NVM_READ_TIMEOUT 3000
  325. #define I40E_AQ_RESOURCE_NVM_WRITE_TIMEOUT 180000
  326. struct i40e_aqc_request_resource {
  327. __le16 resource_id;
  328. __le16 access_type;
  329. __le32 timeout;
  330. __le32 resource_number;
  331. u8 reserved[4];
  332. };
  333. I40E_CHECK_CMD_LENGTH(i40e_aqc_request_resource);
  334. /* Get function capabilities (indirect 0x000A)
  335. * Get device capabilities (indirect 0x000B)
  336. */
  337. struct i40e_aqc_list_capabilites {
  338. u8 command_flags;
  339. #define I40E_AQ_LIST_CAP_PF_INDEX_EN 1
  340. u8 pf_index;
  341. u8 reserved[2];
  342. __le32 count;
  343. __le32 addr_high;
  344. __le32 addr_low;
  345. };
  346. I40E_CHECK_CMD_LENGTH(i40e_aqc_list_capabilites);
  347. struct i40e_aqc_list_capabilities_element_resp {
  348. __le16 id;
  349. u8 major_rev;
  350. u8 minor_rev;
  351. __le32 number;
  352. __le32 logical_id;
  353. __le32 phys_id;
  354. u8 reserved[16];
  355. };
  356. /* list of caps */
  357. #define I40E_AQ_CAP_ID_SWITCH_MODE 0x0001
  358. #define I40E_AQ_CAP_ID_MNG_MODE 0x0002
  359. #define I40E_AQ_CAP_ID_NPAR_ACTIVE 0x0003
  360. #define I40E_AQ_CAP_ID_OS2BMC_CAP 0x0004
  361. #define I40E_AQ_CAP_ID_FUNCTIONS_VALID 0x0005
  362. #define I40E_AQ_CAP_ID_ALTERNATE_RAM 0x0006
  363. #define I40E_AQ_CAP_ID_WOL_AND_PROXY 0x0008
  364. #define I40E_AQ_CAP_ID_SRIOV 0x0012
  365. #define I40E_AQ_CAP_ID_VF 0x0013
  366. #define I40E_AQ_CAP_ID_VMDQ 0x0014
  367. #define I40E_AQ_CAP_ID_8021QBG 0x0015
  368. #define I40E_AQ_CAP_ID_8021QBR 0x0016
  369. #define I40E_AQ_CAP_ID_VSI 0x0017
  370. #define I40E_AQ_CAP_ID_DCB 0x0018
  371. #define I40E_AQ_CAP_ID_FCOE 0x0021
  372. #define I40E_AQ_CAP_ID_ISCSI 0x0022
  373. #define I40E_AQ_CAP_ID_RSS 0x0040
  374. #define I40E_AQ_CAP_ID_RXQ 0x0041
  375. #define I40E_AQ_CAP_ID_TXQ 0x0042
  376. #define I40E_AQ_CAP_ID_MSIX 0x0043
  377. #define I40E_AQ_CAP_ID_VF_MSIX 0x0044
  378. #define I40E_AQ_CAP_ID_FLOW_DIRECTOR 0x0045
  379. #define I40E_AQ_CAP_ID_1588 0x0046
  380. #define I40E_AQ_CAP_ID_IWARP 0x0051
  381. #define I40E_AQ_CAP_ID_LED 0x0061
  382. #define I40E_AQ_CAP_ID_SDP 0x0062
  383. #define I40E_AQ_CAP_ID_MDIO 0x0063
  384. #define I40E_AQ_CAP_ID_WSR_PROT 0x0064
  385. #define I40E_AQ_CAP_ID_NVM_MGMT 0x0080
  386. #define I40E_AQ_CAP_ID_FLEX10 0x00F1
  387. #define I40E_AQ_CAP_ID_CEM 0x00F2
  388. /* Set CPPM Configuration (direct 0x0103) */
  389. struct i40e_aqc_cppm_configuration {
  390. __le16 command_flags;
  391. #define I40E_AQ_CPPM_EN_LTRC 0x0800
  392. #define I40E_AQ_CPPM_EN_DMCTH 0x1000
  393. #define I40E_AQ_CPPM_EN_DMCTLX 0x2000
  394. #define I40E_AQ_CPPM_EN_HPTC 0x4000
  395. #define I40E_AQ_CPPM_EN_DMARC 0x8000
  396. __le16 ttlx;
  397. __le32 dmacr;
  398. __le16 dmcth;
  399. u8 hptc;
  400. u8 reserved;
  401. __le32 pfltrc;
  402. };
  403. I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration);
  404. /* Set ARP Proxy command / response (indirect 0x0104) */
  405. struct i40e_aqc_arp_proxy_data {
  406. __le16 command_flags;
  407. #define I40E_AQ_ARP_INIT_IPV4 0x0800
  408. #define I40E_AQ_ARP_UNSUP_CTL 0x1000
  409. #define I40E_AQ_ARP_ENA 0x2000
  410. #define I40E_AQ_ARP_ADD_IPV4 0x4000
  411. #define I40E_AQ_ARP_DEL_IPV4 0x8000
  412. __le16 table_id;
  413. __le32 enabled_offloads;
  414. #define I40E_AQ_ARP_DIRECTED_OFFLOAD_ENABLE 0x00000020
  415. #define I40E_AQ_ARP_OFFLOAD_ENABLE 0x00000800
  416. __le32 ip_addr;
  417. u8 mac_addr[6];
  418. u8 reserved[2];
  419. };
  420. I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_proxy_data);
  421. /* Set NS Proxy Table Entry Command (indirect 0x0105) */
  422. struct i40e_aqc_ns_proxy_data {
  423. __le16 table_idx_mac_addr_0;
  424. __le16 table_idx_mac_addr_1;
  425. __le16 table_idx_ipv6_0;
  426. __le16 table_idx_ipv6_1;
  427. __le16 control;
  428. #define I40E_AQ_NS_PROXY_ADD_0 0x0001
  429. #define I40E_AQ_NS_PROXY_DEL_0 0x0002
  430. #define I40E_AQ_NS_PROXY_ADD_1 0x0004
  431. #define I40E_AQ_NS_PROXY_DEL_1 0x0008
  432. #define I40E_AQ_NS_PROXY_ADD_IPV6_0 0x0010
  433. #define I40E_AQ_NS_PROXY_DEL_IPV6_0 0x0020
  434. #define I40E_AQ_NS_PROXY_ADD_IPV6_1 0x0040
  435. #define I40E_AQ_NS_PROXY_DEL_IPV6_1 0x0080
  436. #define I40E_AQ_NS_PROXY_COMMAND_SEQ 0x0100
  437. #define I40E_AQ_NS_PROXY_INIT_IPV6_TBL 0x0200
  438. #define I40E_AQ_NS_PROXY_INIT_MAC_TBL 0x0400
  439. #define I40E_AQ_NS_PROXY_OFFLOAD_ENABLE 0x0800
  440. #define I40E_AQ_NS_PROXY_DIRECTED_OFFLOAD_ENABLE 0x1000
  441. u8 mac_addr_0[6];
  442. u8 mac_addr_1[6];
  443. u8 local_mac_addr[6];
  444. u8 ipv6_addr_0[16]; /* Warning! spec specifies BE byte order */
  445. u8 ipv6_addr_1[16];
  446. };
  447. I40E_CHECK_STRUCT_LEN(0x3c, i40e_aqc_ns_proxy_data);
  448. /* Manage LAA Command (0x0106) - obsolete */
  449. struct i40e_aqc_mng_laa {
  450. __le16 command_flags;
  451. #define I40E_AQ_LAA_FLAG_WR 0x8000
  452. u8 reserved[2];
  453. __le32 sal;
  454. __le16 sah;
  455. u8 reserved2[6];
  456. };
  457. I40E_CHECK_CMD_LENGTH(i40e_aqc_mng_laa);
  458. /* Manage MAC Address Read Command (indirect 0x0107) */
  459. struct i40e_aqc_mac_address_read {
  460. __le16 command_flags;
  461. #define I40E_AQC_LAN_ADDR_VALID 0x10
  462. #define I40E_AQC_SAN_ADDR_VALID 0x20
  463. #define I40E_AQC_PORT_ADDR_VALID 0x40
  464. #define I40E_AQC_WOL_ADDR_VALID 0x80
  465. #define I40E_AQC_MC_MAG_EN_VALID 0x100
  466. #define I40E_AQC_ADDR_VALID_MASK 0x1F0
  467. u8 reserved[6];
  468. __le32 addr_high;
  469. __le32 addr_low;
  470. };
  471. I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_read);
  472. struct i40e_aqc_mac_address_read_data {
  473. u8 pf_lan_mac[6];
  474. u8 pf_san_mac[6];
  475. u8 port_mac[6];
  476. u8 pf_wol_mac[6];
  477. };
  478. I40E_CHECK_STRUCT_LEN(24, i40e_aqc_mac_address_read_data);
  479. /* Manage MAC Address Write Command (0x0108) */
  480. struct i40e_aqc_mac_address_write {
  481. __le16 command_flags;
  482. #define I40E_AQC_WRITE_TYPE_LAA_ONLY 0x0000
  483. #define I40E_AQC_WRITE_TYPE_LAA_WOL 0x4000
  484. #define I40E_AQC_WRITE_TYPE_PORT 0x8000
  485. #define I40E_AQC_WRITE_TYPE_UPDATE_MC_MAG 0xC000
  486. #define I40E_AQC_WRITE_TYPE_MASK 0xC000
  487. __le16 mac_sah;
  488. __le32 mac_sal;
  489. u8 reserved[8];
  490. };
  491. I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_write);
  492. /* PXE commands (0x011x) */
  493. /* Clear PXE Command and response (direct 0x0110) */
  494. struct i40e_aqc_clear_pxe {
  495. u8 rx_cnt;
  496. u8 reserved[15];
  497. };
  498. I40E_CHECK_CMD_LENGTH(i40e_aqc_clear_pxe);
  499. /* Set WoL Filter (0x0120) */
  500. struct i40e_aqc_set_wol_filter {
  501. __le16 filter_index;
  502. #define I40E_AQC_MAX_NUM_WOL_FILTERS 8
  503. #define I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_SHIFT 15
  504. #define I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_MASK (0x1 << \
  505. I40E_AQC_SET_WOL_FILTER_TYPE_MAGIC_SHIFT)
  506. #define I40E_AQC_SET_WOL_FILTER_INDEX_SHIFT 0
  507. #define I40E_AQC_SET_WOL_FILTER_INDEX_MASK (0x7 << \
  508. I40E_AQC_SET_WOL_FILTER_INDEX_SHIFT)
  509. __le16 cmd_flags;
  510. #define I40E_AQC_SET_WOL_FILTER 0x8000
  511. #define I40E_AQC_SET_WOL_FILTER_NO_TCO_WOL 0x4000
  512. #define I40E_AQC_SET_WOL_FILTER_ACTION_CLEAR 0
  513. #define I40E_AQC_SET_WOL_FILTER_ACTION_SET 1
  514. __le16 valid_flags;
  515. #define I40E_AQC_SET_WOL_FILTER_ACTION_VALID 0x8000
  516. #define I40E_AQC_SET_WOL_FILTER_NO_TCO_ACTION_VALID 0x4000
  517. u8 reserved[2];
  518. __le32 address_high;
  519. __le32 address_low;
  520. };
  521. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_wol_filter);
  522. struct i40e_aqc_set_wol_filter_data {
  523. u8 filter[128];
  524. u8 mask[16];
  525. };
  526. I40E_CHECK_STRUCT_LEN(0x90, i40e_aqc_set_wol_filter_data);
  527. /* Get Wake Reason (0x0121) */
  528. struct i40e_aqc_get_wake_reason_completion {
  529. u8 reserved_1[2];
  530. __le16 wake_reason;
  531. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT 0
  532. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_MASK (0xFF << \
  533. I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT)
  534. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT 8
  535. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_MASK (0xFF << \
  536. I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT)
  537. u8 reserved_2[12];
  538. };
  539. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_wake_reason_completion);
  540. /* Switch configuration commands (0x02xx) */
  541. /* Used by many indirect commands that only pass an seid and a buffer in the
  542. * command
  543. */
  544. struct i40e_aqc_switch_seid {
  545. __le16 seid;
  546. u8 reserved[6];
  547. __le32 addr_high;
  548. __le32 addr_low;
  549. };
  550. I40E_CHECK_CMD_LENGTH(i40e_aqc_switch_seid);
  551. /* Get Switch Configuration command (indirect 0x0200)
  552. * uses i40e_aqc_switch_seid for the descriptor
  553. */
  554. struct i40e_aqc_get_switch_config_header_resp {
  555. __le16 num_reported;
  556. __le16 num_total;
  557. u8 reserved[12];
  558. };
  559. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_config_header_resp);
  560. struct i40e_aqc_switch_config_element_resp {
  561. u8 element_type;
  562. #define I40E_AQ_SW_ELEM_TYPE_MAC 1
  563. #define I40E_AQ_SW_ELEM_TYPE_PF 2
  564. #define I40E_AQ_SW_ELEM_TYPE_VF 3
  565. #define I40E_AQ_SW_ELEM_TYPE_EMP 4
  566. #define I40E_AQ_SW_ELEM_TYPE_BMC 5
  567. #define I40E_AQ_SW_ELEM_TYPE_PV 16
  568. #define I40E_AQ_SW_ELEM_TYPE_VEB 17
  569. #define I40E_AQ_SW_ELEM_TYPE_PA 18
  570. #define I40E_AQ_SW_ELEM_TYPE_VSI 19
  571. u8 revision;
  572. #define I40E_AQ_SW_ELEM_REV_1 1
  573. __le16 seid;
  574. __le16 uplink_seid;
  575. __le16 downlink_seid;
  576. u8 reserved[3];
  577. u8 connection_type;
  578. #define I40E_AQ_CONN_TYPE_REGULAR 0x1
  579. #define I40E_AQ_CONN_TYPE_DEFAULT 0x2
  580. #define I40E_AQ_CONN_TYPE_CASCADED 0x3
  581. __le16 scheduler_id;
  582. __le16 element_info;
  583. };
  584. I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_config_element_resp);
  585. /* Get Switch Configuration (indirect 0x0200)
  586. * an array of elements are returned in the response buffer
  587. * the first in the array is the header, remainder are elements
  588. */
  589. struct i40e_aqc_get_switch_config_resp {
  590. struct i40e_aqc_get_switch_config_header_resp header;
  591. struct i40e_aqc_switch_config_element_resp element[1];
  592. };
  593. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_switch_config_resp);
  594. /* Add Statistics (direct 0x0201)
  595. * Remove Statistics (direct 0x0202)
  596. */
  597. struct i40e_aqc_add_remove_statistics {
  598. __le16 seid;
  599. __le16 vlan;
  600. __le16 stat_index;
  601. u8 reserved[10];
  602. };
  603. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_statistics);
  604. /* Set Port Parameters command (direct 0x0203) */
  605. struct i40e_aqc_set_port_parameters {
  606. __le16 command_flags;
  607. #define I40E_AQ_SET_P_PARAMS_SAVE_BAD_PACKETS 1
  608. #define I40E_AQ_SET_P_PARAMS_PAD_SHORT_PACKETS 2 /* must set! */
  609. #define I40E_AQ_SET_P_PARAMS_DOUBLE_VLAN_ENA 4
  610. __le16 bad_frame_vsi;
  611. #define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_SHIFT 0x0
  612. #define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_MASK 0x3FF
  613. __le16 default_seid; /* reserved for command */
  614. u8 reserved[10];
  615. };
  616. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_port_parameters);
  617. /* Get Switch Resource Allocation (indirect 0x0204) */
  618. struct i40e_aqc_get_switch_resource_alloc {
  619. u8 num_entries; /* reserved for command */
  620. u8 reserved[7];
  621. __le32 addr_high;
  622. __le32 addr_low;
  623. };
  624. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_resource_alloc);
  625. /* expect an array of these structs in the response buffer */
  626. struct i40e_aqc_switch_resource_alloc_element_resp {
  627. u8 resource_type;
  628. #define I40E_AQ_RESOURCE_TYPE_VEB 0x0
  629. #define I40E_AQ_RESOURCE_TYPE_VSI 0x1
  630. #define I40E_AQ_RESOURCE_TYPE_MACADDR 0x2
  631. #define I40E_AQ_RESOURCE_TYPE_STAG 0x3
  632. #define I40E_AQ_RESOURCE_TYPE_ETAG 0x4
  633. #define I40E_AQ_RESOURCE_TYPE_MULTICAST_HASH 0x5
  634. #define I40E_AQ_RESOURCE_TYPE_UNICAST_HASH 0x6
  635. #define I40E_AQ_RESOURCE_TYPE_VLAN 0x7
  636. #define I40E_AQ_RESOURCE_TYPE_VSI_LIST_ENTRY 0x8
  637. #define I40E_AQ_RESOURCE_TYPE_ETAG_LIST_ENTRY 0x9
  638. #define I40E_AQ_RESOURCE_TYPE_VLAN_STAT_POOL 0xA
  639. #define I40E_AQ_RESOURCE_TYPE_MIRROR_RULE 0xB
  640. #define I40E_AQ_RESOURCE_TYPE_QUEUE_SETS 0xC
  641. #define I40E_AQ_RESOURCE_TYPE_VLAN_FILTERS 0xD
  642. #define I40E_AQ_RESOURCE_TYPE_INNER_MAC_FILTERS 0xF
  643. #define I40E_AQ_RESOURCE_TYPE_IP_FILTERS 0x10
  644. #define I40E_AQ_RESOURCE_TYPE_GRE_VN_KEYS 0x11
  645. #define I40E_AQ_RESOURCE_TYPE_VN2_KEYS 0x12
  646. #define I40E_AQ_RESOURCE_TYPE_TUNNEL_PORTS 0x13
  647. u8 reserved1;
  648. __le16 guaranteed;
  649. __le16 total;
  650. __le16 used;
  651. __le16 total_unalloced;
  652. u8 reserved2[6];
  653. };
  654. I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_resource_alloc_element_resp);
  655. /* Set Switch Configuration (direct 0x0205) */
  656. struct i40e_aqc_set_switch_config {
  657. __le16 flags;
  658. /* flags used for both fields below */
  659. #define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001
  660. #define I40E_AQ_SET_SWITCH_CFG_L2_FILTER 0x0002
  661. __le16 valid_flags;
  662. u8 reserved[12];
  663. };
  664. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_switch_config);
  665. /* Read Receive control registers (direct 0x0206)
  666. * Write Receive control registers (direct 0x0207)
  667. * used for accessing Rx control registers that can be
  668. * slow and need special handling when under high Rx load
  669. */
  670. struct i40e_aqc_rx_ctl_reg_read_write {
  671. __le32 reserved1;
  672. __le32 address;
  673. __le32 reserved2;
  674. __le32 value;
  675. };
  676. I40E_CHECK_CMD_LENGTH(i40e_aqc_rx_ctl_reg_read_write);
  677. /* Add VSI (indirect 0x0210)
  678. * this indirect command uses struct i40e_aqc_vsi_properties_data
  679. * as the indirect buffer (128 bytes)
  680. *
  681. * Update VSI (indirect 0x211)
  682. * uses the same data structure as Add VSI
  683. *
  684. * Get VSI (indirect 0x0212)
  685. * uses the same completion and data structure as Add VSI
  686. */
  687. struct i40e_aqc_add_get_update_vsi {
  688. __le16 uplink_seid;
  689. u8 connection_type;
  690. #define I40E_AQ_VSI_CONN_TYPE_NORMAL 0x1
  691. #define I40E_AQ_VSI_CONN_TYPE_DEFAULT 0x2
  692. #define I40E_AQ_VSI_CONN_TYPE_CASCADED 0x3
  693. u8 reserved1;
  694. u8 vf_id;
  695. u8 reserved2;
  696. __le16 vsi_flags;
  697. #define I40E_AQ_VSI_TYPE_SHIFT 0x0
  698. #define I40E_AQ_VSI_TYPE_MASK (0x3 << I40E_AQ_VSI_TYPE_SHIFT)
  699. #define I40E_AQ_VSI_TYPE_VF 0x0
  700. #define I40E_AQ_VSI_TYPE_VMDQ2 0x1
  701. #define I40E_AQ_VSI_TYPE_PF 0x2
  702. #define I40E_AQ_VSI_TYPE_EMP_MNG 0x3
  703. #define I40E_AQ_VSI_FLAG_CASCADED_PV 0x4
  704. __le32 addr_high;
  705. __le32 addr_low;
  706. };
  707. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi);
  708. struct i40e_aqc_add_get_update_vsi_completion {
  709. __le16 seid;
  710. __le16 vsi_number;
  711. __le16 vsi_used;
  712. __le16 vsi_free;
  713. __le32 addr_high;
  714. __le32 addr_low;
  715. };
  716. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi_completion);
  717. struct i40e_aqc_vsi_properties_data {
  718. /* first 96 byte are written by SW */
  719. __le16 valid_sections;
  720. #define I40E_AQ_VSI_PROP_SWITCH_VALID 0x0001
  721. #define I40E_AQ_VSI_PROP_SECURITY_VALID 0x0002
  722. #define I40E_AQ_VSI_PROP_VLAN_VALID 0x0004
  723. #define I40E_AQ_VSI_PROP_CAS_PV_VALID 0x0008
  724. #define I40E_AQ_VSI_PROP_INGRESS_UP_VALID 0x0010
  725. #define I40E_AQ_VSI_PROP_EGRESS_UP_VALID 0x0020
  726. #define I40E_AQ_VSI_PROP_QUEUE_MAP_VALID 0x0040
  727. #define I40E_AQ_VSI_PROP_QUEUE_OPT_VALID 0x0080
  728. #define I40E_AQ_VSI_PROP_OUTER_UP_VALID 0x0100
  729. #define I40E_AQ_VSI_PROP_SCHED_VALID 0x0200
  730. /* switch section */
  731. __le16 switch_id; /* 12bit id combined with flags below */
  732. #define I40E_AQ_VSI_SW_ID_SHIFT 0x0000
  733. #define I40E_AQ_VSI_SW_ID_MASK (0xFFF << I40E_AQ_VSI_SW_ID_SHIFT)
  734. #define I40E_AQ_VSI_SW_ID_FLAG_NOT_STAG 0x1000
  735. #define I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB 0x2000
  736. #define I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB 0x4000
  737. u8 sw_reserved[2];
  738. /* security section */
  739. u8 sec_flags;
  740. #define I40E_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD 0x01
  741. #define I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK 0x02
  742. #define I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK 0x04
  743. u8 sec_reserved;
  744. /* VLAN section */
  745. __le16 pvid; /* VLANS include priority bits */
  746. __le16 fcoe_pvid;
  747. u8 port_vlan_flags;
  748. #define I40E_AQ_VSI_PVLAN_MODE_SHIFT 0x00
  749. #define I40E_AQ_VSI_PVLAN_MODE_MASK (0x03 << \
  750. I40E_AQ_VSI_PVLAN_MODE_SHIFT)
  751. #define I40E_AQ_VSI_PVLAN_MODE_TAGGED 0x01
  752. #define I40E_AQ_VSI_PVLAN_MODE_UNTAGGED 0x02
  753. #define I40E_AQ_VSI_PVLAN_MODE_ALL 0x03
  754. #define I40E_AQ_VSI_PVLAN_INSERT_PVID 0x04
  755. #define I40E_AQ_VSI_PVLAN_EMOD_SHIFT 0x03
  756. #define I40E_AQ_VSI_PVLAN_EMOD_MASK (0x3 << \
  757. I40E_AQ_VSI_PVLAN_EMOD_SHIFT)
  758. #define I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH 0x0
  759. #define I40E_AQ_VSI_PVLAN_EMOD_STR_UP 0x08
  760. #define I40E_AQ_VSI_PVLAN_EMOD_STR 0x10
  761. #define I40E_AQ_VSI_PVLAN_EMOD_NOTHING 0x18
  762. u8 pvlan_reserved[3];
  763. /* ingress egress up sections */
  764. __le32 ingress_table; /* bitmap, 3 bits per up */
  765. #define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT 0
  766. #define I40E_AQ_VSI_UP_TABLE_UP0_MASK (0x7 << \
  767. I40E_AQ_VSI_UP_TABLE_UP0_SHIFT)
  768. #define I40E_AQ_VSI_UP_TABLE_UP1_SHIFT 3
  769. #define I40E_AQ_VSI_UP_TABLE_UP1_MASK (0x7 << \
  770. I40E_AQ_VSI_UP_TABLE_UP1_SHIFT)
  771. #define I40E_AQ_VSI_UP_TABLE_UP2_SHIFT 6
  772. #define I40E_AQ_VSI_UP_TABLE_UP2_MASK (0x7 << \
  773. I40E_AQ_VSI_UP_TABLE_UP2_SHIFT)
  774. #define I40E_AQ_VSI_UP_TABLE_UP3_SHIFT 9
  775. #define I40E_AQ_VSI_UP_TABLE_UP3_MASK (0x7 << \
  776. I40E_AQ_VSI_UP_TABLE_UP3_SHIFT)
  777. #define I40E_AQ_VSI_UP_TABLE_UP4_SHIFT 12
  778. #define I40E_AQ_VSI_UP_TABLE_UP4_MASK (0x7 << \
  779. I40E_AQ_VSI_UP_TABLE_UP4_SHIFT)
  780. #define I40E_AQ_VSI_UP_TABLE_UP5_SHIFT 15
  781. #define I40E_AQ_VSI_UP_TABLE_UP5_MASK (0x7 << \
  782. I40E_AQ_VSI_UP_TABLE_UP5_SHIFT)
  783. #define I40E_AQ_VSI_UP_TABLE_UP6_SHIFT 18
  784. #define I40E_AQ_VSI_UP_TABLE_UP6_MASK (0x7 << \
  785. I40E_AQ_VSI_UP_TABLE_UP6_SHIFT)
  786. #define I40E_AQ_VSI_UP_TABLE_UP7_SHIFT 21
  787. #define I40E_AQ_VSI_UP_TABLE_UP7_MASK (0x7 << \
  788. I40E_AQ_VSI_UP_TABLE_UP7_SHIFT)
  789. __le32 egress_table; /* same defines as for ingress table */
  790. /* cascaded PV section */
  791. __le16 cas_pv_tag;
  792. u8 cas_pv_flags;
  793. #define I40E_AQ_VSI_CAS_PV_TAGX_SHIFT 0x00
  794. #define I40E_AQ_VSI_CAS_PV_TAGX_MASK (0x03 << \
  795. I40E_AQ_VSI_CAS_PV_TAGX_SHIFT)
  796. #define I40E_AQ_VSI_CAS_PV_TAGX_LEAVE 0x00
  797. #define I40E_AQ_VSI_CAS_PV_TAGX_REMOVE 0x01
  798. #define I40E_AQ_VSI_CAS_PV_TAGX_COPY 0x02
  799. #define I40E_AQ_VSI_CAS_PV_INSERT_TAG 0x10
  800. #define I40E_AQ_VSI_CAS_PV_ETAG_PRUNE 0x20
  801. #define I40E_AQ_VSI_CAS_PV_ACCEPT_HOST_TAG 0x40
  802. u8 cas_pv_reserved;
  803. /* queue mapping section */
  804. __le16 mapping_flags;
  805. #define I40E_AQ_VSI_QUE_MAP_CONTIG 0x0
  806. #define I40E_AQ_VSI_QUE_MAP_NONCONTIG 0x1
  807. __le16 queue_mapping[16];
  808. #define I40E_AQ_VSI_QUEUE_SHIFT 0x0
  809. #define I40E_AQ_VSI_QUEUE_MASK (0x7FF << I40E_AQ_VSI_QUEUE_SHIFT)
  810. __le16 tc_mapping[8];
  811. #define I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT 0
  812. #define I40E_AQ_VSI_TC_QUE_OFFSET_MASK (0x1FF << \
  813. I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT)
  814. #define I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT 9
  815. #define I40E_AQ_VSI_TC_QUE_NUMBER_MASK (0x7 << \
  816. I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT)
  817. /* queueing option section */
  818. u8 queueing_opt_flags;
  819. #define I40E_AQ_VSI_QUE_OPT_MULTICAST_UDP_ENA 0x04
  820. #define I40E_AQ_VSI_QUE_OPT_UNICAST_UDP_ENA 0x08
  821. #define I40E_AQ_VSI_QUE_OPT_TCP_ENA 0x10
  822. #define I40E_AQ_VSI_QUE_OPT_FCOE_ENA 0x20
  823. #define I40E_AQ_VSI_QUE_OPT_RSS_LUT_PF 0x00
  824. #define I40E_AQ_VSI_QUE_OPT_RSS_LUT_VSI 0x40
  825. u8 queueing_opt_reserved[3];
  826. /* scheduler section */
  827. u8 up_enable_bits;
  828. u8 sched_reserved;
  829. /* outer up section */
  830. __le32 outer_up_table; /* same structure and defines as ingress tbl */
  831. u8 cmd_reserved[8];
  832. /* last 32 bytes are written by FW */
  833. __le16 qs_handle[8];
  834. #define I40E_AQ_VSI_QS_HANDLE_INVALID 0xFFFF
  835. __le16 stat_counter_idx;
  836. __le16 sched_id;
  837. u8 resp_reserved[12];
  838. };
  839. I40E_CHECK_STRUCT_LEN(128, i40e_aqc_vsi_properties_data);
  840. /* Add Port Virtualizer (direct 0x0220)
  841. * also used for update PV (direct 0x0221) but only flags are used
  842. * (IS_CTRL_PORT only works on add PV)
  843. */
  844. struct i40e_aqc_add_update_pv {
  845. __le16 command_flags;
  846. #define I40E_AQC_PV_FLAG_PV_TYPE 0x1
  847. #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_STAG_EN 0x2
  848. #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_ETAG_EN 0x4
  849. #define I40E_AQC_PV_FLAG_IS_CTRL_PORT 0x8
  850. __le16 uplink_seid;
  851. __le16 connected_seid;
  852. u8 reserved[10];
  853. };
  854. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv);
  855. struct i40e_aqc_add_update_pv_completion {
  856. /* reserved for update; for add also encodes error if rc == ENOSPC */
  857. __le16 pv_seid;
  858. #define I40E_AQC_PV_ERR_FLAG_NO_PV 0x1
  859. #define I40E_AQC_PV_ERR_FLAG_NO_SCHED 0x2
  860. #define I40E_AQC_PV_ERR_FLAG_NO_COUNTER 0x4
  861. #define I40E_AQC_PV_ERR_FLAG_NO_ENTRY 0x8
  862. u8 reserved[14];
  863. };
  864. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv_completion);
  865. /* Get PV Params (direct 0x0222)
  866. * uses i40e_aqc_switch_seid for the descriptor
  867. */
  868. struct i40e_aqc_get_pv_params_completion {
  869. __le16 seid;
  870. __le16 default_stag;
  871. __le16 pv_flags; /* same flags as add_pv */
  872. #define I40E_AQC_GET_PV_PV_TYPE 0x1
  873. #define I40E_AQC_GET_PV_FRWD_UNKNOWN_STAG 0x2
  874. #define I40E_AQC_GET_PV_FRWD_UNKNOWN_ETAG 0x4
  875. u8 reserved[8];
  876. __le16 default_port_seid;
  877. };
  878. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_pv_params_completion);
  879. /* Add VEB (direct 0x0230) */
  880. struct i40e_aqc_add_veb {
  881. __le16 uplink_seid;
  882. __le16 downlink_seid;
  883. __le16 veb_flags;
  884. #define I40E_AQC_ADD_VEB_FLOATING 0x1
  885. #define I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT 1
  886. #define I40E_AQC_ADD_VEB_PORT_TYPE_MASK (0x3 << \
  887. I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT)
  888. #define I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT 0x2
  889. #define I40E_AQC_ADD_VEB_PORT_TYPE_DATA 0x4
  890. #define I40E_AQC_ADD_VEB_ENABLE_L2_FILTER 0x8 /* deprecated */
  891. #define I40E_AQC_ADD_VEB_ENABLE_DISABLE_STATS 0x10
  892. u8 enable_tcs;
  893. u8 reserved[9];
  894. };
  895. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb);
  896. struct i40e_aqc_add_veb_completion {
  897. u8 reserved[6];
  898. __le16 switch_seid;
  899. /* also encodes error if rc == ENOSPC; codes are the same as add_pv */
  900. __le16 veb_seid;
  901. #define I40E_AQC_VEB_ERR_FLAG_NO_VEB 0x1
  902. #define I40E_AQC_VEB_ERR_FLAG_NO_SCHED 0x2
  903. #define I40E_AQC_VEB_ERR_FLAG_NO_COUNTER 0x4
  904. #define I40E_AQC_VEB_ERR_FLAG_NO_ENTRY 0x8
  905. __le16 statistic_index;
  906. __le16 vebs_used;
  907. __le16 vebs_free;
  908. };
  909. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb_completion);
  910. /* Get VEB Parameters (direct 0x0232)
  911. * uses i40e_aqc_switch_seid for the descriptor
  912. */
  913. struct i40e_aqc_get_veb_parameters_completion {
  914. __le16 seid;
  915. __le16 switch_id;
  916. __le16 veb_flags; /* only the first/last flags from 0x0230 is valid */
  917. __le16 statistic_index;
  918. __le16 vebs_used;
  919. __le16 vebs_free;
  920. u8 reserved[4];
  921. };
  922. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_veb_parameters_completion);
  923. /* Delete Element (direct 0x0243)
  924. * uses the generic i40e_aqc_switch_seid
  925. */
  926. /* Add MAC-VLAN (indirect 0x0250) */
  927. /* used for the command for most vlan commands */
  928. struct i40e_aqc_macvlan {
  929. __le16 num_addresses;
  930. __le16 seid[3];
  931. #define I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT 0
  932. #define I40E_AQC_MACVLAN_CMD_SEID_NUM_MASK (0x3FF << \
  933. I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
  934. #define I40E_AQC_MACVLAN_CMD_SEID_VALID 0x8000
  935. __le32 addr_high;
  936. __le32 addr_low;
  937. };
  938. I40E_CHECK_CMD_LENGTH(i40e_aqc_macvlan);
  939. /* indirect data for command and response */
  940. struct i40e_aqc_add_macvlan_element_data {
  941. u8 mac_addr[6];
  942. __le16 vlan_tag;
  943. __le16 flags;
  944. #define I40E_AQC_MACVLAN_ADD_PERFECT_MATCH 0x0001
  945. #define I40E_AQC_MACVLAN_ADD_HASH_MATCH 0x0002
  946. #define I40E_AQC_MACVLAN_ADD_IGNORE_VLAN 0x0004
  947. #define I40E_AQC_MACVLAN_ADD_TO_QUEUE 0x0008
  948. #define I40E_AQC_MACVLAN_ADD_USE_SHARED_MAC 0x0010
  949. __le16 queue_number;
  950. #define I40E_AQC_MACVLAN_CMD_QUEUE_SHIFT 0
  951. #define I40E_AQC_MACVLAN_CMD_QUEUE_MASK (0x7FF << \
  952. I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
  953. /* response section */
  954. u8 match_method;
  955. #define I40E_AQC_MM_PERFECT_MATCH 0x01
  956. #define I40E_AQC_MM_HASH_MATCH 0x02
  957. #define I40E_AQC_MM_ERR_NO_RES 0xFF
  958. u8 reserved1[3];
  959. };
  960. struct i40e_aqc_add_remove_macvlan_completion {
  961. __le16 perfect_mac_used;
  962. __le16 perfect_mac_free;
  963. __le16 unicast_hash_free;
  964. __le16 multicast_hash_free;
  965. __le32 addr_high;
  966. __le32 addr_low;
  967. };
  968. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_macvlan_completion);
  969. /* Remove MAC-VLAN (indirect 0x0251)
  970. * uses i40e_aqc_macvlan for the descriptor
  971. * data points to an array of num_addresses of elements
  972. */
  973. struct i40e_aqc_remove_macvlan_element_data {
  974. u8 mac_addr[6];
  975. __le16 vlan_tag;
  976. u8 flags;
  977. #define I40E_AQC_MACVLAN_DEL_PERFECT_MATCH 0x01
  978. #define I40E_AQC_MACVLAN_DEL_HASH_MATCH 0x02
  979. #define I40E_AQC_MACVLAN_DEL_IGNORE_VLAN 0x08
  980. #define I40E_AQC_MACVLAN_DEL_ALL_VSIS 0x10
  981. u8 reserved[3];
  982. /* reply section */
  983. u8 error_code;
  984. #define I40E_AQC_REMOVE_MACVLAN_SUCCESS 0x0
  985. #define I40E_AQC_REMOVE_MACVLAN_FAIL 0xFF
  986. u8 reply_reserved[3];
  987. };
  988. /* Add VLAN (indirect 0x0252)
  989. * Remove VLAN (indirect 0x0253)
  990. * use the generic i40e_aqc_macvlan for the command
  991. */
  992. struct i40e_aqc_add_remove_vlan_element_data {
  993. __le16 vlan_tag;
  994. u8 vlan_flags;
  995. /* flags for add VLAN */
  996. #define I40E_AQC_ADD_VLAN_LOCAL 0x1
  997. #define I40E_AQC_ADD_PVLAN_TYPE_SHIFT 1
  998. #define I40E_AQC_ADD_PVLAN_TYPE_MASK (0x3 << I40E_AQC_ADD_PVLAN_TYPE_SHIFT)
  999. #define I40E_AQC_ADD_PVLAN_TYPE_REGULAR 0x0
  1000. #define I40E_AQC_ADD_PVLAN_TYPE_PRIMARY 0x2
  1001. #define I40E_AQC_ADD_PVLAN_TYPE_SECONDARY 0x4
  1002. #define I40E_AQC_VLAN_PTYPE_SHIFT 3
  1003. #define I40E_AQC_VLAN_PTYPE_MASK (0x3 << I40E_AQC_VLAN_PTYPE_SHIFT)
  1004. #define I40E_AQC_VLAN_PTYPE_REGULAR_VSI 0x0
  1005. #define I40E_AQC_VLAN_PTYPE_PROMISC_VSI 0x8
  1006. #define I40E_AQC_VLAN_PTYPE_COMMUNITY_VSI 0x10
  1007. #define I40E_AQC_VLAN_PTYPE_ISOLATED_VSI 0x18
  1008. /* flags for remove VLAN */
  1009. #define I40E_AQC_REMOVE_VLAN_ALL 0x1
  1010. u8 reserved;
  1011. u8 result;
  1012. /* flags for add VLAN */
  1013. #define I40E_AQC_ADD_VLAN_SUCCESS 0x0
  1014. #define I40E_AQC_ADD_VLAN_FAIL_REQUEST 0xFE
  1015. #define I40E_AQC_ADD_VLAN_FAIL_RESOURCE 0xFF
  1016. /* flags for remove VLAN */
  1017. #define I40E_AQC_REMOVE_VLAN_SUCCESS 0x0
  1018. #define I40E_AQC_REMOVE_VLAN_FAIL 0xFF
  1019. u8 reserved1[3];
  1020. };
  1021. struct i40e_aqc_add_remove_vlan_completion {
  1022. u8 reserved[4];
  1023. __le16 vlans_used;
  1024. __le16 vlans_free;
  1025. __le32 addr_high;
  1026. __le32 addr_low;
  1027. };
  1028. /* Set VSI Promiscuous Modes (direct 0x0254) */
  1029. struct i40e_aqc_set_vsi_promiscuous_modes {
  1030. __le16 promiscuous_flags;
  1031. __le16 valid_flags;
  1032. /* flags used for both fields above */
  1033. #define I40E_AQC_SET_VSI_PROMISC_UNICAST 0x01
  1034. #define I40E_AQC_SET_VSI_PROMISC_MULTICAST 0x02
  1035. #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04
  1036. #define I40E_AQC_SET_VSI_DEFAULT 0x08
  1037. #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10
  1038. #define I40E_AQC_SET_VSI_PROMISC_TX 0x8000
  1039. __le16 seid;
  1040. #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF
  1041. __le16 vlan_tag;
  1042. #define I40E_AQC_SET_VSI_VLAN_MASK 0x0FFF
  1043. #define I40E_AQC_SET_VSI_VLAN_VALID 0x8000
  1044. u8 reserved[8];
  1045. };
  1046. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_vsi_promiscuous_modes);
  1047. /* Add S/E-tag command (direct 0x0255)
  1048. * Uses generic i40e_aqc_add_remove_tag_completion for completion
  1049. */
  1050. struct i40e_aqc_add_tag {
  1051. __le16 flags;
  1052. #define I40E_AQC_ADD_TAG_FLAG_TO_QUEUE 0x0001
  1053. __le16 seid;
  1054. #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT 0
  1055. #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  1056. I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT)
  1057. __le16 tag;
  1058. __le16 queue_number;
  1059. u8 reserved[8];
  1060. };
  1061. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_tag);
  1062. struct i40e_aqc_add_remove_tag_completion {
  1063. u8 reserved[12];
  1064. __le16 tags_used;
  1065. __le16 tags_free;
  1066. };
  1067. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_tag_completion);
  1068. /* Remove S/E-tag command (direct 0x0256)
  1069. * Uses generic i40e_aqc_add_remove_tag_completion for completion
  1070. */
  1071. struct i40e_aqc_remove_tag {
  1072. __le16 seid;
  1073. #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT 0
  1074. #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  1075. I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT)
  1076. __le16 tag;
  1077. u8 reserved[12];
  1078. };
  1079. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_tag);
  1080. /* Add multicast E-Tag (direct 0x0257)
  1081. * del multicast E-Tag (direct 0x0258) only uses pv_seid and etag fields
  1082. * and no external data
  1083. */
  1084. struct i40e_aqc_add_remove_mcast_etag {
  1085. __le16 pv_seid;
  1086. __le16 etag;
  1087. u8 num_unicast_etags;
  1088. u8 reserved[3];
  1089. __le32 addr_high; /* address of array of 2-byte s-tags */
  1090. __le32 addr_low;
  1091. };
  1092. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag);
  1093. struct i40e_aqc_add_remove_mcast_etag_completion {
  1094. u8 reserved[4];
  1095. __le16 mcast_etags_used;
  1096. __le16 mcast_etags_free;
  1097. __le32 addr_high;
  1098. __le32 addr_low;
  1099. };
  1100. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag_completion);
  1101. /* Update S/E-Tag (direct 0x0259) */
  1102. struct i40e_aqc_update_tag {
  1103. __le16 seid;
  1104. #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT 0
  1105. #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  1106. I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT)
  1107. __le16 old_tag;
  1108. __le16 new_tag;
  1109. u8 reserved[10];
  1110. };
  1111. I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag);
  1112. struct i40e_aqc_update_tag_completion {
  1113. u8 reserved[12];
  1114. __le16 tags_used;
  1115. __le16 tags_free;
  1116. };
  1117. I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag_completion);
  1118. /* Add Control Packet filter (direct 0x025A)
  1119. * Remove Control Packet filter (direct 0x025B)
  1120. * uses the i40e_aqc_add_oveb_cloud,
  1121. * and the generic direct completion structure
  1122. */
  1123. struct i40e_aqc_add_remove_control_packet_filter {
  1124. u8 mac[6];
  1125. __le16 etype;
  1126. __le16 flags;
  1127. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC 0x0001
  1128. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP 0x0002
  1129. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE 0x0004
  1130. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX 0x0008
  1131. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX 0x0000
  1132. __le16 seid;
  1133. #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT 0
  1134. #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_MASK (0x3FF << \
  1135. I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT)
  1136. __le16 queue;
  1137. u8 reserved[2];
  1138. };
  1139. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter);
  1140. struct i40e_aqc_add_remove_control_packet_filter_completion {
  1141. __le16 mac_etype_used;
  1142. __le16 etype_used;
  1143. __le16 mac_etype_free;
  1144. __le16 etype_free;
  1145. u8 reserved[8];
  1146. };
  1147. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter_completion);
  1148. /* Add Cloud filters (indirect 0x025C)
  1149. * Remove Cloud filters (indirect 0x025D)
  1150. * uses the i40e_aqc_add_remove_cloud_filters,
  1151. * and the generic indirect completion structure
  1152. */
  1153. struct i40e_aqc_add_remove_cloud_filters {
  1154. u8 num_filters;
  1155. u8 reserved;
  1156. __le16 seid;
  1157. #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT 0
  1158. #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_MASK (0x3FF << \
  1159. I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT)
  1160. u8 reserved2[4];
  1161. __le32 addr_high;
  1162. __le32 addr_low;
  1163. };
  1164. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_cloud_filters);
  1165. struct i40e_aqc_add_remove_cloud_filters_element_data {
  1166. u8 outer_mac[6];
  1167. u8 inner_mac[6];
  1168. __le16 inner_vlan;
  1169. union {
  1170. struct {
  1171. u8 reserved[12];
  1172. u8 data[4];
  1173. } v4;
  1174. struct {
  1175. u8 data[16];
  1176. } v6;
  1177. } ipaddr;
  1178. __le16 flags;
  1179. #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0
  1180. #define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \
  1181. I40E_AQC_ADD_CLOUD_FILTER_SHIFT)
  1182. /* 0x0000 reserved */
  1183. #define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001
  1184. /* 0x0002 reserved */
  1185. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN 0x0003
  1186. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID 0x0004
  1187. /* 0x0005 reserved */
  1188. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID 0x0006
  1189. /* 0x0007 reserved */
  1190. /* 0x0008 reserved */
  1191. #define I40E_AQC_ADD_CLOUD_FILTER_OMAC 0x0009
  1192. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A
  1193. #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B
  1194. #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C
  1195. #define I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE 0x0080
  1196. #define I40E_AQC_ADD_CLOUD_VNK_SHIFT 6
  1197. #define I40E_AQC_ADD_CLOUD_VNK_MASK 0x00C0
  1198. #define I40E_AQC_ADD_CLOUD_FLAGS_IPV4 0
  1199. #define I40E_AQC_ADD_CLOUD_FLAGS_IPV6 0x0100
  1200. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT 9
  1201. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK 0x1E00
  1202. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN 0
  1203. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC 1
  1204. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE 2
  1205. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_IP 3
  1206. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_RESERVED 4
  1207. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN_GPE 5
  1208. #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_MAC 0x2000
  1209. #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_INNER_MAC 0x4000
  1210. #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_IP 0x8000
  1211. __le32 tenant_id;
  1212. u8 reserved[4];
  1213. __le16 queue_number;
  1214. #define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT 0
  1215. #define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x7FF << \
  1216. I40E_AQC_ADD_CLOUD_QUEUE_SHIFT)
  1217. u8 reserved2[14];
  1218. /* response section */
  1219. u8 allocation_result;
  1220. #define I40E_AQC_ADD_CLOUD_FILTER_SUCCESS 0x0
  1221. #define I40E_AQC_ADD_CLOUD_FILTER_FAIL 0xFF
  1222. u8 response_reserved[7];
  1223. };
  1224. struct i40e_aqc_remove_cloud_filters_completion {
  1225. __le16 perfect_ovlan_used;
  1226. __le16 perfect_ovlan_free;
  1227. __le16 vlan_used;
  1228. __le16 vlan_free;
  1229. __le32 addr_high;
  1230. __le32 addr_low;
  1231. };
  1232. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_cloud_filters_completion);
  1233. /* Add Mirror Rule (indirect or direct 0x0260)
  1234. * Delete Mirror Rule (indirect or direct 0x0261)
  1235. * note: some rule types (4,5) do not use an external buffer.
  1236. * take care to set the flags correctly.
  1237. */
  1238. struct i40e_aqc_add_delete_mirror_rule {
  1239. __le16 seid;
  1240. __le16 rule_type;
  1241. #define I40E_AQC_MIRROR_RULE_TYPE_SHIFT 0
  1242. #define I40E_AQC_MIRROR_RULE_TYPE_MASK (0x7 << \
  1243. I40E_AQC_MIRROR_RULE_TYPE_SHIFT)
  1244. #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_INGRESS 1
  1245. #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_EGRESS 2
  1246. #define I40E_AQC_MIRROR_RULE_TYPE_VLAN 3
  1247. #define I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS 4
  1248. #define I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS 5
  1249. __le16 num_entries;
  1250. __le16 destination; /* VSI for add, rule id for delete */
  1251. __le32 addr_high; /* address of array of 2-byte VSI or VLAN ids */
  1252. __le32 addr_low;
  1253. };
  1254. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule);
  1255. struct i40e_aqc_add_delete_mirror_rule_completion {
  1256. u8 reserved[2];
  1257. __le16 rule_id; /* only used on add */
  1258. __le16 mirror_rules_used;
  1259. __le16 mirror_rules_free;
  1260. __le32 addr_high;
  1261. __le32 addr_low;
  1262. };
  1263. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule_completion);
  1264. /* Pipeline Personalization Profile */
  1265. struct i40e_aqc_write_personalization_profile {
  1266. u8 flags;
  1267. u8 reserved[3];
  1268. __le32 profile_track_id;
  1269. __le32 addr_high;
  1270. __le32 addr_low;
  1271. };
  1272. I40E_CHECK_CMD_LENGTH(i40e_aqc_write_personalization_profile);
  1273. struct i40e_aqc_write_ppp_resp {
  1274. __le32 error_offset;
  1275. __le32 error_info;
  1276. __le32 addr_high;
  1277. __le32 addr_low;
  1278. };
  1279. struct i40e_aqc_get_applied_profiles {
  1280. u8 flags;
  1281. #define I40E_AQC_GET_PPP_GET_CONF 0x1
  1282. #define I40E_AQC_GET_PPP_GET_RDPU_CONF 0x2
  1283. u8 rsv[3];
  1284. __le32 reserved;
  1285. __le32 addr_high;
  1286. __le32 addr_low;
  1287. };
  1288. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_applied_profiles);
  1289. /* DCB 0x03xx*/
  1290. /* PFC Ignore (direct 0x0301)
  1291. * the command and response use the same descriptor structure
  1292. */
  1293. struct i40e_aqc_pfc_ignore {
  1294. u8 tc_bitmap;
  1295. u8 command_flags; /* unused on response */
  1296. #define I40E_AQC_PFC_IGNORE_SET 0x80
  1297. #define I40E_AQC_PFC_IGNORE_CLEAR 0x0
  1298. u8 reserved[14];
  1299. };
  1300. I40E_CHECK_CMD_LENGTH(i40e_aqc_pfc_ignore);
  1301. /* DCB Update (direct 0x0302) uses the i40e_aq_desc structure
  1302. * with no parameters
  1303. */
  1304. /* TX scheduler 0x04xx */
  1305. /* Almost all the indirect commands use
  1306. * this generic struct to pass the SEID in param0
  1307. */
  1308. struct i40e_aqc_tx_sched_ind {
  1309. __le16 vsi_seid;
  1310. u8 reserved[6];
  1311. __le32 addr_high;
  1312. __le32 addr_low;
  1313. };
  1314. I40E_CHECK_CMD_LENGTH(i40e_aqc_tx_sched_ind);
  1315. /* Several commands respond with a set of queue set handles */
  1316. struct i40e_aqc_qs_handles_resp {
  1317. __le16 qs_handles[8];
  1318. };
  1319. /* Configure VSI BW limits (direct 0x0400) */
  1320. struct i40e_aqc_configure_vsi_bw_limit {
  1321. __le16 vsi_seid;
  1322. u8 reserved[2];
  1323. __le16 credit;
  1324. u8 reserved1[2];
  1325. u8 max_credit; /* 0-3, limit = 2^max */
  1326. u8 reserved2[7];
  1327. };
  1328. I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_vsi_bw_limit);
  1329. /* Configure VSI Bandwidth Limit per Traffic Type (indirect 0x0406)
  1330. * responds with i40e_aqc_qs_handles_resp
  1331. */
  1332. struct i40e_aqc_configure_vsi_ets_sla_bw_data {
  1333. u8 tc_valid_bits;
  1334. u8 reserved[15];
  1335. __le16 tc_bw_credits[8]; /* FW writesback QS handles here */
  1336. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1337. __le16 tc_bw_max[2];
  1338. u8 reserved1[28];
  1339. };
  1340. I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_configure_vsi_ets_sla_bw_data);
  1341. /* Configure VSI Bandwidth Allocation per Traffic Type (indirect 0x0407)
  1342. * responds with i40e_aqc_qs_handles_resp
  1343. */
  1344. struct i40e_aqc_configure_vsi_tc_bw_data {
  1345. u8 tc_valid_bits;
  1346. u8 reserved[3];
  1347. u8 tc_bw_credits[8];
  1348. u8 reserved1[4];
  1349. __le16 qs_handles[8];
  1350. };
  1351. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_vsi_tc_bw_data);
  1352. /* Query vsi bw configuration (indirect 0x0408) */
  1353. struct i40e_aqc_query_vsi_bw_config_resp {
  1354. u8 tc_valid_bits;
  1355. u8 tc_suspended_bits;
  1356. u8 reserved[14];
  1357. __le16 qs_handles[8];
  1358. u8 reserved1[4];
  1359. __le16 port_bw_limit;
  1360. u8 reserved2[2];
  1361. u8 max_bw; /* 0-3, limit = 2^max */
  1362. u8 reserved3[23];
  1363. };
  1364. I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_vsi_bw_config_resp);
  1365. /* Query VSI Bandwidth Allocation per Traffic Type (indirect 0x040A) */
  1366. struct i40e_aqc_query_vsi_ets_sla_config_resp {
  1367. u8 tc_valid_bits;
  1368. u8 reserved[3];
  1369. u8 share_credits[8];
  1370. __le16 credits[8];
  1371. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1372. __le16 tc_bw_max[2];
  1373. };
  1374. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_vsi_ets_sla_config_resp);
  1375. /* Configure Switching Component Bandwidth Limit (direct 0x0410) */
  1376. struct i40e_aqc_configure_switching_comp_bw_limit {
  1377. __le16 seid;
  1378. u8 reserved[2];
  1379. __le16 credit;
  1380. u8 reserved1[2];
  1381. u8 max_bw; /* 0-3, limit = 2^max */
  1382. u8 reserved2[7];
  1383. };
  1384. I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_switching_comp_bw_limit);
  1385. /* Enable Physical Port ETS (indirect 0x0413)
  1386. * Modify Physical Port ETS (indirect 0x0414)
  1387. * Disable Physical Port ETS (indirect 0x0415)
  1388. */
  1389. struct i40e_aqc_configure_switching_comp_ets_data {
  1390. u8 reserved[4];
  1391. u8 tc_valid_bits;
  1392. u8 seepage;
  1393. #define I40E_AQ_ETS_SEEPAGE_EN_MASK 0x1
  1394. u8 tc_strict_priority_flags;
  1395. u8 reserved1[17];
  1396. u8 tc_bw_share_credits[8];
  1397. u8 reserved2[96];
  1398. };
  1399. I40E_CHECK_STRUCT_LEN(0x80, i40e_aqc_configure_switching_comp_ets_data);
  1400. /* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */
  1401. struct i40e_aqc_configure_switching_comp_ets_bw_limit_data {
  1402. u8 tc_valid_bits;
  1403. u8 reserved[15];
  1404. __le16 tc_bw_credit[8];
  1405. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1406. __le16 tc_bw_max[2];
  1407. u8 reserved1[28];
  1408. };
  1409. I40E_CHECK_STRUCT_LEN(0x40,
  1410. i40e_aqc_configure_switching_comp_ets_bw_limit_data);
  1411. /* Configure Switching Component Bandwidth Allocation per Tc
  1412. * (indirect 0x0417)
  1413. */
  1414. struct i40e_aqc_configure_switching_comp_bw_config_data {
  1415. u8 tc_valid_bits;
  1416. u8 reserved[2];
  1417. u8 absolute_credits; /* bool */
  1418. u8 tc_bw_share_credits[8];
  1419. u8 reserved1[20];
  1420. };
  1421. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_switching_comp_bw_config_data);
  1422. /* Query Switching Component Configuration (indirect 0x0418) */
  1423. struct i40e_aqc_query_switching_comp_ets_config_resp {
  1424. u8 tc_valid_bits;
  1425. u8 reserved[35];
  1426. __le16 port_bw_limit;
  1427. u8 reserved1[2];
  1428. u8 tc_bw_max; /* 0-3, limit = 2^max */
  1429. u8 reserved2[23];
  1430. };
  1431. I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_switching_comp_ets_config_resp);
  1432. /* Query PhysicalPort ETS Configuration (indirect 0x0419) */
  1433. struct i40e_aqc_query_port_ets_config_resp {
  1434. u8 reserved[4];
  1435. u8 tc_valid_bits;
  1436. u8 reserved1;
  1437. u8 tc_strict_priority_bits;
  1438. u8 reserved2;
  1439. u8 tc_bw_share_credits[8];
  1440. __le16 tc_bw_limits[8];
  1441. /* 4 bits per tc 0-7, 4th bit reserved, limit = 2^max */
  1442. __le16 tc_bw_max[2];
  1443. u8 reserved3[32];
  1444. };
  1445. I40E_CHECK_STRUCT_LEN(0x44, i40e_aqc_query_port_ets_config_resp);
  1446. /* Query Switching Component Bandwidth Allocation per Traffic Type
  1447. * (indirect 0x041A)
  1448. */
  1449. struct i40e_aqc_query_switching_comp_bw_config_resp {
  1450. u8 tc_valid_bits;
  1451. u8 reserved[2];
  1452. u8 absolute_credits_enable; /* bool */
  1453. u8 tc_bw_share_credits[8];
  1454. __le16 tc_bw_limits[8];
  1455. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1456. __le16 tc_bw_max[2];
  1457. };
  1458. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_switching_comp_bw_config_resp);
  1459. /* Suspend/resume port TX traffic
  1460. * (direct 0x041B and 0x041C) uses the generic SEID struct
  1461. */
  1462. /* Configure partition BW
  1463. * (indirect 0x041D)
  1464. */
  1465. struct i40e_aqc_configure_partition_bw_data {
  1466. __le16 pf_valid_bits;
  1467. u8 min_bw[16]; /* guaranteed bandwidth */
  1468. u8 max_bw[16]; /* bandwidth limit */
  1469. };
  1470. I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data);
  1471. /* Get and set the active HMC resource profile and status.
  1472. * (direct 0x0500) and (direct 0x0501)
  1473. */
  1474. struct i40e_aq_get_set_hmc_resource_profile {
  1475. u8 pm_profile;
  1476. u8 pe_vf_enabled;
  1477. u8 reserved[14];
  1478. };
  1479. I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile);
  1480. enum i40e_aq_hmc_profile {
  1481. /* I40E_HMC_PROFILE_NO_CHANGE = 0, reserved */
  1482. I40E_HMC_PROFILE_DEFAULT = 1,
  1483. I40E_HMC_PROFILE_FAVOR_VF = 2,
  1484. I40E_HMC_PROFILE_EQUAL = 3,
  1485. };
  1486. /* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */
  1487. /* set in param0 for get phy abilities to report qualified modules */
  1488. #define I40E_AQ_PHY_REPORT_QUALIFIED_MODULES 0x0001
  1489. #define I40E_AQ_PHY_REPORT_INITIAL_VALUES 0x0002
  1490. enum i40e_aq_phy_type {
  1491. I40E_PHY_TYPE_SGMII = 0x0,
  1492. I40E_PHY_TYPE_1000BASE_KX = 0x1,
  1493. I40E_PHY_TYPE_10GBASE_KX4 = 0x2,
  1494. I40E_PHY_TYPE_10GBASE_KR = 0x3,
  1495. I40E_PHY_TYPE_40GBASE_KR4 = 0x4,
  1496. I40E_PHY_TYPE_XAUI = 0x5,
  1497. I40E_PHY_TYPE_XFI = 0x6,
  1498. I40E_PHY_TYPE_SFI = 0x7,
  1499. I40E_PHY_TYPE_XLAUI = 0x8,
  1500. I40E_PHY_TYPE_XLPPI = 0x9,
  1501. I40E_PHY_TYPE_40GBASE_CR4_CU = 0xA,
  1502. I40E_PHY_TYPE_10GBASE_CR1_CU = 0xB,
  1503. I40E_PHY_TYPE_10GBASE_AOC = 0xC,
  1504. I40E_PHY_TYPE_40GBASE_AOC = 0xD,
  1505. I40E_PHY_TYPE_100BASE_TX = 0x11,
  1506. I40E_PHY_TYPE_1000BASE_T = 0x12,
  1507. I40E_PHY_TYPE_10GBASE_T = 0x13,
  1508. I40E_PHY_TYPE_10GBASE_SR = 0x14,
  1509. I40E_PHY_TYPE_10GBASE_LR = 0x15,
  1510. I40E_PHY_TYPE_10GBASE_SFPP_CU = 0x16,
  1511. I40E_PHY_TYPE_10GBASE_CR1 = 0x17,
  1512. I40E_PHY_TYPE_40GBASE_CR4 = 0x18,
  1513. I40E_PHY_TYPE_40GBASE_SR4 = 0x19,
  1514. I40E_PHY_TYPE_40GBASE_LR4 = 0x1A,
  1515. I40E_PHY_TYPE_1000BASE_SX = 0x1B,
  1516. I40E_PHY_TYPE_1000BASE_LX = 0x1C,
  1517. I40E_PHY_TYPE_1000BASE_T_OPTICAL = 0x1D,
  1518. I40E_PHY_TYPE_20GBASE_KR2 = 0x1E,
  1519. I40E_PHY_TYPE_25GBASE_KR = 0x1F,
  1520. I40E_PHY_TYPE_25GBASE_CR = 0x20,
  1521. I40E_PHY_TYPE_25GBASE_SR = 0x21,
  1522. I40E_PHY_TYPE_25GBASE_LR = 0x22,
  1523. I40E_PHY_TYPE_MAX
  1524. };
  1525. #define I40E_LINK_SPEED_100MB_SHIFT 0x1
  1526. #define I40E_LINK_SPEED_1000MB_SHIFT 0x2
  1527. #define I40E_LINK_SPEED_10GB_SHIFT 0x3
  1528. #define I40E_LINK_SPEED_40GB_SHIFT 0x4
  1529. #define I40E_LINK_SPEED_20GB_SHIFT 0x5
  1530. #define I40E_LINK_SPEED_25GB_SHIFT 0x6
  1531. enum i40e_aq_link_speed {
  1532. I40E_LINK_SPEED_UNKNOWN = 0,
  1533. I40E_LINK_SPEED_100MB = BIT(I40E_LINK_SPEED_100MB_SHIFT),
  1534. I40E_LINK_SPEED_1GB = BIT(I40E_LINK_SPEED_1000MB_SHIFT),
  1535. I40E_LINK_SPEED_10GB = BIT(I40E_LINK_SPEED_10GB_SHIFT),
  1536. I40E_LINK_SPEED_40GB = BIT(I40E_LINK_SPEED_40GB_SHIFT),
  1537. I40E_LINK_SPEED_20GB = BIT(I40E_LINK_SPEED_20GB_SHIFT),
  1538. I40E_LINK_SPEED_25GB = BIT(I40E_LINK_SPEED_25GB_SHIFT),
  1539. };
  1540. struct i40e_aqc_module_desc {
  1541. u8 oui[3];
  1542. u8 reserved1;
  1543. u8 part_number[16];
  1544. u8 revision[4];
  1545. u8 reserved2[8];
  1546. };
  1547. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_module_desc);
  1548. struct i40e_aq_get_phy_abilities_resp {
  1549. __le32 phy_type; /* bitmap using the above enum for offsets */
  1550. u8 link_speed; /* bitmap using the above enum bit patterns */
  1551. u8 abilities;
  1552. #define I40E_AQ_PHY_FLAG_PAUSE_TX 0x01
  1553. #define I40E_AQ_PHY_FLAG_PAUSE_RX 0x02
  1554. #define I40E_AQ_PHY_FLAG_LOW_POWER 0x04
  1555. #define I40E_AQ_PHY_LINK_ENABLED 0x08
  1556. #define I40E_AQ_PHY_AN_ENABLED 0x10
  1557. #define I40E_AQ_PHY_FLAG_MODULE_QUAL 0x20
  1558. #define I40E_AQ_PHY_FEC_ABILITY_KR 0x40
  1559. #define I40E_AQ_PHY_FEC_ABILITY_RS 0x80
  1560. __le16 eee_capability;
  1561. #define I40E_AQ_EEE_100BASE_TX 0x0002
  1562. #define I40E_AQ_EEE_1000BASE_T 0x0004
  1563. #define I40E_AQ_EEE_10GBASE_T 0x0008
  1564. #define I40E_AQ_EEE_1000BASE_KX 0x0010
  1565. #define I40E_AQ_EEE_10GBASE_KX4 0x0020
  1566. #define I40E_AQ_EEE_10GBASE_KR 0x0040
  1567. __le32 eeer_val;
  1568. u8 d3_lpan;
  1569. #define I40E_AQ_SET_PHY_D3_LPAN_ENA 0x01
  1570. u8 phy_type_ext;
  1571. #define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01
  1572. #define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02
  1573. #define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04
  1574. #define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08
  1575. u8 fec_cfg_curr_mod_ext_info;
  1576. #define I40E_AQ_ENABLE_FEC_KR 0x01
  1577. #define I40E_AQ_ENABLE_FEC_RS 0x02
  1578. #define I40E_AQ_REQUEST_FEC_KR 0x04
  1579. #define I40E_AQ_REQUEST_FEC_RS 0x08
  1580. #define I40E_AQ_ENABLE_FEC_AUTO 0x10
  1581. #define I40E_AQ_FEC
  1582. #define I40E_AQ_MODULE_TYPE_EXT_MASK 0xE0
  1583. #define I40E_AQ_MODULE_TYPE_EXT_SHIFT 5
  1584. u8 ext_comp_code;
  1585. u8 phy_id[4];
  1586. u8 module_type[3];
  1587. u8 qualified_module_count;
  1588. #define I40E_AQ_PHY_MAX_QMS 16
  1589. struct i40e_aqc_module_desc qualified_module[I40E_AQ_PHY_MAX_QMS];
  1590. };
  1591. I40E_CHECK_STRUCT_LEN(0x218, i40e_aq_get_phy_abilities_resp);
  1592. /* Set PHY Config (direct 0x0601) */
  1593. struct i40e_aq_set_phy_config { /* same bits as above in all */
  1594. __le32 phy_type;
  1595. u8 link_speed;
  1596. u8 abilities;
  1597. /* bits 0-2 use the values from get_phy_abilities_resp */
  1598. #define I40E_AQ_PHY_ENABLE_LINK 0x08
  1599. #define I40E_AQ_PHY_ENABLE_AN 0x10
  1600. #define I40E_AQ_PHY_ENABLE_ATOMIC_LINK 0x20
  1601. __le16 eee_capability;
  1602. __le32 eeer;
  1603. u8 low_power_ctrl;
  1604. u8 phy_type_ext;
  1605. #define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01
  1606. #define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02
  1607. #define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04
  1608. #define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08
  1609. u8 fec_config;
  1610. #define I40E_AQ_SET_FEC_ABILITY_KR BIT(0)
  1611. #define I40E_AQ_SET_FEC_ABILITY_RS BIT(1)
  1612. #define I40E_AQ_SET_FEC_REQUEST_KR BIT(2)
  1613. #define I40E_AQ_SET_FEC_REQUEST_RS BIT(3)
  1614. #define I40E_AQ_SET_FEC_AUTO BIT(4)
  1615. #define I40E_AQ_PHY_FEC_CONFIG_SHIFT 0x0
  1616. #define I40E_AQ_PHY_FEC_CONFIG_MASK (0x1F << I40E_AQ_PHY_FEC_CONFIG_SHIFT)
  1617. u8 reserved;
  1618. };
  1619. I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
  1620. /* Set MAC Config command data structure (direct 0x0603) */
  1621. struct i40e_aq_set_mac_config {
  1622. __le16 max_frame_size;
  1623. u8 params;
  1624. #define I40E_AQ_SET_MAC_CONFIG_CRC_EN 0x04
  1625. #define I40E_AQ_SET_MAC_CONFIG_PACING_MASK 0x78
  1626. #define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT 3
  1627. #define I40E_AQ_SET_MAC_CONFIG_PACING_NONE 0x0
  1628. #define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX 0xF
  1629. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX 0x9
  1630. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX 0x8
  1631. #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX 0x7
  1632. #define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX 0x6
  1633. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX 0x5
  1634. #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX 0x4
  1635. #define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX 0x3
  1636. #define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX 0x2
  1637. #define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX 0x1
  1638. u8 tx_timer_priority; /* bitmap */
  1639. __le16 tx_timer_value;
  1640. __le16 fc_refresh_threshold;
  1641. u8 reserved[8];
  1642. };
  1643. I40E_CHECK_CMD_LENGTH(i40e_aq_set_mac_config);
  1644. /* Restart Auto-Negotiation (direct 0x605) */
  1645. struct i40e_aqc_set_link_restart_an {
  1646. u8 command;
  1647. #define I40E_AQ_PHY_RESTART_AN 0x02
  1648. #define I40E_AQ_PHY_LINK_ENABLE 0x04
  1649. u8 reserved[15];
  1650. };
  1651. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_link_restart_an);
  1652. /* Get Link Status cmd & response data structure (direct 0x0607) */
  1653. struct i40e_aqc_get_link_status {
  1654. __le16 command_flags; /* only field set on command */
  1655. #define I40E_AQ_LSE_MASK 0x3
  1656. #define I40E_AQ_LSE_NOP 0x0
  1657. #define I40E_AQ_LSE_DISABLE 0x2
  1658. #define I40E_AQ_LSE_ENABLE 0x3
  1659. /* only response uses this flag */
  1660. #define I40E_AQ_LSE_IS_ENABLED 0x1
  1661. u8 phy_type; /* i40e_aq_phy_type */
  1662. u8 link_speed; /* i40e_aq_link_speed */
  1663. u8 link_info;
  1664. #define I40E_AQ_LINK_UP 0x01 /* obsolete */
  1665. #define I40E_AQ_LINK_UP_FUNCTION 0x01
  1666. #define I40E_AQ_LINK_FAULT 0x02
  1667. #define I40E_AQ_LINK_FAULT_TX 0x04
  1668. #define I40E_AQ_LINK_FAULT_RX 0x08
  1669. #define I40E_AQ_LINK_FAULT_REMOTE 0x10
  1670. #define I40E_AQ_LINK_UP_PORT 0x20
  1671. #define I40E_AQ_MEDIA_AVAILABLE 0x40
  1672. #define I40E_AQ_SIGNAL_DETECT 0x80
  1673. u8 an_info;
  1674. #define I40E_AQ_AN_COMPLETED 0x01
  1675. #define I40E_AQ_LP_AN_ABILITY 0x02
  1676. #define I40E_AQ_PD_FAULT 0x04
  1677. #define I40E_AQ_FEC_EN 0x08
  1678. #define I40E_AQ_PHY_LOW_POWER 0x10
  1679. #define I40E_AQ_LINK_PAUSE_TX 0x20
  1680. #define I40E_AQ_LINK_PAUSE_RX 0x40
  1681. #define I40E_AQ_QUALIFIED_MODULE 0x80
  1682. u8 ext_info;
  1683. #define I40E_AQ_LINK_PHY_TEMP_ALARM 0x01
  1684. #define I40E_AQ_LINK_XCESSIVE_ERRORS 0x02
  1685. #define I40E_AQ_LINK_TX_SHIFT 0x02
  1686. #define I40E_AQ_LINK_TX_MASK (0x03 << I40E_AQ_LINK_TX_SHIFT)
  1687. #define I40E_AQ_LINK_TX_ACTIVE 0x00
  1688. #define I40E_AQ_LINK_TX_DRAINED 0x01
  1689. #define I40E_AQ_LINK_TX_FLUSHED 0x03
  1690. #define I40E_AQ_LINK_FORCED_40G 0x10
  1691. /* 25G Error Codes */
  1692. #define I40E_AQ_25G_NO_ERR 0X00
  1693. #define I40E_AQ_25G_NOT_PRESENT 0X01
  1694. #define I40E_AQ_25G_NVM_CRC_ERR 0X02
  1695. #define I40E_AQ_25G_SBUS_UCODE_ERR 0X03
  1696. #define I40E_AQ_25G_SERDES_UCODE_ERR 0X04
  1697. #define I40E_AQ_25G_NIMB_UCODE_ERR 0X05
  1698. u8 loopback; /* use defines from i40e_aqc_set_lb_mode */
  1699. __le16 max_frame_size;
  1700. u8 config;
  1701. #define I40E_AQ_CONFIG_FEC_KR_ENA 0x01
  1702. #define I40E_AQ_CONFIG_FEC_RS_ENA 0x02
  1703. #define I40E_AQ_CONFIG_CRC_ENA 0x04
  1704. #define I40E_AQ_CONFIG_PACING_MASK 0x78
  1705. u8 power_desc;
  1706. #define I40E_AQ_LINK_POWER_CLASS_1 0x00
  1707. #define I40E_AQ_LINK_POWER_CLASS_2 0x01
  1708. #define I40E_AQ_LINK_POWER_CLASS_3 0x02
  1709. #define I40E_AQ_LINK_POWER_CLASS_4 0x03
  1710. #define I40E_AQ_PWR_CLASS_MASK 0x03
  1711. u8 reserved[4];
  1712. };
  1713. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_link_status);
  1714. /* Set event mask command (direct 0x613) */
  1715. struct i40e_aqc_set_phy_int_mask {
  1716. u8 reserved[8];
  1717. __le16 event_mask;
  1718. #define I40E_AQ_EVENT_LINK_UPDOWN 0x0002
  1719. #define I40E_AQ_EVENT_MEDIA_NA 0x0004
  1720. #define I40E_AQ_EVENT_LINK_FAULT 0x0008
  1721. #define I40E_AQ_EVENT_PHY_TEMP_ALARM 0x0010
  1722. #define I40E_AQ_EVENT_EXCESSIVE_ERRORS 0x0020
  1723. #define I40E_AQ_EVENT_SIGNAL_DETECT 0x0040
  1724. #define I40E_AQ_EVENT_AN_COMPLETED 0x0080
  1725. #define I40E_AQ_EVENT_MODULE_QUAL_FAIL 0x0100
  1726. #define I40E_AQ_EVENT_PORT_TX_SUSPENDED 0x0200
  1727. u8 reserved1[6];
  1728. };
  1729. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_int_mask);
  1730. /* Get Local AN advt register (direct 0x0614)
  1731. * Set Local AN advt register (direct 0x0615)
  1732. * Get Link Partner AN advt register (direct 0x0616)
  1733. */
  1734. struct i40e_aqc_an_advt_reg {
  1735. __le32 local_an_reg0;
  1736. __le16 local_an_reg1;
  1737. u8 reserved[10];
  1738. };
  1739. I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
  1740. /* Set Loopback mode (0x0618) */
  1741. struct i40e_aqc_set_lb_mode {
  1742. __le16 lb_mode;
  1743. #define I40E_AQ_LB_PHY_LOCAL 0x01
  1744. #define I40E_AQ_LB_PHY_REMOTE 0x02
  1745. #define I40E_AQ_LB_MAC_LOCAL 0x04
  1746. u8 reserved[14];
  1747. };
  1748. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);
  1749. /* Set PHY Debug command (0x0622) */
  1750. struct i40e_aqc_set_phy_debug {
  1751. u8 command_flags;
  1752. #define I40E_AQ_PHY_DEBUG_RESET_INTERNAL 0x02
  1753. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT 2
  1754. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_MASK (0x03 << \
  1755. I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT)
  1756. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE 0x00
  1757. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD 0x01
  1758. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT 0x02
  1759. #define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW 0x10
  1760. u8 reserved[15];
  1761. };
  1762. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_debug);
  1763. enum i40e_aq_phy_reg_type {
  1764. I40E_AQC_PHY_REG_INTERNAL = 0x1,
  1765. I40E_AQC_PHY_REG_EXERNAL_BASET = 0x2,
  1766. I40E_AQC_PHY_REG_EXERNAL_MODULE = 0x3
  1767. };
  1768. /* Run PHY Activity (0x0626) */
  1769. struct i40e_aqc_run_phy_activity {
  1770. __le16 activity_id;
  1771. u8 flags;
  1772. u8 reserved1;
  1773. __le32 control;
  1774. __le32 data;
  1775. u8 reserved2[4];
  1776. };
  1777. I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
  1778. /* NVM Read command (indirect 0x0701)
  1779. * NVM Erase commands (direct 0x0702)
  1780. * NVM Update commands (indirect 0x0703)
  1781. */
  1782. struct i40e_aqc_nvm_update {
  1783. u8 command_flags;
  1784. #define I40E_AQ_NVM_LAST_CMD 0x01
  1785. #define I40E_AQ_NVM_FLASH_ONLY 0x80
  1786. u8 module_pointer;
  1787. __le16 length;
  1788. __le32 offset;
  1789. __le32 addr_high;
  1790. __le32 addr_low;
  1791. };
  1792. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update);
  1793. /* NVM Config Read (indirect 0x0704) */
  1794. struct i40e_aqc_nvm_config_read {
  1795. __le16 cmd_flags;
  1796. #define I40E_AQ_ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK 1
  1797. #define I40E_AQ_ANVM_READ_SINGLE_FEATURE 0
  1798. #define I40E_AQ_ANVM_READ_MULTIPLE_FEATURES 1
  1799. __le16 element_count;
  1800. __le16 element_id; /* Feature/field ID */
  1801. __le16 element_id_msw; /* MSWord of field ID */
  1802. __le32 address_high;
  1803. __le32 address_low;
  1804. };
  1805. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_read);
  1806. /* NVM Config Write (indirect 0x0705) */
  1807. struct i40e_aqc_nvm_config_write {
  1808. __le16 cmd_flags;
  1809. __le16 element_count;
  1810. u8 reserved[4];
  1811. __le32 address_high;
  1812. __le32 address_low;
  1813. };
  1814. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write);
  1815. /* Used for 0x0704 as well as for 0x0705 commands */
  1816. #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT 1
  1817. #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_MASK \
  1818. BIT(I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT)
  1819. #define I40E_AQ_ANVM_FEATURE 0
  1820. #define I40E_AQ_ANVM_IMMEDIATE_FIELD BIT(FEATURE_OR_IMMEDIATE_SHIFT)
  1821. struct i40e_aqc_nvm_config_data_feature {
  1822. __le16 feature_id;
  1823. #define I40E_AQ_ANVM_FEATURE_OPTION_OEM_ONLY 0x01
  1824. #define I40E_AQ_ANVM_FEATURE_OPTION_DWORD_MAP 0x08
  1825. #define I40E_AQ_ANVM_FEATURE_OPTION_POR_CSR 0x10
  1826. __le16 feature_options;
  1827. __le16 feature_selection;
  1828. };
  1829. I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature);
  1830. struct i40e_aqc_nvm_config_data_immediate_field {
  1831. __le32 field_id;
  1832. __le32 field_value;
  1833. __le16 field_options;
  1834. __le16 reserved;
  1835. };
  1836. I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field);
  1837. /* OEM Post Update (indirect 0x0720)
  1838. * no command data struct used
  1839. */
  1840. struct i40e_aqc_nvm_oem_post_update {
  1841. #define I40E_AQ_NVM_OEM_POST_UPDATE_EXTERNAL_DATA 0x01
  1842. u8 sel_data;
  1843. u8 reserved[7];
  1844. };
  1845. I40E_CHECK_STRUCT_LEN(0x8, i40e_aqc_nvm_oem_post_update);
  1846. struct i40e_aqc_nvm_oem_post_update_buffer {
  1847. u8 str_len;
  1848. u8 dev_addr;
  1849. __le16 eeprom_addr;
  1850. u8 data[36];
  1851. };
  1852. I40E_CHECK_STRUCT_LEN(0x28, i40e_aqc_nvm_oem_post_update_buffer);
  1853. /* Thermal Sensor (indirect 0x0721)
  1854. * read or set thermal sensor configs and values
  1855. * takes a sensor and command specific data buffer, not detailed here
  1856. */
  1857. struct i40e_aqc_thermal_sensor {
  1858. u8 sensor_action;
  1859. #define I40E_AQ_THERMAL_SENSOR_READ_CONFIG 0
  1860. #define I40E_AQ_THERMAL_SENSOR_SET_CONFIG 1
  1861. #define I40E_AQ_THERMAL_SENSOR_READ_TEMP 2
  1862. u8 reserved[7];
  1863. __le32 addr_high;
  1864. __le32 addr_low;
  1865. };
  1866. I40E_CHECK_CMD_LENGTH(i40e_aqc_thermal_sensor);
  1867. /* Send to PF command (indirect 0x0801) id is only used by PF
  1868. * Send to VF command (indirect 0x0802) id is only used by PF
  1869. * Send to Peer PF command (indirect 0x0803)
  1870. */
  1871. struct i40e_aqc_pf_vf_message {
  1872. __le32 id;
  1873. u8 reserved[4];
  1874. __le32 addr_high;
  1875. __le32 addr_low;
  1876. };
  1877. I40E_CHECK_CMD_LENGTH(i40e_aqc_pf_vf_message);
  1878. /* Alternate structure */
  1879. /* Direct write (direct 0x0900)
  1880. * Direct read (direct 0x0902)
  1881. */
  1882. struct i40e_aqc_alternate_write {
  1883. __le32 address0;
  1884. __le32 data0;
  1885. __le32 address1;
  1886. __le32 data1;
  1887. };
  1888. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write);
  1889. /* Indirect write (indirect 0x0901)
  1890. * Indirect read (indirect 0x0903)
  1891. */
  1892. struct i40e_aqc_alternate_ind_write {
  1893. __le32 address;
  1894. __le32 length;
  1895. __le32 addr_high;
  1896. __le32 addr_low;
  1897. };
  1898. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_ind_write);
  1899. /* Done alternate write (direct 0x0904)
  1900. * uses i40e_aq_desc
  1901. */
  1902. struct i40e_aqc_alternate_write_done {
  1903. __le16 cmd_flags;
  1904. #define I40E_AQ_ALTERNATE_MODE_BIOS_MASK 1
  1905. #define I40E_AQ_ALTERNATE_MODE_BIOS_LEGACY 0
  1906. #define I40E_AQ_ALTERNATE_MODE_BIOS_UEFI 1
  1907. #define I40E_AQ_ALTERNATE_RESET_NEEDED 2
  1908. u8 reserved[14];
  1909. };
  1910. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write_done);
  1911. /* Set OEM mode (direct 0x0905) */
  1912. struct i40e_aqc_alternate_set_mode {
  1913. __le32 mode;
  1914. #define I40E_AQ_ALTERNATE_MODE_NONE 0
  1915. #define I40E_AQ_ALTERNATE_MODE_OEM 1
  1916. u8 reserved[12];
  1917. };
  1918. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_set_mode);
  1919. /* Clear port Alternate RAM (direct 0x0906) uses i40e_aq_desc */
  1920. /* async events 0x10xx */
  1921. /* Lan Queue Overflow Event (direct, 0x1001) */
  1922. struct i40e_aqc_lan_overflow {
  1923. __le32 prtdcb_rupto;
  1924. __le32 otx_ctl;
  1925. u8 reserved[8];
  1926. };
  1927. I40E_CHECK_CMD_LENGTH(i40e_aqc_lan_overflow);
  1928. /* Get LLDP MIB (indirect 0x0A00) */
  1929. struct i40e_aqc_lldp_get_mib {
  1930. u8 type;
  1931. u8 reserved1;
  1932. #define I40E_AQ_LLDP_MIB_TYPE_MASK 0x3
  1933. #define I40E_AQ_LLDP_MIB_LOCAL 0x0
  1934. #define I40E_AQ_LLDP_MIB_REMOTE 0x1
  1935. #define I40E_AQ_LLDP_MIB_LOCAL_AND_REMOTE 0x2
  1936. #define I40E_AQ_LLDP_BRIDGE_TYPE_MASK 0xC
  1937. #define I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT 0x2
  1938. #define I40E_AQ_LLDP_BRIDGE_TYPE_NEAREST_BRIDGE 0x0
  1939. #define I40E_AQ_LLDP_BRIDGE_TYPE_NON_TPMR 0x1
  1940. #define I40E_AQ_LLDP_TX_SHIFT 0x4
  1941. #define I40E_AQ_LLDP_TX_MASK (0x03 << I40E_AQ_LLDP_TX_SHIFT)
  1942. /* TX pause flags use I40E_AQ_LINK_TX_* above */
  1943. __le16 local_len;
  1944. __le16 remote_len;
  1945. u8 reserved2[2];
  1946. __le32 addr_high;
  1947. __le32 addr_low;
  1948. };
  1949. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_get_mib);
  1950. /* Configure LLDP MIB Change Event (direct 0x0A01)
  1951. * also used for the event (with type in the command field)
  1952. */
  1953. struct i40e_aqc_lldp_update_mib {
  1954. u8 command;
  1955. #define I40E_AQ_LLDP_MIB_UPDATE_ENABLE 0x0
  1956. #define I40E_AQ_LLDP_MIB_UPDATE_DISABLE 0x1
  1957. u8 reserved[7];
  1958. __le32 addr_high;
  1959. __le32 addr_low;
  1960. };
  1961. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_mib);
  1962. /* Add LLDP TLV (indirect 0x0A02)
  1963. * Delete LLDP TLV (indirect 0x0A04)
  1964. */
  1965. struct i40e_aqc_lldp_add_tlv {
  1966. u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
  1967. u8 reserved1[1];
  1968. __le16 len;
  1969. u8 reserved2[4];
  1970. __le32 addr_high;
  1971. __le32 addr_low;
  1972. };
  1973. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_add_tlv);
  1974. /* Update LLDP TLV (indirect 0x0A03) */
  1975. struct i40e_aqc_lldp_update_tlv {
  1976. u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
  1977. u8 reserved;
  1978. __le16 old_len;
  1979. __le16 new_offset;
  1980. __le16 new_len;
  1981. __le32 addr_high;
  1982. __le32 addr_low;
  1983. };
  1984. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
  1985. /* Stop LLDP (direct 0x0A05) */
  1986. struct i40e_aqc_lldp_stop {
  1987. u8 command;
  1988. #define I40E_AQ_LLDP_AGENT_STOP 0x0
  1989. #define I40E_AQ_LLDP_AGENT_SHUTDOWN 0x1
  1990. u8 reserved[15];
  1991. };
  1992. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
  1993. /* Start LLDP (direct 0x0A06) */
  1994. struct i40e_aqc_lldp_start {
  1995. u8 command;
  1996. #define I40E_AQ_LLDP_AGENT_START 0x1
  1997. u8 reserved[15];
  1998. };
  1999. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_start);
  2000. /* Apply MIB changes (0x0A07)
  2001. * uses the generic struc as it contains no data
  2002. */
  2003. /* Add Udp Tunnel command and completion (direct 0x0B00) */
  2004. struct i40e_aqc_add_udp_tunnel {
  2005. __le16 udp_port;
  2006. u8 reserved0[3];
  2007. u8 protocol_type;
  2008. #define I40E_AQC_TUNNEL_TYPE_VXLAN 0x00
  2009. #define I40E_AQC_TUNNEL_TYPE_NGE 0x01
  2010. #define I40E_AQC_TUNNEL_TYPE_TEREDO 0x10
  2011. #define I40E_AQC_TUNNEL_TYPE_VXLAN_GPE 0x11
  2012. u8 reserved1[10];
  2013. };
  2014. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel);
  2015. struct i40e_aqc_add_udp_tunnel_completion {
  2016. __le16 udp_port;
  2017. u8 filter_entry_index;
  2018. u8 multiple_pfs;
  2019. #define I40E_AQC_SINGLE_PF 0x0
  2020. #define I40E_AQC_MULTIPLE_PFS 0x1
  2021. u8 total_filters;
  2022. u8 reserved[11];
  2023. };
  2024. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel_completion);
  2025. /* remove UDP Tunnel command (0x0B01) */
  2026. struct i40e_aqc_remove_udp_tunnel {
  2027. u8 reserved[2];
  2028. u8 index; /* 0 to 15 */
  2029. u8 reserved2[13];
  2030. };
  2031. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_udp_tunnel);
  2032. struct i40e_aqc_del_udp_tunnel_completion {
  2033. __le16 udp_port;
  2034. u8 index; /* 0 to 15 */
  2035. u8 multiple_pfs;
  2036. u8 total_filters_used;
  2037. u8 reserved1[11];
  2038. };
  2039. I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion);
  2040. struct i40e_aqc_get_set_rss_key {
  2041. #define I40E_AQC_SET_RSS_KEY_VSI_VALID BIT(15)
  2042. #define I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT 0
  2043. #define I40E_AQC_SET_RSS_KEY_VSI_ID_MASK (0x3FF << \
  2044. I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT)
  2045. __le16 vsi_id;
  2046. u8 reserved[6];
  2047. __le32 addr_high;
  2048. __le32 addr_low;
  2049. };
  2050. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_set_rss_key);
  2051. struct i40e_aqc_get_set_rss_key_data {
  2052. u8 standard_rss_key[0x28];
  2053. u8 extended_hash_key[0xc];
  2054. };
  2055. I40E_CHECK_STRUCT_LEN(0x34, i40e_aqc_get_set_rss_key_data);
  2056. struct i40e_aqc_get_set_rss_lut {
  2057. #define I40E_AQC_SET_RSS_LUT_VSI_VALID BIT(15)
  2058. #define I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT 0
  2059. #define I40E_AQC_SET_RSS_LUT_VSI_ID_MASK (0x3FF << \
  2060. I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT)
  2061. __le16 vsi_id;
  2062. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT 0
  2063. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK \
  2064. BIT(I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT)
  2065. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_VSI 0
  2066. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_PF 1
  2067. __le16 flags;
  2068. u8 reserved[4];
  2069. __le32 addr_high;
  2070. __le32 addr_low;
  2071. };
  2072. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_set_rss_lut);
  2073. /* tunnel key structure 0x0B10 */
  2074. struct i40e_aqc_tunnel_key_structure_A0 {
  2075. __le16 key1_off;
  2076. __le16 key1_len;
  2077. __le16 key2_off;
  2078. __le16 key2_len;
  2079. __le16 flags;
  2080. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE 0x01
  2081. /* response flags */
  2082. #define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS 0x01
  2083. #define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED 0x02
  2084. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN 0x03
  2085. u8 resreved[6];
  2086. };
  2087. I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure_A0);
  2088. struct i40e_aqc_tunnel_key_structure {
  2089. u8 key1_off;
  2090. u8 key2_off;
  2091. u8 key1_len; /* 0 to 15 */
  2092. u8 key2_len; /* 0 to 15 */
  2093. u8 flags;
  2094. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE 0x01
  2095. /* response flags */
  2096. #define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS 0x01
  2097. #define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED 0x02
  2098. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN 0x03
  2099. u8 network_key_index;
  2100. #define I40E_AQC_NETWORK_KEY_INDEX_VXLAN 0x0
  2101. #define I40E_AQC_NETWORK_KEY_INDEX_NGE 0x1
  2102. #define I40E_AQC_NETWORK_KEY_INDEX_FLEX_MAC_IN_UDP 0x2
  2103. #define I40E_AQC_NETWORK_KEY_INDEX_GRE 0x3
  2104. u8 reserved[10];
  2105. };
  2106. I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure);
  2107. /* OEM mode commands (direct 0xFE0x) */
  2108. struct i40e_aqc_oem_param_change {
  2109. __le32 param_type;
  2110. #define I40E_AQ_OEM_PARAM_TYPE_PF_CTL 0
  2111. #define I40E_AQ_OEM_PARAM_TYPE_BW_CTL 1
  2112. #define I40E_AQ_OEM_PARAM_MAC 2
  2113. __le32 param_value1;
  2114. __le16 param_value2;
  2115. u8 reserved[6];
  2116. };
  2117. I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change);
  2118. struct i40e_aqc_oem_state_change {
  2119. __le32 state;
  2120. #define I40E_AQ_OEM_STATE_LINK_DOWN 0x0
  2121. #define I40E_AQ_OEM_STATE_LINK_UP 0x1
  2122. u8 reserved[12];
  2123. };
  2124. I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_state_change);
  2125. /* Initialize OCSD (0xFE02, direct) */
  2126. struct i40e_aqc_opc_oem_ocsd_initialize {
  2127. u8 type_status;
  2128. u8 reserved1[3];
  2129. __le32 ocsd_memory_block_addr_high;
  2130. __le32 ocsd_memory_block_addr_low;
  2131. __le32 requested_update_interval;
  2132. };
  2133. I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocsd_initialize);
  2134. /* Initialize OCBB (0xFE03, direct) */
  2135. struct i40e_aqc_opc_oem_ocbb_initialize {
  2136. u8 type_status;
  2137. u8 reserved1[3];
  2138. __le32 ocbb_memory_block_addr_high;
  2139. __le32 ocbb_memory_block_addr_low;
  2140. u8 reserved2[4];
  2141. };
  2142. I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocbb_initialize);
  2143. /* debug commands */
  2144. /* get device id (0xFF00) uses the generic structure */
  2145. /* set test more (0xFF01, internal) */
  2146. struct i40e_acq_set_test_mode {
  2147. u8 mode;
  2148. #define I40E_AQ_TEST_PARTIAL 0
  2149. #define I40E_AQ_TEST_FULL 1
  2150. #define I40E_AQ_TEST_NVM 2
  2151. u8 reserved[3];
  2152. u8 command;
  2153. #define I40E_AQ_TEST_OPEN 0
  2154. #define I40E_AQ_TEST_CLOSE 1
  2155. #define I40E_AQ_TEST_INC 2
  2156. u8 reserved2[3];
  2157. __le32 address_high;
  2158. __le32 address_low;
  2159. };
  2160. I40E_CHECK_CMD_LENGTH(i40e_acq_set_test_mode);
  2161. /* Debug Read Register command (0xFF03)
  2162. * Debug Write Register command (0xFF04)
  2163. */
  2164. struct i40e_aqc_debug_reg_read_write {
  2165. __le32 reserved;
  2166. __le32 address;
  2167. __le32 value_high;
  2168. __le32 value_low;
  2169. };
  2170. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_reg_read_write);
  2171. /* Scatter/gather Reg Read (indirect 0xFF05)
  2172. * Scatter/gather Reg Write (indirect 0xFF06)
  2173. */
  2174. /* i40e_aq_desc is used for the command */
  2175. struct i40e_aqc_debug_reg_sg_element_data {
  2176. __le32 address;
  2177. __le32 value;
  2178. };
  2179. /* Debug Modify register (direct 0xFF07) */
  2180. struct i40e_aqc_debug_modify_reg {
  2181. __le32 address;
  2182. __le32 value;
  2183. __le32 clear_mask;
  2184. __le32 set_mask;
  2185. };
  2186. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_reg);
  2187. /* dump internal data (0xFF08, indirect) */
  2188. #define I40E_AQ_CLUSTER_ID_AUX 0
  2189. #define I40E_AQ_CLUSTER_ID_SWITCH_FLU 1
  2190. #define I40E_AQ_CLUSTER_ID_TXSCHED 2
  2191. #define I40E_AQ_CLUSTER_ID_HMC 3
  2192. #define I40E_AQ_CLUSTER_ID_MAC0 4
  2193. #define I40E_AQ_CLUSTER_ID_MAC1 5
  2194. #define I40E_AQ_CLUSTER_ID_MAC2 6
  2195. #define I40E_AQ_CLUSTER_ID_MAC3 7
  2196. #define I40E_AQ_CLUSTER_ID_DCB 8
  2197. #define I40E_AQ_CLUSTER_ID_EMP_MEM 9
  2198. #define I40E_AQ_CLUSTER_ID_PKT_BUF 10
  2199. #define I40E_AQ_CLUSTER_ID_ALTRAM 11
  2200. struct i40e_aqc_debug_dump_internals {
  2201. u8 cluster_id;
  2202. u8 table_id;
  2203. __le16 data_size;
  2204. __le32 idx;
  2205. __le32 address_high;
  2206. __le32 address_low;
  2207. };
  2208. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_dump_internals);
  2209. struct i40e_aqc_debug_modify_internals {
  2210. u8 cluster_id;
  2211. u8 cluster_specific_params[7];
  2212. __le32 address_high;
  2213. __le32 address_low;
  2214. };
  2215. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
  2216. #endif /* _I40E_ADMINQ_CMD_H_ */