1 /* SPDX-License-Identifier: Apache-2.0
2 * Copyright(c) 2023 Cisco Systems, Inc.
5 #ifndef _ENA_ADMIN_DEFS_H_
6 #define _ENA_ADMIN_DEFS_H_
8 #include <vppinfra/clib.h>
9 #include <vppinfra/error_bootstrap.h>
11 #define foreach_ena_aq_opcode \
22 #define _(v, n) ENA_AQ_OPCODE_##n = (v),
25 } __clib_packed ena_aq_opcode_t;
27 #define foreach_ena_aq_compl_status \
29 _ (1, RESOURCE_ALLOCATION_FAILURE) \
31 _ (3, UNSUPPORTED_OPCODE) \
32 _ (4, MALFORMED_REQUEST) \
33 _ (5, ILLEGAL_PARAMETER) \
34 _ (6, UNKNOWN_ERROR) \
39 #define _(v, n) ENA_ADMIN_COMPL_STATUS_##n = (v),
40 foreach_ena_aq_compl_status
42 } __clib_packed ena_aq_compl_status_t;
44 /* id, versiom, get, set, name, struct */
45 #define foreach_ena_aq_feature_id \
46 _ (1, 0, 1, 0, DEVICE_ATTRIBUTES, ena_aq_feat_device_attr_t) \
47 _ (2, 0, 1, 0, MAX_QUEUES_NUM, ena_aq_feat_max_queue_num_t) \
48 _ (3, 0, 1, 0, HW_HINTS, ena_aq_feat_hw_hints_t) \
49 _ (4, 0, 1, 1, LLQ, ena_aq_feat_llq_t) \
50 _ (5, 0, 1, 0, EXTRA_PROPERTIES_STRINGS, \
51 ena_aq_feat_extra_properties_strings_t) \
52 _ (6, 0, 1, 0, EXTRA_PROPERTIES_FLAGS, \
53 ena_aq_feat_extra_properties_flags_t) \
54 _ (7, 1, 1, 0, MAX_QUEUES_EXT, ena_aq_feat_max_queue_ext_t) \
55 _ (10, 0, 1, 1, RSS_HASH_FUNCTION, ena_aq_feat_rss_hash_function_t) \
56 _ (11, 0, 1, 0, STATELESS_OFFLOAD_CONFIG, \
57 ena_aq_feat_stateless_offload_config_t) \
58 _ (12, 0, 1, 1, RSS_INDIRECTION_TABLE_CONFIG, \
59 ena_aq_feat_rss_ind_table_config_t) \
60 _ (14, 0, 0, 1, MTU, ena_aq_feat_mtu_t) \
61 _ (18, 0, 1, 1, RSS_HASH_INPUT, ena_aq_feat_rss_hash_input_t) \
62 _ (20, 0, 1, 0, INTERRUPT_MODERATION, ena_aq_feat_intr_moder_t) \
63 _ (26, 0, 1, 1, AENQ_CONFIG, ena_aq_feat_aenq_config_t) \
64 _ (27, 0, 1, 0, LINK_CONFIG, ena_aq_feat_link_config_t) \
65 _ (28, 0, 0, 1, HOST_ATTR_CONFIG, ena_aq_feat_host_attr_config_t) \
66 _ (29, 0, 1, 1, PHC_CONFIG, ena_aq_feat_phc_config_t)
70 #define _(v, ver, r, w, n, s) ENA_ADMIN_FEAT_ID_##n = (v),
71 foreach_ena_aq_feature_id
73 } __clib_packed ena_aq_feature_id_t;
75 #define foreach_ena_aq_stats_type \
80 #define foreach_ena_aq_stats_scope \
81 _ (0, SPECIFIC_QUEUE) \
86 #define _(v, n) ENA_ADMIN_STATS_TYPE_##n = (v),
87 foreach_ena_aq_stats_type
89 } __clib_packed ena_aq_stats_type_t;
93 #define _(v, n) ENA_ADMIN_STATS_SCOPE_##n = (v),
94 foreach_ena_aq_stats_scope
96 } __clib_packed ena_aq_stats_scope_t;
105 #define foreach_ena_aq_aenq_groups \
111 _ (refresh_capabilities) \
112 _ (conf_notifications)
118 #define _(g) u32 g : 1;
119 foreach_ena_aq_aenq_groups
123 } ena_aq_aenq_groups_t;
125 STATIC_ASSERT_SIZEOF (ena_aq_aenq_groups_t, 4);
131 } ena_aq_aq_ctrl_buff_info_t;
137 u32 supported_features;
144 } ena_aq_feat_device_attr_t;
155 u16 supported_input_sort;
161 u16 enable_l3_sort : 1;
162 u16 enable_l4_sort : 1;
164 u16 enabled_input_sort;
166 } ena_aq_feat_rss_hash_input_t;
168 STATIC_ASSERT_SIZEOF (ena_aq_feat_rss_hash_input_t, 4);
172 u16 intr_delay_resolution;
174 } ena_aq_feat_intr_moder_t;
178 ena_aq_aenq_groups_t supported_groups;
179 ena_aq_aenq_groups_t enabled_groups;
180 } ena_aq_feat_aenq_config_t;
182 #define foreach_ena_aq_link_types \
190 _ (7, 100000, 100G) \
191 _ (8, 200000, 200G) \
196 #define _(b, v, n) ENA_ADMIN_LINK_TYPE_##n = (1U << b),
197 foreach_ena_aq_link_types
199 } ena_aq_link_types_t;
204 ena_aq_link_types_t supported;
207 } ena_aq_feat_link_config_t;
209 STATIC_ASSERT_SIZEOF (ena_aq_feat_link_config_t, 12);
216 } ena_aq_feat_stateless_offload_config_t;
222 } ena_aq_feat_rss_ind_table_entry_t;
229 u8 one_entry_update : 1;
232 ena_aq_feat_rss_ind_table_entry_t inline_entry;
233 } ena_aq_feat_rss_ind_table_config_t;
243 } ena_aq_feat_extra_properties_strings_t;
248 } ena_aq_feat_extra_properties_flags_t;
256 u32 max_legacy_llq_num;
257 u32 max_legacy_llq_depth;
259 u16 max_packet_tx_descs;
260 u16 max_packet_rx_descs;
261 } ena_aq_feat_max_queue_num_t;
265 u16 mmio_read_timeout;
266 u16 driver_watchdog_timeout;
267 u16 missing_tx_completion_timeout;
268 u16 missed_tx_completion_count_threshold_to_reset;
269 u16 admin_completion_tx_timeout;
270 u16 netdev_wd_timeout;
274 } ena_aq_feat_hw_hints_t;
288 u32 max_tx_header_size;
289 u16 max_per_packet_tx_descs;
290 u16 max_per_packet_rx_descs;
291 } ena_aq_feat_max_queue_ext_t;
298 } ena_aq_feat_rss_hash_function_t;
302 ena_mem_addr_t os_info_ba;
303 ena_mem_addr_t debug_ba;
305 } ena_aq_feat_host_attr_config_t;
312 u32 expire_timeout_usec;
313 u32 block_timeout_usec;
314 ena_mem_addr_t output_address;
316 } ena_aq_feat_phc_config_t;
322 u16 header_location_ctrl_supported;
323 u16 header_location_ctrl_enabled;
324 u16 entry_size_ctrl_supported;
325 u16 entry_size_ctrl_enabled;
326 u16 desc_num_before_header_supported;
327 u16 desc_num_before_header_enabled;
328 u16 descriptors_stride_ctrl_supported;
329 u16 descriptors_stride_ctrl_enabled;
335 u16 max_tx_burst_size;
348 ena_aq_feature_id_t feature_id;
351 } ena_aq_get_set_feature_common_desc_t;
353 STATIC_ASSERT_SIZEOF (ena_aq_get_set_feature_common_desc_t, 4);
357 ena_aq_aq_ctrl_buff_info_t control_buffer;
358 ena_aq_stats_type_t type;
359 ena_aq_stats_scope_t scope;
363 } ena_aq_get_stats_cmd_t;
364 STATIC_ASSERT_SIZEOF (ena_aq_get_stats_cmd_t, 20);
368 ENA_ADMIN_SQ_DIRECTION_TX = 1,
369 ENA_ADMIN_SQ_DIRECTION_RX = 2,
370 } ena_aq_sq_direction_t;
374 ENA_ADMIN_SQ_PLACEMENT_POLICY_HOST = 1,
375 ENA_ADMIN_SQ_PLACEMENT_POLICY_DEVICE = 3,
376 } ena_aq_sq_placement_policy_t;
380 ENA_ADMIN_SQ_COMPLETION_POLICY_DESC = 0,
381 ENA_ADMIN_SQ_COMPLETION_POLICY_DESC_ON_DEMAND = 1,
382 ENA_ADMIN_SQ_COMPLETION_POLICY_HEAD_ON_DEMAND = 2,
383 ENA_ADMIN_SQ_COMPLETION_POLICY_HEAD = 3,
384 } ena_aq_completion_policy_t;
393 u8 sq_direction : 3; /* ena_aq_sq_direction_t */
404 u8 placement_policy : 4; /* ena_aq_sq_placement_policy_t */
405 u8 completion_policy : 3; /* ena_aq_completion_policy_t */
415 u8 is_physically_contiguous : 1;
423 ena_mem_addr_t sq_ba;
424 ena_mem_addr_t sq_head_writeback; /* used if completion_policy is 2 or 3 */
427 } ena_aq_create_sq_cmd_t;
433 u32 sq_doorbell_offset; /* REG BAR offset of queue dorbell */
434 u32 llq_descriptors_offset; /* LLQ MEM BAR offset of descriptors */
435 u32 llq_headers_offset; /* LLQ MEM BAR offset of headers mem */
436 } ena_aq_create_sq_resp_t;
445 u8 interrupt_mode_enabled : 1;
455 u8 cq_entry_size_words : 4;
463 ena_mem_addr_t cq_ba;
464 } ena_aq_create_cq_cmd_t;
470 u32 numa_node_register_offset;
471 u32 cq_head_db_register_offset;
472 u32 cq_interrupt_unmask_register_offset;
473 } ena_aq_create_cq_resp_t;
483 u8 sq_direction : 3; /* ena_aq_sq_direction_t */
488 } ena_aq_destroy_sq_cmd_t;
494 } ena_aq_destroy_cq_cmd_t;
496 STATIC_ASSERT_SIZEOF (ena_aq_create_sq_cmd_t, 32);
497 STATIC_ASSERT_SIZEOF (ena_aq_create_sq_resp_t, 16);
498 STATIC_ASSERT_SIZEOF (ena_aq_create_cq_cmd_t, 16);
499 STATIC_ASSERT_SIZEOF (ena_aq_create_cq_resp_t, 16);
500 STATIC_ASSERT_SIZEOF (ena_aq_destroy_sq_cmd_t, 4);
501 STATIC_ASSERT_SIZEOF (ena_aq_destroy_cq_cmd_t, 4);
507 ena_aq_opcode_t opcode;
515 u8 ctrl_data_indirect : 1;
516 u8 _reserved_3_3 : 5;
524 STATIC_ASSERT_SIZEOF (ena_aq_sq_entry_t, 64);
531 u8 kernel_ver_str[32];
542 u32 supported_network_features[2];
566 u32 interrupt_moderation : 1;
567 u32 rx_buf_mirroring : 1;
568 u32 rss_configurable_function_key : 1;
570 u32 rx_page_reuse : 1;
571 u32 tx_ipv6_csum_offload : 1;
575 } driver_supported_features;
577 } ena_aq_host_info_t;
579 STATIC_ASSERT_SIZEOF (ena_aq_host_info_t, 196);
637 } ena_aq_basic_stats_t;
639 #define foreach_ena_aq_basic_counter \
640 _ (rx_pkts, "RX Packets") \
641 _ (tx_pkts, "TX Packets") \
642 _ (rx_bytes, "RX Bytes") \
643 _ (tx_bytes, "TX Bytes") \
644 _ (rx_drops, "RX Packet Drops") \
645 _ (tx_drops, "TX Packet Drops")
649 u64 bw_in_allowance_exceeded;
650 u64 bw_out_allowance_exceeded;
651 u64 pps_allowance_exceeded;
652 u64 conntrack_allowance_exceeded;
653 u64 linklocal_allowance_exceeded;
654 } ena_aq_eni_stats_t;
656 #define foreach_ena_aq_eni_counter \
657 _ (bw_in_allowance_exceeded, "Input BW Allowance Exceeded") \
658 _ (bw_out_allowance_exceeded, "Output BW Allowance Exceeded") \
659 _ (pps_allowance_exceeded, "PPS Allowance Exceeded") \
660 _ (conntrack_allowance_exceeded, "ConnTrack Allowance Exceeded") \
661 _ (linklocal_allowance_exceeded, "LinkLocal Allowance Exceeded")
667 ena_aq_compl_status_t status;
683 STATIC_ASSERT_SIZEOF (ena_aq_cq_entry_t, 64);
685 #endif /* _ENA_ADMIN_DEFS_H_ */