i40e_adminq_cmd.h 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554
  1. /*******************************************************************************
  2. *
  3. * Intel Ethernet Controller XL710 Family Linux Virtual Function Driver
  4. * Copyright(c) 2013 - 2017 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 0x3F0
  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_WOL_PRESERVE_ON_PFR 0x2000
  513. #define I40E_AQC_SET_WOL_FILTER_ACTION_CLEAR 0
  514. #define I40E_AQC_SET_WOL_FILTER_ACTION_SET 1
  515. __le16 valid_flags;
  516. #define I40E_AQC_SET_WOL_FILTER_ACTION_VALID 0x8000
  517. #define I40E_AQC_SET_WOL_FILTER_NO_TCO_ACTION_VALID 0x4000
  518. u8 reserved[2];
  519. __le32 address_high;
  520. __le32 address_low;
  521. };
  522. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_wol_filter);
  523. struct i40e_aqc_set_wol_filter_data {
  524. u8 filter[128];
  525. u8 mask[16];
  526. };
  527. I40E_CHECK_STRUCT_LEN(0x90, i40e_aqc_set_wol_filter_data);
  528. /* Get Wake Reason (0x0121) */
  529. struct i40e_aqc_get_wake_reason_completion {
  530. u8 reserved_1[2];
  531. __le16 wake_reason;
  532. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT 0
  533. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_MASK (0xFF << \
  534. I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_MATCHED_INDEX_SHIFT)
  535. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT 8
  536. #define I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_MASK (0xFF << \
  537. I40E_AQC_GET_WAKE_UP_REASON_WOL_REASON_RESERVED_SHIFT)
  538. u8 reserved_2[12];
  539. };
  540. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_wake_reason_completion);
  541. /* Switch configuration commands (0x02xx) */
  542. /* Used by many indirect commands that only pass an seid and a buffer in the
  543. * command
  544. */
  545. struct i40e_aqc_switch_seid {
  546. __le16 seid;
  547. u8 reserved[6];
  548. __le32 addr_high;
  549. __le32 addr_low;
  550. };
  551. I40E_CHECK_CMD_LENGTH(i40e_aqc_switch_seid);
  552. /* Get Switch Configuration command (indirect 0x0200)
  553. * uses i40e_aqc_switch_seid for the descriptor
  554. */
  555. struct i40e_aqc_get_switch_config_header_resp {
  556. __le16 num_reported;
  557. __le16 num_total;
  558. u8 reserved[12];
  559. };
  560. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_config_header_resp);
  561. struct i40e_aqc_switch_config_element_resp {
  562. u8 element_type;
  563. #define I40E_AQ_SW_ELEM_TYPE_MAC 1
  564. #define I40E_AQ_SW_ELEM_TYPE_PF 2
  565. #define I40E_AQ_SW_ELEM_TYPE_VF 3
  566. #define I40E_AQ_SW_ELEM_TYPE_EMP 4
  567. #define I40E_AQ_SW_ELEM_TYPE_BMC 5
  568. #define I40E_AQ_SW_ELEM_TYPE_PV 16
  569. #define I40E_AQ_SW_ELEM_TYPE_VEB 17
  570. #define I40E_AQ_SW_ELEM_TYPE_PA 18
  571. #define I40E_AQ_SW_ELEM_TYPE_VSI 19
  572. u8 revision;
  573. #define I40E_AQ_SW_ELEM_REV_1 1
  574. __le16 seid;
  575. __le16 uplink_seid;
  576. __le16 downlink_seid;
  577. u8 reserved[3];
  578. u8 connection_type;
  579. #define I40E_AQ_CONN_TYPE_REGULAR 0x1
  580. #define I40E_AQ_CONN_TYPE_DEFAULT 0x2
  581. #define I40E_AQ_CONN_TYPE_CASCADED 0x3
  582. __le16 scheduler_id;
  583. __le16 element_info;
  584. };
  585. I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_config_element_resp);
  586. /* Get Switch Configuration (indirect 0x0200)
  587. * an array of elements are returned in the response buffer
  588. * the first in the array is the header, remainder are elements
  589. */
  590. struct i40e_aqc_get_switch_config_resp {
  591. struct i40e_aqc_get_switch_config_header_resp header;
  592. struct i40e_aqc_switch_config_element_resp element[1];
  593. };
  594. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_get_switch_config_resp);
  595. /* Add Statistics (direct 0x0201)
  596. * Remove Statistics (direct 0x0202)
  597. */
  598. struct i40e_aqc_add_remove_statistics {
  599. __le16 seid;
  600. __le16 vlan;
  601. __le16 stat_index;
  602. u8 reserved[10];
  603. };
  604. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_statistics);
  605. /* Set Port Parameters command (direct 0x0203) */
  606. struct i40e_aqc_set_port_parameters {
  607. __le16 command_flags;
  608. #define I40E_AQ_SET_P_PARAMS_SAVE_BAD_PACKETS 1
  609. #define I40E_AQ_SET_P_PARAMS_PAD_SHORT_PACKETS 2 /* must set! */
  610. #define I40E_AQ_SET_P_PARAMS_DOUBLE_VLAN_ENA 4
  611. __le16 bad_frame_vsi;
  612. #define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_SHIFT 0x0
  613. #define I40E_AQ_SET_P_PARAMS_BFRAME_SEID_MASK 0x3FF
  614. __le16 default_seid; /* reserved for command */
  615. u8 reserved[10];
  616. };
  617. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_port_parameters);
  618. /* Get Switch Resource Allocation (indirect 0x0204) */
  619. struct i40e_aqc_get_switch_resource_alloc {
  620. u8 num_entries; /* reserved for command */
  621. u8 reserved[7];
  622. __le32 addr_high;
  623. __le32 addr_low;
  624. };
  625. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_resource_alloc);
  626. /* expect an array of these structs in the response buffer */
  627. struct i40e_aqc_switch_resource_alloc_element_resp {
  628. u8 resource_type;
  629. #define I40E_AQ_RESOURCE_TYPE_VEB 0x0
  630. #define I40E_AQ_RESOURCE_TYPE_VSI 0x1
  631. #define I40E_AQ_RESOURCE_TYPE_MACADDR 0x2
  632. #define I40E_AQ_RESOURCE_TYPE_STAG 0x3
  633. #define I40E_AQ_RESOURCE_TYPE_ETAG 0x4
  634. #define I40E_AQ_RESOURCE_TYPE_MULTICAST_HASH 0x5
  635. #define I40E_AQ_RESOURCE_TYPE_UNICAST_HASH 0x6
  636. #define I40E_AQ_RESOURCE_TYPE_VLAN 0x7
  637. #define I40E_AQ_RESOURCE_TYPE_VSI_LIST_ENTRY 0x8
  638. #define I40E_AQ_RESOURCE_TYPE_ETAG_LIST_ENTRY 0x9
  639. #define I40E_AQ_RESOURCE_TYPE_VLAN_STAT_POOL 0xA
  640. #define I40E_AQ_RESOURCE_TYPE_MIRROR_RULE 0xB
  641. #define I40E_AQ_RESOURCE_TYPE_QUEUE_SETS 0xC
  642. #define I40E_AQ_RESOURCE_TYPE_VLAN_FILTERS 0xD
  643. #define I40E_AQ_RESOURCE_TYPE_INNER_MAC_FILTERS 0xF
  644. #define I40E_AQ_RESOURCE_TYPE_IP_FILTERS 0x10
  645. #define I40E_AQ_RESOURCE_TYPE_GRE_VN_KEYS 0x11
  646. #define I40E_AQ_RESOURCE_TYPE_VN2_KEYS 0x12
  647. #define I40E_AQ_RESOURCE_TYPE_TUNNEL_PORTS 0x13
  648. u8 reserved1;
  649. __le16 guaranteed;
  650. __le16 total;
  651. __le16 used;
  652. __le16 total_unalloced;
  653. u8 reserved2[6];
  654. };
  655. I40E_CHECK_STRUCT_LEN(0x10, i40e_aqc_switch_resource_alloc_element_resp);
  656. /* Set Switch Configuration (direct 0x0205) */
  657. struct i40e_aqc_set_switch_config {
  658. __le16 flags;
  659. /* flags used for both fields below */
  660. #define I40E_AQ_SET_SWITCH_CFG_PROMISC 0x0001
  661. #define I40E_AQ_SET_SWITCH_CFG_L2_FILTER 0x0002
  662. __le16 valid_flags;
  663. u8 reserved[12];
  664. };
  665. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_switch_config);
  666. /* Read Receive control registers (direct 0x0206)
  667. * Write Receive control registers (direct 0x0207)
  668. * used for accessing Rx control registers that can be
  669. * slow and need special handling when under high Rx load
  670. */
  671. struct i40e_aqc_rx_ctl_reg_read_write {
  672. __le32 reserved1;
  673. __le32 address;
  674. __le32 reserved2;
  675. __le32 value;
  676. };
  677. I40E_CHECK_CMD_LENGTH(i40e_aqc_rx_ctl_reg_read_write);
  678. /* Add VSI (indirect 0x0210)
  679. * this indirect command uses struct i40e_aqc_vsi_properties_data
  680. * as the indirect buffer (128 bytes)
  681. *
  682. * Update VSI (indirect 0x211)
  683. * uses the same data structure as Add VSI
  684. *
  685. * Get VSI (indirect 0x0212)
  686. * uses the same completion and data structure as Add VSI
  687. */
  688. struct i40e_aqc_add_get_update_vsi {
  689. __le16 uplink_seid;
  690. u8 connection_type;
  691. #define I40E_AQ_VSI_CONN_TYPE_NORMAL 0x1
  692. #define I40E_AQ_VSI_CONN_TYPE_DEFAULT 0x2
  693. #define I40E_AQ_VSI_CONN_TYPE_CASCADED 0x3
  694. u8 reserved1;
  695. u8 vf_id;
  696. u8 reserved2;
  697. __le16 vsi_flags;
  698. #define I40E_AQ_VSI_TYPE_SHIFT 0x0
  699. #define I40E_AQ_VSI_TYPE_MASK (0x3 << I40E_AQ_VSI_TYPE_SHIFT)
  700. #define I40E_AQ_VSI_TYPE_VF 0x0
  701. #define I40E_AQ_VSI_TYPE_VMDQ2 0x1
  702. #define I40E_AQ_VSI_TYPE_PF 0x2
  703. #define I40E_AQ_VSI_TYPE_EMP_MNG 0x3
  704. #define I40E_AQ_VSI_FLAG_CASCADED_PV 0x4
  705. __le32 addr_high;
  706. __le32 addr_low;
  707. };
  708. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi);
  709. struct i40e_aqc_add_get_update_vsi_completion {
  710. __le16 seid;
  711. __le16 vsi_number;
  712. __le16 vsi_used;
  713. __le16 vsi_free;
  714. __le32 addr_high;
  715. __le32 addr_low;
  716. };
  717. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi_completion);
  718. struct i40e_aqc_vsi_properties_data {
  719. /* first 96 byte are written by SW */
  720. __le16 valid_sections;
  721. #define I40E_AQ_VSI_PROP_SWITCH_VALID 0x0001
  722. #define I40E_AQ_VSI_PROP_SECURITY_VALID 0x0002
  723. #define I40E_AQ_VSI_PROP_VLAN_VALID 0x0004
  724. #define I40E_AQ_VSI_PROP_CAS_PV_VALID 0x0008
  725. #define I40E_AQ_VSI_PROP_INGRESS_UP_VALID 0x0010
  726. #define I40E_AQ_VSI_PROP_EGRESS_UP_VALID 0x0020
  727. #define I40E_AQ_VSI_PROP_QUEUE_MAP_VALID 0x0040
  728. #define I40E_AQ_VSI_PROP_QUEUE_OPT_VALID 0x0080
  729. #define I40E_AQ_VSI_PROP_OUTER_UP_VALID 0x0100
  730. #define I40E_AQ_VSI_PROP_SCHED_VALID 0x0200
  731. /* switch section */
  732. __le16 switch_id; /* 12bit id combined with flags below */
  733. #define I40E_AQ_VSI_SW_ID_SHIFT 0x0000
  734. #define I40E_AQ_VSI_SW_ID_MASK (0xFFF << I40E_AQ_VSI_SW_ID_SHIFT)
  735. #define I40E_AQ_VSI_SW_ID_FLAG_NOT_STAG 0x1000
  736. #define I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB 0x2000
  737. #define I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB 0x4000
  738. u8 sw_reserved[2];
  739. /* security section */
  740. u8 sec_flags;
  741. #define I40E_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD 0x01
  742. #define I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK 0x02
  743. #define I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK 0x04
  744. u8 sec_reserved;
  745. /* VLAN section */
  746. __le16 pvid; /* VLANS include priority bits */
  747. __le16 fcoe_pvid;
  748. u8 port_vlan_flags;
  749. #define I40E_AQ_VSI_PVLAN_MODE_SHIFT 0x00
  750. #define I40E_AQ_VSI_PVLAN_MODE_MASK (0x03 << \
  751. I40E_AQ_VSI_PVLAN_MODE_SHIFT)
  752. #define I40E_AQ_VSI_PVLAN_MODE_TAGGED 0x01
  753. #define I40E_AQ_VSI_PVLAN_MODE_UNTAGGED 0x02
  754. #define I40E_AQ_VSI_PVLAN_MODE_ALL 0x03
  755. #define I40E_AQ_VSI_PVLAN_INSERT_PVID 0x04
  756. #define I40E_AQ_VSI_PVLAN_EMOD_SHIFT 0x03
  757. #define I40E_AQ_VSI_PVLAN_EMOD_MASK (0x3 << \
  758. I40E_AQ_VSI_PVLAN_EMOD_SHIFT)
  759. #define I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH 0x0
  760. #define I40E_AQ_VSI_PVLAN_EMOD_STR_UP 0x08
  761. #define I40E_AQ_VSI_PVLAN_EMOD_STR 0x10
  762. #define I40E_AQ_VSI_PVLAN_EMOD_NOTHING 0x18
  763. u8 pvlan_reserved[3];
  764. /* ingress egress up sections */
  765. __le32 ingress_table; /* bitmap, 3 bits per up */
  766. #define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT 0
  767. #define I40E_AQ_VSI_UP_TABLE_UP0_MASK (0x7 << \
  768. I40E_AQ_VSI_UP_TABLE_UP0_SHIFT)
  769. #define I40E_AQ_VSI_UP_TABLE_UP1_SHIFT 3
  770. #define I40E_AQ_VSI_UP_TABLE_UP1_MASK (0x7 << \
  771. I40E_AQ_VSI_UP_TABLE_UP1_SHIFT)
  772. #define I40E_AQ_VSI_UP_TABLE_UP2_SHIFT 6
  773. #define I40E_AQ_VSI_UP_TABLE_UP2_MASK (0x7 << \
  774. I40E_AQ_VSI_UP_TABLE_UP2_SHIFT)
  775. #define I40E_AQ_VSI_UP_TABLE_UP3_SHIFT 9
  776. #define I40E_AQ_VSI_UP_TABLE_UP3_MASK (0x7 << \
  777. I40E_AQ_VSI_UP_TABLE_UP3_SHIFT)
  778. #define I40E_AQ_VSI_UP_TABLE_UP4_SHIFT 12
  779. #define I40E_AQ_VSI_UP_TABLE_UP4_MASK (0x7 << \
  780. I40E_AQ_VSI_UP_TABLE_UP4_SHIFT)
  781. #define I40E_AQ_VSI_UP_TABLE_UP5_SHIFT 15
  782. #define I40E_AQ_VSI_UP_TABLE_UP5_MASK (0x7 << \
  783. I40E_AQ_VSI_UP_TABLE_UP5_SHIFT)
  784. #define I40E_AQ_VSI_UP_TABLE_UP6_SHIFT 18
  785. #define I40E_AQ_VSI_UP_TABLE_UP6_MASK (0x7 << \
  786. I40E_AQ_VSI_UP_TABLE_UP6_SHIFT)
  787. #define I40E_AQ_VSI_UP_TABLE_UP7_SHIFT 21
  788. #define I40E_AQ_VSI_UP_TABLE_UP7_MASK (0x7 << \
  789. I40E_AQ_VSI_UP_TABLE_UP7_SHIFT)
  790. __le32 egress_table; /* same defines as for ingress table */
  791. /* cascaded PV section */
  792. __le16 cas_pv_tag;
  793. u8 cas_pv_flags;
  794. #define I40E_AQ_VSI_CAS_PV_TAGX_SHIFT 0x00
  795. #define I40E_AQ_VSI_CAS_PV_TAGX_MASK (0x03 << \
  796. I40E_AQ_VSI_CAS_PV_TAGX_SHIFT)
  797. #define I40E_AQ_VSI_CAS_PV_TAGX_LEAVE 0x00
  798. #define I40E_AQ_VSI_CAS_PV_TAGX_REMOVE 0x01
  799. #define I40E_AQ_VSI_CAS_PV_TAGX_COPY 0x02
  800. #define I40E_AQ_VSI_CAS_PV_INSERT_TAG 0x10
  801. #define I40E_AQ_VSI_CAS_PV_ETAG_PRUNE 0x20
  802. #define I40E_AQ_VSI_CAS_PV_ACCEPT_HOST_TAG 0x40
  803. u8 cas_pv_reserved;
  804. /* queue mapping section */
  805. __le16 mapping_flags;
  806. #define I40E_AQ_VSI_QUE_MAP_CONTIG 0x0
  807. #define I40E_AQ_VSI_QUE_MAP_NONCONTIG 0x1
  808. __le16 queue_mapping[16];
  809. #define I40E_AQ_VSI_QUEUE_SHIFT 0x0
  810. #define I40E_AQ_VSI_QUEUE_MASK (0x7FF << I40E_AQ_VSI_QUEUE_SHIFT)
  811. __le16 tc_mapping[8];
  812. #define I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT 0
  813. #define I40E_AQ_VSI_TC_QUE_OFFSET_MASK (0x1FF << \
  814. I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT)
  815. #define I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT 9
  816. #define I40E_AQ_VSI_TC_QUE_NUMBER_MASK (0x7 << \
  817. I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT)
  818. /* queueing option section */
  819. u8 queueing_opt_flags;
  820. #define I40E_AQ_VSI_QUE_OPT_MULTICAST_UDP_ENA 0x04
  821. #define I40E_AQ_VSI_QUE_OPT_UNICAST_UDP_ENA 0x08
  822. #define I40E_AQ_VSI_QUE_OPT_TCP_ENA 0x10
  823. #define I40E_AQ_VSI_QUE_OPT_FCOE_ENA 0x20
  824. #define I40E_AQ_VSI_QUE_OPT_RSS_LUT_PF 0x00
  825. #define I40E_AQ_VSI_QUE_OPT_RSS_LUT_VSI 0x40
  826. u8 queueing_opt_reserved[3];
  827. /* scheduler section */
  828. u8 up_enable_bits;
  829. u8 sched_reserved;
  830. /* outer up section */
  831. __le32 outer_up_table; /* same structure and defines as ingress tbl */
  832. u8 cmd_reserved[8];
  833. /* last 32 bytes are written by FW */
  834. __le16 qs_handle[8];
  835. #define I40E_AQ_VSI_QS_HANDLE_INVALID 0xFFFF
  836. __le16 stat_counter_idx;
  837. __le16 sched_id;
  838. u8 resp_reserved[12];
  839. };
  840. I40E_CHECK_STRUCT_LEN(128, i40e_aqc_vsi_properties_data);
  841. /* Add Port Virtualizer (direct 0x0220)
  842. * also used for update PV (direct 0x0221) but only flags are used
  843. * (IS_CTRL_PORT only works on add PV)
  844. */
  845. struct i40e_aqc_add_update_pv {
  846. __le16 command_flags;
  847. #define I40E_AQC_PV_FLAG_PV_TYPE 0x1
  848. #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_STAG_EN 0x2
  849. #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_ETAG_EN 0x4
  850. #define I40E_AQC_PV_FLAG_IS_CTRL_PORT 0x8
  851. __le16 uplink_seid;
  852. __le16 connected_seid;
  853. u8 reserved[10];
  854. };
  855. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv);
  856. struct i40e_aqc_add_update_pv_completion {
  857. /* reserved for update; for add also encodes error if rc == ENOSPC */
  858. __le16 pv_seid;
  859. #define I40E_AQC_PV_ERR_FLAG_NO_PV 0x1
  860. #define I40E_AQC_PV_ERR_FLAG_NO_SCHED 0x2
  861. #define I40E_AQC_PV_ERR_FLAG_NO_COUNTER 0x4
  862. #define I40E_AQC_PV_ERR_FLAG_NO_ENTRY 0x8
  863. u8 reserved[14];
  864. };
  865. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv_completion);
  866. /* Get PV Params (direct 0x0222)
  867. * uses i40e_aqc_switch_seid for the descriptor
  868. */
  869. struct i40e_aqc_get_pv_params_completion {
  870. __le16 seid;
  871. __le16 default_stag;
  872. __le16 pv_flags; /* same flags as add_pv */
  873. #define I40E_AQC_GET_PV_PV_TYPE 0x1
  874. #define I40E_AQC_GET_PV_FRWD_UNKNOWN_STAG 0x2
  875. #define I40E_AQC_GET_PV_FRWD_UNKNOWN_ETAG 0x4
  876. u8 reserved[8];
  877. __le16 default_port_seid;
  878. };
  879. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_pv_params_completion);
  880. /* Add VEB (direct 0x0230) */
  881. struct i40e_aqc_add_veb {
  882. __le16 uplink_seid;
  883. __le16 downlink_seid;
  884. __le16 veb_flags;
  885. #define I40E_AQC_ADD_VEB_FLOATING 0x1
  886. #define I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT 1
  887. #define I40E_AQC_ADD_VEB_PORT_TYPE_MASK (0x3 << \
  888. I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT)
  889. #define I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT 0x2
  890. #define I40E_AQC_ADD_VEB_PORT_TYPE_DATA 0x4
  891. #define I40E_AQC_ADD_VEB_ENABLE_L2_FILTER 0x8 /* deprecated */
  892. #define I40E_AQC_ADD_VEB_ENABLE_DISABLE_STATS 0x10
  893. u8 enable_tcs;
  894. u8 reserved[9];
  895. };
  896. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb);
  897. struct i40e_aqc_add_veb_completion {
  898. u8 reserved[6];
  899. __le16 switch_seid;
  900. /* also encodes error if rc == ENOSPC; codes are the same as add_pv */
  901. __le16 veb_seid;
  902. #define I40E_AQC_VEB_ERR_FLAG_NO_VEB 0x1
  903. #define I40E_AQC_VEB_ERR_FLAG_NO_SCHED 0x2
  904. #define I40E_AQC_VEB_ERR_FLAG_NO_COUNTER 0x4
  905. #define I40E_AQC_VEB_ERR_FLAG_NO_ENTRY 0x8
  906. __le16 statistic_index;
  907. __le16 vebs_used;
  908. __le16 vebs_free;
  909. };
  910. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb_completion);
  911. /* Get VEB Parameters (direct 0x0232)
  912. * uses i40e_aqc_switch_seid for the descriptor
  913. */
  914. struct i40e_aqc_get_veb_parameters_completion {
  915. __le16 seid;
  916. __le16 switch_id;
  917. __le16 veb_flags; /* only the first/last flags from 0x0230 is valid */
  918. __le16 statistic_index;
  919. __le16 vebs_used;
  920. __le16 vebs_free;
  921. u8 reserved[4];
  922. };
  923. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_veb_parameters_completion);
  924. /* Delete Element (direct 0x0243)
  925. * uses the generic i40e_aqc_switch_seid
  926. */
  927. /* Add MAC-VLAN (indirect 0x0250) */
  928. /* used for the command for most vlan commands */
  929. struct i40e_aqc_macvlan {
  930. __le16 num_addresses;
  931. __le16 seid[3];
  932. #define I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT 0
  933. #define I40E_AQC_MACVLAN_CMD_SEID_NUM_MASK (0x3FF << \
  934. I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
  935. #define I40E_AQC_MACVLAN_CMD_SEID_VALID 0x8000
  936. __le32 addr_high;
  937. __le32 addr_low;
  938. };
  939. I40E_CHECK_CMD_LENGTH(i40e_aqc_macvlan);
  940. /* indirect data for command and response */
  941. struct i40e_aqc_add_macvlan_element_data {
  942. u8 mac_addr[6];
  943. __le16 vlan_tag;
  944. __le16 flags;
  945. #define I40E_AQC_MACVLAN_ADD_PERFECT_MATCH 0x0001
  946. #define I40E_AQC_MACVLAN_ADD_HASH_MATCH 0x0002
  947. #define I40E_AQC_MACVLAN_ADD_IGNORE_VLAN 0x0004
  948. #define I40E_AQC_MACVLAN_ADD_TO_QUEUE 0x0008
  949. #define I40E_AQC_MACVLAN_ADD_USE_SHARED_MAC 0x0010
  950. __le16 queue_number;
  951. #define I40E_AQC_MACVLAN_CMD_QUEUE_SHIFT 0
  952. #define I40E_AQC_MACVLAN_CMD_QUEUE_MASK (0x7FF << \
  953. I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
  954. /* response section */
  955. u8 match_method;
  956. #define I40E_AQC_MM_PERFECT_MATCH 0x01
  957. #define I40E_AQC_MM_HASH_MATCH 0x02
  958. #define I40E_AQC_MM_ERR_NO_RES 0xFF
  959. u8 reserved1[3];
  960. };
  961. struct i40e_aqc_add_remove_macvlan_completion {
  962. __le16 perfect_mac_used;
  963. __le16 perfect_mac_free;
  964. __le16 unicast_hash_free;
  965. __le16 multicast_hash_free;
  966. __le32 addr_high;
  967. __le32 addr_low;
  968. };
  969. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_macvlan_completion);
  970. /* Remove MAC-VLAN (indirect 0x0251)
  971. * uses i40e_aqc_macvlan for the descriptor
  972. * data points to an array of num_addresses of elements
  973. */
  974. struct i40e_aqc_remove_macvlan_element_data {
  975. u8 mac_addr[6];
  976. __le16 vlan_tag;
  977. u8 flags;
  978. #define I40E_AQC_MACVLAN_DEL_PERFECT_MATCH 0x01
  979. #define I40E_AQC_MACVLAN_DEL_HASH_MATCH 0x02
  980. #define I40E_AQC_MACVLAN_DEL_IGNORE_VLAN 0x08
  981. #define I40E_AQC_MACVLAN_DEL_ALL_VSIS 0x10
  982. u8 reserved[3];
  983. /* reply section */
  984. u8 error_code;
  985. #define I40E_AQC_REMOVE_MACVLAN_SUCCESS 0x0
  986. #define I40E_AQC_REMOVE_MACVLAN_FAIL 0xFF
  987. u8 reply_reserved[3];
  988. };
  989. /* Add VLAN (indirect 0x0252)
  990. * Remove VLAN (indirect 0x0253)
  991. * use the generic i40e_aqc_macvlan for the command
  992. */
  993. struct i40e_aqc_add_remove_vlan_element_data {
  994. __le16 vlan_tag;
  995. u8 vlan_flags;
  996. /* flags for add VLAN */
  997. #define I40E_AQC_ADD_VLAN_LOCAL 0x1
  998. #define I40E_AQC_ADD_PVLAN_TYPE_SHIFT 1
  999. #define I40E_AQC_ADD_PVLAN_TYPE_MASK (0x3 << I40E_AQC_ADD_PVLAN_TYPE_SHIFT)
  1000. #define I40E_AQC_ADD_PVLAN_TYPE_REGULAR 0x0
  1001. #define I40E_AQC_ADD_PVLAN_TYPE_PRIMARY 0x2
  1002. #define I40E_AQC_ADD_PVLAN_TYPE_SECONDARY 0x4
  1003. #define I40E_AQC_VLAN_PTYPE_SHIFT 3
  1004. #define I40E_AQC_VLAN_PTYPE_MASK (0x3 << I40E_AQC_VLAN_PTYPE_SHIFT)
  1005. #define I40E_AQC_VLAN_PTYPE_REGULAR_VSI 0x0
  1006. #define I40E_AQC_VLAN_PTYPE_PROMISC_VSI 0x8
  1007. #define I40E_AQC_VLAN_PTYPE_COMMUNITY_VSI 0x10
  1008. #define I40E_AQC_VLAN_PTYPE_ISOLATED_VSI 0x18
  1009. /* flags for remove VLAN */
  1010. #define I40E_AQC_REMOVE_VLAN_ALL 0x1
  1011. u8 reserved;
  1012. u8 result;
  1013. /* flags for add VLAN */
  1014. #define I40E_AQC_ADD_VLAN_SUCCESS 0x0
  1015. #define I40E_AQC_ADD_VLAN_FAIL_REQUEST 0xFE
  1016. #define I40E_AQC_ADD_VLAN_FAIL_RESOURCE 0xFF
  1017. /* flags for remove VLAN */
  1018. #define I40E_AQC_REMOVE_VLAN_SUCCESS 0x0
  1019. #define I40E_AQC_REMOVE_VLAN_FAIL 0xFF
  1020. u8 reserved1[3];
  1021. };
  1022. struct i40e_aqc_add_remove_vlan_completion {
  1023. u8 reserved[4];
  1024. __le16 vlans_used;
  1025. __le16 vlans_free;
  1026. __le32 addr_high;
  1027. __le32 addr_low;
  1028. };
  1029. /* Set VSI Promiscuous Modes (direct 0x0254) */
  1030. struct i40e_aqc_set_vsi_promiscuous_modes {
  1031. __le16 promiscuous_flags;
  1032. __le16 valid_flags;
  1033. /* flags used for both fields above */
  1034. #define I40E_AQC_SET_VSI_PROMISC_UNICAST 0x01
  1035. #define I40E_AQC_SET_VSI_PROMISC_MULTICAST 0x02
  1036. #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04
  1037. #define I40E_AQC_SET_VSI_DEFAULT 0x08
  1038. #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10
  1039. #define I40E_AQC_SET_VSI_PROMISC_TX 0x8000
  1040. __le16 seid;
  1041. #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF
  1042. __le16 vlan_tag;
  1043. #define I40E_AQC_SET_VSI_VLAN_MASK 0x0FFF
  1044. #define I40E_AQC_SET_VSI_VLAN_VALID 0x8000
  1045. u8 reserved[8];
  1046. };
  1047. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_vsi_promiscuous_modes);
  1048. /* Add S/E-tag command (direct 0x0255)
  1049. * Uses generic i40e_aqc_add_remove_tag_completion for completion
  1050. */
  1051. struct i40e_aqc_add_tag {
  1052. __le16 flags;
  1053. #define I40E_AQC_ADD_TAG_FLAG_TO_QUEUE 0x0001
  1054. __le16 seid;
  1055. #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT 0
  1056. #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  1057. I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT)
  1058. __le16 tag;
  1059. __le16 queue_number;
  1060. u8 reserved[8];
  1061. };
  1062. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_tag);
  1063. struct i40e_aqc_add_remove_tag_completion {
  1064. u8 reserved[12];
  1065. __le16 tags_used;
  1066. __le16 tags_free;
  1067. };
  1068. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_tag_completion);
  1069. /* Remove S/E-tag command (direct 0x0256)
  1070. * Uses generic i40e_aqc_add_remove_tag_completion for completion
  1071. */
  1072. struct i40e_aqc_remove_tag {
  1073. __le16 seid;
  1074. #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT 0
  1075. #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  1076. I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT)
  1077. __le16 tag;
  1078. u8 reserved[12];
  1079. };
  1080. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_tag);
  1081. /* Add multicast E-Tag (direct 0x0257)
  1082. * del multicast E-Tag (direct 0x0258) only uses pv_seid and etag fields
  1083. * and no external data
  1084. */
  1085. struct i40e_aqc_add_remove_mcast_etag {
  1086. __le16 pv_seid;
  1087. __le16 etag;
  1088. u8 num_unicast_etags;
  1089. u8 reserved[3];
  1090. __le32 addr_high; /* address of array of 2-byte s-tags */
  1091. __le32 addr_low;
  1092. };
  1093. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag);
  1094. struct i40e_aqc_add_remove_mcast_etag_completion {
  1095. u8 reserved[4];
  1096. __le16 mcast_etags_used;
  1097. __le16 mcast_etags_free;
  1098. __le32 addr_high;
  1099. __le32 addr_low;
  1100. };
  1101. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag_completion);
  1102. /* Update S/E-Tag (direct 0x0259) */
  1103. struct i40e_aqc_update_tag {
  1104. __le16 seid;
  1105. #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT 0
  1106. #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  1107. I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT)
  1108. __le16 old_tag;
  1109. __le16 new_tag;
  1110. u8 reserved[10];
  1111. };
  1112. I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag);
  1113. struct i40e_aqc_update_tag_completion {
  1114. u8 reserved[12];
  1115. __le16 tags_used;
  1116. __le16 tags_free;
  1117. };
  1118. I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag_completion);
  1119. /* Add Control Packet filter (direct 0x025A)
  1120. * Remove Control Packet filter (direct 0x025B)
  1121. * uses the i40e_aqc_add_oveb_cloud,
  1122. * and the generic direct completion structure
  1123. */
  1124. struct i40e_aqc_add_remove_control_packet_filter {
  1125. u8 mac[6];
  1126. __le16 etype;
  1127. __le16 flags;
  1128. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC 0x0001
  1129. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP 0x0002
  1130. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE 0x0004
  1131. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX 0x0008
  1132. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX 0x0000
  1133. __le16 seid;
  1134. #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT 0
  1135. #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_MASK (0x3FF << \
  1136. I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT)
  1137. __le16 queue;
  1138. u8 reserved[2];
  1139. };
  1140. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter);
  1141. struct i40e_aqc_add_remove_control_packet_filter_completion {
  1142. __le16 mac_etype_used;
  1143. __le16 etype_used;
  1144. __le16 mac_etype_free;
  1145. __le16 etype_free;
  1146. u8 reserved[8];
  1147. };
  1148. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter_completion);
  1149. /* Add Cloud filters (indirect 0x025C)
  1150. * Remove Cloud filters (indirect 0x025D)
  1151. * uses the i40e_aqc_add_remove_cloud_filters,
  1152. * and the generic indirect completion structure
  1153. */
  1154. struct i40e_aqc_add_remove_cloud_filters {
  1155. u8 num_filters;
  1156. u8 reserved;
  1157. __le16 seid;
  1158. #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT 0
  1159. #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_MASK (0x3FF << \
  1160. I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT)
  1161. u8 reserved2[4];
  1162. __le32 addr_high;
  1163. __le32 addr_low;
  1164. };
  1165. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_cloud_filters);
  1166. struct i40e_aqc_add_remove_cloud_filters_element_data {
  1167. u8 outer_mac[6];
  1168. u8 inner_mac[6];
  1169. __le16 inner_vlan;
  1170. union {
  1171. struct {
  1172. u8 reserved[12];
  1173. u8 data[4];
  1174. } v4;
  1175. struct {
  1176. u8 data[16];
  1177. } v6;
  1178. } ipaddr;
  1179. __le16 flags;
  1180. #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0
  1181. #define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \
  1182. I40E_AQC_ADD_CLOUD_FILTER_SHIFT)
  1183. /* 0x0000 reserved */
  1184. #define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001
  1185. /* 0x0002 reserved */
  1186. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN 0x0003
  1187. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID 0x0004
  1188. /* 0x0005 reserved */
  1189. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID 0x0006
  1190. /* 0x0007 reserved */
  1191. /* 0x0008 reserved */
  1192. #define I40E_AQC_ADD_CLOUD_FILTER_OMAC 0x0009
  1193. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A
  1194. #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B
  1195. #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C
  1196. #define I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE 0x0080
  1197. #define I40E_AQC_ADD_CLOUD_VNK_SHIFT 6
  1198. #define I40E_AQC_ADD_CLOUD_VNK_MASK 0x00C0
  1199. #define I40E_AQC_ADD_CLOUD_FLAGS_IPV4 0
  1200. #define I40E_AQC_ADD_CLOUD_FLAGS_IPV6 0x0100
  1201. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT 9
  1202. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK 0x1E00
  1203. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN 0
  1204. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC 1
  1205. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_GENEVE 2
  1206. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_IP 3
  1207. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_RESERVED 4
  1208. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN_GPE 5
  1209. #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_MAC 0x2000
  1210. #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_INNER_MAC 0x4000
  1211. #define I40E_AQC_ADD_CLOUD_FLAGS_SHARED_OUTER_IP 0x8000
  1212. __le32 tenant_id;
  1213. u8 reserved[4];
  1214. __le16 queue_number;
  1215. #define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT 0
  1216. #define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x7FF << \
  1217. I40E_AQC_ADD_CLOUD_QUEUE_SHIFT)
  1218. u8 reserved2[14];
  1219. /* response section */
  1220. u8 allocation_result;
  1221. #define I40E_AQC_ADD_CLOUD_FILTER_SUCCESS 0x0
  1222. #define I40E_AQC_ADD_CLOUD_FILTER_FAIL 0xFF
  1223. u8 response_reserved[7];
  1224. };
  1225. struct i40e_aqc_remove_cloud_filters_completion {
  1226. __le16 perfect_ovlan_used;
  1227. __le16 perfect_ovlan_free;
  1228. __le16 vlan_used;
  1229. __le16 vlan_free;
  1230. __le32 addr_high;
  1231. __le32 addr_low;
  1232. };
  1233. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_cloud_filters_completion);
  1234. /* Add Mirror Rule (indirect or direct 0x0260)
  1235. * Delete Mirror Rule (indirect or direct 0x0261)
  1236. * note: some rule types (4,5) do not use an external buffer.
  1237. * take care to set the flags correctly.
  1238. */
  1239. struct i40e_aqc_add_delete_mirror_rule {
  1240. __le16 seid;
  1241. __le16 rule_type;
  1242. #define I40E_AQC_MIRROR_RULE_TYPE_SHIFT 0
  1243. #define I40E_AQC_MIRROR_RULE_TYPE_MASK (0x7 << \
  1244. I40E_AQC_MIRROR_RULE_TYPE_SHIFT)
  1245. #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_INGRESS 1
  1246. #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_EGRESS 2
  1247. #define I40E_AQC_MIRROR_RULE_TYPE_VLAN 3
  1248. #define I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS 4
  1249. #define I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS 5
  1250. __le16 num_entries;
  1251. __le16 destination; /* VSI for add, rule id for delete */
  1252. __le32 addr_high; /* address of array of 2-byte VSI or VLAN ids */
  1253. __le32 addr_low;
  1254. };
  1255. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule);
  1256. struct i40e_aqc_add_delete_mirror_rule_completion {
  1257. u8 reserved[2];
  1258. __le16 rule_id; /* only used on add */
  1259. __le16 mirror_rules_used;
  1260. __le16 mirror_rules_free;
  1261. __le32 addr_high;
  1262. __le32 addr_low;
  1263. };
  1264. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule_completion);
  1265. /* Pipeline Personalization Profile */
  1266. struct i40e_aqc_write_personalization_profile {
  1267. u8 flags;
  1268. u8 reserved[3];
  1269. __le32 profile_track_id;
  1270. __le32 addr_high;
  1271. __le32 addr_low;
  1272. };
  1273. I40E_CHECK_CMD_LENGTH(i40e_aqc_write_personalization_profile);
  1274. struct i40e_aqc_write_ppp_resp {
  1275. __le32 error_offset;
  1276. __le32 error_info;
  1277. __le32 addr_high;
  1278. __le32 addr_low;
  1279. };
  1280. struct i40e_aqc_get_applied_profiles {
  1281. u8 flags;
  1282. #define I40E_AQC_GET_PPP_GET_CONF 0x1
  1283. #define I40E_AQC_GET_PPP_GET_RDPU_CONF 0x2
  1284. u8 rsv[3];
  1285. __le32 reserved;
  1286. __le32 addr_high;
  1287. __le32 addr_low;
  1288. };
  1289. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_applied_profiles);
  1290. /* DCB 0x03xx*/
  1291. /* PFC Ignore (direct 0x0301)
  1292. * the command and response use the same descriptor structure
  1293. */
  1294. struct i40e_aqc_pfc_ignore {
  1295. u8 tc_bitmap;
  1296. u8 command_flags; /* unused on response */
  1297. #define I40E_AQC_PFC_IGNORE_SET 0x80
  1298. #define I40E_AQC_PFC_IGNORE_CLEAR 0x0
  1299. u8 reserved[14];
  1300. };
  1301. I40E_CHECK_CMD_LENGTH(i40e_aqc_pfc_ignore);
  1302. /* DCB Update (direct 0x0302) uses the i40e_aq_desc structure
  1303. * with no parameters
  1304. */
  1305. /* TX scheduler 0x04xx */
  1306. /* Almost all the indirect commands use
  1307. * this generic struct to pass the SEID in param0
  1308. */
  1309. struct i40e_aqc_tx_sched_ind {
  1310. __le16 vsi_seid;
  1311. u8 reserved[6];
  1312. __le32 addr_high;
  1313. __le32 addr_low;
  1314. };
  1315. I40E_CHECK_CMD_LENGTH(i40e_aqc_tx_sched_ind);
  1316. /* Several commands respond with a set of queue set handles */
  1317. struct i40e_aqc_qs_handles_resp {
  1318. __le16 qs_handles[8];
  1319. };
  1320. /* Configure VSI BW limits (direct 0x0400) */
  1321. struct i40e_aqc_configure_vsi_bw_limit {
  1322. __le16 vsi_seid;
  1323. u8 reserved[2];
  1324. __le16 credit;
  1325. u8 reserved1[2];
  1326. u8 max_credit; /* 0-3, limit = 2^max */
  1327. u8 reserved2[7];
  1328. };
  1329. I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_vsi_bw_limit);
  1330. /* Configure VSI Bandwidth Limit per Traffic Type (indirect 0x0406)
  1331. * responds with i40e_aqc_qs_handles_resp
  1332. */
  1333. struct i40e_aqc_configure_vsi_ets_sla_bw_data {
  1334. u8 tc_valid_bits;
  1335. u8 reserved[15];
  1336. __le16 tc_bw_credits[8]; /* FW writesback QS handles here */
  1337. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1338. __le16 tc_bw_max[2];
  1339. u8 reserved1[28];
  1340. };
  1341. I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_configure_vsi_ets_sla_bw_data);
  1342. /* Configure VSI Bandwidth Allocation per Traffic Type (indirect 0x0407)
  1343. * responds with i40e_aqc_qs_handles_resp
  1344. */
  1345. struct i40e_aqc_configure_vsi_tc_bw_data {
  1346. u8 tc_valid_bits;
  1347. u8 reserved[3];
  1348. u8 tc_bw_credits[8];
  1349. u8 reserved1[4];
  1350. __le16 qs_handles[8];
  1351. };
  1352. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_vsi_tc_bw_data);
  1353. /* Query vsi bw configuration (indirect 0x0408) */
  1354. struct i40e_aqc_query_vsi_bw_config_resp {
  1355. u8 tc_valid_bits;
  1356. u8 tc_suspended_bits;
  1357. u8 reserved[14];
  1358. __le16 qs_handles[8];
  1359. u8 reserved1[4];
  1360. __le16 port_bw_limit;
  1361. u8 reserved2[2];
  1362. u8 max_bw; /* 0-3, limit = 2^max */
  1363. u8 reserved3[23];
  1364. };
  1365. I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_vsi_bw_config_resp);
  1366. /* Query VSI Bandwidth Allocation per Traffic Type (indirect 0x040A) */
  1367. struct i40e_aqc_query_vsi_ets_sla_config_resp {
  1368. u8 tc_valid_bits;
  1369. u8 reserved[3];
  1370. u8 share_credits[8];
  1371. __le16 credits[8];
  1372. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1373. __le16 tc_bw_max[2];
  1374. };
  1375. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_vsi_ets_sla_config_resp);
  1376. /* Configure Switching Component Bandwidth Limit (direct 0x0410) */
  1377. struct i40e_aqc_configure_switching_comp_bw_limit {
  1378. __le16 seid;
  1379. u8 reserved[2];
  1380. __le16 credit;
  1381. u8 reserved1[2];
  1382. u8 max_bw; /* 0-3, limit = 2^max */
  1383. u8 reserved2[7];
  1384. };
  1385. I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_switching_comp_bw_limit);
  1386. /* Enable Physical Port ETS (indirect 0x0413)
  1387. * Modify Physical Port ETS (indirect 0x0414)
  1388. * Disable Physical Port ETS (indirect 0x0415)
  1389. */
  1390. struct i40e_aqc_configure_switching_comp_ets_data {
  1391. u8 reserved[4];
  1392. u8 tc_valid_bits;
  1393. u8 seepage;
  1394. #define I40E_AQ_ETS_SEEPAGE_EN_MASK 0x1
  1395. u8 tc_strict_priority_flags;
  1396. u8 reserved1[17];
  1397. u8 tc_bw_share_credits[8];
  1398. u8 reserved2[96];
  1399. };
  1400. I40E_CHECK_STRUCT_LEN(0x80, i40e_aqc_configure_switching_comp_ets_data);
  1401. /* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */
  1402. struct i40e_aqc_configure_switching_comp_ets_bw_limit_data {
  1403. u8 tc_valid_bits;
  1404. u8 reserved[15];
  1405. __le16 tc_bw_credit[8];
  1406. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1407. __le16 tc_bw_max[2];
  1408. u8 reserved1[28];
  1409. };
  1410. I40E_CHECK_STRUCT_LEN(0x40,
  1411. i40e_aqc_configure_switching_comp_ets_bw_limit_data);
  1412. /* Configure Switching Component Bandwidth Allocation per Tc
  1413. * (indirect 0x0417)
  1414. */
  1415. struct i40e_aqc_configure_switching_comp_bw_config_data {
  1416. u8 tc_valid_bits;
  1417. u8 reserved[2];
  1418. u8 absolute_credits; /* bool */
  1419. u8 tc_bw_share_credits[8];
  1420. u8 reserved1[20];
  1421. };
  1422. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_configure_switching_comp_bw_config_data);
  1423. /* Query Switching Component Configuration (indirect 0x0418) */
  1424. struct i40e_aqc_query_switching_comp_ets_config_resp {
  1425. u8 tc_valid_bits;
  1426. u8 reserved[35];
  1427. __le16 port_bw_limit;
  1428. u8 reserved1[2];
  1429. u8 tc_bw_max; /* 0-3, limit = 2^max */
  1430. u8 reserved2[23];
  1431. };
  1432. I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_query_switching_comp_ets_config_resp);
  1433. /* Query PhysicalPort ETS Configuration (indirect 0x0419) */
  1434. struct i40e_aqc_query_port_ets_config_resp {
  1435. u8 reserved[4];
  1436. u8 tc_valid_bits;
  1437. u8 reserved1;
  1438. u8 tc_strict_priority_bits;
  1439. u8 reserved2;
  1440. u8 tc_bw_share_credits[8];
  1441. __le16 tc_bw_limits[8];
  1442. /* 4 bits per tc 0-7, 4th bit reserved, limit = 2^max */
  1443. __le16 tc_bw_max[2];
  1444. u8 reserved3[32];
  1445. };
  1446. I40E_CHECK_STRUCT_LEN(0x44, i40e_aqc_query_port_ets_config_resp);
  1447. /* Query Switching Component Bandwidth Allocation per Traffic Type
  1448. * (indirect 0x041A)
  1449. */
  1450. struct i40e_aqc_query_switching_comp_bw_config_resp {
  1451. u8 tc_valid_bits;
  1452. u8 reserved[2];
  1453. u8 absolute_credits_enable; /* bool */
  1454. u8 tc_bw_share_credits[8];
  1455. __le16 tc_bw_limits[8];
  1456. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1457. __le16 tc_bw_max[2];
  1458. };
  1459. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_query_switching_comp_bw_config_resp);
  1460. /* Suspend/resume port TX traffic
  1461. * (direct 0x041B and 0x041C) uses the generic SEID struct
  1462. */
  1463. /* Configure partition BW
  1464. * (indirect 0x041D)
  1465. */
  1466. struct i40e_aqc_configure_partition_bw_data {
  1467. __le16 pf_valid_bits;
  1468. u8 min_bw[16]; /* guaranteed bandwidth */
  1469. u8 max_bw[16]; /* bandwidth limit */
  1470. };
  1471. I40E_CHECK_STRUCT_LEN(0x22, i40e_aqc_configure_partition_bw_data);
  1472. /* Get and set the active HMC resource profile and status.
  1473. * (direct 0x0500) and (direct 0x0501)
  1474. */
  1475. struct i40e_aq_get_set_hmc_resource_profile {
  1476. u8 pm_profile;
  1477. u8 pe_vf_enabled;
  1478. u8 reserved[14];
  1479. };
  1480. I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile);
  1481. enum i40e_aq_hmc_profile {
  1482. /* I40E_HMC_PROFILE_NO_CHANGE = 0, reserved */
  1483. I40E_HMC_PROFILE_DEFAULT = 1,
  1484. I40E_HMC_PROFILE_FAVOR_VF = 2,
  1485. I40E_HMC_PROFILE_EQUAL = 3,
  1486. };
  1487. /* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */
  1488. /* set in param0 for get phy abilities to report qualified modules */
  1489. #define I40E_AQ_PHY_REPORT_QUALIFIED_MODULES 0x0001
  1490. #define I40E_AQ_PHY_REPORT_INITIAL_VALUES 0x0002
  1491. enum i40e_aq_phy_type {
  1492. I40E_PHY_TYPE_SGMII = 0x0,
  1493. I40E_PHY_TYPE_1000BASE_KX = 0x1,
  1494. I40E_PHY_TYPE_10GBASE_KX4 = 0x2,
  1495. I40E_PHY_TYPE_10GBASE_KR = 0x3,
  1496. I40E_PHY_TYPE_40GBASE_KR4 = 0x4,
  1497. I40E_PHY_TYPE_XAUI = 0x5,
  1498. I40E_PHY_TYPE_XFI = 0x6,
  1499. I40E_PHY_TYPE_SFI = 0x7,
  1500. I40E_PHY_TYPE_XLAUI = 0x8,
  1501. I40E_PHY_TYPE_XLPPI = 0x9,
  1502. I40E_PHY_TYPE_40GBASE_CR4_CU = 0xA,
  1503. I40E_PHY_TYPE_10GBASE_CR1_CU = 0xB,
  1504. I40E_PHY_TYPE_10GBASE_AOC = 0xC,
  1505. I40E_PHY_TYPE_40GBASE_AOC = 0xD,
  1506. I40E_PHY_TYPE_100BASE_TX = 0x11,
  1507. I40E_PHY_TYPE_1000BASE_T = 0x12,
  1508. I40E_PHY_TYPE_10GBASE_T = 0x13,
  1509. I40E_PHY_TYPE_10GBASE_SR = 0x14,
  1510. I40E_PHY_TYPE_10GBASE_LR = 0x15,
  1511. I40E_PHY_TYPE_10GBASE_SFPP_CU = 0x16,
  1512. I40E_PHY_TYPE_10GBASE_CR1 = 0x17,
  1513. I40E_PHY_TYPE_40GBASE_CR4 = 0x18,
  1514. I40E_PHY_TYPE_40GBASE_SR4 = 0x19,
  1515. I40E_PHY_TYPE_40GBASE_LR4 = 0x1A,
  1516. I40E_PHY_TYPE_1000BASE_SX = 0x1B,
  1517. I40E_PHY_TYPE_1000BASE_LX = 0x1C,
  1518. I40E_PHY_TYPE_1000BASE_T_OPTICAL = 0x1D,
  1519. I40E_PHY_TYPE_20GBASE_KR2 = 0x1E,
  1520. I40E_PHY_TYPE_25GBASE_KR = 0x1F,
  1521. I40E_PHY_TYPE_25GBASE_CR = 0x20,
  1522. I40E_PHY_TYPE_25GBASE_SR = 0x21,
  1523. I40E_PHY_TYPE_25GBASE_LR = 0x22,
  1524. I40E_PHY_TYPE_MAX
  1525. };
  1526. #define I40E_LINK_SPEED_100MB_SHIFT 0x1
  1527. #define I40E_LINK_SPEED_1000MB_SHIFT 0x2
  1528. #define I40E_LINK_SPEED_10GB_SHIFT 0x3
  1529. #define I40E_LINK_SPEED_40GB_SHIFT 0x4
  1530. #define I40E_LINK_SPEED_20GB_SHIFT 0x5
  1531. #define I40E_LINK_SPEED_25GB_SHIFT 0x6
  1532. enum i40e_aq_link_speed {
  1533. I40E_LINK_SPEED_UNKNOWN = 0,
  1534. I40E_LINK_SPEED_100MB = BIT(I40E_LINK_SPEED_100MB_SHIFT),
  1535. I40E_LINK_SPEED_1GB = BIT(I40E_LINK_SPEED_1000MB_SHIFT),
  1536. I40E_LINK_SPEED_10GB = BIT(I40E_LINK_SPEED_10GB_SHIFT),
  1537. I40E_LINK_SPEED_40GB = BIT(I40E_LINK_SPEED_40GB_SHIFT),
  1538. I40E_LINK_SPEED_20GB = BIT(I40E_LINK_SPEED_20GB_SHIFT),
  1539. I40E_LINK_SPEED_25GB = BIT(I40E_LINK_SPEED_25GB_SHIFT),
  1540. };
  1541. struct i40e_aqc_module_desc {
  1542. u8 oui[3];
  1543. u8 reserved1;
  1544. u8 part_number[16];
  1545. u8 revision[4];
  1546. u8 reserved2[8];
  1547. };
  1548. I40E_CHECK_STRUCT_LEN(0x20, i40e_aqc_module_desc);
  1549. struct i40e_aq_get_phy_abilities_resp {
  1550. __le32 phy_type; /* bitmap using the above enum for offsets */
  1551. u8 link_speed; /* bitmap using the above enum bit patterns */
  1552. u8 abilities;
  1553. #define I40E_AQ_PHY_FLAG_PAUSE_TX 0x01
  1554. #define I40E_AQ_PHY_FLAG_PAUSE_RX 0x02
  1555. #define I40E_AQ_PHY_FLAG_LOW_POWER 0x04
  1556. #define I40E_AQ_PHY_LINK_ENABLED 0x08
  1557. #define I40E_AQ_PHY_AN_ENABLED 0x10
  1558. #define I40E_AQ_PHY_FLAG_MODULE_QUAL 0x20
  1559. #define I40E_AQ_PHY_FEC_ABILITY_KR 0x40
  1560. #define I40E_AQ_PHY_FEC_ABILITY_RS 0x80
  1561. __le16 eee_capability;
  1562. #define I40E_AQ_EEE_100BASE_TX 0x0002
  1563. #define I40E_AQ_EEE_1000BASE_T 0x0004
  1564. #define I40E_AQ_EEE_10GBASE_T 0x0008
  1565. #define I40E_AQ_EEE_1000BASE_KX 0x0010
  1566. #define I40E_AQ_EEE_10GBASE_KX4 0x0020
  1567. #define I40E_AQ_EEE_10GBASE_KR 0x0040
  1568. __le32 eeer_val;
  1569. u8 d3_lpan;
  1570. #define I40E_AQ_SET_PHY_D3_LPAN_ENA 0x01
  1571. u8 phy_type_ext;
  1572. #define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01
  1573. #define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02
  1574. #define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04
  1575. #define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08
  1576. u8 fec_cfg_curr_mod_ext_info;
  1577. #define I40E_AQ_ENABLE_FEC_KR 0x01
  1578. #define I40E_AQ_ENABLE_FEC_RS 0x02
  1579. #define I40E_AQ_REQUEST_FEC_KR 0x04
  1580. #define I40E_AQ_REQUEST_FEC_RS 0x08
  1581. #define I40E_AQ_ENABLE_FEC_AUTO 0x10
  1582. #define I40E_AQ_FEC
  1583. #define I40E_AQ_MODULE_TYPE_EXT_MASK 0xE0
  1584. #define I40E_AQ_MODULE_TYPE_EXT_SHIFT 5
  1585. u8 ext_comp_code;
  1586. u8 phy_id[4];
  1587. u8 module_type[3];
  1588. u8 qualified_module_count;
  1589. #define I40E_AQ_PHY_MAX_QMS 16
  1590. struct i40e_aqc_module_desc qualified_module[I40E_AQ_PHY_MAX_QMS];
  1591. };
  1592. I40E_CHECK_STRUCT_LEN(0x218, i40e_aq_get_phy_abilities_resp);
  1593. /* Set PHY Config (direct 0x0601) */
  1594. struct i40e_aq_set_phy_config { /* same bits as above in all */
  1595. __le32 phy_type;
  1596. u8 link_speed;
  1597. u8 abilities;
  1598. /* bits 0-2 use the values from get_phy_abilities_resp */
  1599. #define I40E_AQ_PHY_ENABLE_LINK 0x08
  1600. #define I40E_AQ_PHY_ENABLE_AN 0x10
  1601. #define I40E_AQ_PHY_ENABLE_ATOMIC_LINK 0x20
  1602. __le16 eee_capability;
  1603. __le32 eeer;
  1604. u8 low_power_ctrl;
  1605. u8 phy_type_ext;
  1606. #define I40E_AQ_PHY_TYPE_EXT_25G_KR 0X01
  1607. #define I40E_AQ_PHY_TYPE_EXT_25G_CR 0X02
  1608. #define I40E_AQ_PHY_TYPE_EXT_25G_SR 0x04
  1609. #define I40E_AQ_PHY_TYPE_EXT_25G_LR 0x08
  1610. u8 fec_config;
  1611. #define I40E_AQ_SET_FEC_ABILITY_KR BIT(0)
  1612. #define I40E_AQ_SET_FEC_ABILITY_RS BIT(1)
  1613. #define I40E_AQ_SET_FEC_REQUEST_KR BIT(2)
  1614. #define I40E_AQ_SET_FEC_REQUEST_RS BIT(3)
  1615. #define I40E_AQ_SET_FEC_AUTO BIT(4)
  1616. #define I40E_AQ_PHY_FEC_CONFIG_SHIFT 0x0
  1617. #define I40E_AQ_PHY_FEC_CONFIG_MASK (0x1F << I40E_AQ_PHY_FEC_CONFIG_SHIFT)
  1618. u8 reserved;
  1619. };
  1620. I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
  1621. /* Set MAC Config command data structure (direct 0x0603) */
  1622. struct i40e_aq_set_mac_config {
  1623. __le16 max_frame_size;
  1624. u8 params;
  1625. #define I40E_AQ_SET_MAC_CONFIG_CRC_EN 0x04
  1626. #define I40E_AQ_SET_MAC_CONFIG_PACING_MASK 0x78
  1627. #define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT 3
  1628. #define I40E_AQ_SET_MAC_CONFIG_PACING_NONE 0x0
  1629. #define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX 0xF
  1630. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX 0x9
  1631. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX 0x8
  1632. #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX 0x7
  1633. #define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX 0x6
  1634. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX 0x5
  1635. #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX 0x4
  1636. #define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX 0x3
  1637. #define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX 0x2
  1638. #define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX 0x1
  1639. u8 tx_timer_priority; /* bitmap */
  1640. __le16 tx_timer_value;
  1641. __le16 fc_refresh_threshold;
  1642. u8 reserved[8];
  1643. };
  1644. I40E_CHECK_CMD_LENGTH(i40e_aq_set_mac_config);
  1645. /* Restart Auto-Negotiation (direct 0x605) */
  1646. struct i40e_aqc_set_link_restart_an {
  1647. u8 command;
  1648. #define I40E_AQ_PHY_RESTART_AN 0x02
  1649. #define I40E_AQ_PHY_LINK_ENABLE 0x04
  1650. u8 reserved[15];
  1651. };
  1652. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_link_restart_an);
  1653. /* Get Link Status cmd & response data structure (direct 0x0607) */
  1654. struct i40e_aqc_get_link_status {
  1655. __le16 command_flags; /* only field set on command */
  1656. #define I40E_AQ_LSE_MASK 0x3
  1657. #define I40E_AQ_LSE_NOP 0x0
  1658. #define I40E_AQ_LSE_DISABLE 0x2
  1659. #define I40E_AQ_LSE_ENABLE 0x3
  1660. /* only response uses this flag */
  1661. #define I40E_AQ_LSE_IS_ENABLED 0x1
  1662. u8 phy_type; /* i40e_aq_phy_type */
  1663. u8 link_speed; /* i40e_aq_link_speed */
  1664. u8 link_info;
  1665. #define I40E_AQ_LINK_UP 0x01 /* obsolete */
  1666. #define I40E_AQ_LINK_UP_FUNCTION 0x01
  1667. #define I40E_AQ_LINK_FAULT 0x02
  1668. #define I40E_AQ_LINK_FAULT_TX 0x04
  1669. #define I40E_AQ_LINK_FAULT_RX 0x08
  1670. #define I40E_AQ_LINK_FAULT_REMOTE 0x10
  1671. #define I40E_AQ_LINK_UP_PORT 0x20
  1672. #define I40E_AQ_MEDIA_AVAILABLE 0x40
  1673. #define I40E_AQ_SIGNAL_DETECT 0x80
  1674. u8 an_info;
  1675. #define I40E_AQ_AN_COMPLETED 0x01
  1676. #define I40E_AQ_LP_AN_ABILITY 0x02
  1677. #define I40E_AQ_PD_FAULT 0x04
  1678. #define I40E_AQ_FEC_EN 0x08
  1679. #define I40E_AQ_PHY_LOW_POWER 0x10
  1680. #define I40E_AQ_LINK_PAUSE_TX 0x20
  1681. #define I40E_AQ_LINK_PAUSE_RX 0x40
  1682. #define I40E_AQ_QUALIFIED_MODULE 0x80
  1683. u8 ext_info;
  1684. #define I40E_AQ_LINK_PHY_TEMP_ALARM 0x01
  1685. #define I40E_AQ_LINK_XCESSIVE_ERRORS 0x02
  1686. #define I40E_AQ_LINK_TX_SHIFT 0x02
  1687. #define I40E_AQ_LINK_TX_MASK (0x03 << I40E_AQ_LINK_TX_SHIFT)
  1688. #define I40E_AQ_LINK_TX_ACTIVE 0x00
  1689. #define I40E_AQ_LINK_TX_DRAINED 0x01
  1690. #define I40E_AQ_LINK_TX_FLUSHED 0x03
  1691. #define I40E_AQ_LINK_FORCED_40G 0x10
  1692. /* 25G Error Codes */
  1693. #define I40E_AQ_25G_NO_ERR 0X00
  1694. #define I40E_AQ_25G_NOT_PRESENT 0X01
  1695. #define I40E_AQ_25G_NVM_CRC_ERR 0X02
  1696. #define I40E_AQ_25G_SBUS_UCODE_ERR 0X03
  1697. #define I40E_AQ_25G_SERDES_UCODE_ERR 0X04
  1698. #define I40E_AQ_25G_NIMB_UCODE_ERR 0X05
  1699. u8 loopback; /* use defines from i40e_aqc_set_lb_mode */
  1700. __le16 max_frame_size;
  1701. u8 config;
  1702. #define I40E_AQ_CONFIG_FEC_KR_ENA 0x01
  1703. #define I40E_AQ_CONFIG_FEC_RS_ENA 0x02
  1704. #define I40E_AQ_CONFIG_CRC_ENA 0x04
  1705. #define I40E_AQ_CONFIG_PACING_MASK 0x78
  1706. u8 power_desc;
  1707. #define I40E_AQ_LINK_POWER_CLASS_1 0x00
  1708. #define I40E_AQ_LINK_POWER_CLASS_2 0x01
  1709. #define I40E_AQ_LINK_POWER_CLASS_3 0x02
  1710. #define I40E_AQ_LINK_POWER_CLASS_4 0x03
  1711. #define I40E_AQ_PWR_CLASS_MASK 0x03
  1712. u8 reserved[4];
  1713. };
  1714. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_link_status);
  1715. /* Set event mask command (direct 0x613) */
  1716. struct i40e_aqc_set_phy_int_mask {
  1717. u8 reserved[8];
  1718. __le16 event_mask;
  1719. #define I40E_AQ_EVENT_LINK_UPDOWN 0x0002
  1720. #define I40E_AQ_EVENT_MEDIA_NA 0x0004
  1721. #define I40E_AQ_EVENT_LINK_FAULT 0x0008
  1722. #define I40E_AQ_EVENT_PHY_TEMP_ALARM 0x0010
  1723. #define I40E_AQ_EVENT_EXCESSIVE_ERRORS 0x0020
  1724. #define I40E_AQ_EVENT_SIGNAL_DETECT 0x0040
  1725. #define I40E_AQ_EVENT_AN_COMPLETED 0x0080
  1726. #define I40E_AQ_EVENT_MODULE_QUAL_FAIL 0x0100
  1727. #define I40E_AQ_EVENT_PORT_TX_SUSPENDED 0x0200
  1728. u8 reserved1[6];
  1729. };
  1730. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_int_mask);
  1731. /* Get Local AN advt register (direct 0x0614)
  1732. * Set Local AN advt register (direct 0x0615)
  1733. * Get Link Partner AN advt register (direct 0x0616)
  1734. */
  1735. struct i40e_aqc_an_advt_reg {
  1736. __le32 local_an_reg0;
  1737. __le16 local_an_reg1;
  1738. u8 reserved[10];
  1739. };
  1740. I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
  1741. /* Set Loopback mode (0x0618) */
  1742. struct i40e_aqc_set_lb_mode {
  1743. __le16 lb_mode;
  1744. #define I40E_AQ_LB_PHY_LOCAL 0x01
  1745. #define I40E_AQ_LB_PHY_REMOTE 0x02
  1746. #define I40E_AQ_LB_MAC_LOCAL 0x04
  1747. u8 reserved[14];
  1748. };
  1749. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);
  1750. /* Set PHY Debug command (0x0622) */
  1751. struct i40e_aqc_set_phy_debug {
  1752. u8 command_flags;
  1753. #define I40E_AQ_PHY_DEBUG_RESET_INTERNAL 0x02
  1754. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT 2
  1755. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_MASK (0x03 << \
  1756. I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT)
  1757. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE 0x00
  1758. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD 0x01
  1759. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT 0x02
  1760. #define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW 0x10
  1761. u8 reserved[15];
  1762. };
  1763. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_debug);
  1764. enum i40e_aq_phy_reg_type {
  1765. I40E_AQC_PHY_REG_INTERNAL = 0x1,
  1766. I40E_AQC_PHY_REG_EXERNAL_BASET = 0x2,
  1767. I40E_AQC_PHY_REG_EXERNAL_MODULE = 0x3
  1768. };
  1769. /* Run PHY Activity (0x0626) */
  1770. struct i40e_aqc_run_phy_activity {
  1771. __le16 activity_id;
  1772. u8 flags;
  1773. u8 reserved1;
  1774. __le32 control;
  1775. __le32 data;
  1776. u8 reserved2[4];
  1777. };
  1778. I40E_CHECK_CMD_LENGTH(i40e_aqc_run_phy_activity);
  1779. /* NVM Read command (indirect 0x0701)
  1780. * NVM Erase commands (direct 0x0702)
  1781. * NVM Update commands (indirect 0x0703)
  1782. */
  1783. struct i40e_aqc_nvm_update {
  1784. u8 command_flags;
  1785. #define I40E_AQ_NVM_LAST_CMD 0x01
  1786. #define I40E_AQ_NVM_FLASH_ONLY 0x80
  1787. u8 module_pointer;
  1788. __le16 length;
  1789. __le32 offset;
  1790. __le32 addr_high;
  1791. __le32 addr_low;
  1792. };
  1793. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update);
  1794. /* NVM Config Read (indirect 0x0704) */
  1795. struct i40e_aqc_nvm_config_read {
  1796. __le16 cmd_flags;
  1797. #define I40E_AQ_ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK 1
  1798. #define I40E_AQ_ANVM_READ_SINGLE_FEATURE 0
  1799. #define I40E_AQ_ANVM_READ_MULTIPLE_FEATURES 1
  1800. __le16 element_count;
  1801. __le16 element_id; /* Feature/field ID */
  1802. __le16 element_id_msw; /* MSWord of field ID */
  1803. __le32 address_high;
  1804. __le32 address_low;
  1805. };
  1806. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_read);
  1807. /* NVM Config Write (indirect 0x0705) */
  1808. struct i40e_aqc_nvm_config_write {
  1809. __le16 cmd_flags;
  1810. __le16 element_count;
  1811. u8 reserved[4];
  1812. __le32 address_high;
  1813. __le32 address_low;
  1814. };
  1815. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write);
  1816. /* Used for 0x0704 as well as for 0x0705 commands */
  1817. #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT 1
  1818. #define I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_MASK \
  1819. BIT(I40E_AQ_ANVM_FEATURE_OR_IMMEDIATE_SHIFT)
  1820. #define I40E_AQ_ANVM_FEATURE 0
  1821. #define I40E_AQ_ANVM_IMMEDIATE_FIELD BIT(FEATURE_OR_IMMEDIATE_SHIFT)
  1822. struct i40e_aqc_nvm_config_data_feature {
  1823. __le16 feature_id;
  1824. #define I40E_AQ_ANVM_FEATURE_OPTION_OEM_ONLY 0x01
  1825. #define I40E_AQ_ANVM_FEATURE_OPTION_DWORD_MAP 0x08
  1826. #define I40E_AQ_ANVM_FEATURE_OPTION_POR_CSR 0x10
  1827. __le16 feature_options;
  1828. __le16 feature_selection;
  1829. };
  1830. I40E_CHECK_STRUCT_LEN(0x6, i40e_aqc_nvm_config_data_feature);
  1831. struct i40e_aqc_nvm_config_data_immediate_field {
  1832. __le32 field_id;
  1833. __le32 field_value;
  1834. __le16 field_options;
  1835. __le16 reserved;
  1836. };
  1837. I40E_CHECK_STRUCT_LEN(0xc, i40e_aqc_nvm_config_data_immediate_field);
  1838. /* OEM Post Update (indirect 0x0720)
  1839. * no command data struct used
  1840. */
  1841. struct i40e_aqc_nvm_oem_post_update {
  1842. #define I40E_AQ_NVM_OEM_POST_UPDATE_EXTERNAL_DATA 0x01
  1843. u8 sel_data;
  1844. u8 reserved[7];
  1845. };
  1846. I40E_CHECK_STRUCT_LEN(0x8, i40e_aqc_nvm_oem_post_update);
  1847. struct i40e_aqc_nvm_oem_post_update_buffer {
  1848. u8 str_len;
  1849. u8 dev_addr;
  1850. __le16 eeprom_addr;
  1851. u8 data[36];
  1852. };
  1853. I40E_CHECK_STRUCT_LEN(0x28, i40e_aqc_nvm_oem_post_update_buffer);
  1854. /* Thermal Sensor (indirect 0x0721)
  1855. * read or set thermal sensor configs and values
  1856. * takes a sensor and command specific data buffer, not detailed here
  1857. */
  1858. struct i40e_aqc_thermal_sensor {
  1859. u8 sensor_action;
  1860. #define I40E_AQ_THERMAL_SENSOR_READ_CONFIG 0
  1861. #define I40E_AQ_THERMAL_SENSOR_SET_CONFIG 1
  1862. #define I40E_AQ_THERMAL_SENSOR_READ_TEMP 2
  1863. u8 reserved[7];
  1864. __le32 addr_high;
  1865. __le32 addr_low;
  1866. };
  1867. I40E_CHECK_CMD_LENGTH(i40e_aqc_thermal_sensor);
  1868. /* Send to PF command (indirect 0x0801) id is only used by PF
  1869. * Send to VF command (indirect 0x0802) id is only used by PF
  1870. * Send to Peer PF command (indirect 0x0803)
  1871. */
  1872. struct i40e_aqc_pf_vf_message {
  1873. __le32 id;
  1874. u8 reserved[4];
  1875. __le32 addr_high;
  1876. __le32 addr_low;
  1877. };
  1878. I40E_CHECK_CMD_LENGTH(i40e_aqc_pf_vf_message);
  1879. /* Alternate structure */
  1880. /* Direct write (direct 0x0900)
  1881. * Direct read (direct 0x0902)
  1882. */
  1883. struct i40e_aqc_alternate_write {
  1884. __le32 address0;
  1885. __le32 data0;
  1886. __le32 address1;
  1887. __le32 data1;
  1888. };
  1889. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write);
  1890. /* Indirect write (indirect 0x0901)
  1891. * Indirect read (indirect 0x0903)
  1892. */
  1893. struct i40e_aqc_alternate_ind_write {
  1894. __le32 address;
  1895. __le32 length;
  1896. __le32 addr_high;
  1897. __le32 addr_low;
  1898. };
  1899. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_ind_write);
  1900. /* Done alternate write (direct 0x0904)
  1901. * uses i40e_aq_desc
  1902. */
  1903. struct i40e_aqc_alternate_write_done {
  1904. __le16 cmd_flags;
  1905. #define I40E_AQ_ALTERNATE_MODE_BIOS_MASK 1
  1906. #define I40E_AQ_ALTERNATE_MODE_BIOS_LEGACY 0
  1907. #define I40E_AQ_ALTERNATE_MODE_BIOS_UEFI 1
  1908. #define I40E_AQ_ALTERNATE_RESET_NEEDED 2
  1909. u8 reserved[14];
  1910. };
  1911. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write_done);
  1912. /* Set OEM mode (direct 0x0905) */
  1913. struct i40e_aqc_alternate_set_mode {
  1914. __le32 mode;
  1915. #define I40E_AQ_ALTERNATE_MODE_NONE 0
  1916. #define I40E_AQ_ALTERNATE_MODE_OEM 1
  1917. u8 reserved[12];
  1918. };
  1919. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_set_mode);
  1920. /* Clear port Alternate RAM (direct 0x0906) uses i40e_aq_desc */
  1921. /* async events 0x10xx */
  1922. /* Lan Queue Overflow Event (direct, 0x1001) */
  1923. struct i40e_aqc_lan_overflow {
  1924. __le32 prtdcb_rupto;
  1925. __le32 otx_ctl;
  1926. u8 reserved[8];
  1927. };
  1928. I40E_CHECK_CMD_LENGTH(i40e_aqc_lan_overflow);
  1929. /* Get LLDP MIB (indirect 0x0A00) */
  1930. struct i40e_aqc_lldp_get_mib {
  1931. u8 type;
  1932. u8 reserved1;
  1933. #define I40E_AQ_LLDP_MIB_TYPE_MASK 0x3
  1934. #define I40E_AQ_LLDP_MIB_LOCAL 0x0
  1935. #define I40E_AQ_LLDP_MIB_REMOTE 0x1
  1936. #define I40E_AQ_LLDP_MIB_LOCAL_AND_REMOTE 0x2
  1937. #define I40E_AQ_LLDP_BRIDGE_TYPE_MASK 0xC
  1938. #define I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT 0x2
  1939. #define I40E_AQ_LLDP_BRIDGE_TYPE_NEAREST_BRIDGE 0x0
  1940. #define I40E_AQ_LLDP_BRIDGE_TYPE_NON_TPMR 0x1
  1941. #define I40E_AQ_LLDP_TX_SHIFT 0x4
  1942. #define I40E_AQ_LLDP_TX_MASK (0x03 << I40E_AQ_LLDP_TX_SHIFT)
  1943. /* TX pause flags use I40E_AQ_LINK_TX_* above */
  1944. __le16 local_len;
  1945. __le16 remote_len;
  1946. u8 reserved2[2];
  1947. __le32 addr_high;
  1948. __le32 addr_low;
  1949. };
  1950. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_get_mib);
  1951. /* Configure LLDP MIB Change Event (direct 0x0A01)
  1952. * also used for the event (with type in the command field)
  1953. */
  1954. struct i40e_aqc_lldp_update_mib {
  1955. u8 command;
  1956. #define I40E_AQ_LLDP_MIB_UPDATE_ENABLE 0x0
  1957. #define I40E_AQ_LLDP_MIB_UPDATE_DISABLE 0x1
  1958. u8 reserved[7];
  1959. __le32 addr_high;
  1960. __le32 addr_low;
  1961. };
  1962. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_mib);
  1963. /* Add LLDP TLV (indirect 0x0A02)
  1964. * Delete LLDP TLV (indirect 0x0A04)
  1965. */
  1966. struct i40e_aqc_lldp_add_tlv {
  1967. u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
  1968. u8 reserved1[1];
  1969. __le16 len;
  1970. u8 reserved2[4];
  1971. __le32 addr_high;
  1972. __le32 addr_low;
  1973. };
  1974. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_add_tlv);
  1975. /* Update LLDP TLV (indirect 0x0A03) */
  1976. struct i40e_aqc_lldp_update_tlv {
  1977. u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
  1978. u8 reserved;
  1979. __le16 old_len;
  1980. __le16 new_offset;
  1981. __le16 new_len;
  1982. __le32 addr_high;
  1983. __le32 addr_low;
  1984. };
  1985. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
  1986. /* Stop LLDP (direct 0x0A05) */
  1987. struct i40e_aqc_lldp_stop {
  1988. u8 command;
  1989. #define I40E_AQ_LLDP_AGENT_STOP 0x0
  1990. #define I40E_AQ_LLDP_AGENT_SHUTDOWN 0x1
  1991. u8 reserved[15];
  1992. };
  1993. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
  1994. /* Start LLDP (direct 0x0A06) */
  1995. struct i40e_aqc_lldp_start {
  1996. u8 command;
  1997. #define I40E_AQ_LLDP_AGENT_START 0x1
  1998. u8 reserved[15];
  1999. };
  2000. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_start);
  2001. /* Apply MIB changes (0x0A07)
  2002. * uses the generic struc as it contains no data
  2003. */
  2004. /* Add Udp Tunnel command and completion (direct 0x0B00) */
  2005. struct i40e_aqc_add_udp_tunnel {
  2006. __le16 udp_port;
  2007. u8 reserved0[3];
  2008. u8 protocol_type;
  2009. #define I40E_AQC_TUNNEL_TYPE_VXLAN 0x00
  2010. #define I40E_AQC_TUNNEL_TYPE_NGE 0x01
  2011. #define I40E_AQC_TUNNEL_TYPE_TEREDO 0x10
  2012. #define I40E_AQC_TUNNEL_TYPE_VXLAN_GPE 0x11
  2013. u8 reserved1[10];
  2014. };
  2015. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel);
  2016. struct i40e_aqc_add_udp_tunnel_completion {
  2017. __le16 udp_port;
  2018. u8 filter_entry_index;
  2019. u8 multiple_pfs;
  2020. #define I40E_AQC_SINGLE_PF 0x0
  2021. #define I40E_AQC_MULTIPLE_PFS 0x1
  2022. u8 total_filters;
  2023. u8 reserved[11];
  2024. };
  2025. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel_completion);
  2026. /* remove UDP Tunnel command (0x0B01) */
  2027. struct i40e_aqc_remove_udp_tunnel {
  2028. u8 reserved[2];
  2029. u8 index; /* 0 to 15 */
  2030. u8 reserved2[13];
  2031. };
  2032. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_udp_tunnel);
  2033. struct i40e_aqc_del_udp_tunnel_completion {
  2034. __le16 udp_port;
  2035. u8 index; /* 0 to 15 */
  2036. u8 multiple_pfs;
  2037. u8 total_filters_used;
  2038. u8 reserved1[11];
  2039. };
  2040. I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion);
  2041. struct i40e_aqc_get_set_rss_key {
  2042. #define I40E_AQC_SET_RSS_KEY_VSI_VALID BIT(15)
  2043. #define I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT 0
  2044. #define I40E_AQC_SET_RSS_KEY_VSI_ID_MASK (0x3FF << \
  2045. I40E_AQC_SET_RSS_KEY_VSI_ID_SHIFT)
  2046. __le16 vsi_id;
  2047. u8 reserved[6];
  2048. __le32 addr_high;
  2049. __le32 addr_low;
  2050. };
  2051. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_set_rss_key);
  2052. struct i40e_aqc_get_set_rss_key_data {
  2053. u8 standard_rss_key[0x28];
  2054. u8 extended_hash_key[0xc];
  2055. };
  2056. I40E_CHECK_STRUCT_LEN(0x34, i40e_aqc_get_set_rss_key_data);
  2057. struct i40e_aqc_get_set_rss_lut {
  2058. #define I40E_AQC_SET_RSS_LUT_VSI_VALID BIT(15)
  2059. #define I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT 0
  2060. #define I40E_AQC_SET_RSS_LUT_VSI_ID_MASK (0x3FF << \
  2061. I40E_AQC_SET_RSS_LUT_VSI_ID_SHIFT)
  2062. __le16 vsi_id;
  2063. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT 0
  2064. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_MASK \
  2065. BIT(I40E_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT)
  2066. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_VSI 0
  2067. #define I40E_AQC_SET_RSS_LUT_TABLE_TYPE_PF 1
  2068. __le16 flags;
  2069. u8 reserved[4];
  2070. __le32 addr_high;
  2071. __le32 addr_low;
  2072. };
  2073. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_set_rss_lut);
  2074. /* tunnel key structure 0x0B10 */
  2075. struct i40e_aqc_tunnel_key_structure_A0 {
  2076. __le16 key1_off;
  2077. __le16 key1_len;
  2078. __le16 key2_off;
  2079. __le16 key2_len;
  2080. __le16 flags;
  2081. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE 0x01
  2082. /* response flags */
  2083. #define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS 0x01
  2084. #define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED 0x02
  2085. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN 0x03
  2086. u8 resreved[6];
  2087. };
  2088. I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure_A0);
  2089. struct i40e_aqc_tunnel_key_structure {
  2090. u8 key1_off;
  2091. u8 key2_off;
  2092. u8 key1_len; /* 0 to 15 */
  2093. u8 key2_len; /* 0 to 15 */
  2094. u8 flags;
  2095. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE 0x01
  2096. /* response flags */
  2097. #define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS 0x01
  2098. #define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED 0x02
  2099. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN 0x03
  2100. u8 network_key_index;
  2101. #define I40E_AQC_NETWORK_KEY_INDEX_VXLAN 0x0
  2102. #define I40E_AQC_NETWORK_KEY_INDEX_NGE 0x1
  2103. #define I40E_AQC_NETWORK_KEY_INDEX_FLEX_MAC_IN_UDP 0x2
  2104. #define I40E_AQC_NETWORK_KEY_INDEX_GRE 0x3
  2105. u8 reserved[10];
  2106. };
  2107. I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure);
  2108. /* OEM mode commands (direct 0xFE0x) */
  2109. struct i40e_aqc_oem_param_change {
  2110. __le32 param_type;
  2111. #define I40E_AQ_OEM_PARAM_TYPE_PF_CTL 0
  2112. #define I40E_AQ_OEM_PARAM_TYPE_BW_CTL 1
  2113. #define I40E_AQ_OEM_PARAM_MAC 2
  2114. __le32 param_value1;
  2115. __le16 param_value2;
  2116. u8 reserved[6];
  2117. };
  2118. I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change);
  2119. struct i40e_aqc_oem_state_change {
  2120. __le32 state;
  2121. #define I40E_AQ_OEM_STATE_LINK_DOWN 0x0
  2122. #define I40E_AQ_OEM_STATE_LINK_UP 0x1
  2123. u8 reserved[12];
  2124. };
  2125. I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_state_change);
  2126. /* Initialize OCSD (0xFE02, direct) */
  2127. struct i40e_aqc_opc_oem_ocsd_initialize {
  2128. u8 type_status;
  2129. u8 reserved1[3];
  2130. __le32 ocsd_memory_block_addr_high;
  2131. __le32 ocsd_memory_block_addr_low;
  2132. __le32 requested_update_interval;
  2133. };
  2134. I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocsd_initialize);
  2135. /* Initialize OCBB (0xFE03, direct) */
  2136. struct i40e_aqc_opc_oem_ocbb_initialize {
  2137. u8 type_status;
  2138. u8 reserved1[3];
  2139. __le32 ocbb_memory_block_addr_high;
  2140. __le32 ocbb_memory_block_addr_low;
  2141. u8 reserved2[4];
  2142. };
  2143. I40E_CHECK_CMD_LENGTH(i40e_aqc_opc_oem_ocbb_initialize);
  2144. /* debug commands */
  2145. /* get device id (0xFF00) uses the generic structure */
  2146. /* set test more (0xFF01, internal) */
  2147. struct i40e_acq_set_test_mode {
  2148. u8 mode;
  2149. #define I40E_AQ_TEST_PARTIAL 0
  2150. #define I40E_AQ_TEST_FULL 1
  2151. #define I40E_AQ_TEST_NVM 2
  2152. u8 reserved[3];
  2153. u8 command;
  2154. #define I40E_AQ_TEST_OPEN 0
  2155. #define I40E_AQ_TEST_CLOSE 1
  2156. #define I40E_AQ_TEST_INC 2
  2157. u8 reserved2[3];
  2158. __le32 address_high;
  2159. __le32 address_low;
  2160. };
  2161. I40E_CHECK_CMD_LENGTH(i40e_acq_set_test_mode);
  2162. /* Debug Read Register command (0xFF03)
  2163. * Debug Write Register command (0xFF04)
  2164. */
  2165. struct i40e_aqc_debug_reg_read_write {
  2166. __le32 reserved;
  2167. __le32 address;
  2168. __le32 value_high;
  2169. __le32 value_low;
  2170. };
  2171. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_reg_read_write);
  2172. /* Scatter/gather Reg Read (indirect 0xFF05)
  2173. * Scatter/gather Reg Write (indirect 0xFF06)
  2174. */
  2175. /* i40e_aq_desc is used for the command */
  2176. struct i40e_aqc_debug_reg_sg_element_data {
  2177. __le32 address;
  2178. __le32 value;
  2179. };
  2180. /* Debug Modify register (direct 0xFF07) */
  2181. struct i40e_aqc_debug_modify_reg {
  2182. __le32 address;
  2183. __le32 value;
  2184. __le32 clear_mask;
  2185. __le32 set_mask;
  2186. };
  2187. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_reg);
  2188. /* dump internal data (0xFF08, indirect) */
  2189. #define I40E_AQ_CLUSTER_ID_AUX 0
  2190. #define I40E_AQ_CLUSTER_ID_SWITCH_FLU 1
  2191. #define I40E_AQ_CLUSTER_ID_TXSCHED 2
  2192. #define I40E_AQ_CLUSTER_ID_HMC 3
  2193. #define I40E_AQ_CLUSTER_ID_MAC0 4
  2194. #define I40E_AQ_CLUSTER_ID_MAC1 5
  2195. #define I40E_AQ_CLUSTER_ID_MAC2 6
  2196. #define I40E_AQ_CLUSTER_ID_MAC3 7
  2197. #define I40E_AQ_CLUSTER_ID_DCB 8
  2198. #define I40E_AQ_CLUSTER_ID_EMP_MEM 9
  2199. #define I40E_AQ_CLUSTER_ID_PKT_BUF 10
  2200. #define I40E_AQ_CLUSTER_ID_ALTRAM 11
  2201. struct i40e_aqc_debug_dump_internals {
  2202. u8 cluster_id;
  2203. u8 table_id;
  2204. __le16 data_size;
  2205. __le32 idx;
  2206. __le32 address_high;
  2207. __le32 address_low;
  2208. };
  2209. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_dump_internals);
  2210. struct i40e_aqc_debug_modify_internals {
  2211. u8 cluster_id;
  2212. u8 cluster_specific_params[7];
  2213. __le32 address_high;
  2214. __le32 address_low;
  2215. };
  2216. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
  2217. #endif /* _I40E_ADMINQ_CMD_H_ */