ena_admin_defs.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. /*
  2. * Copyright 2015 - 2016 Amazon.com, Inc. or its affiliates.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef _ENA_ADMIN_H_
  33. #define _ENA_ADMIN_H_
  34. enum ena_admin_aq_opcode {
  35. ENA_ADMIN_CREATE_SQ = 1,
  36. ENA_ADMIN_DESTROY_SQ = 2,
  37. ENA_ADMIN_CREATE_CQ = 3,
  38. ENA_ADMIN_DESTROY_CQ = 4,
  39. ENA_ADMIN_GET_FEATURE = 8,
  40. ENA_ADMIN_SET_FEATURE = 9,
  41. ENA_ADMIN_GET_STATS = 11,
  42. };
  43. enum ena_admin_aq_completion_status {
  44. ENA_ADMIN_SUCCESS = 0,
  45. ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE = 1,
  46. ENA_ADMIN_BAD_OPCODE = 2,
  47. ENA_ADMIN_UNSUPPORTED_OPCODE = 3,
  48. ENA_ADMIN_MALFORMED_REQUEST = 4,
  49. /* Additional status is provided in ACQ entry extended_status */
  50. ENA_ADMIN_ILLEGAL_PARAMETER = 5,
  51. ENA_ADMIN_UNKNOWN_ERROR = 6,
  52. };
  53. enum ena_admin_aq_feature_id {
  54. ENA_ADMIN_DEVICE_ATTRIBUTES = 1,
  55. ENA_ADMIN_MAX_QUEUES_NUM = 2,
  56. ENA_ADMIN_RSS_HASH_FUNCTION = 10,
  57. ENA_ADMIN_STATELESS_OFFLOAD_CONFIG = 11,
  58. ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG = 12,
  59. ENA_ADMIN_MTU = 14,
  60. ENA_ADMIN_RSS_HASH_INPUT = 18,
  61. ENA_ADMIN_INTERRUPT_MODERATION = 20,
  62. ENA_ADMIN_AENQ_CONFIG = 26,
  63. ENA_ADMIN_LINK_CONFIG = 27,
  64. ENA_ADMIN_HOST_ATTR_CONFIG = 28,
  65. ENA_ADMIN_FEATURES_OPCODE_NUM = 32,
  66. };
  67. enum ena_admin_placement_policy_type {
  68. /* descriptors and headers are in host memory */
  69. ENA_ADMIN_PLACEMENT_POLICY_HOST = 1,
  70. /* descriptors and headers are in device memory (a.k.a Low Latency
  71. * Queue)
  72. */
  73. ENA_ADMIN_PLACEMENT_POLICY_DEV = 3,
  74. };
  75. enum ena_admin_link_types {
  76. ENA_ADMIN_LINK_SPEED_1G = 0x1,
  77. ENA_ADMIN_LINK_SPEED_2_HALF_G = 0x2,
  78. ENA_ADMIN_LINK_SPEED_5G = 0x4,
  79. ENA_ADMIN_LINK_SPEED_10G = 0x8,
  80. ENA_ADMIN_LINK_SPEED_25G = 0x10,
  81. ENA_ADMIN_LINK_SPEED_40G = 0x20,
  82. ENA_ADMIN_LINK_SPEED_50G = 0x40,
  83. ENA_ADMIN_LINK_SPEED_100G = 0x80,
  84. ENA_ADMIN_LINK_SPEED_200G = 0x100,
  85. ENA_ADMIN_LINK_SPEED_400G = 0x200,
  86. };
  87. enum ena_admin_completion_policy_type {
  88. /* completion queue entry for each sq descriptor */
  89. ENA_ADMIN_COMPLETION_POLICY_DESC = 0,
  90. /* completion queue entry upon request in sq descriptor */
  91. ENA_ADMIN_COMPLETION_POLICY_DESC_ON_DEMAND = 1,
  92. /* current queue head pointer is updated in OS memory upon sq
  93. * descriptor request
  94. */
  95. ENA_ADMIN_COMPLETION_POLICY_HEAD_ON_DEMAND = 2,
  96. /* current queue head pointer is updated in OS memory for each sq
  97. * descriptor
  98. */
  99. ENA_ADMIN_COMPLETION_POLICY_HEAD = 3,
  100. };
  101. /* basic stats return ena_admin_basic_stats while extanded stats return a
  102. * buffer (string format) with additional statistics per queue and per
  103. * device id
  104. */
  105. enum ena_admin_get_stats_type {
  106. ENA_ADMIN_GET_STATS_TYPE_BASIC = 0,
  107. ENA_ADMIN_GET_STATS_TYPE_EXTENDED = 1,
  108. };
  109. enum ena_admin_get_stats_scope {
  110. ENA_ADMIN_SPECIFIC_QUEUE = 0,
  111. ENA_ADMIN_ETH_TRAFFIC = 1,
  112. };
  113. struct ena_admin_aq_common_desc {
  114. /* 11:0 : command_id
  115. * 15:12 : reserved12
  116. */
  117. u16 command_id;
  118. /* as appears in ena_admin_aq_opcode */
  119. u8 opcode;
  120. /* 0 : phase
  121. * 1 : ctrl_data - control buffer address valid
  122. * 2 : ctrl_data_indirect - control buffer address
  123. * points to list of pages with addresses of control
  124. * buffers
  125. * 7:3 : reserved3
  126. */
  127. u8 flags;
  128. };
  129. /* used in ena_admin_aq_entry. Can point directly to control data, or to a
  130. * page list chunk. Used also at the end of indirect mode page list chunks,
  131. * for chaining.
  132. */
  133. struct ena_admin_ctrl_buff_info {
  134. u32 length;
  135. struct ena_common_mem_addr address;
  136. };
  137. struct ena_admin_sq {
  138. u16 sq_idx;
  139. /* 4:0 : reserved
  140. * 7:5 : sq_direction - 0x1 - Tx; 0x2 - Rx
  141. */
  142. u8 sq_identity;
  143. u8 reserved1;
  144. };
  145. struct ena_admin_aq_entry {
  146. struct ena_admin_aq_common_desc aq_common_descriptor;
  147. union {
  148. u32 inline_data_w1[3];
  149. struct ena_admin_ctrl_buff_info control_buffer;
  150. } u;
  151. u32 inline_data_w4[12];
  152. };
  153. struct ena_admin_acq_common_desc {
  154. /* command identifier to associate it with the aq descriptor
  155. * 11:0 : command_id
  156. * 15:12 : reserved12
  157. */
  158. u16 command;
  159. u8 status;
  160. /* 0 : phase
  161. * 7:1 : reserved1
  162. */
  163. u8 flags;
  164. u16 extended_status;
  165. /* serves as a hint what AQ entries can be revoked */
  166. u16 sq_head_indx;
  167. };
  168. struct ena_admin_acq_entry {
  169. struct ena_admin_acq_common_desc acq_common_descriptor;
  170. u32 response_specific_data[14];
  171. };
  172. struct ena_admin_aq_create_sq_cmd {
  173. struct ena_admin_aq_common_desc aq_common_descriptor;
  174. /* 4:0 : reserved0_w1
  175. * 7:5 : sq_direction - 0x1 - Tx, 0x2 - Rx
  176. */
  177. u8 sq_identity;
  178. u8 reserved8_w1;
  179. /* 3:0 : placement_policy - Describing where the SQ
  180. * descriptor ring and the SQ packet headers reside:
  181. * 0x1 - descriptors and headers are in OS memory,
  182. * 0x3 - descriptors and headers in device memory
  183. * (a.k.a Low Latency Queue)
  184. * 6:4 : completion_policy - Describing what policy
  185. * to use for generation completion entry (cqe) in
  186. * the CQ associated with this SQ: 0x0 - cqe for each
  187. * sq descriptor, 0x1 - cqe upon request in sq
  188. * descriptor, 0x2 - current queue head pointer is
  189. * updated in OS memory upon sq descriptor request
  190. * 0x3 - current queue head pointer is updated in OS
  191. * memory for each sq descriptor
  192. * 7 : reserved15_w1
  193. */
  194. u8 sq_caps_2;
  195. /* 0 : is_physically_contiguous - Described if the
  196. * queue ring memory is allocated in physical
  197. * contiguous pages or split.
  198. * 7:1 : reserved17_w1
  199. */
  200. u8 sq_caps_3;
  201. /* associated completion queue id. This CQ must be created prior to
  202. * SQ creation
  203. */
  204. u16 cq_idx;
  205. /* submission queue depth in entries */
  206. u16 sq_depth;
  207. /* SQ physical base address in OS memory. This field should not be
  208. * used for Low Latency queues. Has to be page aligned.
  209. */
  210. struct ena_common_mem_addr sq_ba;
  211. /* specifies queue head writeback location in OS memory. Valid if
  212. * completion_policy is set to completion_policy_head_on_demand or
  213. * completion_policy_head. Has to be cache aligned
  214. */
  215. struct ena_common_mem_addr sq_head_writeback;
  216. u32 reserved0_w7;
  217. u32 reserved0_w8;
  218. };
  219. enum ena_admin_sq_direction {
  220. ENA_ADMIN_SQ_DIRECTION_TX = 1,
  221. ENA_ADMIN_SQ_DIRECTION_RX = 2,
  222. };
  223. struct ena_admin_acq_create_sq_resp_desc {
  224. struct ena_admin_acq_common_desc acq_common_desc;
  225. u16 sq_idx;
  226. u16 reserved;
  227. /* queue doorbell address as an offset to PCIe MMIO REG BAR */
  228. u32 sq_doorbell_offset;
  229. /* low latency queue ring base address as an offset to PCIe MMIO
  230. * LLQ_MEM BAR
  231. */
  232. u32 llq_descriptors_offset;
  233. /* low latency queue headers' memory as an offset to PCIe MMIO
  234. * LLQ_MEM BAR
  235. */
  236. u32 llq_headers_offset;
  237. };
  238. struct ena_admin_aq_destroy_sq_cmd {
  239. struct ena_admin_aq_common_desc aq_common_descriptor;
  240. struct ena_admin_sq sq;
  241. };
  242. struct ena_admin_acq_destroy_sq_resp_desc {
  243. struct ena_admin_acq_common_desc acq_common_desc;
  244. };
  245. struct ena_admin_aq_create_cq_cmd {
  246. struct ena_admin_aq_common_desc aq_common_descriptor;
  247. /* 4:0 : reserved5
  248. * 5 : interrupt_mode_enabled - if set, cq operates
  249. * in interrupt mode, otherwise - polling
  250. * 7:6 : reserved6
  251. */
  252. u8 cq_caps_1;
  253. /* 4:0 : cq_entry_size_words - size of CQ entry in
  254. * 32-bit words, valid values: 4, 8.
  255. * 7:5 : reserved7
  256. */
  257. u8 cq_caps_2;
  258. /* completion queue depth in # of entries. must be power of 2 */
  259. u16 cq_depth;
  260. /* msix vector assigned to this cq */
  261. u32 msix_vector;
  262. /* cq physical base address in OS memory. CQ must be physically
  263. * contiguous
  264. */
  265. struct ena_common_mem_addr cq_ba;
  266. };
  267. struct ena_admin_acq_create_cq_resp_desc {
  268. struct ena_admin_acq_common_desc acq_common_desc;
  269. u16 cq_idx;
  270. /* actual cq depth in number of entries */
  271. u16 cq_actual_depth;
  272. u32 numa_node_register_offset;
  273. u32 cq_head_db_register_offset;
  274. u32 cq_interrupt_unmask_register_offset;
  275. };
  276. struct ena_admin_aq_destroy_cq_cmd {
  277. struct ena_admin_aq_common_desc aq_common_descriptor;
  278. u16 cq_idx;
  279. u16 reserved1;
  280. };
  281. struct ena_admin_acq_destroy_cq_resp_desc {
  282. struct ena_admin_acq_common_desc acq_common_desc;
  283. };
  284. /* ENA AQ Get Statistics command. Extended statistics are placed in control
  285. * buffer pointed by AQ entry
  286. */
  287. struct ena_admin_aq_get_stats_cmd {
  288. struct ena_admin_aq_common_desc aq_common_descriptor;
  289. union {
  290. /* command specific inline data */
  291. u32 inline_data_w1[3];
  292. struct ena_admin_ctrl_buff_info control_buffer;
  293. } u;
  294. /* stats type as defined in enum ena_admin_get_stats_type */
  295. u8 type;
  296. /* stats scope defined in enum ena_admin_get_stats_scope */
  297. u8 scope;
  298. u16 reserved3;
  299. /* queue id. used when scope is specific_queue */
  300. u16 queue_idx;
  301. /* device id, value 0xFFFF means mine. only privileged device can get
  302. * stats of other device
  303. */
  304. u16 device_id;
  305. };
  306. /* Basic Statistics Command. */
  307. struct ena_admin_basic_stats {
  308. u32 tx_bytes_low;
  309. u32 tx_bytes_high;
  310. u32 tx_pkts_low;
  311. u32 tx_pkts_high;
  312. u32 rx_bytes_low;
  313. u32 rx_bytes_high;
  314. u32 rx_pkts_low;
  315. u32 rx_pkts_high;
  316. u32 rx_drops_low;
  317. u32 rx_drops_high;
  318. };
  319. struct ena_admin_acq_get_stats_resp {
  320. struct ena_admin_acq_common_desc acq_common_desc;
  321. struct ena_admin_basic_stats basic_stats;
  322. };
  323. struct ena_admin_get_set_feature_common_desc {
  324. /* 1:0 : select - 0x1 - current value; 0x3 - default
  325. * value
  326. * 7:3 : reserved3
  327. */
  328. u8 flags;
  329. /* as appears in ena_admin_aq_feature_id */
  330. u8 feature_id;
  331. u16 reserved16;
  332. };
  333. struct ena_admin_device_attr_feature_desc {
  334. u32 impl_id;
  335. u32 device_version;
  336. /* bitmap of ena_admin_aq_feature_id */
  337. u32 supported_features;
  338. u32 reserved3;
  339. /* Indicates how many bits are used physical address access. */
  340. u32 phys_addr_width;
  341. /* Indicates how many bits are used virtual address access. */
  342. u32 virt_addr_width;
  343. /* unicast MAC address (in Network byte order) */
  344. u8 mac_addr[6];
  345. u8 reserved7[2];
  346. u32 max_mtu;
  347. };
  348. struct ena_admin_queue_feature_desc {
  349. /* including LLQs */
  350. u32 max_sq_num;
  351. u32 max_sq_depth;
  352. u32 max_cq_num;
  353. u32 max_cq_depth;
  354. u32 max_llq_num;
  355. u32 max_llq_depth;
  356. u32 max_header_size;
  357. /* Maximum Descriptors number, including meta descriptor, allowed for
  358. * a single Tx packet
  359. */
  360. u16 max_packet_tx_descs;
  361. /* Maximum Descriptors number allowed for a single Rx packet */
  362. u16 max_packet_rx_descs;
  363. };
  364. struct ena_admin_set_feature_mtu_desc {
  365. /* exclude L2 */
  366. u32 mtu;
  367. };
  368. struct ena_admin_set_feature_host_attr_desc {
  369. /* host OS info base address in OS memory. host info is 4KB of
  370. * physically contiguous
  371. */
  372. struct ena_common_mem_addr os_info_ba;
  373. /* host debug area base address in OS memory. debug area must be
  374. * physically contiguous
  375. */
  376. struct ena_common_mem_addr debug_ba;
  377. /* debug area size */
  378. u32 debug_area_size;
  379. };
  380. struct ena_admin_feature_intr_moder_desc {
  381. /* interrupt delay granularity in usec */
  382. u16 intr_delay_resolution;
  383. u16 reserved;
  384. };
  385. struct ena_admin_get_feature_link_desc {
  386. /* Link speed in Mb */
  387. u32 speed;
  388. /* bit field of enum ena_admin_link types */
  389. u32 supported;
  390. /* 0 : autoneg
  391. * 1 : duplex - Full Duplex
  392. * 31:2 : reserved2
  393. */
  394. u32 flags;
  395. };
  396. struct ena_admin_feature_aenq_desc {
  397. /* bitmask for AENQ groups the device can report */
  398. u32 supported_groups;
  399. /* bitmask for AENQ groups to report */
  400. u32 enabled_groups;
  401. };
  402. struct ena_admin_feature_offload_desc {
  403. /* 0 : TX_L3_csum_ipv4
  404. * 1 : TX_L4_ipv4_csum_part - The checksum field
  405. * should be initialized with pseudo header checksum
  406. * 2 : TX_L4_ipv4_csum_full
  407. * 3 : TX_L4_ipv6_csum_part - The checksum field
  408. * should be initialized with pseudo header checksum
  409. * 4 : TX_L4_ipv6_csum_full
  410. * 5 : tso_ipv4
  411. * 6 : tso_ipv6
  412. * 7 : tso_ecn
  413. */
  414. u32 tx;
  415. /* Receive side supported stateless offload
  416. * 0 : RX_L3_csum_ipv4 - IPv4 checksum
  417. * 1 : RX_L4_ipv4_csum - TCP/UDP/IPv4 checksum
  418. * 2 : RX_L4_ipv6_csum - TCP/UDP/IPv6 checksum
  419. * 3 : RX_hash - Hash calculation
  420. */
  421. u32 rx_supported;
  422. u32 rx_enabled;
  423. };
  424. enum ena_admin_hash_functions {
  425. ENA_ADMIN_TOEPLITZ = 1,
  426. ENA_ADMIN_CRC32 = 2,
  427. };
  428. struct ena_admin_feature_rss_flow_hash_control {
  429. u32 keys_num;
  430. u32 reserved;
  431. u32 key[10];
  432. };
  433. struct ena_admin_feature_rss_flow_hash_function {
  434. /* 7:0 : funcs - bitmask of ena_admin_hash_functions */
  435. u32 supported_func;
  436. /* 7:0 : selected_func - bitmask of
  437. * ena_admin_hash_functions
  438. */
  439. u32 selected_func;
  440. /* initial value */
  441. u32 init_val;
  442. };
  443. /* RSS flow hash protocols */
  444. enum ena_admin_flow_hash_proto {
  445. ENA_ADMIN_RSS_TCP4 = 0,
  446. ENA_ADMIN_RSS_UDP4 = 1,
  447. ENA_ADMIN_RSS_TCP6 = 2,
  448. ENA_ADMIN_RSS_UDP6 = 3,
  449. ENA_ADMIN_RSS_IP4 = 4,
  450. ENA_ADMIN_RSS_IP6 = 5,
  451. ENA_ADMIN_RSS_IP4_FRAG = 6,
  452. ENA_ADMIN_RSS_NOT_IP = 7,
  453. ENA_ADMIN_RSS_PROTO_NUM = 16,
  454. };
  455. /* RSS flow hash fields */
  456. enum ena_admin_flow_hash_fields {
  457. /* Ethernet Dest Addr */
  458. ENA_ADMIN_RSS_L2_DA = 0,
  459. /* Ethernet Src Addr */
  460. ENA_ADMIN_RSS_L2_SA = 1,
  461. /* ipv4/6 Dest Addr */
  462. ENA_ADMIN_RSS_L3_DA = 2,
  463. /* ipv4/6 Src Addr */
  464. ENA_ADMIN_RSS_L3_SA = 5,
  465. /* tcp/udp Dest Port */
  466. ENA_ADMIN_RSS_L4_DP = 6,
  467. /* tcp/udp Src Port */
  468. ENA_ADMIN_RSS_L4_SP = 7,
  469. };
  470. struct ena_admin_proto_input {
  471. /* flow hash fields (bitwise according to ena_admin_flow_hash_fields) */
  472. u16 fields;
  473. u16 reserved2;
  474. };
  475. struct ena_admin_feature_rss_hash_control {
  476. struct ena_admin_proto_input supported_fields[ENA_ADMIN_RSS_PROTO_NUM];
  477. struct ena_admin_proto_input selected_fields[ENA_ADMIN_RSS_PROTO_NUM];
  478. struct ena_admin_proto_input reserved2[ENA_ADMIN_RSS_PROTO_NUM];
  479. struct ena_admin_proto_input reserved3[ENA_ADMIN_RSS_PROTO_NUM];
  480. };
  481. struct ena_admin_feature_rss_flow_hash_input {
  482. /* supported hash input sorting
  483. * 1 : L3_sort - support swap L3 addresses if DA is
  484. * smaller than SA
  485. * 2 : L4_sort - support swap L4 ports if DP smaller
  486. * SP
  487. */
  488. u16 supported_input_sort;
  489. /* enabled hash input sorting
  490. * 1 : enable_L3_sort - enable swap L3 addresses if
  491. * DA smaller than SA
  492. * 2 : enable_L4_sort - enable swap L4 ports if DP
  493. * smaller than SP
  494. */
  495. u16 enabled_input_sort;
  496. };
  497. enum ena_admin_os_type {
  498. ENA_ADMIN_OS_LINUX = 1,
  499. ENA_ADMIN_OS_WIN = 2,
  500. ENA_ADMIN_OS_DPDK = 3,
  501. ENA_ADMIN_OS_FREEBSD = 4,
  502. ENA_ADMIN_OS_IPXE = 5,
  503. };
  504. struct ena_admin_host_info {
  505. /* defined in enum ena_admin_os_type */
  506. u32 os_type;
  507. /* os distribution string format */
  508. u8 os_dist_str[128];
  509. /* OS distribution numeric format */
  510. u32 os_dist;
  511. /* kernel version string format */
  512. u8 kernel_ver_str[32];
  513. /* Kernel version numeric format */
  514. u32 kernel_ver;
  515. /* 7:0 : major
  516. * 15:8 : minor
  517. * 23:16 : sub_minor
  518. */
  519. u32 driver_version;
  520. /* features bitmap */
  521. u32 supported_network_features[4];
  522. };
  523. struct ena_admin_rss_ind_table_entry {
  524. u16 cq_idx;
  525. u16 reserved;
  526. };
  527. struct ena_admin_feature_rss_ind_table {
  528. /* min supported table size (2^min_size) */
  529. u16 min_size;
  530. /* max supported table size (2^max_size) */
  531. u16 max_size;
  532. /* table size (2^size) */
  533. u16 size;
  534. u16 reserved;
  535. /* index of the inline entry. 0xFFFFFFFF means invalid */
  536. u32 inline_index;
  537. /* used for updating single entry, ignored when setting the entire
  538. * table through the control buffer.
  539. */
  540. struct ena_admin_rss_ind_table_entry inline_entry;
  541. };
  542. struct ena_admin_get_feat_cmd {
  543. struct ena_admin_aq_common_desc aq_common_descriptor;
  544. struct ena_admin_ctrl_buff_info control_buffer;
  545. struct ena_admin_get_set_feature_common_desc feat_common;
  546. u32 raw[11];
  547. };
  548. struct ena_admin_get_feat_resp {
  549. struct ena_admin_acq_common_desc acq_common_desc;
  550. union {
  551. u32 raw[14];
  552. struct ena_admin_device_attr_feature_desc dev_attr;
  553. struct ena_admin_queue_feature_desc max_queue;
  554. struct ena_admin_feature_aenq_desc aenq;
  555. struct ena_admin_get_feature_link_desc link;
  556. struct ena_admin_feature_offload_desc offload;
  557. struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
  558. struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
  559. struct ena_admin_feature_rss_ind_table ind_table;
  560. struct ena_admin_feature_intr_moder_desc intr_moderation;
  561. } u;
  562. };
  563. struct ena_admin_set_feat_cmd {
  564. struct ena_admin_aq_common_desc aq_common_descriptor;
  565. struct ena_admin_ctrl_buff_info control_buffer;
  566. struct ena_admin_get_set_feature_common_desc feat_common;
  567. union {
  568. u32 raw[11];
  569. /* mtu size */
  570. struct ena_admin_set_feature_mtu_desc mtu;
  571. /* host attributes */
  572. struct ena_admin_set_feature_host_attr_desc host_attr;
  573. /* AENQ configuration */
  574. struct ena_admin_feature_aenq_desc aenq;
  575. /* rss flow hash function */
  576. struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
  577. /* rss flow hash input */
  578. struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
  579. /* rss indirection table */
  580. struct ena_admin_feature_rss_ind_table ind_table;
  581. } u;
  582. };
  583. struct ena_admin_set_feat_resp {
  584. struct ena_admin_acq_common_desc acq_common_desc;
  585. union {
  586. u32 raw[14];
  587. } u;
  588. };
  589. struct ena_admin_aenq_common_desc {
  590. u16 group;
  591. u16 syndrom;
  592. /* 0 : phase */
  593. u8 flags;
  594. u8 reserved1[3];
  595. u32 timestamp_low;
  596. u32 timestamp_high;
  597. };
  598. /* asynchronous event notification groups */
  599. enum ena_admin_aenq_group {
  600. ENA_ADMIN_LINK_CHANGE = 0,
  601. ENA_ADMIN_FATAL_ERROR = 1,
  602. ENA_ADMIN_WARNING = 2,
  603. ENA_ADMIN_NOTIFICATION = 3,
  604. ENA_ADMIN_KEEP_ALIVE = 4,
  605. ENA_ADMIN_AENQ_GROUPS_NUM = 5,
  606. };
  607. enum ena_admin_aenq_notification_syndrom {
  608. ENA_ADMIN_SUSPEND = 0,
  609. ENA_ADMIN_RESUME = 1,
  610. };
  611. struct ena_admin_aenq_entry {
  612. struct ena_admin_aenq_common_desc aenq_common_desc;
  613. /* command specific inline data */
  614. u32 inline_data_w4[12];
  615. };
  616. struct ena_admin_aenq_link_change_desc {
  617. struct ena_admin_aenq_common_desc aenq_common_desc;
  618. /* 0 : link_status */
  619. u32 flags;
  620. };
  621. struct ena_admin_ena_mmio_req_read_less_resp {
  622. u16 req_id;
  623. u16 reg_off;
  624. /* value is valid when poll is cleared */
  625. u32 reg_val;
  626. };
  627. /* aq_common_desc */
  628. #define ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
  629. #define ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK BIT(0)
  630. #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT 1
  631. #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK BIT(1)
  632. #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT 2
  633. #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK BIT(2)
  634. /* sq */
  635. #define ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT 5
  636. #define ENA_ADMIN_SQ_SQ_DIRECTION_MASK GENMASK(7, 5)
  637. /* acq_common_desc */
  638. #define ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
  639. #define ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK BIT(0)
  640. /* aq_create_sq_cmd */
  641. #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT 5
  642. #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK GENMASK(7, 5)
  643. #define ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK GENMASK(3, 0)
  644. #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT 4
  645. #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK GENMASK(6, 4)
  646. #define ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK BIT(0)
  647. /* aq_create_cq_cmd */
  648. #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT 5
  649. #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
  650. #define ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
  651. /* get_set_feature_common_desc */
  652. #define ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK GENMASK(1, 0)
  653. /* get_feature_link_desc */
  654. #define ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK BIT(0)
  655. #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT 1
  656. #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK BIT(1)
  657. /* feature_offload_desc */
  658. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK BIT(0)
  659. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT 1
  660. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK BIT(1)
  661. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT 2
  662. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK BIT(2)
  663. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT 3
  664. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK BIT(3)
  665. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT 4
  666. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK BIT(4)
  667. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT 5
  668. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK BIT(5)
  669. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT 6
  670. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK BIT(6)
  671. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT 7
  672. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK BIT(7)
  673. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK BIT(0)
  674. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT 1
  675. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK BIT(1)
  676. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT 2
  677. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK BIT(2)
  678. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT 3
  679. #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK BIT(3)
  680. /* feature_rss_flow_hash_function */
  681. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK GENMASK(7, 0)
  682. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK GENMASK(7, 0)
  683. /* feature_rss_flow_hash_input */
  684. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT 1
  685. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK BIT(1)
  686. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT 2
  687. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK BIT(2)
  688. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT 1
  689. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK BIT(1)
  690. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT 2
  691. #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK BIT(2)
  692. /* host_info */
  693. #define ENA_ADMIN_HOST_INFO_MAJOR_MASK GENMASK(7, 0)
  694. #define ENA_ADMIN_HOST_INFO_MINOR_SHIFT 8
  695. #define ENA_ADMIN_HOST_INFO_MINOR_MASK GENMASK(15, 8)
  696. #define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT 16
  697. #define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK GENMASK(23, 16)
  698. /* aenq_common_desc */
  699. #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0)
  700. /* aenq_link_change_desc */
  701. #define ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK BIT(0)
  702. #endif /*_ENA_ADMIN_H_ */