i40e_adminq_cmd.h 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173
  1. /*******************************************************************************
  2. *
  3. * Intel Ethernet Controller XL710 Family Linux Driver
  4. * Copyright(c) 2013 - 2014 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 0x0002
  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 (1 << I40E_AQ_FLAG_DD_SHIFT) /* 0x1 */
  75. #define I40E_AQ_FLAG_CMP (1 << I40E_AQ_FLAG_CMP_SHIFT) /* 0x2 */
  76. #define I40E_AQ_FLAG_ERR (1 << I40E_AQ_FLAG_ERR_SHIFT) /* 0x4 */
  77. #define I40E_AQ_FLAG_VFE (1 << I40E_AQ_FLAG_VFE_SHIFT) /* 0x8 */
  78. #define I40E_AQ_FLAG_LB (1 << I40E_AQ_FLAG_LB_SHIFT) /* 0x200 */
  79. #define I40E_AQ_FLAG_RD (1 << I40E_AQ_FLAG_RD_SHIFT) /* 0x400 */
  80. #define I40E_AQ_FLAG_VFC (1 << I40E_AQ_FLAG_VFC_SHIFT) /* 0x800 */
  81. #define I40E_AQ_FLAG_BUF (1 << I40E_AQ_FLAG_BUF_SHIFT) /* 0x1000 */
  82. #define I40E_AQ_FLAG_SI (1 << I40E_AQ_FLAG_SI_SHIFT) /* 0x2000 */
  83. #define I40E_AQ_FLAG_EI (1 << I40E_AQ_FLAG_EI_SHIFT) /* 0x4000 */
  84. #define I40E_AQ_FLAG_FE (1 << 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 because of 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. i40e_aqc_opc_set_cppm_configuration = 0x0103,
  124. i40e_aqc_opc_set_arp_proxy_entry = 0x0104,
  125. i40e_aqc_opc_set_ns_proxy_entry = 0x0105,
  126. /* LAA */
  127. i40e_aqc_opc_mng_laa = 0x0106, /* AQ obsolete */
  128. i40e_aqc_opc_mac_address_read = 0x0107,
  129. i40e_aqc_opc_mac_address_write = 0x0108,
  130. /* PXE */
  131. i40e_aqc_opc_clear_pxe_mode = 0x0110,
  132. /* internal switch commands */
  133. i40e_aqc_opc_get_switch_config = 0x0200,
  134. i40e_aqc_opc_add_statistics = 0x0201,
  135. i40e_aqc_opc_remove_statistics = 0x0202,
  136. i40e_aqc_opc_set_port_parameters = 0x0203,
  137. i40e_aqc_opc_get_switch_resource_alloc = 0x0204,
  138. i40e_aqc_opc_add_vsi = 0x0210,
  139. i40e_aqc_opc_update_vsi_parameters = 0x0211,
  140. i40e_aqc_opc_get_vsi_parameters = 0x0212,
  141. i40e_aqc_opc_add_pv = 0x0220,
  142. i40e_aqc_opc_update_pv_parameters = 0x0221,
  143. i40e_aqc_opc_get_pv_parameters = 0x0222,
  144. i40e_aqc_opc_add_veb = 0x0230,
  145. i40e_aqc_opc_update_veb_parameters = 0x0231,
  146. i40e_aqc_opc_get_veb_parameters = 0x0232,
  147. i40e_aqc_opc_delete_element = 0x0243,
  148. i40e_aqc_opc_add_macvlan = 0x0250,
  149. i40e_aqc_opc_remove_macvlan = 0x0251,
  150. i40e_aqc_opc_add_vlan = 0x0252,
  151. i40e_aqc_opc_remove_vlan = 0x0253,
  152. i40e_aqc_opc_set_vsi_promiscuous_modes = 0x0254,
  153. i40e_aqc_opc_add_tag = 0x0255,
  154. i40e_aqc_opc_remove_tag = 0x0256,
  155. i40e_aqc_opc_add_multicast_etag = 0x0257,
  156. i40e_aqc_opc_remove_multicast_etag = 0x0258,
  157. i40e_aqc_opc_update_tag = 0x0259,
  158. i40e_aqc_opc_add_control_packet_filter = 0x025A,
  159. i40e_aqc_opc_remove_control_packet_filter = 0x025B,
  160. i40e_aqc_opc_add_cloud_filters = 0x025C,
  161. i40e_aqc_opc_remove_cloud_filters = 0x025D,
  162. i40e_aqc_opc_add_mirror_rule = 0x0260,
  163. i40e_aqc_opc_delete_mirror_rule = 0x0261,
  164. /* DCB commands */
  165. i40e_aqc_opc_dcb_ignore_pfc = 0x0301,
  166. i40e_aqc_opc_dcb_updated = 0x0302,
  167. /* TX scheduler */
  168. i40e_aqc_opc_configure_vsi_bw_limit = 0x0400,
  169. i40e_aqc_opc_configure_vsi_ets_sla_bw_limit = 0x0406,
  170. i40e_aqc_opc_configure_vsi_tc_bw = 0x0407,
  171. i40e_aqc_opc_query_vsi_bw_config = 0x0408,
  172. i40e_aqc_opc_query_vsi_ets_sla_config = 0x040A,
  173. i40e_aqc_opc_configure_switching_comp_bw_limit = 0x0410,
  174. i40e_aqc_opc_enable_switching_comp_ets = 0x0413,
  175. i40e_aqc_opc_modify_switching_comp_ets = 0x0414,
  176. i40e_aqc_opc_disable_switching_comp_ets = 0x0415,
  177. i40e_aqc_opc_configure_switching_comp_ets_bw_limit = 0x0416,
  178. i40e_aqc_opc_configure_switching_comp_bw_config = 0x0417,
  179. i40e_aqc_opc_query_switching_comp_ets_config = 0x0418,
  180. i40e_aqc_opc_query_port_ets_config = 0x0419,
  181. i40e_aqc_opc_query_switching_comp_bw_config = 0x041A,
  182. i40e_aqc_opc_suspend_port_tx = 0x041B,
  183. i40e_aqc_opc_resume_port_tx = 0x041C,
  184. i40e_aqc_opc_configure_partition_bw = 0x041D,
  185. /* hmc */
  186. i40e_aqc_opc_query_hmc_resource_profile = 0x0500,
  187. i40e_aqc_opc_set_hmc_resource_profile = 0x0501,
  188. /* phy commands*/
  189. i40e_aqc_opc_get_phy_abilities = 0x0600,
  190. i40e_aqc_opc_set_phy_config = 0x0601,
  191. i40e_aqc_opc_set_mac_config = 0x0603,
  192. i40e_aqc_opc_set_link_restart_an = 0x0605,
  193. i40e_aqc_opc_get_link_status = 0x0607,
  194. i40e_aqc_opc_set_phy_int_mask = 0x0613,
  195. i40e_aqc_opc_get_local_advt_reg = 0x0614,
  196. i40e_aqc_opc_set_local_advt_reg = 0x0615,
  197. i40e_aqc_opc_get_partner_advt = 0x0616,
  198. i40e_aqc_opc_set_lb_modes = 0x0618,
  199. i40e_aqc_opc_get_phy_wol_caps = 0x0621,
  200. i40e_aqc_opc_set_phy_debug = 0x0622,
  201. i40e_aqc_opc_upload_ext_phy_fm = 0x0625,
  202. /* NVM commands */
  203. i40e_aqc_opc_nvm_read = 0x0701,
  204. i40e_aqc_opc_nvm_erase = 0x0702,
  205. i40e_aqc_opc_nvm_update = 0x0703,
  206. i40e_aqc_opc_nvm_config_read = 0x0704,
  207. i40e_aqc_opc_nvm_config_write = 0x0705,
  208. /* virtualization commands */
  209. i40e_aqc_opc_send_msg_to_pf = 0x0801,
  210. i40e_aqc_opc_send_msg_to_vf = 0x0802,
  211. i40e_aqc_opc_send_msg_to_peer = 0x0803,
  212. /* alternate structure */
  213. i40e_aqc_opc_alternate_write = 0x0900,
  214. i40e_aqc_opc_alternate_write_indirect = 0x0901,
  215. i40e_aqc_opc_alternate_read = 0x0902,
  216. i40e_aqc_opc_alternate_read_indirect = 0x0903,
  217. i40e_aqc_opc_alternate_write_done = 0x0904,
  218. i40e_aqc_opc_alternate_set_mode = 0x0905,
  219. i40e_aqc_opc_alternate_clear_port = 0x0906,
  220. /* LLDP commands */
  221. i40e_aqc_opc_lldp_get_mib = 0x0A00,
  222. i40e_aqc_opc_lldp_update_mib = 0x0A01,
  223. i40e_aqc_opc_lldp_add_tlv = 0x0A02,
  224. i40e_aqc_opc_lldp_update_tlv = 0x0A03,
  225. i40e_aqc_opc_lldp_delete_tlv = 0x0A04,
  226. i40e_aqc_opc_lldp_stop = 0x0A05,
  227. i40e_aqc_opc_lldp_start = 0x0A06,
  228. /* Tunnel commands */
  229. i40e_aqc_opc_add_udp_tunnel = 0x0B00,
  230. i40e_aqc_opc_del_udp_tunnel = 0x0B01,
  231. i40e_aqc_opc_tunnel_key_structure = 0x0B10,
  232. /* Async Events */
  233. i40e_aqc_opc_event_lan_overflow = 0x1001,
  234. /* OEM commands */
  235. i40e_aqc_opc_oem_parameter_change = 0xFE00,
  236. i40e_aqc_opc_oem_device_status_change = 0xFE01,
  237. /* debug commands */
  238. i40e_aqc_opc_debug_get_deviceid = 0xFF00,
  239. i40e_aqc_opc_debug_set_mode = 0xFF01,
  240. i40e_aqc_opc_debug_read_reg = 0xFF03,
  241. i40e_aqc_opc_debug_write_reg = 0xFF04,
  242. i40e_aqc_opc_debug_modify_reg = 0xFF07,
  243. i40e_aqc_opc_debug_dump_internals = 0xFF08,
  244. i40e_aqc_opc_debug_modify_internals = 0xFF09,
  245. };
  246. /* command structures and indirect data structures */
  247. /* Structure naming conventions:
  248. * - no suffix for direct command descriptor structures
  249. * - _data for indirect sent data
  250. * - _resp for indirect return data (data which is both will use _data)
  251. * - _completion for direct return data
  252. * - _element_ for repeated elements (may also be _data or _resp)
  253. *
  254. * Command structures are expected to overlay the params.raw member of the basic
  255. * descriptor, and as such cannot exceed 16 bytes in length.
  256. */
  257. /* This macro is used to generate a compilation error if a structure
  258. * is not exactly the correct length. It gives a divide by zero error if the
  259. * structure is not of the correct size, otherwise it creates an enum that is
  260. * never used.
  261. */
  262. #define I40E_CHECK_STRUCT_LEN(n, X) enum i40e_static_assert_enum_##X \
  263. { i40e_static_assert_##X = (n)/((sizeof(struct X) == (n)) ? 1 : 0) }
  264. /* This macro is used extensively to ensure that command structures are 16
  265. * bytes in length as they have to map to the raw array of that size.
  266. */
  267. #define I40E_CHECK_CMD_LENGTH(X) I40E_CHECK_STRUCT_LEN(16, X)
  268. /* internal (0x00XX) commands */
  269. /* Get version (direct 0x0001) */
  270. struct i40e_aqc_get_version {
  271. __le32 rom_ver;
  272. __le32 fw_build;
  273. __le16 fw_major;
  274. __le16 fw_minor;
  275. __le16 api_major;
  276. __le16 api_minor;
  277. };
  278. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_version);
  279. /* Send driver version (indirect 0x0002) */
  280. struct i40e_aqc_driver_version {
  281. u8 driver_major_ver;
  282. u8 driver_minor_ver;
  283. u8 driver_build_ver;
  284. u8 driver_subbuild_ver;
  285. u8 reserved[4];
  286. __le32 address_high;
  287. __le32 address_low;
  288. };
  289. I40E_CHECK_CMD_LENGTH(i40e_aqc_driver_version);
  290. /* Queue Shutdown (direct 0x0003) */
  291. struct i40e_aqc_queue_shutdown {
  292. __le32 driver_unloading;
  293. #define I40E_AQ_DRIVER_UNLOADING 0x1
  294. u8 reserved[12];
  295. };
  296. I40E_CHECK_CMD_LENGTH(i40e_aqc_queue_shutdown);
  297. /* Set PF context (0x0004, direct) */
  298. struct i40e_aqc_set_pf_context {
  299. u8 pf_id;
  300. u8 reserved[15];
  301. };
  302. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_pf_context);
  303. /* Request resource ownership (direct 0x0008)
  304. * Release resource ownership (direct 0x0009)
  305. */
  306. #define I40E_AQ_RESOURCE_NVM 1
  307. #define I40E_AQ_RESOURCE_SDP 2
  308. #define I40E_AQ_RESOURCE_ACCESS_READ 1
  309. #define I40E_AQ_RESOURCE_ACCESS_WRITE 2
  310. #define I40E_AQ_RESOURCE_NVM_READ_TIMEOUT 3000
  311. #define I40E_AQ_RESOURCE_NVM_WRITE_TIMEOUT 180000
  312. struct i40e_aqc_request_resource {
  313. __le16 resource_id;
  314. __le16 access_type;
  315. __le32 timeout;
  316. __le32 resource_number;
  317. u8 reserved[4];
  318. };
  319. I40E_CHECK_CMD_LENGTH(i40e_aqc_request_resource);
  320. /* Get function capabilities (indirect 0x000A)
  321. * Get device capabilities (indirect 0x000B)
  322. */
  323. struct i40e_aqc_list_capabilites {
  324. u8 command_flags;
  325. #define I40E_AQ_LIST_CAP_PF_INDEX_EN 1
  326. u8 pf_index;
  327. u8 reserved[2];
  328. __le32 count;
  329. __le32 addr_high;
  330. __le32 addr_low;
  331. };
  332. I40E_CHECK_CMD_LENGTH(i40e_aqc_list_capabilites);
  333. struct i40e_aqc_list_capabilities_element_resp {
  334. __le16 id;
  335. u8 major_rev;
  336. u8 minor_rev;
  337. __le32 number;
  338. __le32 logical_id;
  339. __le32 phys_id;
  340. u8 reserved[16];
  341. };
  342. /* list of caps */
  343. #define I40E_AQ_CAP_ID_SWITCH_MODE 0x0001
  344. #define I40E_AQ_CAP_ID_MNG_MODE 0x0002
  345. #define I40E_AQ_CAP_ID_NPAR_ACTIVE 0x0003
  346. #define I40E_AQ_CAP_ID_OS2BMC_CAP 0x0004
  347. #define I40E_AQ_CAP_ID_FUNCTIONS_VALID 0x0005
  348. #define I40E_AQ_CAP_ID_ALTERNATE_RAM 0x0006
  349. #define I40E_AQ_CAP_ID_SRIOV 0x0012
  350. #define I40E_AQ_CAP_ID_VF 0x0013
  351. #define I40E_AQ_CAP_ID_VMDQ 0x0014
  352. #define I40E_AQ_CAP_ID_8021QBG 0x0015
  353. #define I40E_AQ_CAP_ID_8021QBR 0x0016
  354. #define I40E_AQ_CAP_ID_VSI 0x0017
  355. #define I40E_AQ_CAP_ID_DCB 0x0018
  356. #define I40E_AQ_CAP_ID_FCOE 0x0021
  357. #define I40E_AQ_CAP_ID_RSS 0x0040
  358. #define I40E_AQ_CAP_ID_RXQ 0x0041
  359. #define I40E_AQ_CAP_ID_TXQ 0x0042
  360. #define I40E_AQ_CAP_ID_MSIX 0x0043
  361. #define I40E_AQ_CAP_ID_VF_MSIX 0x0044
  362. #define I40E_AQ_CAP_ID_FLOW_DIRECTOR 0x0045
  363. #define I40E_AQ_CAP_ID_1588 0x0046
  364. #define I40E_AQ_CAP_ID_IWARP 0x0051
  365. #define I40E_AQ_CAP_ID_LED 0x0061
  366. #define I40E_AQ_CAP_ID_SDP 0x0062
  367. #define I40E_AQ_CAP_ID_MDIO 0x0063
  368. #define I40E_AQ_CAP_ID_FLEX10 0x00F1
  369. #define I40E_AQ_CAP_ID_CEM 0x00F2
  370. /* Set CPPM Configuration (direct 0x0103) */
  371. struct i40e_aqc_cppm_configuration {
  372. __le16 command_flags;
  373. #define I40E_AQ_CPPM_EN_LTRC 0x0800
  374. #define I40E_AQ_CPPM_EN_DMCTH 0x1000
  375. #define I40E_AQ_CPPM_EN_DMCTLX 0x2000
  376. #define I40E_AQ_CPPM_EN_HPTC 0x4000
  377. #define I40E_AQ_CPPM_EN_DMARC 0x8000
  378. __le16 ttlx;
  379. __le32 dmacr;
  380. __le16 dmcth;
  381. u8 hptc;
  382. u8 reserved;
  383. __le32 pfltrc;
  384. };
  385. I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration);
  386. /* Set ARP Proxy command / response (indirect 0x0104) */
  387. struct i40e_aqc_arp_proxy_data {
  388. __le16 command_flags;
  389. #define I40E_AQ_ARP_INIT_IPV4 0x0008
  390. #define I40E_AQ_ARP_UNSUP_CTL 0x0010
  391. #define I40E_AQ_ARP_ENA 0x0020
  392. #define I40E_AQ_ARP_ADD_IPV4 0x0040
  393. #define I40E_AQ_ARP_DEL_IPV4 0x0080
  394. __le16 table_id;
  395. __le32 pfpm_proxyfc;
  396. __le32 ip_addr;
  397. u8 mac_addr[6];
  398. };
  399. /* Set NS Proxy Table Entry Command (indirect 0x0105) */
  400. struct i40e_aqc_ns_proxy_data {
  401. __le16 table_idx_mac_addr_0;
  402. __le16 table_idx_mac_addr_1;
  403. __le16 table_idx_ipv6_0;
  404. __le16 table_idx_ipv6_1;
  405. __le16 control;
  406. #define I40E_AQ_NS_PROXY_ADD_0 0x0100
  407. #define I40E_AQ_NS_PROXY_DEL_0 0x0200
  408. #define I40E_AQ_NS_PROXY_ADD_1 0x0400
  409. #define I40E_AQ_NS_PROXY_DEL_1 0x0800
  410. #define I40E_AQ_NS_PROXY_ADD_IPV6_0 0x1000
  411. #define I40E_AQ_NS_PROXY_DEL_IPV6_0 0x2000
  412. #define I40E_AQ_NS_PROXY_ADD_IPV6_1 0x4000
  413. #define I40E_AQ_NS_PROXY_DEL_IPV6_1 0x8000
  414. #define I40E_AQ_NS_PROXY_COMMAND_SEQ 0x0001
  415. #define I40E_AQ_NS_PROXY_INIT_IPV6_TBL 0x0002
  416. #define I40E_AQ_NS_PROXY_INIT_MAC_TBL 0x0004
  417. u8 mac_addr_0[6];
  418. u8 mac_addr_1[6];
  419. u8 local_mac_addr[6];
  420. u8 ipv6_addr_0[16]; /* Warning! spec specifies BE byte order */
  421. u8 ipv6_addr_1[16];
  422. };
  423. /* Manage LAA Command (0x0106) - obsolete */
  424. struct i40e_aqc_mng_laa {
  425. __le16 command_flags;
  426. #define I40E_AQ_LAA_FLAG_WR 0x8000
  427. u8 reserved[2];
  428. __le32 sal;
  429. __le16 sah;
  430. u8 reserved2[6];
  431. };
  432. /* Manage MAC Address Read Command (indirect 0x0107) */
  433. struct i40e_aqc_mac_address_read {
  434. __le16 command_flags;
  435. #define I40E_AQC_LAN_ADDR_VALID 0x10
  436. #define I40E_AQC_SAN_ADDR_VALID 0x20
  437. #define I40E_AQC_PORT_ADDR_VALID 0x40
  438. #define I40E_AQC_WOL_ADDR_VALID 0x80
  439. #define I40E_AQC_ADDR_VALID_MASK 0xf0
  440. u8 reserved[6];
  441. __le32 addr_high;
  442. __le32 addr_low;
  443. };
  444. I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_read);
  445. struct i40e_aqc_mac_address_read_data {
  446. u8 pf_lan_mac[6];
  447. u8 pf_san_mac[6];
  448. u8 port_mac[6];
  449. u8 pf_wol_mac[6];
  450. };
  451. I40E_CHECK_STRUCT_LEN(24, i40e_aqc_mac_address_read_data);
  452. /* Manage MAC Address Write Command (0x0108) */
  453. struct i40e_aqc_mac_address_write {
  454. __le16 command_flags;
  455. #define I40E_AQC_WRITE_TYPE_LAA_ONLY 0x0000
  456. #define I40E_AQC_WRITE_TYPE_LAA_WOL 0x4000
  457. #define I40E_AQC_WRITE_TYPE_PORT 0x8000
  458. #define I40E_AQC_WRITE_TYPE_MASK 0xc000
  459. __le16 mac_sah;
  460. __le32 mac_sal;
  461. u8 reserved[8];
  462. };
  463. I40E_CHECK_CMD_LENGTH(i40e_aqc_mac_address_write);
  464. /* PXE commands (0x011x) */
  465. /* Clear PXE Command and response (direct 0x0110) */
  466. struct i40e_aqc_clear_pxe {
  467. u8 rx_cnt;
  468. u8 reserved[15];
  469. };
  470. I40E_CHECK_CMD_LENGTH(i40e_aqc_clear_pxe);
  471. /* Switch configuration commands (0x02xx) */
  472. /* Used by many indirect commands that only pass an seid and a buffer in the
  473. * command
  474. */
  475. struct i40e_aqc_switch_seid {
  476. __le16 seid;
  477. u8 reserved[6];
  478. __le32 addr_high;
  479. __le32 addr_low;
  480. };
  481. I40E_CHECK_CMD_LENGTH(i40e_aqc_switch_seid);
  482. /* Get Switch Configuration command (indirect 0x0200)
  483. * uses i40e_aqc_switch_seid for the descriptor
  484. */
  485. struct i40e_aqc_get_switch_config_header_resp {
  486. __le16 num_reported;
  487. __le16 num_total;
  488. u8 reserved[12];
  489. };
  490. struct i40e_aqc_switch_config_element_resp {
  491. u8 element_type;
  492. #define I40E_AQ_SW_ELEM_TYPE_MAC 1
  493. #define I40E_AQ_SW_ELEM_TYPE_PF 2
  494. #define I40E_AQ_SW_ELEM_TYPE_VF 3
  495. #define I40E_AQ_SW_ELEM_TYPE_EMP 4
  496. #define I40E_AQ_SW_ELEM_TYPE_BMC 5
  497. #define I40E_AQ_SW_ELEM_TYPE_PV 16
  498. #define I40E_AQ_SW_ELEM_TYPE_VEB 17
  499. #define I40E_AQ_SW_ELEM_TYPE_PA 18
  500. #define I40E_AQ_SW_ELEM_TYPE_VSI 19
  501. u8 revision;
  502. #define I40E_AQ_SW_ELEM_REV_1 1
  503. __le16 seid;
  504. __le16 uplink_seid;
  505. __le16 downlink_seid;
  506. u8 reserved[3];
  507. u8 connection_type;
  508. #define I40E_AQ_CONN_TYPE_REGULAR 0x1
  509. #define I40E_AQ_CONN_TYPE_DEFAULT 0x2
  510. #define I40E_AQ_CONN_TYPE_CASCADED 0x3
  511. __le16 scheduler_id;
  512. __le16 element_info;
  513. };
  514. /* Get Switch Configuration (indirect 0x0200)
  515. * an array of elements are returned in the response buffer
  516. * the first in the array is the header, remainder are elements
  517. */
  518. struct i40e_aqc_get_switch_config_resp {
  519. struct i40e_aqc_get_switch_config_header_resp header;
  520. struct i40e_aqc_switch_config_element_resp element[1];
  521. };
  522. /* Add Statistics (direct 0x0201)
  523. * Remove Statistics (direct 0x0202)
  524. */
  525. struct i40e_aqc_add_remove_statistics {
  526. __le16 seid;
  527. __le16 vlan;
  528. __le16 stat_index;
  529. u8 reserved[10];
  530. };
  531. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_statistics);
  532. /* Set Port Parameters command (direct 0x0203) */
  533. struct i40e_aqc_set_port_parameters {
  534. __le16 command_flags;
  535. #define I40E_AQ_SET_P_PARAMS_SAVE_BAD_PACKETS 1
  536. #define I40E_AQ_SET_P_PARAMS_PAD_SHORT_PACKETS 2 /* must set! */
  537. #define I40E_AQ_SET_P_PARAMS_DOUBLE_VLAN_ENA 4
  538. __le16 bad_frame_vsi;
  539. __le16 default_seid; /* reserved for command */
  540. u8 reserved[10];
  541. };
  542. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_port_parameters);
  543. /* Get Switch Resource Allocation (indirect 0x0204) */
  544. struct i40e_aqc_get_switch_resource_alloc {
  545. u8 num_entries; /* reserved for command */
  546. u8 reserved[7];
  547. __le32 addr_high;
  548. __le32 addr_low;
  549. };
  550. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_switch_resource_alloc);
  551. /* expect an array of these structs in the response buffer */
  552. struct i40e_aqc_switch_resource_alloc_element_resp {
  553. u8 resource_type;
  554. #define I40E_AQ_RESOURCE_TYPE_VEB 0x0
  555. #define I40E_AQ_RESOURCE_TYPE_VSI 0x1
  556. #define I40E_AQ_RESOURCE_TYPE_MACADDR 0x2
  557. #define I40E_AQ_RESOURCE_TYPE_STAG 0x3
  558. #define I40E_AQ_RESOURCE_TYPE_ETAG 0x4
  559. #define I40E_AQ_RESOURCE_TYPE_MULTICAST_HASH 0x5
  560. #define I40E_AQ_RESOURCE_TYPE_UNICAST_HASH 0x6
  561. #define I40E_AQ_RESOURCE_TYPE_VLAN 0x7
  562. #define I40E_AQ_RESOURCE_TYPE_VSI_LIST_ENTRY 0x8
  563. #define I40E_AQ_RESOURCE_TYPE_ETAG_LIST_ENTRY 0x9
  564. #define I40E_AQ_RESOURCE_TYPE_VLAN_STAT_POOL 0xA
  565. #define I40E_AQ_RESOURCE_TYPE_MIRROR_RULE 0xB
  566. #define I40E_AQ_RESOURCE_TYPE_QUEUE_SETS 0xC
  567. #define I40E_AQ_RESOURCE_TYPE_VLAN_FILTERS 0xD
  568. #define I40E_AQ_RESOURCE_TYPE_INNER_MAC_FILTERS 0xF
  569. #define I40E_AQ_RESOURCE_TYPE_IP_FILTERS 0x10
  570. #define I40E_AQ_RESOURCE_TYPE_GRE_VN_KEYS 0x11
  571. #define I40E_AQ_RESOURCE_TYPE_VN2_KEYS 0x12
  572. #define I40E_AQ_RESOURCE_TYPE_TUNNEL_PORTS 0x13
  573. u8 reserved1;
  574. __le16 guaranteed;
  575. __le16 total;
  576. __le16 used;
  577. __le16 total_unalloced;
  578. u8 reserved2[6];
  579. };
  580. /* Add VSI (indirect 0x0210)
  581. * this indirect command uses struct i40e_aqc_vsi_properties_data
  582. * as the indirect buffer (128 bytes)
  583. *
  584. * Update VSI (indirect 0x211)
  585. * uses the same data structure as Add VSI
  586. *
  587. * Get VSI (indirect 0x0212)
  588. * uses the same completion and data structure as Add VSI
  589. */
  590. struct i40e_aqc_add_get_update_vsi {
  591. __le16 uplink_seid;
  592. u8 connection_type;
  593. #define I40E_AQ_VSI_CONN_TYPE_NORMAL 0x1
  594. #define I40E_AQ_VSI_CONN_TYPE_DEFAULT 0x2
  595. #define I40E_AQ_VSI_CONN_TYPE_CASCADED 0x3
  596. u8 reserved1;
  597. u8 vf_id;
  598. u8 reserved2;
  599. __le16 vsi_flags;
  600. #define I40E_AQ_VSI_TYPE_SHIFT 0x0
  601. #define I40E_AQ_VSI_TYPE_MASK (0x3 << I40E_AQ_VSI_TYPE_SHIFT)
  602. #define I40E_AQ_VSI_TYPE_VF 0x0
  603. #define I40E_AQ_VSI_TYPE_VMDQ2 0x1
  604. #define I40E_AQ_VSI_TYPE_PF 0x2
  605. #define I40E_AQ_VSI_TYPE_EMP_MNG 0x3
  606. #define I40E_AQ_VSI_FLAG_CASCADED_PV 0x4
  607. __le32 addr_high;
  608. __le32 addr_low;
  609. };
  610. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi);
  611. struct i40e_aqc_add_get_update_vsi_completion {
  612. __le16 seid;
  613. __le16 vsi_number;
  614. __le16 vsi_used;
  615. __le16 vsi_free;
  616. __le32 addr_high;
  617. __le32 addr_low;
  618. };
  619. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_get_update_vsi_completion);
  620. struct i40e_aqc_vsi_properties_data {
  621. /* first 96 byte are written by SW */
  622. __le16 valid_sections;
  623. #define I40E_AQ_VSI_PROP_SWITCH_VALID 0x0001
  624. #define I40E_AQ_VSI_PROP_SECURITY_VALID 0x0002
  625. #define I40E_AQ_VSI_PROP_VLAN_VALID 0x0004
  626. #define I40E_AQ_VSI_PROP_CAS_PV_VALID 0x0008
  627. #define I40E_AQ_VSI_PROP_INGRESS_UP_VALID 0x0010
  628. #define I40E_AQ_VSI_PROP_EGRESS_UP_VALID 0x0020
  629. #define I40E_AQ_VSI_PROP_QUEUE_MAP_VALID 0x0040
  630. #define I40E_AQ_VSI_PROP_QUEUE_OPT_VALID 0x0080
  631. #define I40E_AQ_VSI_PROP_OUTER_UP_VALID 0x0100
  632. #define I40E_AQ_VSI_PROP_SCHED_VALID 0x0200
  633. /* switch section */
  634. __le16 switch_id; /* 12bit id combined with flags below */
  635. #define I40E_AQ_VSI_SW_ID_SHIFT 0x0000
  636. #define I40E_AQ_VSI_SW_ID_MASK (0xFFF << I40E_AQ_VSI_SW_ID_SHIFT)
  637. #define I40E_AQ_VSI_SW_ID_FLAG_NOT_STAG 0x1000
  638. #define I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB 0x2000
  639. #define I40E_AQ_VSI_SW_ID_FLAG_LOCAL_LB 0x4000
  640. u8 sw_reserved[2];
  641. /* security section */
  642. u8 sec_flags;
  643. #define I40E_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD 0x01
  644. #define I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK 0x02
  645. #define I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK 0x04
  646. u8 sec_reserved;
  647. /* VLAN section */
  648. __le16 pvid; /* VLANS include priority bits */
  649. __le16 fcoe_pvid;
  650. u8 port_vlan_flags;
  651. #define I40E_AQ_VSI_PVLAN_MODE_SHIFT 0x00
  652. #define I40E_AQ_VSI_PVLAN_MODE_MASK (0x03 << \
  653. I40E_AQ_VSI_PVLAN_MODE_SHIFT)
  654. #define I40E_AQ_VSI_PVLAN_MODE_TAGGED 0x01
  655. #define I40E_AQ_VSI_PVLAN_MODE_UNTAGGED 0x02
  656. #define I40E_AQ_VSI_PVLAN_MODE_ALL 0x03
  657. #define I40E_AQ_VSI_PVLAN_INSERT_PVID 0x04
  658. #define I40E_AQ_VSI_PVLAN_EMOD_SHIFT 0x03
  659. #define I40E_AQ_VSI_PVLAN_EMOD_MASK (0x3 << \
  660. I40E_AQ_VSI_PVLAN_EMOD_SHIFT)
  661. #define I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH 0x0
  662. #define I40E_AQ_VSI_PVLAN_EMOD_STR_UP 0x08
  663. #define I40E_AQ_VSI_PVLAN_EMOD_STR 0x10
  664. #define I40E_AQ_VSI_PVLAN_EMOD_NOTHING 0x18
  665. u8 pvlan_reserved[3];
  666. /* ingress egress up sections */
  667. __le32 ingress_table; /* bitmap, 3 bits per up */
  668. #define I40E_AQ_VSI_UP_TABLE_UP0_SHIFT 0
  669. #define I40E_AQ_VSI_UP_TABLE_UP0_MASK (0x7 << \
  670. I40E_AQ_VSI_UP_TABLE_UP0_SHIFT)
  671. #define I40E_AQ_VSI_UP_TABLE_UP1_SHIFT 3
  672. #define I40E_AQ_VSI_UP_TABLE_UP1_MASK (0x7 << \
  673. I40E_AQ_VSI_UP_TABLE_UP1_SHIFT)
  674. #define I40E_AQ_VSI_UP_TABLE_UP2_SHIFT 6
  675. #define I40E_AQ_VSI_UP_TABLE_UP2_MASK (0x7 << \
  676. I40E_AQ_VSI_UP_TABLE_UP2_SHIFT)
  677. #define I40E_AQ_VSI_UP_TABLE_UP3_SHIFT 9
  678. #define I40E_AQ_VSI_UP_TABLE_UP3_MASK (0x7 << \
  679. I40E_AQ_VSI_UP_TABLE_UP3_SHIFT)
  680. #define I40E_AQ_VSI_UP_TABLE_UP4_SHIFT 12
  681. #define I40E_AQ_VSI_UP_TABLE_UP4_MASK (0x7 << \
  682. I40E_AQ_VSI_UP_TABLE_UP4_SHIFT)
  683. #define I40E_AQ_VSI_UP_TABLE_UP5_SHIFT 15
  684. #define I40E_AQ_VSI_UP_TABLE_UP5_MASK (0x7 << \
  685. I40E_AQ_VSI_UP_TABLE_UP5_SHIFT)
  686. #define I40E_AQ_VSI_UP_TABLE_UP6_SHIFT 18
  687. #define I40E_AQ_VSI_UP_TABLE_UP6_MASK (0x7 << \
  688. I40E_AQ_VSI_UP_TABLE_UP6_SHIFT)
  689. #define I40E_AQ_VSI_UP_TABLE_UP7_SHIFT 21
  690. #define I40E_AQ_VSI_UP_TABLE_UP7_MASK (0x7 << \
  691. I40E_AQ_VSI_UP_TABLE_UP7_SHIFT)
  692. __le32 egress_table; /* same defines as for ingress table */
  693. /* cascaded PV section */
  694. __le16 cas_pv_tag;
  695. u8 cas_pv_flags;
  696. #define I40E_AQ_VSI_CAS_PV_TAGX_SHIFT 0x00
  697. #define I40E_AQ_VSI_CAS_PV_TAGX_MASK (0x03 << \
  698. I40E_AQ_VSI_CAS_PV_TAGX_SHIFT)
  699. #define I40E_AQ_VSI_CAS_PV_TAGX_LEAVE 0x00
  700. #define I40E_AQ_VSI_CAS_PV_TAGX_REMOVE 0x01
  701. #define I40E_AQ_VSI_CAS_PV_TAGX_COPY 0x02
  702. #define I40E_AQ_VSI_CAS_PV_INSERT_TAG 0x10
  703. #define I40E_AQ_VSI_CAS_PV_ETAG_PRUNE 0x20
  704. #define I40E_AQ_VSI_CAS_PV_ACCEPT_HOST_TAG 0x40
  705. u8 cas_pv_reserved;
  706. /* queue mapping section */
  707. __le16 mapping_flags;
  708. #define I40E_AQ_VSI_QUE_MAP_CONTIG 0x0
  709. #define I40E_AQ_VSI_QUE_MAP_NONCONTIG 0x1
  710. __le16 queue_mapping[16];
  711. #define I40E_AQ_VSI_QUEUE_SHIFT 0x0
  712. #define I40E_AQ_VSI_QUEUE_MASK (0x7FF << I40E_AQ_VSI_QUEUE_SHIFT)
  713. __le16 tc_mapping[8];
  714. #define I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT 0
  715. #define I40E_AQ_VSI_TC_QUE_OFFSET_MASK (0x1FF << \
  716. I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT)
  717. #define I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT 9
  718. #define I40E_AQ_VSI_TC_QUE_NUMBER_MASK (0x7 << \
  719. I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT)
  720. /* queueing option section */
  721. u8 queueing_opt_flags;
  722. #define I40E_AQ_VSI_QUE_OPT_TCP_ENA 0x10
  723. #define I40E_AQ_VSI_QUE_OPT_FCOE_ENA 0x20
  724. u8 queueing_opt_reserved[3];
  725. /* scheduler section */
  726. u8 up_enable_bits;
  727. u8 sched_reserved;
  728. /* outer up section */
  729. __le32 outer_up_table; /* same structure and defines as ingress table */
  730. u8 cmd_reserved[8];
  731. /* last 32 bytes are written by FW */
  732. __le16 qs_handle[8];
  733. #define I40E_AQ_VSI_QS_HANDLE_INVALID 0xFFFF
  734. __le16 stat_counter_idx;
  735. __le16 sched_id;
  736. u8 resp_reserved[12];
  737. };
  738. I40E_CHECK_STRUCT_LEN(128, i40e_aqc_vsi_properties_data);
  739. /* Add Port Virtualizer (direct 0x0220)
  740. * also used for update PV (direct 0x0221) but only flags are used
  741. * (IS_CTRL_PORT only works on add PV)
  742. */
  743. struct i40e_aqc_add_update_pv {
  744. __le16 command_flags;
  745. #define I40E_AQC_PV_FLAG_PV_TYPE 0x1
  746. #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_STAG_EN 0x2
  747. #define I40E_AQC_PV_FLAG_FWD_UNKNOWN_ETAG_EN 0x4
  748. #define I40E_AQC_PV_FLAG_IS_CTRL_PORT 0x8
  749. __le16 uplink_seid;
  750. __le16 connected_seid;
  751. u8 reserved[10];
  752. };
  753. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv);
  754. struct i40e_aqc_add_update_pv_completion {
  755. /* reserved for update; for add also encodes error if rc == ENOSPC */
  756. __le16 pv_seid;
  757. #define I40E_AQC_PV_ERR_FLAG_NO_PV 0x1
  758. #define I40E_AQC_PV_ERR_FLAG_NO_SCHED 0x2
  759. #define I40E_AQC_PV_ERR_FLAG_NO_COUNTER 0x4
  760. #define I40E_AQC_PV_ERR_FLAG_NO_ENTRY 0x8
  761. u8 reserved[14];
  762. };
  763. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_update_pv_completion);
  764. /* Get PV Params (direct 0x0222)
  765. * uses i40e_aqc_switch_seid for the descriptor
  766. */
  767. struct i40e_aqc_get_pv_params_completion {
  768. __le16 seid;
  769. __le16 default_stag;
  770. __le16 pv_flags; /* same flags as add_pv */
  771. #define I40E_AQC_GET_PV_PV_TYPE 0x1
  772. #define I40E_AQC_GET_PV_FRWD_UNKNOWN_STAG 0x2
  773. #define I40E_AQC_GET_PV_FRWD_UNKNOWN_ETAG 0x4
  774. u8 reserved[8];
  775. __le16 default_port_seid;
  776. };
  777. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_pv_params_completion);
  778. /* Add VEB (direct 0x0230) */
  779. struct i40e_aqc_add_veb {
  780. __le16 uplink_seid;
  781. __le16 downlink_seid;
  782. __le16 veb_flags;
  783. #define I40E_AQC_ADD_VEB_FLOATING 0x1
  784. #define I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT 1
  785. #define I40E_AQC_ADD_VEB_PORT_TYPE_MASK (0x3 << \
  786. I40E_AQC_ADD_VEB_PORT_TYPE_SHIFT)
  787. #define I40E_AQC_ADD_VEB_PORT_TYPE_DEFAULT 0x2
  788. #define I40E_AQC_ADD_VEB_PORT_TYPE_DATA 0x4
  789. #define I40E_AQC_ADD_VEB_ENABLE_L2_FILTER 0x8
  790. u8 enable_tcs;
  791. u8 reserved[9];
  792. };
  793. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb);
  794. struct i40e_aqc_add_veb_completion {
  795. u8 reserved[6];
  796. __le16 switch_seid;
  797. /* also encodes error if rc == ENOSPC; codes are the same as add_pv */
  798. __le16 veb_seid;
  799. #define I40E_AQC_VEB_ERR_FLAG_NO_VEB 0x1
  800. #define I40E_AQC_VEB_ERR_FLAG_NO_SCHED 0x2
  801. #define I40E_AQC_VEB_ERR_FLAG_NO_COUNTER 0x4
  802. #define I40E_AQC_VEB_ERR_FLAG_NO_ENTRY 0x8
  803. __le16 statistic_index;
  804. __le16 vebs_used;
  805. __le16 vebs_free;
  806. };
  807. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_veb_completion);
  808. /* Get VEB Parameters (direct 0x0232)
  809. * uses i40e_aqc_switch_seid for the descriptor
  810. */
  811. struct i40e_aqc_get_veb_parameters_completion {
  812. __le16 seid;
  813. __le16 switch_id;
  814. __le16 veb_flags; /* only the first/last flags from 0x0230 is valid */
  815. __le16 statistic_index;
  816. __le16 vebs_used;
  817. __le16 vebs_free;
  818. u8 reserved[4];
  819. };
  820. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_veb_parameters_completion);
  821. /* Delete Element (direct 0x0243)
  822. * uses the generic i40e_aqc_switch_seid
  823. */
  824. /* Add MAC-VLAN (indirect 0x0250) */
  825. /* used for the command for most vlan commands */
  826. struct i40e_aqc_macvlan {
  827. __le16 num_addresses;
  828. __le16 seid[3];
  829. #define I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT 0
  830. #define I40E_AQC_MACVLAN_CMD_SEID_NUM_MASK (0x3FF << \
  831. I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
  832. #define I40E_AQC_MACVLAN_CMD_SEID_VALID 0x8000
  833. __le32 addr_high;
  834. __le32 addr_low;
  835. };
  836. I40E_CHECK_CMD_LENGTH(i40e_aqc_macvlan);
  837. /* indirect data for command and response */
  838. struct i40e_aqc_add_macvlan_element_data {
  839. u8 mac_addr[6];
  840. __le16 vlan_tag;
  841. __le16 flags;
  842. #define I40E_AQC_MACVLAN_ADD_PERFECT_MATCH 0x0001
  843. #define I40E_AQC_MACVLAN_ADD_HASH_MATCH 0x0002
  844. #define I40E_AQC_MACVLAN_ADD_IGNORE_VLAN 0x0004
  845. #define I40E_AQC_MACVLAN_ADD_TO_QUEUE 0x0008
  846. __le16 queue_number;
  847. #define I40E_AQC_MACVLAN_CMD_QUEUE_SHIFT 0
  848. #define I40E_AQC_MACVLAN_CMD_QUEUE_MASK (0x7FF << \
  849. I40E_AQC_MACVLAN_CMD_SEID_NUM_SHIFT)
  850. /* response section */
  851. u8 match_method;
  852. #define I40E_AQC_MM_PERFECT_MATCH 0x01
  853. #define I40E_AQC_MM_HASH_MATCH 0x02
  854. #define I40E_AQC_MM_ERR_NO_RES 0xFF
  855. u8 reserved1[3];
  856. };
  857. struct i40e_aqc_add_remove_macvlan_completion {
  858. __le16 perfect_mac_used;
  859. __le16 perfect_mac_free;
  860. __le16 unicast_hash_free;
  861. __le16 multicast_hash_free;
  862. __le32 addr_high;
  863. __le32 addr_low;
  864. };
  865. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_macvlan_completion);
  866. /* Remove MAC-VLAN (indirect 0x0251)
  867. * uses i40e_aqc_macvlan for the descriptor
  868. * data points to an array of num_addresses of elements
  869. */
  870. struct i40e_aqc_remove_macvlan_element_data {
  871. u8 mac_addr[6];
  872. __le16 vlan_tag;
  873. u8 flags;
  874. #define I40E_AQC_MACVLAN_DEL_PERFECT_MATCH 0x01
  875. #define I40E_AQC_MACVLAN_DEL_HASH_MATCH 0x02
  876. #define I40E_AQC_MACVLAN_DEL_IGNORE_VLAN 0x08
  877. #define I40E_AQC_MACVLAN_DEL_ALL_VSIS 0x10
  878. u8 reserved[3];
  879. /* reply section */
  880. u8 error_code;
  881. #define I40E_AQC_REMOVE_MACVLAN_SUCCESS 0x0
  882. #define I40E_AQC_REMOVE_MACVLAN_FAIL 0xFF
  883. u8 reply_reserved[3];
  884. };
  885. /* Add VLAN (indirect 0x0252)
  886. * Remove VLAN (indirect 0x0253)
  887. * use the generic i40e_aqc_macvlan for the command
  888. */
  889. struct i40e_aqc_add_remove_vlan_element_data {
  890. __le16 vlan_tag;
  891. u8 vlan_flags;
  892. /* flags for add VLAN */
  893. #define I40E_AQC_ADD_VLAN_LOCAL 0x1
  894. #define I40E_AQC_ADD_PVLAN_TYPE_SHIFT 1
  895. #define I40E_AQC_ADD_PVLAN_TYPE_MASK (0x3 << \
  896. I40E_AQC_ADD_PVLAN_TYPE_SHIFT)
  897. #define I40E_AQC_ADD_PVLAN_TYPE_REGULAR 0x0
  898. #define I40E_AQC_ADD_PVLAN_TYPE_PRIMARY 0x2
  899. #define I40E_AQC_ADD_PVLAN_TYPE_SECONDARY 0x4
  900. #define I40E_AQC_VLAN_PTYPE_SHIFT 3
  901. #define I40E_AQC_VLAN_PTYPE_MASK (0x3 << I40E_AQC_VLAN_PTYPE_SHIFT)
  902. #define I40E_AQC_VLAN_PTYPE_REGULAR_VSI 0x0
  903. #define I40E_AQC_VLAN_PTYPE_PROMISC_VSI 0x8
  904. #define I40E_AQC_VLAN_PTYPE_COMMUNITY_VSI 0x10
  905. #define I40E_AQC_VLAN_PTYPE_ISOLATED_VSI 0x18
  906. /* flags for remove VLAN */
  907. #define I40E_AQC_REMOVE_VLAN_ALL 0x1
  908. u8 reserved;
  909. u8 result;
  910. /* flags for add VLAN */
  911. #define I40E_AQC_ADD_VLAN_SUCCESS 0x0
  912. #define I40E_AQC_ADD_VLAN_FAIL_REQUEST 0xFE
  913. #define I40E_AQC_ADD_VLAN_FAIL_RESOURCE 0xFF
  914. /* flags for remove VLAN */
  915. #define I40E_AQC_REMOVE_VLAN_SUCCESS 0x0
  916. #define I40E_AQC_REMOVE_VLAN_FAIL 0xFF
  917. u8 reserved1[3];
  918. };
  919. struct i40e_aqc_add_remove_vlan_completion {
  920. u8 reserved[4];
  921. __le16 vlans_used;
  922. __le16 vlans_free;
  923. __le32 addr_high;
  924. __le32 addr_low;
  925. };
  926. /* Set VSI Promiscuous Modes (direct 0x0254) */
  927. struct i40e_aqc_set_vsi_promiscuous_modes {
  928. __le16 promiscuous_flags;
  929. __le16 valid_flags;
  930. /* flags used for both fields above */
  931. #define I40E_AQC_SET_VSI_PROMISC_UNICAST 0x01
  932. #define I40E_AQC_SET_VSI_PROMISC_MULTICAST 0x02
  933. #define I40E_AQC_SET_VSI_PROMISC_BROADCAST 0x04
  934. #define I40E_AQC_SET_VSI_DEFAULT 0x08
  935. #define I40E_AQC_SET_VSI_PROMISC_VLAN 0x10
  936. __le16 seid;
  937. #define I40E_AQC_VSI_PROM_CMD_SEID_MASK 0x3FF
  938. __le16 vlan_tag;
  939. #define I40E_AQC_SET_VSI_VLAN_VALID 0x8000
  940. u8 reserved[8];
  941. };
  942. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_vsi_promiscuous_modes);
  943. /* Add S/E-tag command (direct 0x0255)
  944. * Uses generic i40e_aqc_add_remove_tag_completion for completion
  945. */
  946. struct i40e_aqc_add_tag {
  947. __le16 flags;
  948. #define I40E_AQC_ADD_TAG_FLAG_TO_QUEUE 0x0001
  949. __le16 seid;
  950. #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT 0
  951. #define I40E_AQC_ADD_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  952. I40E_AQC_ADD_TAG_CMD_SEID_NUM_SHIFT)
  953. __le16 tag;
  954. __le16 queue_number;
  955. u8 reserved[8];
  956. };
  957. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_tag);
  958. struct i40e_aqc_add_remove_tag_completion {
  959. u8 reserved[12];
  960. __le16 tags_used;
  961. __le16 tags_free;
  962. };
  963. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_tag_completion);
  964. /* Remove S/E-tag command (direct 0x0256)
  965. * Uses generic i40e_aqc_add_remove_tag_completion for completion
  966. */
  967. struct i40e_aqc_remove_tag {
  968. __le16 seid;
  969. #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT 0
  970. #define I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  971. I40E_AQC_REMOVE_TAG_CMD_SEID_NUM_SHIFT)
  972. __le16 tag;
  973. u8 reserved[12];
  974. };
  975. /* Add multicast E-Tag (direct 0x0257)
  976. * del multicast E-Tag (direct 0x0258) only uses pv_seid and etag fields
  977. * and no external data
  978. */
  979. struct i40e_aqc_add_remove_mcast_etag {
  980. __le16 pv_seid;
  981. __le16 etag;
  982. u8 num_unicast_etags;
  983. u8 reserved[3];
  984. __le32 addr_high; /* address of array of 2-byte s-tags */
  985. __le32 addr_low;
  986. };
  987. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag);
  988. struct i40e_aqc_add_remove_mcast_etag_completion {
  989. u8 reserved[4];
  990. __le16 mcast_etags_used;
  991. __le16 mcast_etags_free;
  992. __le32 addr_high;
  993. __le32 addr_low;
  994. };
  995. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_mcast_etag_completion);
  996. /* Update S/E-Tag (direct 0x0259) */
  997. struct i40e_aqc_update_tag {
  998. __le16 seid;
  999. #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT 0
  1000. #define I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_MASK (0x3FF << \
  1001. I40E_AQC_UPDATE_TAG_CMD_SEID_NUM_SHIFT)
  1002. __le16 old_tag;
  1003. __le16 new_tag;
  1004. u8 reserved[10];
  1005. };
  1006. I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag);
  1007. struct i40e_aqc_update_tag_completion {
  1008. u8 reserved[12];
  1009. __le16 tags_used;
  1010. __le16 tags_free;
  1011. };
  1012. I40E_CHECK_CMD_LENGTH(i40e_aqc_update_tag_completion);
  1013. /* Add Control Packet filter (direct 0x025A)
  1014. * Remove Control Packet filter (direct 0x025B)
  1015. * uses the i40e_aqc_add_oveb_cloud,
  1016. * and the generic direct completion structure
  1017. */
  1018. struct i40e_aqc_add_remove_control_packet_filter {
  1019. u8 mac[6];
  1020. __le16 etype;
  1021. __le16 flags;
  1022. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC 0x0001
  1023. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP 0x0002
  1024. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE 0x0004
  1025. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TX 0x0008
  1026. #define I40E_AQC_ADD_CONTROL_PACKET_FLAGS_RX 0x0000
  1027. __le16 seid;
  1028. #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT 0
  1029. #define I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_MASK (0x3FF << \
  1030. I40E_AQC_ADD_CONTROL_PACKET_CMD_SEID_NUM_SHIFT)
  1031. __le16 queue;
  1032. u8 reserved[2];
  1033. };
  1034. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter);
  1035. struct i40e_aqc_add_remove_control_packet_filter_completion {
  1036. __le16 mac_etype_used;
  1037. __le16 etype_used;
  1038. __le16 mac_etype_free;
  1039. __le16 etype_free;
  1040. u8 reserved[8];
  1041. };
  1042. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_control_packet_filter_completion);
  1043. /* Add Cloud filters (indirect 0x025C)
  1044. * Remove Cloud filters (indirect 0x025D)
  1045. * uses the i40e_aqc_add_remove_cloud_filters,
  1046. * and the generic indirect completion structure
  1047. */
  1048. struct i40e_aqc_add_remove_cloud_filters {
  1049. u8 num_filters;
  1050. u8 reserved;
  1051. __le16 seid;
  1052. #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT 0
  1053. #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_MASK (0x3FF << \
  1054. I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT)
  1055. u8 reserved2[4];
  1056. __le32 addr_high;
  1057. __le32 addr_low;
  1058. };
  1059. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_cloud_filters);
  1060. struct i40e_aqc_add_remove_cloud_filters_element_data {
  1061. u8 outer_mac[6];
  1062. u8 inner_mac[6];
  1063. __le16 inner_vlan;
  1064. union {
  1065. struct {
  1066. u8 reserved[12];
  1067. u8 data[4];
  1068. } v4;
  1069. struct {
  1070. u8 data[16];
  1071. } v6;
  1072. } ipaddr;
  1073. __le16 flags;
  1074. #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0
  1075. #define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \
  1076. I40E_AQC_ADD_CLOUD_FILTER_SHIFT)
  1077. /* 0x0000 reserved */
  1078. #define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001
  1079. /* 0x0002 reserved */
  1080. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN 0x0003
  1081. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID 0x0004
  1082. /* 0x0005 reserved */
  1083. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_TEN_ID 0x0006
  1084. /* 0x0007 reserved */
  1085. /* 0x0008 reserved */
  1086. #define I40E_AQC_ADD_CLOUD_FILTER_OMAC 0x0009
  1087. #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A
  1088. #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B
  1089. #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C
  1090. #define I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE 0x0080
  1091. #define I40E_AQC_ADD_CLOUD_VNK_SHIFT 6
  1092. #define I40E_AQC_ADD_CLOUD_VNK_MASK 0x00C0
  1093. #define I40E_AQC_ADD_CLOUD_FLAGS_IPV4 0
  1094. #define I40E_AQC_ADD_CLOUD_FLAGS_IPV6 0x0100
  1095. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_SHIFT 9
  1096. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_MASK 0x1E00
  1097. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_XVLAN 0
  1098. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC 1
  1099. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_NGE 2
  1100. #define I40E_AQC_ADD_CLOUD_TNL_TYPE_IP 3
  1101. __le32 tenant_id;
  1102. u8 reserved[4];
  1103. __le16 queue_number;
  1104. #define I40E_AQC_ADD_CLOUD_QUEUE_SHIFT 0
  1105. #define I40E_AQC_ADD_CLOUD_QUEUE_MASK (0x3F << \
  1106. I40E_AQC_ADD_CLOUD_QUEUE_SHIFT)
  1107. u8 reserved2[14];
  1108. /* response section */
  1109. u8 allocation_result;
  1110. #define I40E_AQC_ADD_CLOUD_FILTER_SUCCESS 0x0
  1111. #define I40E_AQC_ADD_CLOUD_FILTER_FAIL 0xFF
  1112. u8 response_reserved[7];
  1113. };
  1114. struct i40e_aqc_remove_cloud_filters_completion {
  1115. __le16 perfect_ovlan_used;
  1116. __le16 perfect_ovlan_free;
  1117. __le16 vlan_used;
  1118. __le16 vlan_free;
  1119. __le32 addr_high;
  1120. __le32 addr_low;
  1121. };
  1122. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_cloud_filters_completion);
  1123. /* Add Mirror Rule (indirect or direct 0x0260)
  1124. * Delete Mirror Rule (indirect or direct 0x0261)
  1125. * note: some rule types (4,5) do not use an external buffer.
  1126. * take care to set the flags correctly.
  1127. */
  1128. struct i40e_aqc_add_delete_mirror_rule {
  1129. __le16 seid;
  1130. __le16 rule_type;
  1131. #define I40E_AQC_MIRROR_RULE_TYPE_SHIFT 0
  1132. #define I40E_AQC_MIRROR_RULE_TYPE_MASK (0x7 << \
  1133. I40E_AQC_MIRROR_RULE_TYPE_SHIFT)
  1134. #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_INGRESS 1
  1135. #define I40E_AQC_MIRROR_RULE_TYPE_VPORT_EGRESS 2
  1136. #define I40E_AQC_MIRROR_RULE_TYPE_VLAN 3
  1137. #define I40E_AQC_MIRROR_RULE_TYPE_ALL_INGRESS 4
  1138. #define I40E_AQC_MIRROR_RULE_TYPE_ALL_EGRESS 5
  1139. __le16 num_entries;
  1140. __le16 destination; /* VSI for add, rule id for delete */
  1141. __le32 addr_high; /* address of array of 2-byte VSI or VLAN ids */
  1142. __le32 addr_low;
  1143. };
  1144. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule);
  1145. struct i40e_aqc_add_delete_mirror_rule_completion {
  1146. u8 reserved[2];
  1147. __le16 rule_id; /* only used on add */
  1148. __le16 mirror_rules_used;
  1149. __le16 mirror_rules_free;
  1150. __le32 addr_high;
  1151. __le32 addr_low;
  1152. };
  1153. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_delete_mirror_rule_completion);
  1154. /* DCB 0x03xx*/
  1155. /* PFC Ignore (direct 0x0301)
  1156. * the command and response use the same descriptor structure
  1157. */
  1158. struct i40e_aqc_pfc_ignore {
  1159. u8 tc_bitmap;
  1160. u8 command_flags; /* unused on response */
  1161. #define I40E_AQC_PFC_IGNORE_SET 0x80
  1162. #define I40E_AQC_PFC_IGNORE_CLEAR 0x0
  1163. u8 reserved[14];
  1164. };
  1165. I40E_CHECK_CMD_LENGTH(i40e_aqc_pfc_ignore);
  1166. /* DCB Update (direct 0x0302) uses the i40e_aq_desc structure
  1167. * with no parameters
  1168. */
  1169. /* TX scheduler 0x04xx */
  1170. /* Almost all the indirect commands use
  1171. * this generic struct to pass the SEID in param0
  1172. */
  1173. struct i40e_aqc_tx_sched_ind {
  1174. __le16 vsi_seid;
  1175. u8 reserved[6];
  1176. __le32 addr_high;
  1177. __le32 addr_low;
  1178. };
  1179. I40E_CHECK_CMD_LENGTH(i40e_aqc_tx_sched_ind);
  1180. /* Several commands respond with a set of queue set handles */
  1181. struct i40e_aqc_qs_handles_resp {
  1182. __le16 qs_handles[8];
  1183. };
  1184. /* Configure VSI BW limits (direct 0x0400) */
  1185. struct i40e_aqc_configure_vsi_bw_limit {
  1186. __le16 vsi_seid;
  1187. u8 reserved[2];
  1188. __le16 credit;
  1189. u8 reserved1[2];
  1190. u8 max_credit; /* 0-3, limit = 2^max */
  1191. u8 reserved2[7];
  1192. };
  1193. I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_vsi_bw_limit);
  1194. /* Configure VSI Bandwidth Limit per Traffic Type (indirect 0x0406)
  1195. * responds with i40e_aqc_qs_handles_resp
  1196. */
  1197. struct i40e_aqc_configure_vsi_ets_sla_bw_data {
  1198. u8 tc_valid_bits;
  1199. u8 reserved[15];
  1200. __le16 tc_bw_credits[8]; /* FW writesback QS handles here */
  1201. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1202. __le16 tc_bw_max[2];
  1203. u8 reserved1[28];
  1204. };
  1205. /* Configure VSI Bandwidth Allocation per Traffic Type (indirect 0x0407)
  1206. * responds with i40e_aqc_qs_handles_resp
  1207. */
  1208. struct i40e_aqc_configure_vsi_tc_bw_data {
  1209. u8 tc_valid_bits;
  1210. u8 reserved[3];
  1211. u8 tc_bw_credits[8];
  1212. u8 reserved1[4];
  1213. __le16 qs_handles[8];
  1214. };
  1215. /* Query vsi bw configuration (indirect 0x0408) */
  1216. struct i40e_aqc_query_vsi_bw_config_resp {
  1217. u8 tc_valid_bits;
  1218. u8 tc_suspended_bits;
  1219. u8 reserved[14];
  1220. __le16 qs_handles[8];
  1221. u8 reserved1[4];
  1222. __le16 port_bw_limit;
  1223. u8 reserved2[2];
  1224. u8 max_bw; /* 0-3, limit = 2^max */
  1225. u8 reserved3[23];
  1226. };
  1227. /* Query VSI Bandwidth Allocation per Traffic Type (indirect 0x040A) */
  1228. struct i40e_aqc_query_vsi_ets_sla_config_resp {
  1229. u8 tc_valid_bits;
  1230. u8 reserved[3];
  1231. u8 share_credits[8];
  1232. __le16 credits[8];
  1233. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1234. __le16 tc_bw_max[2];
  1235. };
  1236. /* Configure Switching Component Bandwidth Limit (direct 0x0410) */
  1237. struct i40e_aqc_configure_switching_comp_bw_limit {
  1238. __le16 seid;
  1239. u8 reserved[2];
  1240. __le16 credit;
  1241. u8 reserved1[2];
  1242. u8 max_bw; /* 0-3, limit = 2^max */
  1243. u8 reserved2[7];
  1244. };
  1245. I40E_CHECK_CMD_LENGTH(i40e_aqc_configure_switching_comp_bw_limit);
  1246. /* Enable Physical Port ETS (indirect 0x0413)
  1247. * Modify Physical Port ETS (indirect 0x0414)
  1248. * Disable Physical Port ETS (indirect 0x0415)
  1249. */
  1250. struct i40e_aqc_configure_switching_comp_ets_data {
  1251. u8 reserved[4];
  1252. u8 tc_valid_bits;
  1253. u8 seepage;
  1254. #define I40E_AQ_ETS_SEEPAGE_EN_MASK 0x1
  1255. u8 tc_strict_priority_flags;
  1256. u8 reserved1[17];
  1257. u8 tc_bw_share_credits[8];
  1258. u8 reserved2[96];
  1259. };
  1260. /* Configure Switching Component Bandwidth Limits per Tc (indirect 0x0416) */
  1261. struct i40e_aqc_configure_switching_comp_ets_bw_limit_data {
  1262. u8 tc_valid_bits;
  1263. u8 reserved[15];
  1264. __le16 tc_bw_credit[8];
  1265. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1266. __le16 tc_bw_max[2];
  1267. u8 reserved1[28];
  1268. };
  1269. /* Configure Switching Component Bandwidth Allocation per Tc
  1270. * (indirect 0x0417)
  1271. */
  1272. struct i40e_aqc_configure_switching_comp_bw_config_data {
  1273. u8 tc_valid_bits;
  1274. u8 reserved[2];
  1275. u8 absolute_credits; /* bool */
  1276. u8 tc_bw_share_credits[8];
  1277. u8 reserved1[20];
  1278. };
  1279. /* Query Switching Component Configuration (indirect 0x0418) */
  1280. struct i40e_aqc_query_switching_comp_ets_config_resp {
  1281. u8 tc_valid_bits;
  1282. u8 reserved[35];
  1283. __le16 port_bw_limit;
  1284. u8 reserved1[2];
  1285. u8 tc_bw_max; /* 0-3, limit = 2^max */
  1286. u8 reserved2[23];
  1287. };
  1288. /* Query PhysicalPort ETS Configuration (indirect 0x0419) */
  1289. struct i40e_aqc_query_port_ets_config_resp {
  1290. u8 reserved[4];
  1291. u8 tc_valid_bits;
  1292. u8 reserved1;
  1293. u8 tc_strict_priority_bits;
  1294. u8 reserved2;
  1295. u8 tc_bw_share_credits[8];
  1296. __le16 tc_bw_limits[8];
  1297. /* 4 bits per tc 0-7, 4th bit reserved, limit = 2^max */
  1298. __le16 tc_bw_max[2];
  1299. u8 reserved3[32];
  1300. };
  1301. /* Query Switching Component Bandwidth Allocation per Traffic Type
  1302. * (indirect 0x041A)
  1303. */
  1304. struct i40e_aqc_query_switching_comp_bw_config_resp {
  1305. u8 tc_valid_bits;
  1306. u8 reserved[2];
  1307. u8 absolute_credits_enable; /* bool */
  1308. u8 tc_bw_share_credits[8];
  1309. __le16 tc_bw_limits[8];
  1310. /* 4 bits per tc 0-7, 4th bit is reserved, limit = 2^max */
  1311. __le16 tc_bw_max[2];
  1312. };
  1313. /* Suspend/resume port TX traffic
  1314. * (direct 0x041B and 0x041C) uses the generic SEID struct
  1315. */
  1316. /* Configure partition BW
  1317. * (indirect 0x041D)
  1318. */
  1319. struct i40e_aqc_configure_partition_bw_data {
  1320. __le16 pf_valid_bits;
  1321. u8 min_bw[16]; /* guaranteed bandwidth */
  1322. u8 max_bw[16]; /* bandwidth limit */
  1323. };
  1324. /* Get and set the active HMC resource profile and status.
  1325. * (direct 0x0500) and (direct 0x0501)
  1326. */
  1327. struct i40e_aq_get_set_hmc_resource_profile {
  1328. u8 pm_profile;
  1329. u8 pe_vf_enabled;
  1330. u8 reserved[14];
  1331. };
  1332. I40E_CHECK_CMD_LENGTH(i40e_aq_get_set_hmc_resource_profile);
  1333. enum i40e_aq_hmc_profile {
  1334. /* I40E_HMC_PROFILE_NO_CHANGE = 0, reserved */
  1335. I40E_HMC_PROFILE_DEFAULT = 1,
  1336. I40E_HMC_PROFILE_FAVOR_VF = 2,
  1337. I40E_HMC_PROFILE_EQUAL = 3,
  1338. };
  1339. #define I40E_AQ_GET_HMC_RESOURCE_PROFILE_PM_MASK 0xF
  1340. #define I40E_AQ_GET_HMC_RESOURCE_PROFILE_COUNT_MASK 0x3F
  1341. /* Get PHY Abilities (indirect 0x0600) uses the generic indirect struct */
  1342. /* set in param0 for get phy abilities to report qualified modules */
  1343. #define I40E_AQ_PHY_REPORT_QUALIFIED_MODULES 0x0001
  1344. #define I40E_AQ_PHY_REPORT_INITIAL_VALUES 0x0002
  1345. enum i40e_aq_phy_type {
  1346. I40E_PHY_TYPE_SGMII = 0x0,
  1347. I40E_PHY_TYPE_1000BASE_KX = 0x1,
  1348. I40E_PHY_TYPE_10GBASE_KX4 = 0x2,
  1349. I40E_PHY_TYPE_10GBASE_KR = 0x3,
  1350. I40E_PHY_TYPE_40GBASE_KR4 = 0x4,
  1351. I40E_PHY_TYPE_XAUI = 0x5,
  1352. I40E_PHY_TYPE_XFI = 0x6,
  1353. I40E_PHY_TYPE_SFI = 0x7,
  1354. I40E_PHY_TYPE_XLAUI = 0x8,
  1355. I40E_PHY_TYPE_XLPPI = 0x9,
  1356. I40E_PHY_TYPE_40GBASE_CR4_CU = 0xA,
  1357. I40E_PHY_TYPE_10GBASE_CR1_CU = 0xB,
  1358. I40E_PHY_TYPE_10GBASE_AOC = 0xC,
  1359. I40E_PHY_TYPE_40GBASE_AOC = 0xD,
  1360. I40E_PHY_TYPE_100BASE_TX = 0x11,
  1361. I40E_PHY_TYPE_1000BASE_T = 0x12,
  1362. I40E_PHY_TYPE_10GBASE_T = 0x13,
  1363. I40E_PHY_TYPE_10GBASE_SR = 0x14,
  1364. I40E_PHY_TYPE_10GBASE_LR = 0x15,
  1365. I40E_PHY_TYPE_10GBASE_SFPP_CU = 0x16,
  1366. I40E_PHY_TYPE_10GBASE_CR1 = 0x17,
  1367. I40E_PHY_TYPE_40GBASE_CR4 = 0x18,
  1368. I40E_PHY_TYPE_40GBASE_SR4 = 0x19,
  1369. I40E_PHY_TYPE_40GBASE_LR4 = 0x1A,
  1370. I40E_PHY_TYPE_1000BASE_SX = 0x1B,
  1371. I40E_PHY_TYPE_1000BASE_LX = 0x1C,
  1372. I40E_PHY_TYPE_1000BASE_T_OPTICAL = 0x1D,
  1373. I40E_PHY_TYPE_20GBASE_KR2 = 0x1E,
  1374. I40E_PHY_TYPE_MAX
  1375. };
  1376. #define I40E_LINK_SPEED_100MB_SHIFT 0x1
  1377. #define I40E_LINK_SPEED_1000MB_SHIFT 0x2
  1378. #define I40E_LINK_SPEED_10GB_SHIFT 0x3
  1379. #define I40E_LINK_SPEED_40GB_SHIFT 0x4
  1380. #define I40E_LINK_SPEED_20GB_SHIFT 0x5
  1381. enum i40e_aq_link_speed {
  1382. I40E_LINK_SPEED_UNKNOWN = 0,
  1383. I40E_LINK_SPEED_100MB = (1 << I40E_LINK_SPEED_100MB_SHIFT),
  1384. I40E_LINK_SPEED_1GB = (1 << I40E_LINK_SPEED_1000MB_SHIFT),
  1385. I40E_LINK_SPEED_10GB = (1 << I40E_LINK_SPEED_10GB_SHIFT),
  1386. I40E_LINK_SPEED_40GB = (1 << I40E_LINK_SPEED_40GB_SHIFT),
  1387. I40E_LINK_SPEED_20GB = (1 << I40E_LINK_SPEED_20GB_SHIFT)
  1388. };
  1389. struct i40e_aqc_module_desc {
  1390. u8 oui[3];
  1391. u8 reserved1;
  1392. u8 part_number[16];
  1393. u8 revision[4];
  1394. u8 reserved2[8];
  1395. };
  1396. struct i40e_aq_get_phy_abilities_resp {
  1397. __le32 phy_type; /* bitmap using the above enum for offsets */
  1398. u8 link_speed; /* bitmap using the above enum bit patterns */
  1399. u8 abilities;
  1400. #define I40E_AQ_PHY_FLAG_PAUSE_TX 0x01
  1401. #define I40E_AQ_PHY_FLAG_PAUSE_RX 0x02
  1402. #define I40E_AQ_PHY_FLAG_LOW_POWER 0x04
  1403. #define I40E_AQ_PHY_LINK_ENABLED 0x08
  1404. #define I40E_AQ_PHY_AN_ENABLED 0x10
  1405. #define I40E_AQ_PHY_FLAG_MODULE_QUAL 0x20
  1406. __le16 eee_capability;
  1407. #define I40E_AQ_EEE_100BASE_TX 0x0002
  1408. #define I40E_AQ_EEE_1000BASE_T 0x0004
  1409. #define I40E_AQ_EEE_10GBASE_T 0x0008
  1410. #define I40E_AQ_EEE_1000BASE_KX 0x0010
  1411. #define I40E_AQ_EEE_10GBASE_KX4 0x0020
  1412. #define I40E_AQ_EEE_10GBASE_KR 0x0040
  1413. __le32 eeer_val;
  1414. u8 d3_lpan;
  1415. #define I40E_AQ_SET_PHY_D3_LPAN_ENA 0x01
  1416. u8 reserved[3];
  1417. u8 phy_id[4];
  1418. u8 module_type[3];
  1419. u8 qualified_module_count;
  1420. #define I40E_AQ_PHY_MAX_QMS 16
  1421. struct i40e_aqc_module_desc qualified_module[I40E_AQ_PHY_MAX_QMS];
  1422. };
  1423. /* Set PHY Config (direct 0x0601) */
  1424. struct i40e_aq_set_phy_config { /* same bits as above in all */
  1425. __le32 phy_type;
  1426. u8 link_speed;
  1427. u8 abilities;
  1428. /* bits 0-2 use the values from get_phy_abilities_resp */
  1429. #define I40E_AQ_PHY_ENABLE_LINK 0x08
  1430. #define I40E_AQ_PHY_ENABLE_AN 0x10
  1431. #define I40E_AQ_PHY_ENABLE_ATOMIC_LINK 0x20
  1432. __le16 eee_capability;
  1433. __le32 eeer;
  1434. u8 low_power_ctrl;
  1435. u8 reserved[3];
  1436. };
  1437. I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config);
  1438. /* Set MAC Config command data structure (direct 0x0603) */
  1439. struct i40e_aq_set_mac_config {
  1440. __le16 max_frame_size;
  1441. u8 params;
  1442. #define I40E_AQ_SET_MAC_CONFIG_CRC_EN 0x04
  1443. #define I40E_AQ_SET_MAC_CONFIG_PACING_MASK 0x78
  1444. #define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT 3
  1445. #define I40E_AQ_SET_MAC_CONFIG_PACING_NONE 0x0
  1446. #define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX 0xF
  1447. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX 0x9
  1448. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX 0x8
  1449. #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX 0x7
  1450. #define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX 0x6
  1451. #define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX 0x5
  1452. #define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX 0x4
  1453. #define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX 0x3
  1454. #define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX 0x2
  1455. #define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX 0x1
  1456. u8 tx_timer_priority; /* bitmap */
  1457. __le16 tx_timer_value;
  1458. __le16 fc_refresh_threshold;
  1459. u8 reserved[8];
  1460. };
  1461. I40E_CHECK_CMD_LENGTH(i40e_aq_set_mac_config);
  1462. /* Restart Auto-Negotiation (direct 0x605) */
  1463. struct i40e_aqc_set_link_restart_an {
  1464. u8 command;
  1465. #define I40E_AQ_PHY_RESTART_AN 0x02
  1466. #define I40E_AQ_PHY_LINK_ENABLE 0x04
  1467. u8 reserved[15];
  1468. };
  1469. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_link_restart_an);
  1470. /* Get Link Status cmd & response data structure (direct 0x0607) */
  1471. struct i40e_aqc_get_link_status {
  1472. __le16 command_flags; /* only field set on command */
  1473. #define I40E_AQ_LSE_MASK 0x3
  1474. #define I40E_AQ_LSE_NOP 0x0
  1475. #define I40E_AQ_LSE_DISABLE 0x2
  1476. #define I40E_AQ_LSE_ENABLE 0x3
  1477. /* only response uses this flag */
  1478. #define I40E_AQ_LSE_IS_ENABLED 0x1
  1479. u8 phy_type; /* i40e_aq_phy_type */
  1480. u8 link_speed; /* i40e_aq_link_speed */
  1481. u8 link_info;
  1482. #define I40E_AQ_LINK_UP 0x01
  1483. #define I40E_AQ_LINK_FAULT 0x02
  1484. #define I40E_AQ_LINK_FAULT_TX 0x04
  1485. #define I40E_AQ_LINK_FAULT_RX 0x08
  1486. #define I40E_AQ_LINK_FAULT_REMOTE 0x10
  1487. #define I40E_AQ_MEDIA_AVAILABLE 0x40
  1488. #define I40E_AQ_SIGNAL_DETECT 0x80
  1489. u8 an_info;
  1490. #define I40E_AQ_AN_COMPLETED 0x01
  1491. #define I40E_AQ_LP_AN_ABILITY 0x02
  1492. #define I40E_AQ_PD_FAULT 0x04
  1493. #define I40E_AQ_FEC_EN 0x08
  1494. #define I40E_AQ_PHY_LOW_POWER 0x10
  1495. #define I40E_AQ_LINK_PAUSE_TX 0x20
  1496. #define I40E_AQ_LINK_PAUSE_RX 0x40
  1497. #define I40E_AQ_QUALIFIED_MODULE 0x80
  1498. u8 ext_info;
  1499. #define I40E_AQ_LINK_PHY_TEMP_ALARM 0x01
  1500. #define I40E_AQ_LINK_XCESSIVE_ERRORS 0x02
  1501. #define I40E_AQ_LINK_TX_SHIFT 0x02
  1502. #define I40E_AQ_LINK_TX_MASK (0x03 << I40E_AQ_LINK_TX_SHIFT)
  1503. #define I40E_AQ_LINK_TX_ACTIVE 0x00
  1504. #define I40E_AQ_LINK_TX_DRAINED 0x01
  1505. #define I40E_AQ_LINK_TX_FLUSHED 0x03
  1506. #define I40E_AQ_LINK_FORCED_40G 0x10
  1507. u8 loopback; /* use defines from i40e_aqc_set_lb_mode */
  1508. __le16 max_frame_size;
  1509. u8 config;
  1510. #define I40E_AQ_CONFIG_CRC_ENA 0x04
  1511. #define I40E_AQ_CONFIG_PACING_MASK 0x78
  1512. u8 reserved[5];
  1513. };
  1514. I40E_CHECK_CMD_LENGTH(i40e_aqc_get_link_status);
  1515. /* Set event mask command (direct 0x613) */
  1516. struct i40e_aqc_set_phy_int_mask {
  1517. u8 reserved[8];
  1518. __le16 event_mask;
  1519. #define I40E_AQ_EVENT_LINK_UPDOWN 0x0002
  1520. #define I40E_AQ_EVENT_MEDIA_NA 0x0004
  1521. #define I40E_AQ_EVENT_LINK_FAULT 0x0008
  1522. #define I40E_AQ_EVENT_PHY_TEMP_ALARM 0x0010
  1523. #define I40E_AQ_EVENT_EXCESSIVE_ERRORS 0x0020
  1524. #define I40E_AQ_EVENT_SIGNAL_DETECT 0x0040
  1525. #define I40E_AQ_EVENT_AN_COMPLETED 0x0080
  1526. #define I40E_AQ_EVENT_MODULE_QUAL_FAIL 0x0100
  1527. #define I40E_AQ_EVENT_PORT_TX_SUSPENDED 0x0200
  1528. u8 reserved1[6];
  1529. };
  1530. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_int_mask);
  1531. /* Get Local AN advt register (direct 0x0614)
  1532. * Set Local AN advt register (direct 0x0615)
  1533. * Get Link Partner AN advt register (direct 0x0616)
  1534. */
  1535. struct i40e_aqc_an_advt_reg {
  1536. __le32 local_an_reg0;
  1537. __le16 local_an_reg1;
  1538. u8 reserved[10];
  1539. };
  1540. I40E_CHECK_CMD_LENGTH(i40e_aqc_an_advt_reg);
  1541. /* Set Loopback mode (0x0618) */
  1542. struct i40e_aqc_set_lb_mode {
  1543. __le16 lb_mode;
  1544. #define I40E_AQ_LB_PHY_LOCAL 0x01
  1545. #define I40E_AQ_LB_PHY_REMOTE 0x02
  1546. #define I40E_AQ_LB_MAC_LOCAL 0x04
  1547. u8 reserved[14];
  1548. };
  1549. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_lb_mode);
  1550. /* Set PHY Debug command (0x0622) */
  1551. struct i40e_aqc_set_phy_debug {
  1552. u8 command_flags;
  1553. #define I40E_AQ_PHY_DEBUG_RESET_INTERNAL 0x02
  1554. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT 2
  1555. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_MASK (0x03 << \
  1556. I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SHIFT)
  1557. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_NONE 0x00
  1558. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_HARD 0x01
  1559. #define I40E_AQ_PHY_DEBUG_RESET_EXTERNAL_SOFT 0x02
  1560. #define I40E_AQ_PHY_DEBUG_DISABLE_LINK_FW 0x10
  1561. u8 reserved[15];
  1562. };
  1563. I40E_CHECK_CMD_LENGTH(i40e_aqc_set_phy_debug);
  1564. enum i40e_aq_phy_reg_type {
  1565. I40E_AQC_PHY_REG_INTERNAL = 0x1,
  1566. I40E_AQC_PHY_REG_EXERNAL_BASET = 0x2,
  1567. I40E_AQC_PHY_REG_EXERNAL_MODULE = 0x3
  1568. };
  1569. /* NVM Read command (indirect 0x0701)
  1570. * NVM Erase commands (direct 0x0702)
  1571. * NVM Update commands (indirect 0x0703)
  1572. */
  1573. struct i40e_aqc_nvm_update {
  1574. u8 command_flags;
  1575. #define I40E_AQ_NVM_LAST_CMD 0x01
  1576. #define I40E_AQ_NVM_FLASH_ONLY 0x80
  1577. u8 module_pointer;
  1578. __le16 length;
  1579. __le32 offset;
  1580. __le32 addr_high;
  1581. __le32 addr_low;
  1582. };
  1583. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_update);
  1584. /* NVM Config Read (indirect 0x0704) */
  1585. struct i40e_aqc_nvm_config_read {
  1586. __le16 cmd_flags;
  1587. #define ANVM_SINGLE_OR_MULTIPLE_FEATURES_MASK 1
  1588. #define ANVM_READ_SINGLE_FEATURE 0
  1589. #define ANVM_READ_MULTIPLE_FEATURES 1
  1590. __le16 element_count;
  1591. __le16 element_id; /* Feature/field ID */
  1592. u8 reserved[2];
  1593. __le32 address_high;
  1594. __le32 address_low;
  1595. };
  1596. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_read);
  1597. /* NVM Config Write (indirect 0x0705) */
  1598. struct i40e_aqc_nvm_config_write {
  1599. __le16 cmd_flags;
  1600. __le16 element_count;
  1601. u8 reserved[4];
  1602. __le32 address_high;
  1603. __le32 address_low;
  1604. };
  1605. I40E_CHECK_CMD_LENGTH(i40e_aqc_nvm_config_write);
  1606. struct i40e_aqc_nvm_config_data_feature {
  1607. __le16 feature_id;
  1608. __le16 instance_id;
  1609. __le16 feature_options;
  1610. __le16 feature_selection;
  1611. };
  1612. struct i40e_aqc_nvm_config_data_immediate_field {
  1613. #define ANVM_FEATURE_OR_IMMEDIATE_MASK 0x2
  1614. __le16 field_id;
  1615. __le16 instance_id;
  1616. __le16 field_options;
  1617. __le16 field_value;
  1618. };
  1619. /* Send to PF command (indirect 0x0801) id is only used by PF
  1620. * Send to VF command (indirect 0x0802) id is only used by PF
  1621. * Send to Peer PF command (indirect 0x0803)
  1622. */
  1623. struct i40e_aqc_pf_vf_message {
  1624. __le32 id;
  1625. u8 reserved[4];
  1626. __le32 addr_high;
  1627. __le32 addr_low;
  1628. };
  1629. I40E_CHECK_CMD_LENGTH(i40e_aqc_pf_vf_message);
  1630. /* Alternate structure */
  1631. /* Direct write (direct 0x0900)
  1632. * Direct read (direct 0x0902)
  1633. */
  1634. struct i40e_aqc_alternate_write {
  1635. __le32 address0;
  1636. __le32 data0;
  1637. __le32 address1;
  1638. __le32 data1;
  1639. };
  1640. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write);
  1641. /* Indirect write (indirect 0x0901)
  1642. * Indirect read (indirect 0x0903)
  1643. */
  1644. struct i40e_aqc_alternate_ind_write {
  1645. __le32 address;
  1646. __le32 length;
  1647. __le32 addr_high;
  1648. __le32 addr_low;
  1649. };
  1650. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_ind_write);
  1651. /* Done alternate write (direct 0x0904)
  1652. * uses i40e_aq_desc
  1653. */
  1654. struct i40e_aqc_alternate_write_done {
  1655. __le16 cmd_flags;
  1656. #define I40E_AQ_ALTERNATE_MODE_BIOS_MASK 1
  1657. #define I40E_AQ_ALTERNATE_MODE_BIOS_LEGACY 0
  1658. #define I40E_AQ_ALTERNATE_MODE_BIOS_UEFI 1
  1659. #define I40E_AQ_ALTERNATE_RESET_NEEDED 2
  1660. u8 reserved[14];
  1661. };
  1662. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_write_done);
  1663. /* Set OEM mode (direct 0x0905) */
  1664. struct i40e_aqc_alternate_set_mode {
  1665. __le32 mode;
  1666. #define I40E_AQ_ALTERNATE_MODE_NONE 0
  1667. #define I40E_AQ_ALTERNATE_MODE_OEM 1
  1668. u8 reserved[12];
  1669. };
  1670. I40E_CHECK_CMD_LENGTH(i40e_aqc_alternate_set_mode);
  1671. /* Clear port Alternate RAM (direct 0x0906) uses i40e_aq_desc */
  1672. /* async events 0x10xx */
  1673. /* Lan Queue Overflow Event (direct, 0x1001) */
  1674. struct i40e_aqc_lan_overflow {
  1675. __le32 prtdcb_rupto;
  1676. __le32 otx_ctl;
  1677. u8 reserved[8];
  1678. };
  1679. I40E_CHECK_CMD_LENGTH(i40e_aqc_lan_overflow);
  1680. /* Get LLDP MIB (indirect 0x0A00) */
  1681. struct i40e_aqc_lldp_get_mib {
  1682. u8 type;
  1683. u8 reserved1;
  1684. #define I40E_AQ_LLDP_MIB_TYPE_MASK 0x3
  1685. #define I40E_AQ_LLDP_MIB_LOCAL 0x0
  1686. #define I40E_AQ_LLDP_MIB_REMOTE 0x1
  1687. #define I40E_AQ_LLDP_MIB_LOCAL_AND_REMOTE 0x2
  1688. #define I40E_AQ_LLDP_BRIDGE_TYPE_MASK 0xC
  1689. #define I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT 0x2
  1690. #define I40E_AQ_LLDP_BRIDGE_TYPE_NEAREST_BRIDGE 0x0
  1691. #define I40E_AQ_LLDP_BRIDGE_TYPE_NON_TPMR 0x1
  1692. #define I40E_AQ_LLDP_TX_SHIFT 0x4
  1693. #define I40E_AQ_LLDP_TX_MASK (0x03 << I40E_AQ_LLDP_TX_SHIFT)
  1694. /* TX pause flags use I40E_AQ_LINK_TX_* above */
  1695. __le16 local_len;
  1696. __le16 remote_len;
  1697. u8 reserved2[2];
  1698. __le32 addr_high;
  1699. __le32 addr_low;
  1700. };
  1701. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_get_mib);
  1702. /* Configure LLDP MIB Change Event (direct 0x0A01)
  1703. * also used for the event (with type in the command field)
  1704. */
  1705. struct i40e_aqc_lldp_update_mib {
  1706. u8 command;
  1707. #define I40E_AQ_LLDP_MIB_UPDATE_ENABLE 0x0
  1708. #define I40E_AQ_LLDP_MIB_UPDATE_DISABLE 0x1
  1709. u8 reserved[7];
  1710. __le32 addr_high;
  1711. __le32 addr_low;
  1712. };
  1713. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_mib);
  1714. /* Add LLDP TLV (indirect 0x0A02)
  1715. * Delete LLDP TLV (indirect 0x0A04)
  1716. */
  1717. struct i40e_aqc_lldp_add_tlv {
  1718. u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
  1719. u8 reserved1[1];
  1720. __le16 len;
  1721. u8 reserved2[4];
  1722. __le32 addr_high;
  1723. __le32 addr_low;
  1724. };
  1725. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_add_tlv);
  1726. /* Update LLDP TLV (indirect 0x0A03) */
  1727. struct i40e_aqc_lldp_update_tlv {
  1728. u8 type; /* only nearest bridge and non-TPMR from 0x0A00 */
  1729. u8 reserved;
  1730. __le16 old_len;
  1731. __le16 new_offset;
  1732. __le16 new_len;
  1733. __le32 addr_high;
  1734. __le32 addr_low;
  1735. };
  1736. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv);
  1737. /* Stop LLDP (direct 0x0A05) */
  1738. struct i40e_aqc_lldp_stop {
  1739. u8 command;
  1740. #define I40E_AQ_LLDP_AGENT_STOP 0x0
  1741. #define I40E_AQ_LLDP_AGENT_SHUTDOWN 0x1
  1742. u8 reserved[15];
  1743. };
  1744. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop);
  1745. /* Start LLDP (direct 0x0A06) */
  1746. struct i40e_aqc_lldp_start {
  1747. u8 command;
  1748. #define I40E_AQ_LLDP_AGENT_START 0x1
  1749. u8 reserved[15];
  1750. };
  1751. I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_start);
  1752. /* Apply MIB changes (0x0A07)
  1753. * uses the generic struc as it contains no data
  1754. */
  1755. /* Add Udp Tunnel command and completion (direct 0x0B00) */
  1756. struct i40e_aqc_add_udp_tunnel {
  1757. __le16 udp_port;
  1758. u8 reserved0[3];
  1759. u8 protocol_type;
  1760. #define I40E_AQC_TUNNEL_TYPE_VXLAN 0x00
  1761. #define I40E_AQC_TUNNEL_TYPE_NGE 0x01
  1762. #define I40E_AQC_TUNNEL_TYPE_TEREDO 0x10
  1763. u8 reserved1[10];
  1764. };
  1765. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel);
  1766. struct i40e_aqc_add_udp_tunnel_completion {
  1767. __le16 udp_port;
  1768. u8 filter_entry_index;
  1769. u8 multiple_pfs;
  1770. #define I40E_AQC_SINGLE_PF 0x0
  1771. #define I40E_AQC_MULTIPLE_PFS 0x1
  1772. u8 total_filters;
  1773. u8 reserved[11];
  1774. };
  1775. I40E_CHECK_CMD_LENGTH(i40e_aqc_add_udp_tunnel_completion);
  1776. /* remove UDP Tunnel command (0x0B01) */
  1777. struct i40e_aqc_remove_udp_tunnel {
  1778. u8 reserved[2];
  1779. u8 index; /* 0 to 15 */
  1780. u8 reserved2[13];
  1781. };
  1782. I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_udp_tunnel);
  1783. struct i40e_aqc_del_udp_tunnel_completion {
  1784. __le16 udp_port;
  1785. u8 index; /* 0 to 15 */
  1786. u8 multiple_pfs;
  1787. u8 total_filters_used;
  1788. u8 reserved1[11];
  1789. };
  1790. I40E_CHECK_CMD_LENGTH(i40e_aqc_del_udp_tunnel_completion);
  1791. /* tunnel key structure 0x0B10 */
  1792. struct i40e_aqc_tunnel_key_structure {
  1793. u8 key1_off;
  1794. u8 key2_off;
  1795. u8 key1_len; /* 0 to 15 */
  1796. u8 key2_len; /* 0 to 15 */
  1797. u8 flags;
  1798. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDE 0x01
  1799. /* response flags */
  1800. #define I40E_AQC_TUNNEL_KEY_STRUCT_SUCCESS 0x01
  1801. #define I40E_AQC_TUNNEL_KEY_STRUCT_MODIFIED 0x02
  1802. #define I40E_AQC_TUNNEL_KEY_STRUCT_OVERRIDDEN 0x03
  1803. u8 network_key_index;
  1804. #define I40E_AQC_NETWORK_KEY_INDEX_VXLAN 0x0
  1805. #define I40E_AQC_NETWORK_KEY_INDEX_NGE 0x1
  1806. #define I40E_AQC_NETWORK_KEY_INDEX_FLEX_MAC_IN_UDP 0x2
  1807. #define I40E_AQC_NETWORK_KEY_INDEX_GRE 0x3
  1808. u8 reserved[10];
  1809. };
  1810. I40E_CHECK_CMD_LENGTH(i40e_aqc_tunnel_key_structure);
  1811. /* OEM mode commands (direct 0xFE0x) */
  1812. struct i40e_aqc_oem_param_change {
  1813. __le32 param_type;
  1814. #define I40E_AQ_OEM_PARAM_TYPE_PF_CTL 0
  1815. #define I40E_AQ_OEM_PARAM_TYPE_BW_CTL 1
  1816. #define I40E_AQ_OEM_PARAM_MAC 2
  1817. __le32 param_value1;
  1818. u8 param_value2[8];
  1819. };
  1820. I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_param_change);
  1821. struct i40e_aqc_oem_state_change {
  1822. __le32 state;
  1823. #define I40E_AQ_OEM_STATE_LINK_DOWN 0x0
  1824. #define I40E_AQ_OEM_STATE_LINK_UP 0x1
  1825. u8 reserved[12];
  1826. };
  1827. I40E_CHECK_CMD_LENGTH(i40e_aqc_oem_state_change);
  1828. /* debug commands */
  1829. /* get device id (0xFF00) uses the generic structure */
  1830. /* set test more (0xFF01, internal) */
  1831. struct i40e_acq_set_test_mode {
  1832. u8 mode;
  1833. #define I40E_AQ_TEST_PARTIAL 0
  1834. #define I40E_AQ_TEST_FULL 1
  1835. #define I40E_AQ_TEST_NVM 2
  1836. u8 reserved[3];
  1837. u8 command;
  1838. #define I40E_AQ_TEST_OPEN 0
  1839. #define I40E_AQ_TEST_CLOSE 1
  1840. #define I40E_AQ_TEST_INC 2
  1841. u8 reserved2[3];
  1842. __le32 address_high;
  1843. __le32 address_low;
  1844. };
  1845. I40E_CHECK_CMD_LENGTH(i40e_acq_set_test_mode);
  1846. /* Debug Read Register command (0xFF03)
  1847. * Debug Write Register command (0xFF04)
  1848. */
  1849. struct i40e_aqc_debug_reg_read_write {
  1850. __le32 reserved;
  1851. __le32 address;
  1852. __le32 value_high;
  1853. __le32 value_low;
  1854. };
  1855. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_reg_read_write);
  1856. /* Scatter/gather Reg Read (indirect 0xFF05)
  1857. * Scatter/gather Reg Write (indirect 0xFF06)
  1858. */
  1859. /* i40e_aq_desc is used for the command */
  1860. struct i40e_aqc_debug_reg_sg_element_data {
  1861. __le32 address;
  1862. __le32 value;
  1863. };
  1864. /* Debug Modify register (direct 0xFF07) */
  1865. struct i40e_aqc_debug_modify_reg {
  1866. __le32 address;
  1867. __le32 value;
  1868. __le32 clear_mask;
  1869. __le32 set_mask;
  1870. };
  1871. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_reg);
  1872. /* dump internal data (0xFF08, indirect) */
  1873. #define I40E_AQ_CLUSTER_ID_AUX 0
  1874. #define I40E_AQ_CLUSTER_ID_SWITCH_FLU 1
  1875. #define I40E_AQ_CLUSTER_ID_TXSCHED 2
  1876. #define I40E_AQ_CLUSTER_ID_HMC 3
  1877. #define I40E_AQ_CLUSTER_ID_MAC0 4
  1878. #define I40E_AQ_CLUSTER_ID_MAC1 5
  1879. #define I40E_AQ_CLUSTER_ID_MAC2 6
  1880. #define I40E_AQ_CLUSTER_ID_MAC3 7
  1881. #define I40E_AQ_CLUSTER_ID_DCB 8
  1882. #define I40E_AQ_CLUSTER_ID_EMP_MEM 9
  1883. #define I40E_AQ_CLUSTER_ID_PKT_BUF 10
  1884. #define I40E_AQ_CLUSTER_ID_ALTRAM 11
  1885. struct i40e_aqc_debug_dump_internals {
  1886. u8 cluster_id;
  1887. u8 table_id;
  1888. __le16 data_size;
  1889. __le32 idx;
  1890. __le32 address_high;
  1891. __le32 address_low;
  1892. };
  1893. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_dump_internals);
  1894. struct i40e_aqc_debug_modify_internals {
  1895. u8 cluster_id;
  1896. u8 cluster_specific_params[7];
  1897. __le32 address_high;
  1898. __le32 address_low;
  1899. };
  1900. I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
  1901. #endif