ice_adminq_cmd.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2018, Intel Corporation. */
  3. #ifndef _ICE_ADMINQ_CMD_H_
  4. #define _ICE_ADMINQ_CMD_H_
  5. /* This header file defines the Admin Queue commands, error codes and
  6. * descriptor format. It is shared between Firmware and Software.
  7. */
  8. #define ICE_MAX_VSI 768
  9. #define ICE_AQC_TOPO_MAX_LEVEL_NUM 0x9
  10. #define ICE_AQ_SET_MAC_FRAME_SIZE_MAX 9728
  11. struct ice_aqc_generic {
  12. __le32 param0;
  13. __le32 param1;
  14. __le32 addr_high;
  15. __le32 addr_low;
  16. };
  17. /* Get version (direct 0x0001) */
  18. struct ice_aqc_get_ver {
  19. __le32 rom_ver;
  20. __le32 fw_build;
  21. u8 fw_branch;
  22. u8 fw_major;
  23. u8 fw_minor;
  24. u8 fw_patch;
  25. u8 api_branch;
  26. u8 api_major;
  27. u8 api_minor;
  28. u8 api_patch;
  29. };
  30. /* Queue Shutdown (direct 0x0003) */
  31. struct ice_aqc_q_shutdown {
  32. #define ICE_AQC_DRIVER_UNLOADING BIT(0)
  33. __le32 driver_unloading;
  34. u8 reserved[12];
  35. };
  36. /* Request resource ownership (direct 0x0008)
  37. * Release resource ownership (direct 0x0009)
  38. */
  39. struct ice_aqc_req_res {
  40. __le16 res_id;
  41. #define ICE_AQC_RES_ID_NVM 1
  42. #define ICE_AQC_RES_ID_SDP 2
  43. #define ICE_AQC_RES_ID_CHNG_LOCK 3
  44. #define ICE_AQC_RES_ID_GLBL_LOCK 4
  45. __le16 access_type;
  46. #define ICE_AQC_RES_ACCESS_READ 1
  47. #define ICE_AQC_RES_ACCESS_WRITE 2
  48. /* Upon successful completion, FW writes this value and driver is
  49. * expected to release resource before timeout. This value is provided
  50. * in milliseconds.
  51. */
  52. __le32 timeout;
  53. #define ICE_AQ_RES_NVM_READ_DFLT_TIMEOUT_MS 3000
  54. #define ICE_AQ_RES_NVM_WRITE_DFLT_TIMEOUT_MS 180000
  55. #define ICE_AQ_RES_CHNG_LOCK_DFLT_TIMEOUT_MS 1000
  56. #define ICE_AQ_RES_GLBL_LOCK_DFLT_TIMEOUT_MS 3000
  57. /* For SDP: pin id of the SDP */
  58. __le32 res_number;
  59. /* Status is only used for ICE_AQC_RES_ID_GLBL_LOCK */
  60. __le16 status;
  61. #define ICE_AQ_RES_GLBL_SUCCESS 0
  62. #define ICE_AQ_RES_GLBL_IN_PROG 1
  63. #define ICE_AQ_RES_GLBL_DONE 2
  64. u8 reserved[2];
  65. };
  66. /* Get function capabilities (indirect 0x000A)
  67. * Get device capabilities (indirect 0x000B)
  68. */
  69. struct ice_aqc_list_caps {
  70. u8 cmd_flags;
  71. u8 pf_index;
  72. u8 reserved[2];
  73. __le32 count;
  74. __le32 addr_high;
  75. __le32 addr_low;
  76. };
  77. /* Device/Function buffer entry, repeated per reported capability */
  78. struct ice_aqc_list_caps_elem {
  79. __le16 cap;
  80. #define ICE_AQC_CAPS_VSI 0x0017
  81. #define ICE_AQC_CAPS_RSS 0x0040
  82. #define ICE_AQC_CAPS_RXQS 0x0041
  83. #define ICE_AQC_CAPS_TXQS 0x0042
  84. #define ICE_AQC_CAPS_MSIX 0x0043
  85. #define ICE_AQC_CAPS_MAX_MTU 0x0047
  86. u8 major_ver;
  87. u8 minor_ver;
  88. /* Number of resources described by this capability */
  89. __le32 number;
  90. /* Only meaningful for some types of resources */
  91. __le32 logical_id;
  92. /* Only meaningful for some types of resources */
  93. __le32 phys_id;
  94. __le64 rsvd1;
  95. __le64 rsvd2;
  96. };
  97. /* Manage MAC address, read command - indirect (0x0107)
  98. * This struct is also used for the response
  99. */
  100. struct ice_aqc_manage_mac_read {
  101. __le16 flags; /* Zeroed by device driver */
  102. #define ICE_AQC_MAN_MAC_LAN_ADDR_VALID BIT(4)
  103. #define ICE_AQC_MAN_MAC_SAN_ADDR_VALID BIT(5)
  104. #define ICE_AQC_MAN_MAC_PORT_ADDR_VALID BIT(6)
  105. #define ICE_AQC_MAN_MAC_WOL_ADDR_VALID BIT(7)
  106. #define ICE_AQC_MAN_MAC_READ_S 4
  107. #define ICE_AQC_MAN_MAC_READ_M (0xF << ICE_AQC_MAN_MAC_READ_S)
  108. u8 lport_num;
  109. u8 lport_num_valid;
  110. #define ICE_AQC_MAN_MAC_PORT_NUM_IS_VALID BIT(0)
  111. u8 num_addr; /* Used in response */
  112. u8 reserved[3];
  113. __le32 addr_high;
  114. __le32 addr_low;
  115. };
  116. /* Response buffer format for manage MAC read command */
  117. struct ice_aqc_manage_mac_read_resp {
  118. u8 lport_num;
  119. u8 addr_type;
  120. #define ICE_AQC_MAN_MAC_ADDR_TYPE_LAN 0
  121. #define ICE_AQC_MAN_MAC_ADDR_TYPE_WOL 1
  122. u8 mac_addr[ETH_ALEN];
  123. };
  124. /* Manage MAC address, write command - direct (0x0108) */
  125. struct ice_aqc_manage_mac_write {
  126. u8 port_num;
  127. u8 flags;
  128. #define ICE_AQC_MAN_MAC_WR_MC_MAG_EN BIT(0)
  129. #define ICE_AQC_MAN_MAC_WR_WOL_LAA_PFR_KEEP BIT(1)
  130. #define ICE_AQC_MAN_MAC_WR_S 6
  131. #define ICE_AQC_MAN_MAC_WR_M (3 << ICE_AQC_MAN_MAC_WR_S)
  132. #define ICE_AQC_MAN_MAC_UPDATE_LAA 0
  133. #define ICE_AQC_MAN_MAC_UPDATE_LAA_WOL (BIT(0) << ICE_AQC_MAN_MAC_WR_S)
  134. /* High 16 bits of MAC address in big endian order */
  135. __be16 sah;
  136. /* Low 32 bits of MAC address in big endian order */
  137. __be32 sal;
  138. __le32 addr_high;
  139. __le32 addr_low;
  140. };
  141. /* Clear PXE Command and response (direct 0x0110) */
  142. struct ice_aqc_clear_pxe {
  143. u8 rx_cnt;
  144. #define ICE_AQC_CLEAR_PXE_RX_CNT 0x2
  145. u8 reserved[15];
  146. };
  147. /* Get switch configuration (0x0200) */
  148. struct ice_aqc_get_sw_cfg {
  149. /* Reserved for command and copy of request flags for response */
  150. __le16 flags;
  151. /* First desc in case of command and next_elem in case of response
  152. * In case of response, if it is not zero, means all the configuration
  153. * was not returned and new command shall be sent with this value in
  154. * the 'first desc' field
  155. */
  156. __le16 element;
  157. /* Reserved for command, only used for response */
  158. __le16 num_elems;
  159. __le16 rsvd;
  160. __le32 addr_high;
  161. __le32 addr_low;
  162. };
  163. /* Each entry in the response buffer is of the following type: */
  164. struct ice_aqc_get_sw_cfg_resp_elem {
  165. /* VSI/Port Number */
  166. __le16 vsi_port_num;
  167. #define ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_S 0
  168. #define ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_M \
  169. (0x3FF << ICE_AQC_GET_SW_CONF_RESP_VSI_PORT_NUM_S)
  170. #define ICE_AQC_GET_SW_CONF_RESP_TYPE_S 14
  171. #define ICE_AQC_GET_SW_CONF_RESP_TYPE_M (0x3 << ICE_AQC_GET_SW_CONF_RESP_TYPE_S)
  172. #define ICE_AQC_GET_SW_CONF_RESP_PHYS_PORT 0
  173. #define ICE_AQC_GET_SW_CONF_RESP_VIRT_PORT 1
  174. #define ICE_AQC_GET_SW_CONF_RESP_VSI 2
  175. /* SWID VSI/Port belongs to */
  176. __le16 swid;
  177. /* Bit 14..0 : PF/VF number VSI belongs to
  178. * Bit 15 : VF indication bit
  179. */
  180. __le16 pf_vf_num;
  181. #define ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_S 0
  182. #define ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_M \
  183. (0x7FFF << ICE_AQC_GET_SW_CONF_RESP_FUNC_NUM_S)
  184. #define ICE_AQC_GET_SW_CONF_RESP_IS_VF BIT(15)
  185. };
  186. /* The response buffer is as follows. Note that the length of the
  187. * elements array varies with the length of the command response.
  188. */
  189. struct ice_aqc_get_sw_cfg_resp {
  190. struct ice_aqc_get_sw_cfg_resp_elem elements[1];
  191. };
  192. /* These resource type defines are used for all switch resource
  193. * commands where a resource type is required, such as:
  194. * Get Resource Allocation command (indirect 0x0204)
  195. * Allocate Resources command (indirect 0x0208)
  196. * Free Resources command (indirect 0x0209)
  197. * Get Allocated Resource Descriptors Command (indirect 0x020A)
  198. */
  199. #define ICE_AQC_RES_TYPE_VSI_LIST_REP 0x03
  200. #define ICE_AQC_RES_TYPE_VSI_LIST_PRUNE 0x04
  201. /* Allocate Resources command (indirect 0x0208)
  202. * Free Resources command (indirect 0x0209)
  203. */
  204. struct ice_aqc_alloc_free_res_cmd {
  205. __le16 num_entries; /* Number of Resource entries */
  206. u8 reserved[6];
  207. __le32 addr_high;
  208. __le32 addr_low;
  209. };
  210. /* Resource descriptor */
  211. struct ice_aqc_res_elem {
  212. union {
  213. __le16 sw_resp;
  214. __le16 flu_resp;
  215. } e;
  216. };
  217. /* Buffer for Allocate/Free Resources commands */
  218. struct ice_aqc_alloc_free_res_elem {
  219. __le16 res_type; /* Types defined above cmd 0x0204 */
  220. #define ICE_AQC_RES_TYPE_SHARED_S 7
  221. #define ICE_AQC_RES_TYPE_SHARED_M (0x1 << ICE_AQC_RES_TYPE_SHARED_S)
  222. #define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S 8
  223. #define ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_M \
  224. (0xF << ICE_AQC_RES_TYPE_VSI_PRUNE_LIST_S)
  225. __le16 num_elems;
  226. struct ice_aqc_res_elem elem[1];
  227. };
  228. /* Add VSI (indirect 0x0210)
  229. * Update VSI (indirect 0x0211)
  230. * Get VSI (indirect 0x0212)
  231. * Free VSI (indirect 0x0213)
  232. */
  233. struct ice_aqc_add_get_update_free_vsi {
  234. __le16 vsi_num;
  235. #define ICE_AQ_VSI_NUM_S 0
  236. #define ICE_AQ_VSI_NUM_M (0x03FF << ICE_AQ_VSI_NUM_S)
  237. #define ICE_AQ_VSI_IS_VALID BIT(15)
  238. __le16 cmd_flags;
  239. #define ICE_AQ_VSI_KEEP_ALLOC 0x1
  240. u8 vf_id;
  241. u8 reserved;
  242. __le16 vsi_flags;
  243. #define ICE_AQ_VSI_TYPE_S 0
  244. #define ICE_AQ_VSI_TYPE_M (0x3 << ICE_AQ_VSI_TYPE_S)
  245. #define ICE_AQ_VSI_TYPE_VF 0x0
  246. #define ICE_AQ_VSI_TYPE_VMDQ2 0x1
  247. #define ICE_AQ_VSI_TYPE_PF 0x2
  248. #define ICE_AQ_VSI_TYPE_EMP_MNG 0x3
  249. __le32 addr_high;
  250. __le32 addr_low;
  251. };
  252. /* Response descriptor for:
  253. * Add VSI (indirect 0x0210)
  254. * Update VSI (indirect 0x0211)
  255. * Free VSI (indirect 0x0213)
  256. */
  257. struct ice_aqc_add_update_free_vsi_resp {
  258. __le16 vsi_num;
  259. __le16 ext_status;
  260. __le16 vsi_used;
  261. __le16 vsi_free;
  262. __le32 addr_high;
  263. __le32 addr_low;
  264. };
  265. struct ice_aqc_vsi_props {
  266. __le16 valid_sections;
  267. #define ICE_AQ_VSI_PROP_SW_VALID BIT(0)
  268. #define ICE_AQ_VSI_PROP_SECURITY_VALID BIT(1)
  269. #define ICE_AQ_VSI_PROP_VLAN_VALID BIT(2)
  270. #define ICE_AQ_VSI_PROP_OUTER_TAG_VALID BIT(3)
  271. #define ICE_AQ_VSI_PROP_INGRESS_UP_VALID BIT(4)
  272. #define ICE_AQ_VSI_PROP_EGRESS_UP_VALID BIT(5)
  273. #define ICE_AQ_VSI_PROP_RXQ_MAP_VALID BIT(6)
  274. #define ICE_AQ_VSI_PROP_Q_OPT_VALID BIT(7)
  275. #define ICE_AQ_VSI_PROP_OUTER_UP_VALID BIT(8)
  276. #define ICE_AQ_VSI_PROP_FLOW_DIR_VALID BIT(11)
  277. #define ICE_AQ_VSI_PROP_PASID_VALID BIT(12)
  278. /* switch section */
  279. u8 sw_id;
  280. u8 sw_flags;
  281. #define ICE_AQ_VSI_SW_FLAG_ALLOW_LB BIT(5)
  282. #define ICE_AQ_VSI_SW_FLAG_LOCAL_LB BIT(6)
  283. #define ICE_AQ_VSI_SW_FLAG_SRC_PRUNE BIT(7)
  284. u8 sw_flags2;
  285. #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S 0
  286. #define ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_M \
  287. (0xF << ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_S)
  288. #define ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA BIT(0)
  289. #define ICE_AQ_VSI_SW_FLAG_LAN_ENA BIT(4)
  290. u8 veb_stat_id;
  291. #define ICE_AQ_VSI_SW_VEB_STAT_ID_S 0
  292. #define ICE_AQ_VSI_SW_VEB_STAT_ID_M (0x1F << ICE_AQ_VSI_SW_VEB_STAT_ID_S)
  293. #define ICE_AQ_VSI_SW_VEB_STAT_ID_VALID BIT(5)
  294. /* security section */
  295. u8 sec_flags;
  296. #define ICE_AQ_VSI_SEC_FLAG_ALLOW_DEST_OVRD BIT(0)
  297. #define ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF BIT(2)
  298. #define ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S 4
  299. #define ICE_AQ_VSI_SEC_TX_PRUNE_ENA_M (0xF << ICE_AQ_VSI_SEC_TX_PRUNE_ENA_S)
  300. #define ICE_AQ_VSI_SEC_TX_VLAN_PRUNE_ENA BIT(0)
  301. u8 sec_reserved;
  302. /* VLAN section */
  303. __le16 pvid; /* VLANS include priority bits */
  304. u8 pvlan_reserved[2];
  305. u8 vlan_flags;
  306. #define ICE_AQ_VSI_VLAN_MODE_S 0
  307. #define ICE_AQ_VSI_VLAN_MODE_M (0x3 << ICE_AQ_VSI_VLAN_MODE_S)
  308. #define ICE_AQ_VSI_VLAN_MODE_UNTAGGED 0x1
  309. #define ICE_AQ_VSI_VLAN_MODE_TAGGED 0x2
  310. #define ICE_AQ_VSI_VLAN_MODE_ALL 0x3
  311. #define ICE_AQ_VSI_PVLAN_INSERT_PVID BIT(2)
  312. #define ICE_AQ_VSI_VLAN_EMOD_S 3
  313. #define ICE_AQ_VSI_VLAN_EMOD_M (0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
  314. #define ICE_AQ_VSI_VLAN_EMOD_STR_BOTH (0x0 << ICE_AQ_VSI_VLAN_EMOD_S)
  315. #define ICE_AQ_VSI_VLAN_EMOD_STR_UP (0x1 << ICE_AQ_VSI_VLAN_EMOD_S)
  316. #define ICE_AQ_VSI_VLAN_EMOD_STR (0x2 << ICE_AQ_VSI_VLAN_EMOD_S)
  317. #define ICE_AQ_VSI_VLAN_EMOD_NOTHING (0x3 << ICE_AQ_VSI_VLAN_EMOD_S)
  318. u8 pvlan_reserved2[3];
  319. /* ingress egress up sections */
  320. __le32 ingress_table; /* bitmap, 3 bits per up */
  321. #define ICE_AQ_VSI_UP_TABLE_UP0_S 0
  322. #define ICE_AQ_VSI_UP_TABLE_UP0_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP0_S)
  323. #define ICE_AQ_VSI_UP_TABLE_UP1_S 3
  324. #define ICE_AQ_VSI_UP_TABLE_UP1_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP1_S)
  325. #define ICE_AQ_VSI_UP_TABLE_UP2_S 6
  326. #define ICE_AQ_VSI_UP_TABLE_UP2_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP2_S)
  327. #define ICE_AQ_VSI_UP_TABLE_UP3_S 9
  328. #define ICE_AQ_VSI_UP_TABLE_UP3_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP3_S)
  329. #define ICE_AQ_VSI_UP_TABLE_UP4_S 12
  330. #define ICE_AQ_VSI_UP_TABLE_UP4_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP4_S)
  331. #define ICE_AQ_VSI_UP_TABLE_UP5_S 15
  332. #define ICE_AQ_VSI_UP_TABLE_UP5_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP5_S)
  333. #define ICE_AQ_VSI_UP_TABLE_UP6_S 18
  334. #define ICE_AQ_VSI_UP_TABLE_UP6_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP6_S)
  335. #define ICE_AQ_VSI_UP_TABLE_UP7_S 21
  336. #define ICE_AQ_VSI_UP_TABLE_UP7_M (0x7 << ICE_AQ_VSI_UP_TABLE_UP7_S)
  337. __le32 egress_table; /* same defines as for ingress table */
  338. /* outer tags section */
  339. __le16 outer_tag;
  340. u8 outer_tag_flags;
  341. #define ICE_AQ_VSI_OUTER_TAG_MODE_S 0
  342. #define ICE_AQ_VSI_OUTER_TAG_MODE_M (0x3 << ICE_AQ_VSI_OUTER_TAG_MODE_S)
  343. #define ICE_AQ_VSI_OUTER_TAG_NOTHING 0x0
  344. #define ICE_AQ_VSI_OUTER_TAG_REMOVE 0x1
  345. #define ICE_AQ_VSI_OUTER_TAG_COPY 0x2
  346. #define ICE_AQ_VSI_OUTER_TAG_TYPE_S 2
  347. #define ICE_AQ_VSI_OUTER_TAG_TYPE_M (0x3 << ICE_AQ_VSI_OUTER_TAG_TYPE_S)
  348. #define ICE_AQ_VSI_OUTER_TAG_NONE 0x0
  349. #define ICE_AQ_VSI_OUTER_TAG_STAG 0x1
  350. #define ICE_AQ_VSI_OUTER_TAG_VLAN_8100 0x2
  351. #define ICE_AQ_VSI_OUTER_TAG_VLAN_9100 0x3
  352. #define ICE_AQ_VSI_OUTER_TAG_INSERT BIT(4)
  353. #define ICE_AQ_VSI_OUTER_TAG_ACCEPT_HOST BIT(6)
  354. u8 outer_tag_reserved;
  355. /* queue mapping section */
  356. __le16 mapping_flags;
  357. #define ICE_AQ_VSI_Q_MAP_CONTIG 0x0
  358. #define ICE_AQ_VSI_Q_MAP_NONCONTIG BIT(0)
  359. __le16 q_mapping[16];
  360. #define ICE_AQ_VSI_Q_S 0
  361. #define ICE_AQ_VSI_Q_M (0x7FF << ICE_AQ_VSI_Q_S)
  362. __le16 tc_mapping[8];
  363. #define ICE_AQ_VSI_TC_Q_OFFSET_S 0
  364. #define ICE_AQ_VSI_TC_Q_OFFSET_M (0x7FF << ICE_AQ_VSI_TC_Q_OFFSET_S)
  365. #define ICE_AQ_VSI_TC_Q_NUM_S 11
  366. #define ICE_AQ_VSI_TC_Q_NUM_M (0xF << ICE_AQ_VSI_TC_Q_NUM_S)
  367. /* queueing option section */
  368. u8 q_opt_rss;
  369. #define ICE_AQ_VSI_Q_OPT_RSS_LUT_S 0
  370. #define ICE_AQ_VSI_Q_OPT_RSS_LUT_M (0x3 << ICE_AQ_VSI_Q_OPT_RSS_LUT_S)
  371. #define ICE_AQ_VSI_Q_OPT_RSS_LUT_VSI 0x0
  372. #define ICE_AQ_VSI_Q_OPT_RSS_LUT_PF 0x2
  373. #define ICE_AQ_VSI_Q_OPT_RSS_LUT_GBL 0x3
  374. #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S 2
  375. #define ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_M (0xF << ICE_AQ_VSI_Q_OPT_RSS_GBL_LUT_S)
  376. #define ICE_AQ_VSI_Q_OPT_RSS_HASH_S 6
  377. #define ICE_AQ_VSI_Q_OPT_RSS_HASH_M (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
  378. #define ICE_AQ_VSI_Q_OPT_RSS_TPLZ (0x0 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
  379. #define ICE_AQ_VSI_Q_OPT_RSS_SYM_TPLZ (0x1 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
  380. #define ICE_AQ_VSI_Q_OPT_RSS_XOR (0x2 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
  381. #define ICE_AQ_VSI_Q_OPT_RSS_JHASH (0x3 << ICE_AQ_VSI_Q_OPT_RSS_HASH_S)
  382. u8 q_opt_tc;
  383. #define ICE_AQ_VSI_Q_OPT_TC_OVR_S 0
  384. #define ICE_AQ_VSI_Q_OPT_TC_OVR_M (0x1F << ICE_AQ_VSI_Q_OPT_TC_OVR_S)
  385. #define ICE_AQ_VSI_Q_OPT_PROF_TC_OVR BIT(7)
  386. u8 q_opt_flags;
  387. #define ICE_AQ_VSI_Q_OPT_PE_FLTR_EN BIT(0)
  388. u8 q_opt_reserved[3];
  389. /* outer up section */
  390. __le32 outer_up_table; /* same structure and defines as ingress tbl */
  391. /* section 10 */
  392. __le16 sect_10_reserved;
  393. /* flow director section */
  394. __le16 fd_options;
  395. #define ICE_AQ_VSI_FD_ENABLE BIT(0)
  396. #define ICE_AQ_VSI_FD_TX_AUTO_ENABLE BIT(1)
  397. #define ICE_AQ_VSI_FD_PROG_ENABLE BIT(3)
  398. __le16 max_fd_fltr_dedicated;
  399. __le16 max_fd_fltr_shared;
  400. __le16 fd_def_q;
  401. #define ICE_AQ_VSI_FD_DEF_Q_S 0
  402. #define ICE_AQ_VSI_FD_DEF_Q_M (0x7FF << ICE_AQ_VSI_FD_DEF_Q_S)
  403. #define ICE_AQ_VSI_FD_DEF_GRP_S 12
  404. #define ICE_AQ_VSI_FD_DEF_GRP_M (0x7 << ICE_AQ_VSI_FD_DEF_GRP_S)
  405. __le16 fd_report_opt;
  406. #define ICE_AQ_VSI_FD_REPORT_Q_S 0
  407. #define ICE_AQ_VSI_FD_REPORT_Q_M (0x7FF << ICE_AQ_VSI_FD_REPORT_Q_S)
  408. #define ICE_AQ_VSI_FD_DEF_PRIORITY_S 12
  409. #define ICE_AQ_VSI_FD_DEF_PRIORITY_M (0x7 << ICE_AQ_VSI_FD_DEF_PRIORITY_S)
  410. #define ICE_AQ_VSI_FD_DEF_DROP BIT(15)
  411. /* PASID section */
  412. __le32 pasid_id;
  413. #define ICE_AQ_VSI_PASID_ID_S 0
  414. #define ICE_AQ_VSI_PASID_ID_M (0xFFFFF << ICE_AQ_VSI_PASID_ID_S)
  415. #define ICE_AQ_VSI_PASID_ID_VALID BIT(31)
  416. u8 reserved[24];
  417. };
  418. #define ICE_MAX_NUM_RECIPES 64
  419. /* Add/Update/Remove/Get switch rules (indirect 0x02A0, 0x02A1, 0x02A2, 0x02A3)
  420. */
  421. struct ice_aqc_sw_rules {
  422. /* ops: add switch rules, referring the number of rules.
  423. * ops: update switch rules, referring the number of filters
  424. * ops: remove switch rules, referring the entry index.
  425. * ops: get switch rules, referring to the number of filters.
  426. */
  427. __le16 num_rules_fltr_entry_index;
  428. u8 reserved[6];
  429. __le32 addr_high;
  430. __le32 addr_low;
  431. };
  432. /* Add/Update/Get/Remove lookup Rx/Tx command/response entry
  433. * This structures describes the lookup rules and associated actions. "index"
  434. * is returned as part of a response to a successful Add command, and can be
  435. * used to identify the rule for Update/Get/Remove commands.
  436. */
  437. struct ice_sw_rule_lkup_rx_tx {
  438. __le16 recipe_id;
  439. #define ICE_SW_RECIPE_LOGICAL_PORT_FWD 10
  440. /* Source port for LOOKUP_RX and source VSI in case of LOOKUP_TX */
  441. __le16 src;
  442. __le32 act;
  443. /* Bit 0:1 - Action type */
  444. #define ICE_SINGLE_ACT_TYPE_S 0x00
  445. #define ICE_SINGLE_ACT_TYPE_M (0x3 << ICE_SINGLE_ACT_TYPE_S)
  446. /* Bit 2 - Loop back enable
  447. * Bit 3 - LAN enable
  448. */
  449. #define ICE_SINGLE_ACT_LB_ENABLE BIT(2)
  450. #define ICE_SINGLE_ACT_LAN_ENABLE BIT(3)
  451. /* Action type = 0 - Forward to VSI or VSI list */
  452. #define ICE_SINGLE_ACT_VSI_FORWARDING 0x0
  453. #define ICE_SINGLE_ACT_VSI_ID_S 4
  454. #define ICE_SINGLE_ACT_VSI_ID_M (0x3FF << ICE_SINGLE_ACT_VSI_ID_S)
  455. #define ICE_SINGLE_ACT_VSI_LIST_ID_S 4
  456. #define ICE_SINGLE_ACT_VSI_LIST_ID_M (0x3FF << ICE_SINGLE_ACT_VSI_LIST_ID_S)
  457. /* This bit needs to be set if action is forward to VSI list */
  458. #define ICE_SINGLE_ACT_VSI_LIST BIT(14)
  459. #define ICE_SINGLE_ACT_VALID_BIT BIT(17)
  460. #define ICE_SINGLE_ACT_DROP BIT(18)
  461. /* Action type = 1 - Forward to Queue of Queue group */
  462. #define ICE_SINGLE_ACT_TO_Q 0x1
  463. #define ICE_SINGLE_ACT_Q_INDEX_S 4
  464. #define ICE_SINGLE_ACT_Q_INDEX_M (0x7FF << ICE_SINGLE_ACT_Q_INDEX_S)
  465. #define ICE_SINGLE_ACT_Q_REGION_S 15
  466. #define ICE_SINGLE_ACT_Q_REGION_M (0x7 << ICE_SINGLE_ACT_Q_REGION_S)
  467. #define ICE_SINGLE_ACT_Q_PRIORITY BIT(18)
  468. /* Action type = 2 - Prune */
  469. #define ICE_SINGLE_ACT_PRUNE 0x2
  470. #define ICE_SINGLE_ACT_EGRESS BIT(15)
  471. #define ICE_SINGLE_ACT_INGRESS BIT(16)
  472. #define ICE_SINGLE_ACT_PRUNET BIT(17)
  473. /* Bit 18 should be set to 0 for this action */
  474. /* Action type = 2 - Pointer */
  475. #define ICE_SINGLE_ACT_PTR 0x2
  476. #define ICE_SINGLE_ACT_PTR_VAL_S 4
  477. #define ICE_SINGLE_ACT_PTR_VAL_M (0x1FFF << ICE_SINGLE_ACT_PTR_VAL_S)
  478. /* Bit 18 should be set to 1 */
  479. #define ICE_SINGLE_ACT_PTR_BIT BIT(18)
  480. /* Action type = 3 - Other actions. Last two bits
  481. * are other action identifier
  482. */
  483. #define ICE_SINGLE_ACT_OTHER_ACTS 0x3
  484. #define ICE_SINGLE_OTHER_ACT_IDENTIFIER_S 17
  485. #define ICE_SINGLE_OTHER_ACT_IDENTIFIER_M \
  486. (0x3 << \ ICE_SINGLE_OTHER_ACT_IDENTIFIER_S)
  487. /* Bit 17:18 - Defines other actions */
  488. /* Other action = 0 - Mirror VSI */
  489. #define ICE_SINGLE_OTHER_ACT_MIRROR 0
  490. #define ICE_SINGLE_ACT_MIRROR_VSI_ID_S 4
  491. #define ICE_SINGLE_ACT_MIRROR_VSI_ID_M \
  492. (0x3FF << ICE_SINGLE_ACT_MIRROR_VSI_ID_S)
  493. /* Other action = 3 - Set Stat count */
  494. #define ICE_SINGLE_OTHER_ACT_STAT_COUNT 3
  495. #define ICE_SINGLE_ACT_STAT_COUNT_INDEX_S 4
  496. #define ICE_SINGLE_ACT_STAT_COUNT_INDEX_M \
  497. (0x7F << ICE_SINGLE_ACT_STAT_COUNT_INDEX_S)
  498. __le16 index; /* The index of the rule in the lookup table */
  499. /* Length and values of the header to be matched per recipe or
  500. * lookup-type
  501. */
  502. __le16 hdr_len;
  503. u8 hdr[1];
  504. } __packed;
  505. /* Add/Update/Remove large action command/response entry
  506. * "index" is returned as part of a response to a successful Add command, and
  507. * can be used to identify the action for Update/Get/Remove commands.
  508. */
  509. struct ice_sw_rule_lg_act {
  510. __le16 index; /* Index in large action table */
  511. __le16 size;
  512. __le32 act[1]; /* array of size for actions */
  513. /* Max number of large actions */
  514. #define ICE_MAX_LG_ACT 4
  515. /* Bit 0:1 - Action type */
  516. #define ICE_LG_ACT_TYPE_S 0
  517. #define ICE_LG_ACT_TYPE_M (0x7 << ICE_LG_ACT_TYPE_S)
  518. /* Action type = 0 - Forward to VSI or VSI list */
  519. #define ICE_LG_ACT_VSI_FORWARDING 0
  520. #define ICE_LG_ACT_VSI_ID_S 3
  521. #define ICE_LG_ACT_VSI_ID_M (0x3FF << ICE_LG_ACT_VSI_ID_S)
  522. #define ICE_LG_ACT_VSI_LIST_ID_S 3
  523. #define ICE_LG_ACT_VSI_LIST_ID_M (0x3FF << ICE_LG_ACT_VSI_LIST_ID_S)
  524. /* This bit needs to be set if action is forward to VSI list */
  525. #define ICE_LG_ACT_VSI_LIST BIT(13)
  526. #define ICE_LG_ACT_VALID_BIT BIT(16)
  527. /* Action type = 1 - Forward to Queue of Queue group */
  528. #define ICE_LG_ACT_TO_Q 0x1
  529. #define ICE_LG_ACT_Q_INDEX_S 3
  530. #define ICE_LG_ACT_Q_INDEX_M (0x7FF << ICE_LG_ACT_Q_INDEX_S)
  531. #define ICE_LG_ACT_Q_REGION_S 14
  532. #define ICE_LG_ACT_Q_REGION_M (0x7 << ICE_LG_ACT_Q_REGION_S)
  533. #define ICE_LG_ACT_Q_PRIORITY_SET BIT(17)
  534. /* Action type = 2 - Prune */
  535. #define ICE_LG_ACT_PRUNE 0x2
  536. #define ICE_LG_ACT_EGRESS BIT(14)
  537. #define ICE_LG_ACT_INGRESS BIT(15)
  538. #define ICE_LG_ACT_PRUNET BIT(16)
  539. /* Action type = 3 - Mirror VSI */
  540. #define ICE_LG_OTHER_ACT_MIRROR 0x3
  541. #define ICE_LG_ACT_MIRROR_VSI_ID_S 3
  542. #define ICE_LG_ACT_MIRROR_VSI_ID_M (0x3FF << ICE_LG_ACT_MIRROR_VSI_ID_S)
  543. /* Action type = 5 - Generic Value */
  544. #define ICE_LG_ACT_GENERIC 0x5
  545. #define ICE_LG_ACT_GENERIC_VALUE_S 3
  546. #define ICE_LG_ACT_GENERIC_VALUE_M (0xFFFF << ICE_LG_ACT_GENERIC_VALUE_S)
  547. #define ICE_LG_ACT_GENERIC_OFFSET_S 19
  548. #define ICE_LG_ACT_GENERIC_OFFSET_M (0x7 << ICE_LG_ACT_GENERIC_OFFSET_S)
  549. #define ICE_LG_ACT_GENERIC_PRIORITY_S 22
  550. #define ICE_LG_ACT_GENERIC_PRIORITY_M (0x7 << ICE_LG_ACT_GENERIC_PRIORITY_S)
  551. #define ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX 7
  552. /* Action = 7 - Set Stat count */
  553. #define ICE_LG_ACT_STAT_COUNT 0x7
  554. #define ICE_LG_ACT_STAT_COUNT_S 3
  555. #define ICE_LG_ACT_STAT_COUNT_M (0x7F << ICE_LG_ACT_STAT_COUNT_S)
  556. };
  557. /* Add/Update/Remove VSI list command/response entry
  558. * "index" is returned as part of a response to a successful Add command, and
  559. * can be used to identify the VSI list for Update/Get/Remove commands.
  560. */
  561. struct ice_sw_rule_vsi_list {
  562. __le16 index; /* Index of VSI/Prune list */
  563. __le16 number_vsi;
  564. __le16 vsi[1]; /* Array of number_vsi VSI numbers */
  565. };
  566. /* Query VSI list command/response entry */
  567. struct ice_sw_rule_vsi_list_query {
  568. __le16 index;
  569. DECLARE_BITMAP(vsi_list, ICE_MAX_VSI);
  570. } __packed;
  571. /* Add switch rule response:
  572. * Content of return buffer is same as the input buffer. The status field and
  573. * LUT index are updated as part of the response
  574. */
  575. struct ice_aqc_sw_rules_elem {
  576. __le16 type; /* Switch rule type, one of T_... */
  577. #define ICE_AQC_SW_RULES_T_LKUP_RX 0x0
  578. #define ICE_AQC_SW_RULES_T_LKUP_TX 0x1
  579. #define ICE_AQC_SW_RULES_T_LG_ACT 0x2
  580. #define ICE_AQC_SW_RULES_T_VSI_LIST_SET 0x3
  581. #define ICE_AQC_SW_RULES_T_VSI_LIST_CLEAR 0x4
  582. #define ICE_AQC_SW_RULES_T_PRUNE_LIST_SET 0x5
  583. #define ICE_AQC_SW_RULES_T_PRUNE_LIST_CLEAR 0x6
  584. __le16 status;
  585. union {
  586. struct ice_sw_rule_lkup_rx_tx lkup_tx_rx;
  587. struct ice_sw_rule_lg_act lg_act;
  588. struct ice_sw_rule_vsi_list vsi_list;
  589. struct ice_sw_rule_vsi_list_query vsi_list_query;
  590. } __packed pdata;
  591. };
  592. /* Get Default Topology (indirect 0x0400) */
  593. struct ice_aqc_get_topo {
  594. u8 port_num;
  595. u8 num_branches;
  596. __le16 reserved1;
  597. __le32 reserved2;
  598. __le32 addr_high;
  599. __le32 addr_low;
  600. };
  601. /* Update TSE (indirect 0x0403)
  602. * Get TSE (indirect 0x0404)
  603. */
  604. struct ice_aqc_get_cfg_elem {
  605. __le16 num_elem_req; /* Used by commands */
  606. __le16 num_elem_resp; /* Used by responses */
  607. __le32 reserved;
  608. __le32 addr_high;
  609. __le32 addr_low;
  610. };
  611. /* This is the buffer for:
  612. * Suspend Nodes (indirect 0x0409)
  613. * Resume Nodes (indirect 0x040A)
  614. */
  615. struct ice_aqc_suspend_resume_elem {
  616. __le32 teid[1];
  617. };
  618. /* Add TSE (indirect 0x0401)
  619. * Delete TSE (indirect 0x040F)
  620. * Move TSE (indirect 0x0408)
  621. */
  622. struct ice_aqc_add_move_delete_elem {
  623. __le16 num_grps_req;
  624. __le16 num_grps_updated;
  625. __le32 reserved;
  626. __le32 addr_high;
  627. __le32 addr_low;
  628. };
  629. struct ice_aqc_elem_info_bw {
  630. __le16 bw_profile_idx;
  631. __le16 bw_alloc;
  632. };
  633. struct ice_aqc_txsched_elem {
  634. u8 elem_type; /* Special field, reserved for some aq calls */
  635. #define ICE_AQC_ELEM_TYPE_UNDEFINED 0x0
  636. #define ICE_AQC_ELEM_TYPE_ROOT_PORT 0x1
  637. #define ICE_AQC_ELEM_TYPE_TC 0x2
  638. #define ICE_AQC_ELEM_TYPE_SE_GENERIC 0x3
  639. #define ICE_AQC_ELEM_TYPE_ENTRY_POINT 0x4
  640. #define ICE_AQC_ELEM_TYPE_LEAF 0x5
  641. #define ICE_AQC_ELEM_TYPE_SE_PADDED 0x6
  642. u8 valid_sections;
  643. #define ICE_AQC_ELEM_VALID_GENERIC BIT(0)
  644. #define ICE_AQC_ELEM_VALID_CIR BIT(1)
  645. #define ICE_AQC_ELEM_VALID_EIR BIT(2)
  646. #define ICE_AQC_ELEM_VALID_SHARED BIT(3)
  647. u8 generic;
  648. #define ICE_AQC_ELEM_GENERIC_MODE_M 0x1
  649. #define ICE_AQC_ELEM_GENERIC_PRIO_S 0x1
  650. #define ICE_AQC_ELEM_GENERIC_PRIO_M (0x7 << ICE_AQC_ELEM_GENERIC_PRIO_S)
  651. #define ICE_AQC_ELEM_GENERIC_SP_S 0x4
  652. #define ICE_AQC_ELEM_GENERIC_SP_M (0x1 << ICE_AQC_ELEM_GENERIC_SP_S)
  653. #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S 0x5
  654. #define ICE_AQC_ELEM_GENERIC_ADJUST_VAL_M \
  655. (0x3 << ICE_AQC_ELEM_GENERIC_ADJUST_VAL_S)
  656. u8 flags; /* Special field, reserved for some aq calls */
  657. #define ICE_AQC_ELEM_FLAG_SUSPEND_M 0x1
  658. struct ice_aqc_elem_info_bw cir_bw;
  659. struct ice_aqc_elem_info_bw eir_bw;
  660. __le16 srl_id;
  661. __le16 reserved2;
  662. };
  663. struct ice_aqc_txsched_elem_data {
  664. __le32 parent_teid;
  665. __le32 node_teid;
  666. struct ice_aqc_txsched_elem data;
  667. };
  668. struct ice_aqc_txsched_topo_grp_info_hdr {
  669. __le32 parent_teid;
  670. __le16 num_elems;
  671. __le16 reserved2;
  672. };
  673. struct ice_aqc_add_elem {
  674. struct ice_aqc_txsched_topo_grp_info_hdr hdr;
  675. struct ice_aqc_txsched_elem_data generic[1];
  676. };
  677. struct ice_aqc_get_elem {
  678. struct ice_aqc_txsched_elem_data generic[1];
  679. };
  680. struct ice_aqc_get_topo_elem {
  681. struct ice_aqc_txsched_topo_grp_info_hdr hdr;
  682. struct ice_aqc_txsched_elem_data
  683. generic[ICE_AQC_TOPO_MAX_LEVEL_NUM];
  684. };
  685. struct ice_aqc_delete_elem {
  686. struct ice_aqc_txsched_topo_grp_info_hdr hdr;
  687. __le32 teid[1];
  688. };
  689. /* Query Scheduler Resource Allocation (indirect 0x0412)
  690. * This indirect command retrieves the scheduler resources allocated by
  691. * EMP Firmware to the given PF.
  692. */
  693. struct ice_aqc_query_txsched_res {
  694. u8 reserved[8];
  695. __le32 addr_high;
  696. __le32 addr_low;
  697. };
  698. struct ice_aqc_generic_sched_props {
  699. __le16 phys_levels;
  700. __le16 logical_levels;
  701. u8 flattening_bitmap;
  702. u8 max_device_cgds;
  703. u8 max_pf_cgds;
  704. u8 rsvd0;
  705. __le16 rdma_qsets;
  706. u8 rsvd1[22];
  707. };
  708. struct ice_aqc_layer_props {
  709. u8 logical_layer;
  710. u8 chunk_size;
  711. __le16 max_device_nodes;
  712. __le16 max_pf_nodes;
  713. u8 rsvd0[4];
  714. __le16 max_sibl_grp_sz;
  715. __le16 max_cir_rl_profiles;
  716. __le16 max_eir_rl_profiles;
  717. __le16 max_srl_profiles;
  718. u8 rsvd1[14];
  719. };
  720. struct ice_aqc_query_txsched_res_resp {
  721. struct ice_aqc_generic_sched_props sched_props;
  722. struct ice_aqc_layer_props layer_props[ICE_AQC_TOPO_MAX_LEVEL_NUM];
  723. };
  724. /* Get PHY capabilities (indirect 0x0600) */
  725. struct ice_aqc_get_phy_caps {
  726. u8 lport_num;
  727. u8 reserved;
  728. __le16 param0;
  729. /* 18.0 - Report qualified modules */
  730. #define ICE_AQC_GET_PHY_RQM BIT(0)
  731. /* 18.1 - 18.2 : Report mode
  732. * 00b - Report NVM capabilities
  733. * 01b - Report topology capabilities
  734. * 10b - Report SW configured
  735. */
  736. #define ICE_AQC_REPORT_MODE_S 1
  737. #define ICE_AQC_REPORT_MODE_M (3 << ICE_AQC_REPORT_MODE_S)
  738. #define ICE_AQC_REPORT_NVM_CAP 0
  739. #define ICE_AQC_REPORT_TOPO_CAP BIT(1)
  740. #define ICE_AQC_REPORT_SW_CFG BIT(2)
  741. __le32 reserved1;
  742. __le32 addr_high;
  743. __le32 addr_low;
  744. };
  745. /* This is #define of PHY type (Extended):
  746. * The first set of defines is for phy_type_low.
  747. */
  748. #define ICE_PHY_TYPE_LOW_100BASE_TX BIT_ULL(0)
  749. #define ICE_PHY_TYPE_LOW_100M_SGMII BIT_ULL(1)
  750. #define ICE_PHY_TYPE_LOW_1000BASE_T BIT_ULL(2)
  751. #define ICE_PHY_TYPE_LOW_1000BASE_SX BIT_ULL(3)
  752. #define ICE_PHY_TYPE_LOW_1000BASE_LX BIT_ULL(4)
  753. #define ICE_PHY_TYPE_LOW_1000BASE_KX BIT_ULL(5)
  754. #define ICE_PHY_TYPE_LOW_1G_SGMII BIT_ULL(6)
  755. #define ICE_PHY_TYPE_LOW_2500BASE_T BIT_ULL(7)
  756. #define ICE_PHY_TYPE_LOW_2500BASE_X BIT_ULL(8)
  757. #define ICE_PHY_TYPE_LOW_2500BASE_KX BIT_ULL(9)
  758. #define ICE_PHY_TYPE_LOW_5GBASE_T BIT_ULL(10)
  759. #define ICE_PHY_TYPE_LOW_5GBASE_KR BIT_ULL(11)
  760. #define ICE_PHY_TYPE_LOW_10GBASE_T BIT_ULL(12)
  761. #define ICE_PHY_TYPE_LOW_10G_SFI_DA BIT_ULL(13)
  762. #define ICE_PHY_TYPE_LOW_10GBASE_SR BIT_ULL(14)
  763. #define ICE_PHY_TYPE_LOW_10GBASE_LR BIT_ULL(15)
  764. #define ICE_PHY_TYPE_LOW_10GBASE_KR_CR1 BIT_ULL(16)
  765. #define ICE_PHY_TYPE_LOW_10G_SFI_AOC_ACC BIT_ULL(17)
  766. #define ICE_PHY_TYPE_LOW_10G_SFI_C2C BIT_ULL(18)
  767. #define ICE_PHY_TYPE_LOW_25GBASE_T BIT_ULL(19)
  768. #define ICE_PHY_TYPE_LOW_25GBASE_CR BIT_ULL(20)
  769. #define ICE_PHY_TYPE_LOW_25GBASE_CR_S BIT_ULL(21)
  770. #define ICE_PHY_TYPE_LOW_25GBASE_CR1 BIT_ULL(22)
  771. #define ICE_PHY_TYPE_LOW_25GBASE_SR BIT_ULL(23)
  772. #define ICE_PHY_TYPE_LOW_25GBASE_LR BIT_ULL(24)
  773. #define ICE_PHY_TYPE_LOW_25GBASE_KR BIT_ULL(25)
  774. #define ICE_PHY_TYPE_LOW_25GBASE_KR_S BIT_ULL(26)
  775. #define ICE_PHY_TYPE_LOW_25GBASE_KR1 BIT_ULL(27)
  776. #define ICE_PHY_TYPE_LOW_25G_AUI_AOC_ACC BIT_ULL(28)
  777. #define ICE_PHY_TYPE_LOW_25G_AUI_C2C BIT_ULL(29)
  778. #define ICE_PHY_TYPE_LOW_40GBASE_CR4 BIT_ULL(30)
  779. #define ICE_PHY_TYPE_LOW_40GBASE_SR4 BIT_ULL(31)
  780. #define ICE_PHY_TYPE_LOW_40GBASE_LR4 BIT_ULL(32)
  781. #define ICE_PHY_TYPE_LOW_40GBASE_KR4 BIT_ULL(33)
  782. #define ICE_PHY_TYPE_LOW_40G_XLAUI_AOC_ACC BIT_ULL(34)
  783. #define ICE_PHY_TYPE_LOW_40G_XLAUI BIT_ULL(35)
  784. #define ICE_PHY_TYPE_LOW_MAX_INDEX 63
  785. struct ice_aqc_get_phy_caps_data {
  786. __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
  787. __le64 reserved;
  788. u8 caps;
  789. #define ICE_AQC_PHY_EN_TX_LINK_PAUSE BIT(0)
  790. #define ICE_AQC_PHY_EN_RX_LINK_PAUSE BIT(1)
  791. #define ICE_AQC_PHY_LOW_POWER_MODE BIT(2)
  792. #define ICE_AQC_PHY_EN_LINK BIT(3)
  793. #define ICE_AQC_PHY_AN_MODE BIT(4)
  794. #define ICE_AQC_GET_PHY_EN_MOD_QUAL BIT(5)
  795. u8 low_power_ctrl;
  796. #define ICE_AQC_PHY_EN_D3COLD_LOW_POWER_AUTONEG BIT(0)
  797. __le16 eee_cap;
  798. #define ICE_AQC_PHY_EEE_EN_100BASE_TX BIT(0)
  799. #define ICE_AQC_PHY_EEE_EN_1000BASE_T BIT(1)
  800. #define ICE_AQC_PHY_EEE_EN_10GBASE_T BIT(2)
  801. #define ICE_AQC_PHY_EEE_EN_1000BASE_KX BIT(3)
  802. #define ICE_AQC_PHY_EEE_EN_10GBASE_KR BIT(4)
  803. #define ICE_AQC_PHY_EEE_EN_25GBASE_KR BIT(5)
  804. #define ICE_AQC_PHY_EEE_EN_40GBASE_KR4 BIT(6)
  805. __le16 eeer_value;
  806. u8 phy_id_oui[4]; /* PHY/Module ID connected on the port */
  807. u8 link_fec_options;
  808. #define ICE_AQC_PHY_FEC_10G_KR_40G_KR4_EN BIT(0)
  809. #define ICE_AQC_PHY_FEC_10G_KR_40G_KR4_REQ BIT(1)
  810. #define ICE_AQC_PHY_FEC_25G_RS_528_REQ BIT(2)
  811. #define ICE_AQC_PHY_FEC_25G_KR_REQ BIT(3)
  812. #define ICE_AQC_PHY_FEC_25G_RS_544_REQ BIT(4)
  813. #define ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN BIT(6)
  814. #define ICE_AQC_PHY_FEC_25G_KR_CLAUSE74_EN BIT(7)
  815. u8 extended_compliance_code;
  816. #define ICE_MODULE_TYPE_TOTAL_BYTE 3
  817. u8 module_type[ICE_MODULE_TYPE_TOTAL_BYTE];
  818. #define ICE_AQC_MOD_TYPE_BYTE0_SFP_PLUS 0xA0
  819. #define ICE_AQC_MOD_TYPE_BYTE0_QSFP_PLUS 0x80
  820. #define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_PASSIVE BIT(0)
  821. #define ICE_AQC_MOD_TYPE_BYTE1_SFP_PLUS_CU_ACTIVE BIT(1)
  822. #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_SR BIT(4)
  823. #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_LR BIT(5)
  824. #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_LRM BIT(6)
  825. #define ICE_AQC_MOD_TYPE_BYTE1_10G_BASE_ER BIT(7)
  826. #define ICE_AQC_MOD_TYPE_BYTE2_SFP_PLUS 0xA0
  827. #define ICE_AQC_MOD_TYPE_BYTE2_QSFP_PLUS 0x86
  828. u8 qualified_module_count;
  829. #define ICE_AQC_QUAL_MOD_COUNT_MAX 16
  830. struct {
  831. u8 v_oui[3];
  832. u8 rsvd1;
  833. u8 v_part[16];
  834. __le32 v_rev;
  835. __le64 rsvd8;
  836. } qual_modules[ICE_AQC_QUAL_MOD_COUNT_MAX];
  837. };
  838. /* Set PHY capabilities (direct 0x0601)
  839. * NOTE: This command must be followed by setup link and restart auto-neg
  840. */
  841. struct ice_aqc_set_phy_cfg {
  842. u8 lport_num;
  843. u8 reserved[7];
  844. __le32 addr_high;
  845. __le32 addr_low;
  846. };
  847. /* Set PHY config command data structure */
  848. struct ice_aqc_set_phy_cfg_data {
  849. __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
  850. __le64 rsvd0;
  851. u8 caps;
  852. #define ICE_AQ_PHY_ENA_TX_PAUSE_ABILITY BIT(0)
  853. #define ICE_AQ_PHY_ENA_RX_PAUSE_ABILITY BIT(1)
  854. #define ICE_AQ_PHY_ENA_LOW_POWER BIT(2)
  855. #define ICE_AQ_PHY_ENA_LINK BIT(3)
  856. #define ICE_AQ_PHY_ENA_AUTO_LINK_UPDT BIT(5)
  857. #define ICE_AQ_PHY_ENA_LESM BIT(6)
  858. #define ICE_AQ_PHY_ENA_AUTO_FEC BIT(7)
  859. u8 low_power_ctrl;
  860. __le16 eee_cap; /* Value from ice_aqc_get_phy_caps */
  861. __le16 eeer_value;
  862. u8 link_fec_opt; /* Use defines from ice_aqc_get_phy_caps */
  863. u8 rsvd1;
  864. };
  865. /* Restart AN command data structure (direct 0x0605)
  866. * Also used for response, with only the lport_num field present.
  867. */
  868. struct ice_aqc_restart_an {
  869. u8 lport_num;
  870. u8 reserved;
  871. u8 cmd_flags;
  872. #define ICE_AQC_RESTART_AN_LINK_RESTART BIT(1)
  873. #define ICE_AQC_RESTART_AN_LINK_ENABLE BIT(2)
  874. u8 reserved2[13];
  875. };
  876. /* Get link status (indirect 0x0607), also used for Link Status Event */
  877. struct ice_aqc_get_link_status {
  878. u8 lport_num;
  879. u8 reserved;
  880. __le16 cmd_flags;
  881. #define ICE_AQ_LSE_M 0x3
  882. #define ICE_AQ_LSE_NOP 0x0
  883. #define ICE_AQ_LSE_DIS 0x2
  884. #define ICE_AQ_LSE_ENA 0x3
  885. /* only response uses this flag */
  886. #define ICE_AQ_LSE_IS_ENABLED 0x1
  887. __le32 reserved2;
  888. __le32 addr_high;
  889. __le32 addr_low;
  890. };
  891. /* Get link status response data structure, also used for Link Status Event */
  892. struct ice_aqc_get_link_status_data {
  893. u8 topo_media_conflict;
  894. #define ICE_AQ_LINK_TOPO_CONFLICT BIT(0)
  895. #define ICE_AQ_LINK_MEDIA_CONFLICT BIT(1)
  896. #define ICE_AQ_LINK_TOPO_CORRUPT BIT(2)
  897. u8 reserved1;
  898. u8 link_info;
  899. #define ICE_AQ_LINK_UP BIT(0) /* Link Status */
  900. #define ICE_AQ_LINK_FAULT BIT(1)
  901. #define ICE_AQ_LINK_FAULT_TX BIT(2)
  902. #define ICE_AQ_LINK_FAULT_RX BIT(3)
  903. #define ICE_AQ_LINK_FAULT_REMOTE BIT(4)
  904. #define ICE_AQ_LINK_UP_PORT BIT(5) /* External Port Link Status */
  905. #define ICE_AQ_MEDIA_AVAILABLE BIT(6)
  906. #define ICE_AQ_SIGNAL_DETECT BIT(7)
  907. u8 an_info;
  908. #define ICE_AQ_AN_COMPLETED BIT(0)
  909. #define ICE_AQ_LP_AN_ABILITY BIT(1)
  910. #define ICE_AQ_PD_FAULT BIT(2) /* Parallel Detection Fault */
  911. #define ICE_AQ_FEC_EN BIT(3)
  912. #define ICE_AQ_PHY_LOW_POWER BIT(4) /* Low Power State */
  913. #define ICE_AQ_LINK_PAUSE_TX BIT(5)
  914. #define ICE_AQ_LINK_PAUSE_RX BIT(6)
  915. #define ICE_AQ_QUALIFIED_MODULE BIT(7)
  916. u8 ext_info;
  917. #define ICE_AQ_LINK_PHY_TEMP_ALARM BIT(0)
  918. #define ICE_AQ_LINK_EXCESSIVE_ERRORS BIT(1) /* Excessive Link Errors */
  919. /* Port TX Suspended */
  920. #define ICE_AQ_LINK_TX_S 2
  921. #define ICE_AQ_LINK_TX_M (0x03 << ICE_AQ_LINK_TX_S)
  922. #define ICE_AQ_LINK_TX_ACTIVE 0
  923. #define ICE_AQ_LINK_TX_DRAINED 1
  924. #define ICE_AQ_LINK_TX_FLUSHED 3
  925. u8 reserved2;
  926. __le16 max_frame_size;
  927. u8 cfg;
  928. #define ICE_AQ_LINK_25G_KR_FEC_EN BIT(0)
  929. #define ICE_AQ_LINK_25G_RS_528_FEC_EN BIT(1)
  930. #define ICE_AQ_LINK_25G_RS_544_FEC_EN BIT(2)
  931. /* Pacing Config */
  932. #define ICE_AQ_CFG_PACING_S 3
  933. #define ICE_AQ_CFG_PACING_M (0xF << ICE_AQ_CFG_PACING_S)
  934. #define ICE_AQ_CFG_PACING_TYPE_M BIT(7)
  935. #define ICE_AQ_CFG_PACING_TYPE_AVG 0
  936. #define ICE_AQ_CFG_PACING_TYPE_FIXED ICE_AQ_CFG_PACING_TYPE_M
  937. /* External Device Power Ability */
  938. u8 power_desc;
  939. #define ICE_AQ_PWR_CLASS_M 0x3
  940. #define ICE_AQ_LINK_PWR_BASET_LOW_HIGH 0
  941. #define ICE_AQ_LINK_PWR_BASET_HIGH 1
  942. #define ICE_AQ_LINK_PWR_QSFP_CLASS_1 0
  943. #define ICE_AQ_LINK_PWR_QSFP_CLASS_2 1
  944. #define ICE_AQ_LINK_PWR_QSFP_CLASS_3 2
  945. #define ICE_AQ_LINK_PWR_QSFP_CLASS_4 3
  946. __le16 link_speed;
  947. #define ICE_AQ_LINK_SPEED_10MB BIT(0)
  948. #define ICE_AQ_LINK_SPEED_100MB BIT(1)
  949. #define ICE_AQ_LINK_SPEED_1000MB BIT(2)
  950. #define ICE_AQ_LINK_SPEED_2500MB BIT(3)
  951. #define ICE_AQ_LINK_SPEED_5GB BIT(4)
  952. #define ICE_AQ_LINK_SPEED_10GB BIT(5)
  953. #define ICE_AQ_LINK_SPEED_20GB BIT(6)
  954. #define ICE_AQ_LINK_SPEED_25GB BIT(7)
  955. #define ICE_AQ_LINK_SPEED_40GB BIT(8)
  956. #define ICE_AQ_LINK_SPEED_UNKNOWN BIT(15)
  957. __le32 reserved3; /* Aligns next field to 8-byte boundary */
  958. __le64 phy_type_low; /* Use values from ICE_PHY_TYPE_LOW_* */
  959. __le64 reserved4;
  960. };
  961. /* Set event mask command (direct 0x0613) */
  962. struct ice_aqc_set_event_mask {
  963. u8 lport_num;
  964. u8 reserved[7];
  965. __le16 event_mask;
  966. #define ICE_AQ_LINK_EVENT_UPDOWN BIT(1)
  967. #define ICE_AQ_LINK_EVENT_MEDIA_NA BIT(2)
  968. #define ICE_AQ_LINK_EVENT_LINK_FAULT BIT(3)
  969. #define ICE_AQ_LINK_EVENT_PHY_TEMP_ALARM BIT(4)
  970. #define ICE_AQ_LINK_EVENT_EXCESSIVE_ERRORS BIT(5)
  971. #define ICE_AQ_LINK_EVENT_SIGNAL_DETECT BIT(6)
  972. #define ICE_AQ_LINK_EVENT_AN_COMPLETED BIT(7)
  973. #define ICE_AQ_LINK_EVENT_MODULE_QUAL_FAIL BIT(8)
  974. #define ICE_AQ_LINK_EVENT_PORT_TX_SUSPENDED BIT(9)
  975. u8 reserved1[6];
  976. };
  977. /* NVM Read command (indirect 0x0701)
  978. * NVM Erase commands (direct 0x0702)
  979. * NVM Update commands (indirect 0x0703)
  980. */
  981. struct ice_aqc_nvm {
  982. __le16 offset_low;
  983. u8 offset_high;
  984. u8 cmd_flags;
  985. #define ICE_AQC_NVM_LAST_CMD BIT(0)
  986. #define ICE_AQC_NVM_PCIR_REQ BIT(0) /* Used by NVM Update reply */
  987. #define ICE_AQC_NVM_PRESERVATION_S 1
  988. #define ICE_AQC_NVM_PRESERVATION_M (3 << CSR_AQ_NVM_PRESERVATION_S)
  989. #define ICE_AQC_NVM_NO_PRESERVATION (0 << CSR_AQ_NVM_PRESERVATION_S)
  990. #define ICE_AQC_NVM_PRESERVE_ALL BIT(1)
  991. #define ICE_AQC_NVM_PRESERVE_SELECTED (3 << CSR_AQ_NVM_PRESERVATION_S)
  992. #define ICE_AQC_NVM_FLASH_ONLY BIT(7)
  993. __le16 module_typeid;
  994. __le16 length;
  995. #define ICE_AQC_NVM_ERASE_LEN 0xFFFF
  996. __le32 addr_high;
  997. __le32 addr_low;
  998. };
  999. /* Get/Set RSS key (indirect 0x0B04/0x0B02) */
  1000. struct ice_aqc_get_set_rss_key {
  1001. #define ICE_AQC_GSET_RSS_KEY_VSI_VALID BIT(15)
  1002. #define ICE_AQC_GSET_RSS_KEY_VSI_ID_S 0
  1003. #define ICE_AQC_GSET_RSS_KEY_VSI_ID_M (0x3FF << ICE_AQC_GSET_RSS_KEY_VSI_ID_S)
  1004. __le16 vsi_id;
  1005. u8 reserved[6];
  1006. __le32 addr_high;
  1007. __le32 addr_low;
  1008. };
  1009. #define ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE 0x28
  1010. #define ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE 0xC
  1011. struct ice_aqc_get_set_rss_keys {
  1012. u8 standard_rss_key[ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE];
  1013. u8 extended_hash_key[ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE];
  1014. };
  1015. /* Get/Set RSS LUT (indirect 0x0B05/0x0B03) */
  1016. struct ice_aqc_get_set_rss_lut {
  1017. #define ICE_AQC_GSET_RSS_LUT_VSI_VALID BIT(15)
  1018. #define ICE_AQC_GSET_RSS_LUT_VSI_ID_S 0
  1019. #define ICE_AQC_GSET_RSS_LUT_VSI_ID_M (0x1FF << ICE_AQC_GSET_RSS_LUT_VSI_ID_S)
  1020. __le16 vsi_id;
  1021. #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S 0
  1022. #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M \
  1023. (0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
  1024. #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI 0
  1025. #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF 1
  1026. #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL 2
  1027. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S 2
  1028. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M \
  1029. (0x3 << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
  1030. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 128
  1031. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
  1032. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 512
  1033. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG 1
  1034. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K 2048
  1035. #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG 2
  1036. #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S 4
  1037. #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_M \
  1038. (0xF << ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S)
  1039. __le16 flags;
  1040. __le32 reserved;
  1041. __le32 addr_high;
  1042. __le32 addr_low;
  1043. };
  1044. /* Add TX LAN Queues (indirect 0x0C30) */
  1045. struct ice_aqc_add_txqs {
  1046. u8 num_qgrps;
  1047. u8 reserved[3];
  1048. __le32 reserved1;
  1049. __le32 addr_high;
  1050. __le32 addr_low;
  1051. };
  1052. /* This is the descriptor of each queue entry for the Add TX LAN Queues
  1053. * command (0x0C30). Only used within struct ice_aqc_add_tx_qgrp.
  1054. */
  1055. struct ice_aqc_add_txqs_perq {
  1056. __le16 txq_id;
  1057. u8 rsvd[2];
  1058. __le32 q_teid;
  1059. u8 txq_ctx[22];
  1060. u8 rsvd2[2];
  1061. struct ice_aqc_txsched_elem info;
  1062. };
  1063. /* The format of the command buffer for Add TX LAN Queues (0x0C30)
  1064. * is an array of the following structs. Please note that the length of
  1065. * each struct ice_aqc_add_tx_qgrp is variable due
  1066. * to the variable number of queues in each group!
  1067. */
  1068. struct ice_aqc_add_tx_qgrp {
  1069. __le32 parent_teid;
  1070. u8 num_txqs;
  1071. u8 rsvd[3];
  1072. struct ice_aqc_add_txqs_perq txqs[1];
  1073. };
  1074. /* Disable TX LAN Queues (indirect 0x0C31) */
  1075. struct ice_aqc_dis_txqs {
  1076. u8 cmd_type;
  1077. #define ICE_AQC_Q_DIS_CMD_S 0
  1078. #define ICE_AQC_Q_DIS_CMD_M (0x3 << ICE_AQC_Q_DIS_CMD_S)
  1079. #define ICE_AQC_Q_DIS_CMD_NO_FUNC_RESET (0 << ICE_AQC_Q_DIS_CMD_S)
  1080. #define ICE_AQC_Q_DIS_CMD_VM_RESET BIT(ICE_AQC_Q_DIS_CMD_S)
  1081. #define ICE_AQC_Q_DIS_CMD_VF_RESET (2 << ICE_AQC_Q_DIS_CMD_S)
  1082. #define ICE_AQC_Q_DIS_CMD_PF_RESET (3 << ICE_AQC_Q_DIS_CMD_S)
  1083. #define ICE_AQC_Q_DIS_CMD_SUBSEQ_CALL BIT(2)
  1084. #define ICE_AQC_Q_DIS_CMD_FLUSH_PIPE BIT(3)
  1085. u8 num_entries;
  1086. __le16 vmvf_and_timeout;
  1087. #define ICE_AQC_Q_DIS_VMVF_NUM_S 0
  1088. #define ICE_AQC_Q_DIS_VMVF_NUM_M (0x3FF << ICE_AQC_Q_DIS_VMVF_NUM_S)
  1089. #define ICE_AQC_Q_DIS_TIMEOUT_S 10
  1090. #define ICE_AQC_Q_DIS_TIMEOUT_M (0x3F << ICE_AQC_Q_DIS_TIMEOUT_S)
  1091. __le32 blocked_cgds;
  1092. __le32 addr_high;
  1093. __le32 addr_low;
  1094. };
  1095. /* The buffer for Disable TX LAN Queues (indirect 0x0C31)
  1096. * contains the following structures, arrayed one after the
  1097. * other.
  1098. * Note: Since the q_id is 16 bits wide, if the
  1099. * number of queues is even, then 2 bytes of alignment MUST be
  1100. * added before the start of the next group, to allow correct
  1101. * alignment of the parent_teid field.
  1102. */
  1103. struct ice_aqc_dis_txq_item {
  1104. __le32 parent_teid;
  1105. u8 num_qs;
  1106. u8 rsvd;
  1107. /* The length of the q_id array varies according to num_qs */
  1108. __le16 q_id[1];
  1109. /* This only applies from F8 onward */
  1110. #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S 15
  1111. #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_LAN_Q \
  1112. (0 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
  1113. #define ICE_AQC_Q_DIS_BUF_ELEM_TYPE_RDMA_QSET \
  1114. (1 << ICE_AQC_Q_DIS_BUF_ELEM_TYPE_S)
  1115. };
  1116. struct ice_aqc_dis_txq {
  1117. struct ice_aqc_dis_txq_item qgrps[1];
  1118. };
  1119. /* Configure Firmware Logging Command (indirect 0xFF09)
  1120. * Logging Information Read Response (indirect 0xFF10)
  1121. * Note: The 0xFF10 command has no input parameters.
  1122. */
  1123. struct ice_aqc_fw_logging {
  1124. u8 log_ctrl;
  1125. #define ICE_AQC_FW_LOG_AQ_EN BIT(0)
  1126. #define ICE_AQC_FW_LOG_UART_EN BIT(1)
  1127. u8 rsvd0;
  1128. u8 log_ctrl_valid; /* Not used by 0xFF10 Response */
  1129. #define ICE_AQC_FW_LOG_AQ_VALID BIT(0)
  1130. #define ICE_AQC_FW_LOG_UART_VALID BIT(1)
  1131. u8 rsvd1[5];
  1132. __le32 addr_high;
  1133. __le32 addr_low;
  1134. };
  1135. enum ice_aqc_fw_logging_mod {
  1136. ICE_AQC_FW_LOG_ID_GENERAL = 0,
  1137. ICE_AQC_FW_LOG_ID_CTRL,
  1138. ICE_AQC_FW_LOG_ID_LINK,
  1139. ICE_AQC_FW_LOG_ID_LINK_TOPO,
  1140. ICE_AQC_FW_LOG_ID_DNL,
  1141. ICE_AQC_FW_LOG_ID_I2C,
  1142. ICE_AQC_FW_LOG_ID_SDP,
  1143. ICE_AQC_FW_LOG_ID_MDIO,
  1144. ICE_AQC_FW_LOG_ID_ADMINQ,
  1145. ICE_AQC_FW_LOG_ID_HDMA,
  1146. ICE_AQC_FW_LOG_ID_LLDP,
  1147. ICE_AQC_FW_LOG_ID_DCBX,
  1148. ICE_AQC_FW_LOG_ID_DCB,
  1149. ICE_AQC_FW_LOG_ID_NETPROXY,
  1150. ICE_AQC_FW_LOG_ID_NVM,
  1151. ICE_AQC_FW_LOG_ID_AUTH,
  1152. ICE_AQC_FW_LOG_ID_VPD,
  1153. ICE_AQC_FW_LOG_ID_IOSF,
  1154. ICE_AQC_FW_LOG_ID_PARSER,
  1155. ICE_AQC_FW_LOG_ID_SW,
  1156. ICE_AQC_FW_LOG_ID_SCHEDULER,
  1157. ICE_AQC_FW_LOG_ID_TXQ,
  1158. ICE_AQC_FW_LOG_ID_RSVD,
  1159. ICE_AQC_FW_LOG_ID_POST,
  1160. ICE_AQC_FW_LOG_ID_WATCHDOG,
  1161. ICE_AQC_FW_LOG_ID_TASK_DISPATCH,
  1162. ICE_AQC_FW_LOG_ID_MNG,
  1163. ICE_AQC_FW_LOG_ID_MAX,
  1164. };
  1165. /* This is the buffer for both of the logging commands.
  1166. * The entry array size depends on the datalen parameter in the descriptor.
  1167. * There will be a total of datalen / 2 entries.
  1168. */
  1169. struct ice_aqc_fw_logging_data {
  1170. __le16 entry[1];
  1171. #define ICE_AQC_FW_LOG_ID_S 0
  1172. #define ICE_AQC_FW_LOG_ID_M (0xFFF << ICE_AQC_FW_LOG_ID_S)
  1173. #define ICE_AQC_FW_LOG_CONF_SUCCESS 0 /* Used by response */
  1174. #define ICE_AQC_FW_LOG_CONF_BAD_INDX BIT(12) /* Used by response */
  1175. #define ICE_AQC_FW_LOG_EN_S 12
  1176. #define ICE_AQC_FW_LOG_EN_M (0xF << ICE_AQC_FW_LOG_EN_S)
  1177. #define ICE_AQC_FW_LOG_INFO_EN BIT(12) /* Used by command */
  1178. #define ICE_AQC_FW_LOG_INIT_EN BIT(13) /* Used by command */
  1179. #define ICE_AQC_FW_LOG_FLOW_EN BIT(14) /* Used by command */
  1180. #define ICE_AQC_FW_LOG_ERR_EN BIT(15) /* Used by command */
  1181. };
  1182. /* Get/Clear FW Log (indirect 0xFF11) */
  1183. struct ice_aqc_get_clear_fw_log {
  1184. u8 flags;
  1185. #define ICE_AQC_FW_LOG_CLEAR BIT(0)
  1186. #define ICE_AQC_FW_LOG_MORE_DATA_AVAIL BIT(1)
  1187. u8 rsvd1[7];
  1188. __le32 addr_high;
  1189. __le32 addr_low;
  1190. };
  1191. /**
  1192. * struct ice_aq_desc - Admin Queue (AQ) descriptor
  1193. * @flags: ICE_AQ_FLAG_* flags
  1194. * @opcode: AQ command opcode
  1195. * @datalen: length in bytes of indirect/external data buffer
  1196. * @retval: return value from firmware
  1197. * @cookie_h: opaque data high-half
  1198. * @cookie_l: opaque data low-half
  1199. * @params: command-specific parameters
  1200. *
  1201. * Descriptor format for commands the driver posts on the Admin Transmit Queue
  1202. * (ATQ). The firmware writes back onto the command descriptor and returns
  1203. * the result of the command. Asynchronous events that are not an immediate
  1204. * result of the command are written to the Admin Receive Queue (ARQ) using
  1205. * the same descriptor format. Descriptors are in little-endian notation with
  1206. * 32-bit words.
  1207. */
  1208. struct ice_aq_desc {
  1209. __le16 flags;
  1210. __le16 opcode;
  1211. __le16 datalen;
  1212. __le16 retval;
  1213. __le32 cookie_high;
  1214. __le32 cookie_low;
  1215. union {
  1216. u8 raw[16];
  1217. struct ice_aqc_generic generic;
  1218. struct ice_aqc_get_ver get_ver;
  1219. struct ice_aqc_q_shutdown q_shutdown;
  1220. struct ice_aqc_req_res res_owner;
  1221. struct ice_aqc_manage_mac_read mac_read;
  1222. struct ice_aqc_manage_mac_write mac_write;
  1223. struct ice_aqc_clear_pxe clear_pxe;
  1224. struct ice_aqc_list_caps get_cap;
  1225. struct ice_aqc_get_phy_caps get_phy;
  1226. struct ice_aqc_set_phy_cfg set_phy;
  1227. struct ice_aqc_restart_an restart_an;
  1228. struct ice_aqc_get_sw_cfg get_sw_conf;
  1229. struct ice_aqc_sw_rules sw_rules;
  1230. struct ice_aqc_get_topo get_topo;
  1231. struct ice_aqc_get_cfg_elem get_update_elem;
  1232. struct ice_aqc_query_txsched_res query_sched_res;
  1233. struct ice_aqc_add_move_delete_elem add_move_delete_elem;
  1234. struct ice_aqc_nvm nvm;
  1235. struct ice_aqc_get_set_rss_lut get_set_rss_lut;
  1236. struct ice_aqc_get_set_rss_key get_set_rss_key;
  1237. struct ice_aqc_add_txqs add_txqs;
  1238. struct ice_aqc_dis_txqs dis_txqs;
  1239. struct ice_aqc_add_get_update_free_vsi vsi_cmd;
  1240. struct ice_aqc_add_update_free_vsi_resp add_update_free_vsi_res;
  1241. struct ice_aqc_fw_logging fw_logging;
  1242. struct ice_aqc_get_clear_fw_log get_clear_fw_log;
  1243. struct ice_aqc_alloc_free_res_cmd sw_res_ctrl;
  1244. struct ice_aqc_set_event_mask set_event_mask;
  1245. struct ice_aqc_get_link_status get_link_status;
  1246. } params;
  1247. };
  1248. /* FW defined boundary for a large buffer, 4k >= Large buffer > 512 bytes */
  1249. #define ICE_AQ_LG_BUF 512
  1250. #define ICE_AQ_FLAG_ERR_S 2
  1251. #define ICE_AQ_FLAG_LB_S 9
  1252. #define ICE_AQ_FLAG_RD_S 10
  1253. #define ICE_AQ_FLAG_BUF_S 12
  1254. #define ICE_AQ_FLAG_SI_S 13
  1255. #define ICE_AQ_FLAG_ERR BIT(ICE_AQ_FLAG_ERR_S) /* 0x4 */
  1256. #define ICE_AQ_FLAG_LB BIT(ICE_AQ_FLAG_LB_S) /* 0x200 */
  1257. #define ICE_AQ_FLAG_RD BIT(ICE_AQ_FLAG_RD_S) /* 0x400 */
  1258. #define ICE_AQ_FLAG_BUF BIT(ICE_AQ_FLAG_BUF_S) /* 0x1000 */
  1259. #define ICE_AQ_FLAG_SI BIT(ICE_AQ_FLAG_SI_S) /* 0x2000 */
  1260. /* error codes */
  1261. enum ice_aq_err {
  1262. ICE_AQ_RC_OK = 0, /* success */
  1263. ICE_AQ_RC_ENOMEM = 9, /* Out of memory */
  1264. ICE_AQ_RC_EBUSY = 12, /* Device or resource busy */
  1265. ICE_AQ_RC_EEXIST = 13, /* object already exists */
  1266. ICE_AQ_RC_ENOSPC = 16, /* No space left or allocation failure */
  1267. };
  1268. /* Admin Queue command opcodes */
  1269. enum ice_adminq_opc {
  1270. /* AQ commands */
  1271. ice_aqc_opc_get_ver = 0x0001,
  1272. ice_aqc_opc_q_shutdown = 0x0003,
  1273. /* resource ownership */
  1274. ice_aqc_opc_req_res = 0x0008,
  1275. ice_aqc_opc_release_res = 0x0009,
  1276. /* device/function capabilities */
  1277. ice_aqc_opc_list_func_caps = 0x000A,
  1278. ice_aqc_opc_list_dev_caps = 0x000B,
  1279. /* manage MAC address */
  1280. ice_aqc_opc_manage_mac_read = 0x0107,
  1281. ice_aqc_opc_manage_mac_write = 0x0108,
  1282. /* PXE */
  1283. ice_aqc_opc_clear_pxe_mode = 0x0110,
  1284. /* internal switch commands */
  1285. ice_aqc_opc_get_sw_cfg = 0x0200,
  1286. /* Alloc/Free/Get Resources */
  1287. ice_aqc_opc_alloc_res = 0x0208,
  1288. ice_aqc_opc_free_res = 0x0209,
  1289. /* VSI commands */
  1290. ice_aqc_opc_add_vsi = 0x0210,
  1291. ice_aqc_opc_update_vsi = 0x0211,
  1292. ice_aqc_opc_free_vsi = 0x0213,
  1293. /* switch rules population commands */
  1294. ice_aqc_opc_add_sw_rules = 0x02A0,
  1295. ice_aqc_opc_update_sw_rules = 0x02A1,
  1296. ice_aqc_opc_remove_sw_rules = 0x02A2,
  1297. ice_aqc_opc_clear_pf_cfg = 0x02A4,
  1298. /* transmit scheduler commands */
  1299. ice_aqc_opc_get_dflt_topo = 0x0400,
  1300. ice_aqc_opc_add_sched_elems = 0x0401,
  1301. ice_aqc_opc_get_sched_elems = 0x0404,
  1302. ice_aqc_opc_suspend_sched_elems = 0x0409,
  1303. ice_aqc_opc_resume_sched_elems = 0x040A,
  1304. ice_aqc_opc_delete_sched_elems = 0x040F,
  1305. ice_aqc_opc_query_sched_res = 0x0412,
  1306. /* PHY commands */
  1307. ice_aqc_opc_get_phy_caps = 0x0600,
  1308. ice_aqc_opc_set_phy_cfg = 0x0601,
  1309. ice_aqc_opc_restart_an = 0x0605,
  1310. ice_aqc_opc_get_link_status = 0x0607,
  1311. ice_aqc_opc_set_event_mask = 0x0613,
  1312. /* NVM commands */
  1313. ice_aqc_opc_nvm_read = 0x0701,
  1314. /* RSS commands */
  1315. ice_aqc_opc_set_rss_key = 0x0B02,
  1316. ice_aqc_opc_set_rss_lut = 0x0B03,
  1317. ice_aqc_opc_get_rss_key = 0x0B04,
  1318. ice_aqc_opc_get_rss_lut = 0x0B05,
  1319. /* TX queue handling commands/events */
  1320. ice_aqc_opc_add_txqs = 0x0C30,
  1321. ice_aqc_opc_dis_txqs = 0x0C31,
  1322. /* debug commands */
  1323. ice_aqc_opc_fw_logging = 0xFF09,
  1324. };
  1325. #endif /* _ICE_ADMINQ_CMD_H_ */