WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / ethernet / amazon / ena / ena_admin_defs.h
blob4164eacc5c28b7175dd1a4b832dad545ddeb45c8
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3 * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
4 */
5 #ifndef _ENA_ADMIN_H_
6 #define _ENA_ADMIN_H_
8 #define ENA_ADMIN_RSS_KEY_PARTS 10
10 enum ena_admin_aq_opcode {
11 ENA_ADMIN_CREATE_SQ = 1,
12 ENA_ADMIN_DESTROY_SQ = 2,
13 ENA_ADMIN_CREATE_CQ = 3,
14 ENA_ADMIN_DESTROY_CQ = 4,
15 ENA_ADMIN_GET_FEATURE = 8,
16 ENA_ADMIN_SET_FEATURE = 9,
17 ENA_ADMIN_GET_STATS = 11,
20 enum ena_admin_aq_completion_status {
21 ENA_ADMIN_SUCCESS = 0,
22 ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE = 1,
23 ENA_ADMIN_BAD_OPCODE = 2,
24 ENA_ADMIN_UNSUPPORTED_OPCODE = 3,
25 ENA_ADMIN_MALFORMED_REQUEST = 4,
26 /* Additional status is provided in ACQ entry extended_status */
27 ENA_ADMIN_ILLEGAL_PARAMETER = 5,
28 ENA_ADMIN_UNKNOWN_ERROR = 6,
29 ENA_ADMIN_RESOURCE_BUSY = 7,
32 /* subcommands for the set/get feature admin commands */
33 enum ena_admin_aq_feature_id {
34 ENA_ADMIN_DEVICE_ATTRIBUTES = 1,
35 ENA_ADMIN_MAX_QUEUES_NUM = 2,
36 ENA_ADMIN_HW_HINTS = 3,
37 ENA_ADMIN_LLQ = 4,
38 ENA_ADMIN_MAX_QUEUES_EXT = 7,
39 ENA_ADMIN_RSS_HASH_FUNCTION = 10,
40 ENA_ADMIN_STATELESS_OFFLOAD_CONFIG = 11,
41 ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG = 12,
42 ENA_ADMIN_MTU = 14,
43 ENA_ADMIN_RSS_HASH_INPUT = 18,
44 ENA_ADMIN_INTERRUPT_MODERATION = 20,
45 ENA_ADMIN_AENQ_CONFIG = 26,
46 ENA_ADMIN_LINK_CONFIG = 27,
47 ENA_ADMIN_HOST_ATTR_CONFIG = 28,
48 ENA_ADMIN_FEATURES_OPCODE_NUM = 32,
51 enum ena_admin_placement_policy_type {
52 /* descriptors and headers are in host memory */
53 ENA_ADMIN_PLACEMENT_POLICY_HOST = 1,
54 /* descriptors and headers are in device memory (a.k.a Low Latency
55 * Queue)
57 ENA_ADMIN_PLACEMENT_POLICY_DEV = 3,
60 enum ena_admin_link_types {
61 ENA_ADMIN_LINK_SPEED_1G = 0x1,
62 ENA_ADMIN_LINK_SPEED_2_HALF_G = 0x2,
63 ENA_ADMIN_LINK_SPEED_5G = 0x4,
64 ENA_ADMIN_LINK_SPEED_10G = 0x8,
65 ENA_ADMIN_LINK_SPEED_25G = 0x10,
66 ENA_ADMIN_LINK_SPEED_40G = 0x20,
67 ENA_ADMIN_LINK_SPEED_50G = 0x40,
68 ENA_ADMIN_LINK_SPEED_100G = 0x80,
69 ENA_ADMIN_LINK_SPEED_200G = 0x100,
70 ENA_ADMIN_LINK_SPEED_400G = 0x200,
73 enum ena_admin_completion_policy_type {
74 /* completion queue entry for each sq descriptor */
75 ENA_ADMIN_COMPLETION_POLICY_DESC = 0,
76 /* completion queue entry upon request in sq descriptor */
77 ENA_ADMIN_COMPLETION_POLICY_DESC_ON_DEMAND = 1,
78 /* current queue head pointer is updated in OS memory upon sq
79 * descriptor request
81 ENA_ADMIN_COMPLETION_POLICY_HEAD_ON_DEMAND = 2,
82 /* current queue head pointer is updated in OS memory for each sq
83 * descriptor
85 ENA_ADMIN_COMPLETION_POLICY_HEAD = 3,
88 /* basic stats return ena_admin_basic_stats while extanded stats return a
89 * buffer (string format) with additional statistics per queue and per
90 * device id
92 enum ena_admin_get_stats_type {
93 ENA_ADMIN_GET_STATS_TYPE_BASIC = 0,
94 ENA_ADMIN_GET_STATS_TYPE_EXTENDED = 1,
95 /* extra HW stats for specific network interface */
96 ENA_ADMIN_GET_STATS_TYPE_ENI = 2,
99 enum ena_admin_get_stats_scope {
100 ENA_ADMIN_SPECIFIC_QUEUE = 0,
101 ENA_ADMIN_ETH_TRAFFIC = 1,
104 struct ena_admin_aq_common_desc {
105 /* 11:0 : command_id
106 * 15:12 : reserved12
108 u16 command_id;
110 /* as appears in ena_admin_aq_opcode */
111 u8 opcode;
113 /* 0 : phase
114 * 1 : ctrl_data - control buffer address valid
115 * 2 : ctrl_data_indirect - control buffer address
116 * points to list of pages with addresses of control
117 * buffers
118 * 7:3 : reserved3
120 u8 flags;
123 /* used in ena_admin_aq_entry. Can point directly to control data, or to a
124 * page list chunk. Used also at the end of indirect mode page list chunks,
125 * for chaining.
127 struct ena_admin_ctrl_buff_info {
128 u32 length;
130 struct ena_common_mem_addr address;
133 struct ena_admin_sq {
134 u16 sq_idx;
136 /* 4:0 : reserved
137 * 7:5 : sq_direction - 0x1 - Tx; 0x2 - Rx
139 u8 sq_identity;
141 u8 reserved1;
144 struct ena_admin_aq_entry {
145 struct ena_admin_aq_common_desc aq_common_descriptor;
147 union {
148 u32 inline_data_w1[3];
150 struct ena_admin_ctrl_buff_info control_buffer;
151 } u;
153 u32 inline_data_w4[12];
156 struct ena_admin_acq_common_desc {
157 /* command identifier to associate it with the aq descriptor
158 * 11:0 : command_id
159 * 15:12 : reserved12
161 u16 command;
163 u8 status;
165 /* 0 : phase
166 * 7:1 : reserved1
168 u8 flags;
170 u16 extended_status;
172 /* indicates to the driver which AQ entry has been consumed by the
173 * device and could be reused
175 u16 sq_head_indx;
178 struct ena_admin_acq_entry {
179 struct ena_admin_acq_common_desc acq_common_descriptor;
181 u32 response_specific_data[14];
184 struct ena_admin_aq_create_sq_cmd {
185 struct ena_admin_aq_common_desc aq_common_descriptor;
187 /* 4:0 : reserved0_w1
188 * 7:5 : sq_direction - 0x1 - Tx, 0x2 - Rx
190 u8 sq_identity;
192 u8 reserved8_w1;
194 /* 3:0 : placement_policy - Describing where the SQ
195 * descriptor ring and the SQ packet headers reside:
196 * 0x1 - descriptors and headers are in OS memory,
197 * 0x3 - descriptors and headers in device memory
198 * (a.k.a Low Latency Queue)
199 * 6:4 : completion_policy - Describing what policy
200 * to use for generation completion entry (cqe) in
201 * the CQ associated with this SQ: 0x0 - cqe for each
202 * sq descriptor, 0x1 - cqe upon request in sq
203 * descriptor, 0x2 - current queue head pointer is
204 * updated in OS memory upon sq descriptor request
205 * 0x3 - current queue head pointer is updated in OS
206 * memory for each sq descriptor
207 * 7 : reserved15_w1
209 u8 sq_caps_2;
211 /* 0 : is_physically_contiguous - Described if the
212 * queue ring memory is allocated in physical
213 * contiguous pages or split.
214 * 7:1 : reserved17_w1
216 u8 sq_caps_3;
218 /* associated completion queue id. This CQ must be created prior to SQ
219 * creation
221 u16 cq_idx;
223 /* submission queue depth in entries */
224 u16 sq_depth;
226 /* SQ physical base address in OS memory. This field should not be
227 * used for Low Latency queues. Has to be page aligned.
229 struct ena_common_mem_addr sq_ba;
231 /* specifies queue head writeback location in OS memory. Valid if
232 * completion_policy is set to completion_policy_head_on_demand or
233 * completion_policy_head. Has to be cache aligned
235 struct ena_common_mem_addr sq_head_writeback;
237 u32 reserved0_w7;
239 u32 reserved0_w8;
242 enum ena_admin_sq_direction {
243 ENA_ADMIN_SQ_DIRECTION_TX = 1,
244 ENA_ADMIN_SQ_DIRECTION_RX = 2,
247 struct ena_admin_acq_create_sq_resp_desc {
248 struct ena_admin_acq_common_desc acq_common_desc;
250 u16 sq_idx;
252 u16 reserved;
254 /* queue doorbell address as an offset to PCIe MMIO REG BAR */
255 u32 sq_doorbell_offset;
257 /* low latency queue ring base address as an offset to PCIe MMIO
258 * LLQ_MEM BAR
260 u32 llq_descriptors_offset;
262 /* low latency queue headers' memory as an offset to PCIe MMIO
263 * LLQ_MEM BAR
265 u32 llq_headers_offset;
268 struct ena_admin_aq_destroy_sq_cmd {
269 struct ena_admin_aq_common_desc aq_common_descriptor;
271 struct ena_admin_sq sq;
274 struct ena_admin_acq_destroy_sq_resp_desc {
275 struct ena_admin_acq_common_desc acq_common_desc;
278 struct ena_admin_aq_create_cq_cmd {
279 struct ena_admin_aq_common_desc aq_common_descriptor;
281 /* 4:0 : reserved5
282 * 5 : interrupt_mode_enabled - if set, cq operates
283 * in interrupt mode, otherwise - polling
284 * 7:6 : reserved6
286 u8 cq_caps_1;
288 /* 4:0 : cq_entry_size_words - size of CQ entry in
289 * 32-bit words, valid values: 4, 8.
290 * 7:5 : reserved7
292 u8 cq_caps_2;
294 /* completion queue depth in # of entries. must be power of 2 */
295 u16 cq_depth;
297 /* msix vector assigned to this cq */
298 u32 msix_vector;
300 /* cq physical base address in OS memory. CQ must be physically
301 * contiguous
303 struct ena_common_mem_addr cq_ba;
306 struct ena_admin_acq_create_cq_resp_desc {
307 struct ena_admin_acq_common_desc acq_common_desc;
309 u16 cq_idx;
311 /* actual cq depth in number of entries */
312 u16 cq_actual_depth;
314 u32 numa_node_register_offset;
316 u32 cq_head_db_register_offset;
318 u32 cq_interrupt_unmask_register_offset;
321 struct ena_admin_aq_destroy_cq_cmd {
322 struct ena_admin_aq_common_desc aq_common_descriptor;
324 u16 cq_idx;
326 u16 reserved1;
329 struct ena_admin_acq_destroy_cq_resp_desc {
330 struct ena_admin_acq_common_desc acq_common_desc;
333 /* ENA AQ Get Statistics command. Extended statistics are placed in control
334 * buffer pointed by AQ entry
336 struct ena_admin_aq_get_stats_cmd {
337 struct ena_admin_aq_common_desc aq_common_descriptor;
339 union {
340 /* command specific inline data */
341 u32 inline_data_w1[3];
343 struct ena_admin_ctrl_buff_info control_buffer;
344 } u;
346 /* stats type as defined in enum ena_admin_get_stats_type */
347 u8 type;
349 /* stats scope defined in enum ena_admin_get_stats_scope */
350 u8 scope;
352 u16 reserved3;
354 /* queue id. used when scope is specific_queue */
355 u16 queue_idx;
357 /* device id, value 0xFFFF means mine. only privileged device can get
358 * stats of other device
360 u16 device_id;
363 /* Basic Statistics Command. */
364 struct ena_admin_basic_stats {
365 u32 tx_bytes_low;
367 u32 tx_bytes_high;
369 u32 tx_pkts_low;
371 u32 tx_pkts_high;
373 u32 rx_bytes_low;
375 u32 rx_bytes_high;
377 u32 rx_pkts_low;
379 u32 rx_pkts_high;
381 u32 rx_drops_low;
383 u32 rx_drops_high;
385 u32 tx_drops_low;
387 u32 tx_drops_high;
390 /* ENI Statistics Command. */
391 struct ena_admin_eni_stats {
392 /* The number of packets shaped due to inbound aggregate BW
393 * allowance being exceeded
395 u64 bw_in_allowance_exceeded;
397 /* The number of packets shaped due to outbound aggregate BW
398 * allowance being exceeded
400 u64 bw_out_allowance_exceeded;
402 /* The number of packets shaped due to PPS allowance being exceeded */
403 u64 pps_allowance_exceeded;
405 /* The number of packets shaped due to connection tracking
406 * allowance being exceeded and leading to failure in establishment
407 * of new connections
409 u64 conntrack_allowance_exceeded;
411 /* The number of packets shaped due to linklocal packet rate
412 * allowance being exceeded
414 u64 linklocal_allowance_exceeded;
417 struct ena_admin_acq_get_stats_resp {
418 struct ena_admin_acq_common_desc acq_common_desc;
420 union {
421 u64 raw[7];
423 struct ena_admin_basic_stats basic_stats;
425 struct ena_admin_eni_stats eni_stats;
426 } u;
429 struct ena_admin_get_set_feature_common_desc {
430 /* 1:0 : select - 0x1 - current value; 0x3 - default
431 * value
432 * 7:3 : reserved3
434 u8 flags;
436 /* as appears in ena_admin_aq_feature_id */
437 u8 feature_id;
439 /* The driver specifies the max feature version it supports and the
440 * device responds with the currently supported feature version. The
441 * field is zero based
443 u8 feature_version;
445 u8 reserved8;
448 struct ena_admin_device_attr_feature_desc {
449 u32 impl_id;
451 u32 device_version;
453 /* bitmap of ena_admin_aq_feature_id, which represents supported
454 * subcommands for the set/get feature admin commands.
456 u32 supported_features;
458 u32 reserved3;
460 /* Indicates how many bits are used physical address access. */
461 u32 phys_addr_width;
463 /* Indicates how many bits are used virtual address access. */
464 u32 virt_addr_width;
466 /* unicast MAC address (in Network byte order) */
467 u8 mac_addr[6];
469 u8 reserved7[2];
471 u32 max_mtu;
474 enum ena_admin_llq_header_location {
475 /* header is in descriptor list */
476 ENA_ADMIN_INLINE_HEADER = 1,
477 /* header in a separate ring, implies 16B descriptor list entry */
478 ENA_ADMIN_HEADER_RING = 2,
481 enum ena_admin_llq_ring_entry_size {
482 ENA_ADMIN_LIST_ENTRY_SIZE_128B = 1,
483 ENA_ADMIN_LIST_ENTRY_SIZE_192B = 2,
484 ENA_ADMIN_LIST_ENTRY_SIZE_256B = 4,
487 enum ena_admin_llq_num_descs_before_header {
488 ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_0 = 0,
489 ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_1 = 1,
490 ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_2 = 2,
491 ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_4 = 4,
492 ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_8 = 8,
495 /* packet descriptor list entry always starts with one or more descriptors,
496 * followed by a header. The rest of the descriptors are located in the
497 * beginning of the subsequent entry. Stride refers to how the rest of the
498 * descriptors are placed. This field is relevant only for inline header
499 * mode
501 enum ena_admin_llq_stride_ctrl {
502 ENA_ADMIN_SINGLE_DESC_PER_ENTRY = 1,
503 ENA_ADMIN_MULTIPLE_DESCS_PER_ENTRY = 2,
506 enum ena_admin_accel_mode_feat {
507 ENA_ADMIN_DISABLE_META_CACHING = 0,
508 ENA_ADMIN_LIMIT_TX_BURST = 1,
511 struct ena_admin_accel_mode_get {
512 /* bit field of enum ena_admin_accel_mode_feat */
513 u16 supported_flags;
515 /* maximum burst size between two doorbells. The size is in bytes */
516 u16 max_tx_burst_size;
519 struct ena_admin_accel_mode_set {
520 /* bit field of enum ena_admin_accel_mode_feat */
521 u16 enabled_flags;
523 u16 reserved;
526 struct ena_admin_accel_mode_req {
527 union {
528 u32 raw[2];
530 struct ena_admin_accel_mode_get get;
532 struct ena_admin_accel_mode_set set;
533 } u;
536 struct ena_admin_feature_llq_desc {
537 u32 max_llq_num;
539 u32 max_llq_depth;
541 /* specify the header locations the device supports. bitfield of enum
542 * ena_admin_llq_header_location.
544 u16 header_location_ctrl_supported;
546 /* the header location the driver selected to use. */
547 u16 header_location_ctrl_enabled;
549 /* if inline header is specified - this is the size of descriptor list
550 * entry. If header in a separate ring is specified - this is the size
551 * of header ring entry. bitfield of enum ena_admin_llq_ring_entry_size.
552 * specify the entry sizes the device supports
554 u16 entry_size_ctrl_supported;
556 /* the entry size the driver selected to use. */
557 u16 entry_size_ctrl_enabled;
559 /* valid only if inline header is specified. First entry associated with
560 * the packet includes descriptors and header. Rest of the entries
561 * occupied by descriptors. This parameter defines the max number of
562 * descriptors precedding the header in the first entry. The field is
563 * bitfield of enum ena_admin_llq_num_descs_before_header and specify
564 * the values the device supports
566 u16 desc_num_before_header_supported;
568 /* the desire field the driver selected to use */
569 u16 desc_num_before_header_enabled;
571 /* valid only if inline was chosen. bitfield of enum
572 * ena_admin_llq_stride_ctrl
574 u16 descriptors_stride_ctrl_supported;
576 /* the stride control the driver selected to use */
577 u16 descriptors_stride_ctrl_enabled;
579 /* reserved */
580 u32 reserved1;
582 /* accelerated low latency queues requirement. driver needs to
583 * support those requirements in order to use accelerated llq
585 struct ena_admin_accel_mode_req accel_mode;
588 struct ena_admin_queue_ext_feature_fields {
589 u32 max_tx_sq_num;
591 u32 max_tx_cq_num;
593 u32 max_rx_sq_num;
595 u32 max_rx_cq_num;
597 u32 max_tx_sq_depth;
599 u32 max_tx_cq_depth;
601 u32 max_rx_sq_depth;
603 u32 max_rx_cq_depth;
605 u32 max_tx_header_size;
607 /* Maximum Descriptors number, including meta descriptor, allowed for a
608 * single Tx packet
610 u16 max_per_packet_tx_descs;
612 /* Maximum Descriptors number allowed for a single Rx packet */
613 u16 max_per_packet_rx_descs;
616 struct ena_admin_queue_feature_desc {
617 u32 max_sq_num;
619 u32 max_sq_depth;
621 u32 max_cq_num;
623 u32 max_cq_depth;
625 u32 max_legacy_llq_num;
627 u32 max_legacy_llq_depth;
629 u32 max_header_size;
631 /* Maximum Descriptors number, including meta descriptor, allowed for a
632 * single Tx packet
634 u16 max_packet_tx_descs;
636 /* Maximum Descriptors number allowed for a single Rx packet */
637 u16 max_packet_rx_descs;
640 struct ena_admin_set_feature_mtu_desc {
641 /* exclude L2 */
642 u32 mtu;
645 struct ena_admin_set_feature_host_attr_desc {
646 /* host OS info base address in OS memory. host info is 4KB of
647 * physically contiguous
649 struct ena_common_mem_addr os_info_ba;
651 /* host debug area base address in OS memory. debug area must be
652 * physically contiguous
654 struct ena_common_mem_addr debug_ba;
656 /* debug area size */
657 u32 debug_area_size;
660 struct ena_admin_feature_intr_moder_desc {
661 /* interrupt delay granularity in usec */
662 u16 intr_delay_resolution;
664 u16 reserved;
667 struct ena_admin_get_feature_link_desc {
668 /* Link speed in Mb */
669 u32 speed;
671 /* bit field of enum ena_admin_link types */
672 u32 supported;
674 /* 0 : autoneg
675 * 1 : duplex - Full Duplex
676 * 31:2 : reserved2
678 u32 flags;
681 struct ena_admin_feature_aenq_desc {
682 /* bitmask for AENQ groups the device can report */
683 u32 supported_groups;
685 /* bitmask for AENQ groups to report */
686 u32 enabled_groups;
689 struct ena_admin_feature_offload_desc {
690 /* 0 : TX_L3_csum_ipv4
691 * 1 : TX_L4_ipv4_csum_part - The checksum field
692 * should be initialized with pseudo header checksum
693 * 2 : TX_L4_ipv4_csum_full
694 * 3 : TX_L4_ipv6_csum_part - The checksum field
695 * should be initialized with pseudo header checksum
696 * 4 : TX_L4_ipv6_csum_full
697 * 5 : tso_ipv4
698 * 6 : tso_ipv6
699 * 7 : tso_ecn
701 u32 tx;
703 /* Receive side supported stateless offload
704 * 0 : RX_L3_csum_ipv4 - IPv4 checksum
705 * 1 : RX_L4_ipv4_csum - TCP/UDP/IPv4 checksum
706 * 2 : RX_L4_ipv6_csum - TCP/UDP/IPv6 checksum
707 * 3 : RX_hash - Hash calculation
709 u32 rx_supported;
711 u32 rx_enabled;
714 enum ena_admin_hash_functions {
715 ENA_ADMIN_TOEPLITZ = 1,
716 ENA_ADMIN_CRC32 = 2,
719 struct ena_admin_feature_rss_flow_hash_control {
720 u32 key_parts;
722 u32 reserved;
724 u32 key[ENA_ADMIN_RSS_KEY_PARTS];
727 struct ena_admin_feature_rss_flow_hash_function {
728 /* 7:0 : funcs - bitmask of ena_admin_hash_functions */
729 u32 supported_func;
731 /* 7:0 : selected_func - bitmask of
732 * ena_admin_hash_functions
734 u32 selected_func;
736 /* initial value */
737 u32 init_val;
740 /* RSS flow hash protocols */
741 enum ena_admin_flow_hash_proto {
742 ENA_ADMIN_RSS_TCP4 = 0,
743 ENA_ADMIN_RSS_UDP4 = 1,
744 ENA_ADMIN_RSS_TCP6 = 2,
745 ENA_ADMIN_RSS_UDP6 = 3,
746 ENA_ADMIN_RSS_IP4 = 4,
747 ENA_ADMIN_RSS_IP6 = 5,
748 ENA_ADMIN_RSS_IP4_FRAG = 6,
749 ENA_ADMIN_RSS_NOT_IP = 7,
750 /* TCPv6 with extension header */
751 ENA_ADMIN_RSS_TCP6_EX = 8,
752 /* IPv6 with extension header */
753 ENA_ADMIN_RSS_IP6_EX = 9,
754 ENA_ADMIN_RSS_PROTO_NUM = 16,
757 /* RSS flow hash fields */
758 enum ena_admin_flow_hash_fields {
759 /* Ethernet Dest Addr */
760 ENA_ADMIN_RSS_L2_DA = BIT(0),
761 /* Ethernet Src Addr */
762 ENA_ADMIN_RSS_L2_SA = BIT(1),
763 /* ipv4/6 Dest Addr */
764 ENA_ADMIN_RSS_L3_DA = BIT(2),
765 /* ipv4/6 Src Addr */
766 ENA_ADMIN_RSS_L3_SA = BIT(3),
767 /* tcp/udp Dest Port */
768 ENA_ADMIN_RSS_L4_DP = BIT(4),
769 /* tcp/udp Src Port */
770 ENA_ADMIN_RSS_L4_SP = BIT(5),
773 struct ena_admin_proto_input {
774 /* flow hash fields (bitwise according to ena_admin_flow_hash_fields) */
775 u16 fields;
777 u16 reserved2;
780 struct ena_admin_feature_rss_hash_control {
781 struct ena_admin_proto_input supported_fields[ENA_ADMIN_RSS_PROTO_NUM];
783 struct ena_admin_proto_input selected_fields[ENA_ADMIN_RSS_PROTO_NUM];
785 struct ena_admin_proto_input reserved2[ENA_ADMIN_RSS_PROTO_NUM];
787 struct ena_admin_proto_input reserved3[ENA_ADMIN_RSS_PROTO_NUM];
790 struct ena_admin_feature_rss_flow_hash_input {
791 /* supported hash input sorting
792 * 1 : L3_sort - support swap L3 addresses if DA is
793 * smaller than SA
794 * 2 : L4_sort - support swap L4 ports if DP smaller
795 * SP
797 u16 supported_input_sort;
799 /* enabled hash input sorting
800 * 1 : enable_L3_sort - enable swap L3 addresses if
801 * DA smaller than SA
802 * 2 : enable_L4_sort - enable swap L4 ports if DP
803 * smaller than SP
805 u16 enabled_input_sort;
808 enum ena_admin_os_type {
809 ENA_ADMIN_OS_LINUX = 1,
810 ENA_ADMIN_OS_WIN = 2,
811 ENA_ADMIN_OS_DPDK = 3,
812 ENA_ADMIN_OS_FREEBSD = 4,
813 ENA_ADMIN_OS_IPXE = 5,
814 ENA_ADMIN_OS_ESXI = 6,
815 ENA_ADMIN_OS_GROUPS_NUM = 6,
818 struct ena_admin_host_info {
819 /* defined in enum ena_admin_os_type */
820 u32 os_type;
822 /* os distribution string format */
823 u8 os_dist_str[128];
825 /* OS distribution numeric format */
826 u32 os_dist;
828 /* kernel version string format */
829 u8 kernel_ver_str[32];
831 /* Kernel version numeric format */
832 u32 kernel_ver;
834 /* 7:0 : major
835 * 15:8 : minor
836 * 23:16 : sub_minor
837 * 31:24 : module_type
839 u32 driver_version;
841 /* features bitmap */
842 u32 supported_network_features[2];
844 /* ENA spec version of driver */
845 u16 ena_spec_version;
847 /* ENA device's Bus, Device and Function
848 * 2:0 : function
849 * 7:3 : device
850 * 15:8 : bus
852 u16 bdf;
854 /* Number of CPUs */
855 u16 num_cpus;
857 u16 reserved;
859 /* 0 : reserved
860 * 1 : rx_offset
861 * 2 : interrupt_moderation
862 * 3 : rx_buf_mirroring
863 * 4 : rss_configurable_function_key
864 * 31:5 : reserved
866 u32 driver_supported_features;
869 struct ena_admin_rss_ind_table_entry {
870 u16 cq_idx;
872 u16 reserved;
875 struct ena_admin_feature_rss_ind_table {
876 /* min supported table size (2^min_size) */
877 u16 min_size;
879 /* max supported table size (2^max_size) */
880 u16 max_size;
882 /* table size (2^size) */
883 u16 size;
885 u16 reserved;
887 /* index of the inline entry. 0xFFFFFFFF means invalid */
888 u32 inline_index;
890 /* used for updating single entry, ignored when setting the entire
891 * table through the control buffer.
893 struct ena_admin_rss_ind_table_entry inline_entry;
896 /* When hint value is 0, driver should use it's own predefined value */
897 struct ena_admin_ena_hw_hints {
898 /* value in ms */
899 u16 mmio_read_timeout;
901 /* value in ms */
902 u16 driver_watchdog_timeout;
904 /* Per packet tx completion timeout. value in ms */
905 u16 missing_tx_completion_timeout;
907 u16 missed_tx_completion_count_threshold_to_reset;
909 /* value in ms */
910 u16 admin_completion_tx_timeout;
912 u16 netdev_wd_timeout;
914 u16 max_tx_sgl_size;
916 u16 max_rx_sgl_size;
918 u16 reserved[8];
921 struct ena_admin_get_feat_cmd {
922 struct ena_admin_aq_common_desc aq_common_descriptor;
924 struct ena_admin_ctrl_buff_info control_buffer;
926 struct ena_admin_get_set_feature_common_desc feat_common;
928 u32 raw[11];
931 struct ena_admin_queue_ext_feature_desc {
932 /* version */
933 u8 version;
935 u8 reserved1[3];
937 union {
938 struct ena_admin_queue_ext_feature_fields max_queue_ext;
940 u32 raw[10];
944 struct ena_admin_get_feat_resp {
945 struct ena_admin_acq_common_desc acq_common_desc;
947 union {
948 u32 raw[14];
950 struct ena_admin_device_attr_feature_desc dev_attr;
952 struct ena_admin_feature_llq_desc llq;
954 struct ena_admin_queue_feature_desc max_queue;
956 struct ena_admin_queue_ext_feature_desc max_queue_ext;
958 struct ena_admin_feature_aenq_desc aenq;
960 struct ena_admin_get_feature_link_desc link;
962 struct ena_admin_feature_offload_desc offload;
964 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
966 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
968 struct ena_admin_feature_rss_ind_table ind_table;
970 struct ena_admin_feature_intr_moder_desc intr_moderation;
972 struct ena_admin_ena_hw_hints hw_hints;
973 } u;
976 struct ena_admin_set_feat_cmd {
977 struct ena_admin_aq_common_desc aq_common_descriptor;
979 struct ena_admin_ctrl_buff_info control_buffer;
981 struct ena_admin_get_set_feature_common_desc feat_common;
983 union {
984 u32 raw[11];
986 /* mtu size */
987 struct ena_admin_set_feature_mtu_desc mtu;
989 /* host attributes */
990 struct ena_admin_set_feature_host_attr_desc host_attr;
992 /* AENQ configuration */
993 struct ena_admin_feature_aenq_desc aenq;
995 /* rss flow hash function */
996 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
998 /* rss flow hash input */
999 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
1001 /* rss indirection table */
1002 struct ena_admin_feature_rss_ind_table ind_table;
1004 /* LLQ configuration */
1005 struct ena_admin_feature_llq_desc llq;
1006 } u;
1009 struct ena_admin_set_feat_resp {
1010 struct ena_admin_acq_common_desc acq_common_desc;
1012 union {
1013 u32 raw[14];
1014 } u;
1017 struct ena_admin_aenq_common_desc {
1018 u16 group;
1020 u16 syndrome;
1022 /* 0 : phase
1023 * 7:1 : reserved - MBZ
1025 u8 flags;
1027 u8 reserved1[3];
1029 u32 timestamp_low;
1031 u32 timestamp_high;
1034 /* asynchronous event notification groups */
1035 enum ena_admin_aenq_group {
1036 ENA_ADMIN_LINK_CHANGE = 0,
1037 ENA_ADMIN_FATAL_ERROR = 1,
1038 ENA_ADMIN_WARNING = 2,
1039 ENA_ADMIN_NOTIFICATION = 3,
1040 ENA_ADMIN_KEEP_ALIVE = 4,
1041 ENA_ADMIN_AENQ_GROUPS_NUM = 5,
1044 enum ena_admin_aenq_notification_syndrome {
1045 ENA_ADMIN_SUSPEND = 0,
1046 ENA_ADMIN_RESUME = 1,
1047 ENA_ADMIN_UPDATE_HINTS = 2,
1050 struct ena_admin_aenq_entry {
1051 struct ena_admin_aenq_common_desc aenq_common_desc;
1053 /* command specific inline data */
1054 u32 inline_data_w4[12];
1057 struct ena_admin_aenq_link_change_desc {
1058 struct ena_admin_aenq_common_desc aenq_common_desc;
1060 /* 0 : link_status */
1061 u32 flags;
1064 struct ena_admin_aenq_keep_alive_desc {
1065 struct ena_admin_aenq_common_desc aenq_common_desc;
1067 u32 rx_drops_low;
1069 u32 rx_drops_high;
1071 u32 tx_drops_low;
1073 u32 tx_drops_high;
1076 struct ena_admin_ena_mmio_req_read_less_resp {
1077 u16 req_id;
1079 u16 reg_off;
1081 /* value is valid when poll is cleared */
1082 u32 reg_val;
1085 /* aq_common_desc */
1086 #define ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
1087 #define ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK BIT(0)
1088 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT 1
1089 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK BIT(1)
1090 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT 2
1091 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK BIT(2)
1093 /* sq */
1094 #define ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT 5
1095 #define ENA_ADMIN_SQ_SQ_DIRECTION_MASK GENMASK(7, 5)
1097 /* acq_common_desc */
1098 #define ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
1099 #define ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK BIT(0)
1101 /* aq_create_sq_cmd */
1102 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT 5
1103 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK GENMASK(7, 5)
1104 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK GENMASK(3, 0)
1105 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT 4
1106 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK GENMASK(6, 4)
1107 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK BIT(0)
1109 /* aq_create_cq_cmd */
1110 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT 5
1111 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
1112 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
1114 /* get_set_feature_common_desc */
1115 #define ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK GENMASK(1, 0)
1117 /* get_feature_link_desc */
1118 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK BIT(0)
1119 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT 1
1120 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK BIT(1)
1122 /* feature_offload_desc */
1123 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK BIT(0)
1124 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT 1
1125 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK BIT(1)
1126 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT 2
1127 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK BIT(2)
1128 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT 3
1129 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK BIT(3)
1130 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT 4
1131 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK BIT(4)
1132 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT 5
1133 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK BIT(5)
1134 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT 6
1135 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK BIT(6)
1136 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT 7
1137 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK BIT(7)
1138 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK BIT(0)
1139 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT 1
1140 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK BIT(1)
1141 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT 2
1142 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK BIT(2)
1143 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT 3
1144 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK BIT(3)
1146 /* feature_rss_flow_hash_function */
1147 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK GENMASK(7, 0)
1148 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK GENMASK(7, 0)
1150 /* feature_rss_flow_hash_input */
1151 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT 1
1152 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK BIT(1)
1153 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT 2
1154 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK BIT(2)
1155 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT 1
1156 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK BIT(1)
1157 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT 2
1158 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK BIT(2)
1160 /* host_info */
1161 #define ENA_ADMIN_HOST_INFO_MAJOR_MASK GENMASK(7, 0)
1162 #define ENA_ADMIN_HOST_INFO_MINOR_SHIFT 8
1163 #define ENA_ADMIN_HOST_INFO_MINOR_MASK GENMASK(15, 8)
1164 #define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT 16
1165 #define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK GENMASK(23, 16)
1166 #define ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT 24
1167 #define ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK GENMASK(31, 24)
1168 #define ENA_ADMIN_HOST_INFO_FUNCTION_MASK GENMASK(2, 0)
1169 #define ENA_ADMIN_HOST_INFO_DEVICE_SHIFT 3
1170 #define ENA_ADMIN_HOST_INFO_DEVICE_MASK GENMASK(7, 3)
1171 #define ENA_ADMIN_HOST_INFO_BUS_SHIFT 8
1172 #define ENA_ADMIN_HOST_INFO_BUS_MASK GENMASK(15, 8)
1173 #define ENA_ADMIN_HOST_INFO_RX_OFFSET_SHIFT 1
1174 #define ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK BIT(1)
1175 #define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT 2
1176 #define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK BIT(2)
1177 #define ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_SHIFT 3
1178 #define ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_MASK BIT(3)
1179 #define ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_SHIFT 4
1180 #define ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_MASK BIT(4)
1182 /* aenq_common_desc */
1183 #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0)
1185 /* aenq_link_change_desc */
1186 #define ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK BIT(0)
1188 #endif /* _ENA_ADMIN_H_ */