Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / net / ethernet / amazon / ena / ena_admin_defs.h
blob4532e574ebcdc5771a79e707a6d719415735eee7
1 /*
2 * Copyright 2015 - 2016 Amazon.com, Inc. or its affiliates.
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:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
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.
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.
32 #ifndef _ENA_ADMIN_H_
33 #define _ENA_ADMIN_H_
35 enum ena_admin_aq_opcode {
36 ENA_ADMIN_CREATE_SQ = 1,
38 ENA_ADMIN_DESTROY_SQ = 2,
40 ENA_ADMIN_CREATE_CQ = 3,
42 ENA_ADMIN_DESTROY_CQ = 4,
44 ENA_ADMIN_GET_FEATURE = 8,
46 ENA_ADMIN_SET_FEATURE = 9,
48 ENA_ADMIN_GET_STATS = 11,
51 enum ena_admin_aq_completion_status {
52 ENA_ADMIN_SUCCESS = 0,
54 ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE = 1,
56 ENA_ADMIN_BAD_OPCODE = 2,
58 ENA_ADMIN_UNSUPPORTED_OPCODE = 3,
60 ENA_ADMIN_MALFORMED_REQUEST = 4,
62 /* Additional status is provided in ACQ entry extended_status */
63 ENA_ADMIN_ILLEGAL_PARAMETER = 5,
65 ENA_ADMIN_UNKNOWN_ERROR = 6,
68 enum ena_admin_aq_feature_id {
69 ENA_ADMIN_DEVICE_ATTRIBUTES = 1,
71 ENA_ADMIN_MAX_QUEUES_NUM = 2,
73 ENA_ADMIN_HW_HINTS = 3,
75 ENA_ADMIN_RSS_HASH_FUNCTION = 10,
77 ENA_ADMIN_STATELESS_OFFLOAD_CONFIG = 11,
79 ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG = 12,
81 ENA_ADMIN_MTU = 14,
83 ENA_ADMIN_RSS_HASH_INPUT = 18,
85 ENA_ADMIN_INTERRUPT_MODERATION = 20,
87 ENA_ADMIN_AENQ_CONFIG = 26,
89 ENA_ADMIN_LINK_CONFIG = 27,
91 ENA_ADMIN_HOST_ATTR_CONFIG = 28,
93 ENA_ADMIN_FEATURES_OPCODE_NUM = 32,
96 enum ena_admin_placement_policy_type {
97 /* descriptors and headers are in host memory */
98 ENA_ADMIN_PLACEMENT_POLICY_HOST = 1,
100 /* descriptors and headers are in device memory (a.k.a Low Latency
101 * Queue)
103 ENA_ADMIN_PLACEMENT_POLICY_DEV = 3,
106 enum ena_admin_link_types {
107 ENA_ADMIN_LINK_SPEED_1G = 0x1,
109 ENA_ADMIN_LINK_SPEED_2_HALF_G = 0x2,
111 ENA_ADMIN_LINK_SPEED_5G = 0x4,
113 ENA_ADMIN_LINK_SPEED_10G = 0x8,
115 ENA_ADMIN_LINK_SPEED_25G = 0x10,
117 ENA_ADMIN_LINK_SPEED_40G = 0x20,
119 ENA_ADMIN_LINK_SPEED_50G = 0x40,
121 ENA_ADMIN_LINK_SPEED_100G = 0x80,
123 ENA_ADMIN_LINK_SPEED_200G = 0x100,
125 ENA_ADMIN_LINK_SPEED_400G = 0x200,
128 enum ena_admin_completion_policy_type {
129 /* completion queue entry for each sq descriptor */
130 ENA_ADMIN_COMPLETION_POLICY_DESC = 0,
132 /* completion queue entry upon request in sq descriptor */
133 ENA_ADMIN_COMPLETION_POLICY_DESC_ON_DEMAND = 1,
135 /* current queue head pointer is updated in OS memory upon sq
136 * descriptor request
138 ENA_ADMIN_COMPLETION_POLICY_HEAD_ON_DEMAND = 2,
140 /* current queue head pointer is updated in OS memory for each sq
141 * descriptor
143 ENA_ADMIN_COMPLETION_POLICY_HEAD = 3,
146 /* basic stats return ena_admin_basic_stats while extanded stats return a
147 * buffer (string format) with additional statistics per queue and per
148 * device id
150 enum ena_admin_get_stats_type {
151 ENA_ADMIN_GET_STATS_TYPE_BASIC = 0,
153 ENA_ADMIN_GET_STATS_TYPE_EXTENDED = 1,
156 enum ena_admin_get_stats_scope {
157 ENA_ADMIN_SPECIFIC_QUEUE = 0,
159 ENA_ADMIN_ETH_TRAFFIC = 1,
162 struct ena_admin_aq_common_desc {
163 /* 11:0 : command_id
164 * 15:12 : reserved12
166 u16 command_id;
168 /* as appears in ena_admin_aq_opcode */
169 u8 opcode;
171 /* 0 : phase
172 * 1 : ctrl_data - control buffer address valid
173 * 2 : ctrl_data_indirect - control buffer address
174 * points to list of pages with addresses of control
175 * buffers
176 * 7:3 : reserved3
178 u8 flags;
181 /* used in ena_admin_aq_entry. Can point directly to control data, or to a
182 * page list chunk. Used also at the end of indirect mode page list chunks,
183 * for chaining.
185 struct ena_admin_ctrl_buff_info {
186 u32 length;
188 struct ena_common_mem_addr address;
191 struct ena_admin_sq {
192 u16 sq_idx;
194 /* 4:0 : reserved
195 * 7:5 : sq_direction - 0x1 - Tx; 0x2 - Rx
197 u8 sq_identity;
199 u8 reserved1;
202 struct ena_admin_aq_entry {
203 struct ena_admin_aq_common_desc aq_common_descriptor;
205 union {
206 u32 inline_data_w1[3];
208 struct ena_admin_ctrl_buff_info control_buffer;
209 } u;
211 u32 inline_data_w4[12];
214 struct ena_admin_acq_common_desc {
215 /* command identifier to associate it with the aq descriptor
216 * 11:0 : command_id
217 * 15:12 : reserved12
219 u16 command;
221 u8 status;
223 /* 0 : phase
224 * 7:1 : reserved1
226 u8 flags;
228 u16 extended_status;
230 /* serves as a hint what AQ entries can be revoked */
231 u16 sq_head_indx;
234 struct ena_admin_acq_entry {
235 struct ena_admin_acq_common_desc acq_common_descriptor;
237 u32 response_specific_data[14];
240 struct ena_admin_aq_create_sq_cmd {
241 struct ena_admin_aq_common_desc aq_common_descriptor;
243 /* 4:0 : reserved0_w1
244 * 7:5 : sq_direction - 0x1 - Tx, 0x2 - Rx
246 u8 sq_identity;
248 u8 reserved8_w1;
250 /* 3:0 : placement_policy - Describing where the SQ
251 * descriptor ring and the SQ packet headers reside:
252 * 0x1 - descriptors and headers are in OS memory,
253 * 0x3 - descriptors and headers in device memory
254 * (a.k.a Low Latency Queue)
255 * 6:4 : completion_policy - Describing what policy
256 * to use for generation completion entry (cqe) in
257 * the CQ associated with this SQ: 0x0 - cqe for each
258 * sq descriptor, 0x1 - cqe upon request in sq
259 * descriptor, 0x2 - current queue head pointer is
260 * updated in OS memory upon sq descriptor request
261 * 0x3 - current queue head pointer is updated in OS
262 * memory for each sq descriptor
263 * 7 : reserved15_w1
265 u8 sq_caps_2;
267 /* 0 : is_physically_contiguous - Described if the
268 * queue ring memory is allocated in physical
269 * contiguous pages or split.
270 * 7:1 : reserved17_w1
272 u8 sq_caps_3;
274 /* associated completion queue id. This CQ must be created prior to
275 * SQ creation
277 u16 cq_idx;
279 /* submission queue depth in entries */
280 u16 sq_depth;
282 /* SQ physical base address in OS memory. This field should not be
283 * used for Low Latency queues. Has to be page aligned.
285 struct ena_common_mem_addr sq_ba;
287 /* specifies queue head writeback location in OS memory. Valid if
288 * completion_policy is set to completion_policy_head_on_demand or
289 * completion_policy_head. Has to be cache aligned
291 struct ena_common_mem_addr sq_head_writeback;
293 u32 reserved0_w7;
295 u32 reserved0_w8;
298 enum ena_admin_sq_direction {
299 ENA_ADMIN_SQ_DIRECTION_TX = 1,
301 ENA_ADMIN_SQ_DIRECTION_RX = 2,
304 struct ena_admin_acq_create_sq_resp_desc {
305 struct ena_admin_acq_common_desc acq_common_desc;
307 u16 sq_idx;
309 u16 reserved;
311 /* queue doorbell address as an offset to PCIe MMIO REG BAR */
312 u32 sq_doorbell_offset;
314 /* low latency queue ring base address as an offset to PCIe MMIO
315 * LLQ_MEM BAR
317 u32 llq_descriptors_offset;
319 /* low latency queue headers' memory as an offset to PCIe MMIO
320 * LLQ_MEM BAR
322 u32 llq_headers_offset;
325 struct ena_admin_aq_destroy_sq_cmd {
326 struct ena_admin_aq_common_desc aq_common_descriptor;
328 struct ena_admin_sq sq;
331 struct ena_admin_acq_destroy_sq_resp_desc {
332 struct ena_admin_acq_common_desc acq_common_desc;
335 struct ena_admin_aq_create_cq_cmd {
336 struct ena_admin_aq_common_desc aq_common_descriptor;
338 /* 4:0 : reserved5
339 * 5 : interrupt_mode_enabled - if set, cq operates
340 * in interrupt mode, otherwise - polling
341 * 7:6 : reserved6
343 u8 cq_caps_1;
345 /* 4:0 : cq_entry_size_words - size of CQ entry in
346 * 32-bit words, valid values: 4, 8.
347 * 7:5 : reserved7
349 u8 cq_caps_2;
351 /* completion queue depth in # of entries. must be power of 2 */
352 u16 cq_depth;
354 /* msix vector assigned to this cq */
355 u32 msix_vector;
357 /* cq physical base address in OS memory. CQ must be physically
358 * contiguous
360 struct ena_common_mem_addr cq_ba;
363 struct ena_admin_acq_create_cq_resp_desc {
364 struct ena_admin_acq_common_desc acq_common_desc;
366 u16 cq_idx;
368 /* actual cq depth in number of entries */
369 u16 cq_actual_depth;
371 u32 numa_node_register_offset;
373 u32 cq_head_db_register_offset;
375 u32 cq_interrupt_unmask_register_offset;
378 struct ena_admin_aq_destroy_cq_cmd {
379 struct ena_admin_aq_common_desc aq_common_descriptor;
381 u16 cq_idx;
383 u16 reserved1;
386 struct ena_admin_acq_destroy_cq_resp_desc {
387 struct ena_admin_acq_common_desc acq_common_desc;
390 /* ENA AQ Get Statistics command. Extended statistics are placed in control
391 * buffer pointed by AQ entry
393 struct ena_admin_aq_get_stats_cmd {
394 struct ena_admin_aq_common_desc aq_common_descriptor;
396 union {
397 /* command specific inline data */
398 u32 inline_data_w1[3];
400 struct ena_admin_ctrl_buff_info control_buffer;
401 } u;
403 /* stats type as defined in enum ena_admin_get_stats_type */
404 u8 type;
406 /* stats scope defined in enum ena_admin_get_stats_scope */
407 u8 scope;
409 u16 reserved3;
411 /* queue id. used when scope is specific_queue */
412 u16 queue_idx;
414 /* device id, value 0xFFFF means mine. only privileged device can get
415 * stats of other device
417 u16 device_id;
420 /* Basic Statistics Command. */
421 struct ena_admin_basic_stats {
422 u32 tx_bytes_low;
424 u32 tx_bytes_high;
426 u32 tx_pkts_low;
428 u32 tx_pkts_high;
430 u32 rx_bytes_low;
432 u32 rx_bytes_high;
434 u32 rx_pkts_low;
436 u32 rx_pkts_high;
438 u32 rx_drops_low;
440 u32 rx_drops_high;
443 struct ena_admin_acq_get_stats_resp {
444 struct ena_admin_acq_common_desc acq_common_desc;
446 struct ena_admin_basic_stats basic_stats;
449 struct ena_admin_get_set_feature_common_desc {
450 /* 1:0 : select - 0x1 - current value; 0x3 - default
451 * value
452 * 7:3 : reserved3
454 u8 flags;
456 /* as appears in ena_admin_aq_feature_id */
457 u8 feature_id;
459 u16 reserved16;
462 struct ena_admin_device_attr_feature_desc {
463 u32 impl_id;
465 u32 device_version;
467 /* bitmap of ena_admin_aq_feature_id */
468 u32 supported_features;
470 u32 reserved3;
472 /* Indicates how many bits are used physical address access. */
473 u32 phys_addr_width;
475 /* Indicates how many bits are used virtual address access. */
476 u32 virt_addr_width;
478 /* unicast MAC address (in Network byte order) */
479 u8 mac_addr[6];
481 u8 reserved7[2];
483 u32 max_mtu;
486 struct ena_admin_queue_feature_desc {
487 /* including LLQs */
488 u32 max_sq_num;
490 u32 max_sq_depth;
492 u32 max_cq_num;
494 u32 max_cq_depth;
496 u32 max_llq_num;
498 u32 max_llq_depth;
500 u32 max_header_size;
502 /* Maximum Descriptors number, including meta descriptor, allowed for
503 * a single Tx packet
505 u16 max_packet_tx_descs;
507 /* Maximum Descriptors number allowed for a single Rx packet */
508 u16 max_packet_rx_descs;
511 struct ena_admin_set_feature_mtu_desc {
512 /* exclude L2 */
513 u32 mtu;
516 struct ena_admin_set_feature_host_attr_desc {
517 /* host OS info base address in OS memory. host info is 4KB of
518 * physically contiguous
520 struct ena_common_mem_addr os_info_ba;
522 /* host debug area base address in OS memory. debug area must be
523 * physically contiguous
525 struct ena_common_mem_addr debug_ba;
527 /* debug area size */
528 u32 debug_area_size;
531 struct ena_admin_feature_intr_moder_desc {
532 /* interrupt delay granularity in usec */
533 u16 intr_delay_resolution;
535 u16 reserved;
538 struct ena_admin_get_feature_link_desc {
539 /* Link speed in Mb */
540 u32 speed;
542 /* bit field of enum ena_admin_link types */
543 u32 supported;
545 /* 0 : autoneg
546 * 1 : duplex - Full Duplex
547 * 31:2 : reserved2
549 u32 flags;
552 struct ena_admin_feature_aenq_desc {
553 /* bitmask for AENQ groups the device can report */
554 u32 supported_groups;
556 /* bitmask for AENQ groups to report */
557 u32 enabled_groups;
560 struct ena_admin_feature_offload_desc {
561 /* 0 : TX_L3_csum_ipv4
562 * 1 : TX_L4_ipv4_csum_part - The checksum field
563 * should be initialized with pseudo header checksum
564 * 2 : TX_L4_ipv4_csum_full
565 * 3 : TX_L4_ipv6_csum_part - The checksum field
566 * should be initialized with pseudo header checksum
567 * 4 : TX_L4_ipv6_csum_full
568 * 5 : tso_ipv4
569 * 6 : tso_ipv6
570 * 7 : tso_ecn
572 u32 tx;
574 /* Receive side supported stateless offload
575 * 0 : RX_L3_csum_ipv4 - IPv4 checksum
576 * 1 : RX_L4_ipv4_csum - TCP/UDP/IPv4 checksum
577 * 2 : RX_L4_ipv6_csum - TCP/UDP/IPv6 checksum
578 * 3 : RX_hash - Hash calculation
580 u32 rx_supported;
582 u32 rx_enabled;
585 enum ena_admin_hash_functions {
586 ENA_ADMIN_TOEPLITZ = 1,
588 ENA_ADMIN_CRC32 = 2,
591 struct ena_admin_feature_rss_flow_hash_control {
592 u32 keys_num;
594 u32 reserved;
596 u32 key[10];
599 struct ena_admin_feature_rss_flow_hash_function {
600 /* 7:0 : funcs - bitmask of ena_admin_hash_functions */
601 u32 supported_func;
603 /* 7:0 : selected_func - bitmask of
604 * ena_admin_hash_functions
606 u32 selected_func;
608 /* initial value */
609 u32 init_val;
612 /* RSS flow hash protocols */
613 enum ena_admin_flow_hash_proto {
614 ENA_ADMIN_RSS_TCP4 = 0,
616 ENA_ADMIN_RSS_UDP4 = 1,
618 ENA_ADMIN_RSS_TCP6 = 2,
620 ENA_ADMIN_RSS_UDP6 = 3,
622 ENA_ADMIN_RSS_IP4 = 4,
624 ENA_ADMIN_RSS_IP6 = 5,
626 ENA_ADMIN_RSS_IP4_FRAG = 6,
628 ENA_ADMIN_RSS_NOT_IP = 7,
630 /* TCPv6 with extension header */
631 ENA_ADMIN_RSS_TCP6_EX = 8,
633 /* IPv6 with extension header */
634 ENA_ADMIN_RSS_IP6_EX = 9,
636 ENA_ADMIN_RSS_PROTO_NUM = 16,
639 /* RSS flow hash fields */
640 enum ena_admin_flow_hash_fields {
641 /* Ethernet Dest Addr */
642 ENA_ADMIN_RSS_L2_DA = BIT(0),
644 /* Ethernet Src Addr */
645 ENA_ADMIN_RSS_L2_SA = BIT(1),
647 /* ipv4/6 Dest Addr */
648 ENA_ADMIN_RSS_L3_DA = BIT(2),
650 /* ipv4/6 Src Addr */
651 ENA_ADMIN_RSS_L3_SA = BIT(3),
653 /* tcp/udp Dest Port */
654 ENA_ADMIN_RSS_L4_DP = BIT(4),
656 /* tcp/udp Src Port */
657 ENA_ADMIN_RSS_L4_SP = BIT(5),
660 struct ena_admin_proto_input {
661 /* flow hash fields (bitwise according to ena_admin_flow_hash_fields) */
662 u16 fields;
664 u16 reserved2;
667 struct ena_admin_feature_rss_hash_control {
668 struct ena_admin_proto_input supported_fields[ENA_ADMIN_RSS_PROTO_NUM];
670 struct ena_admin_proto_input selected_fields[ENA_ADMIN_RSS_PROTO_NUM];
672 struct ena_admin_proto_input reserved2[ENA_ADMIN_RSS_PROTO_NUM];
674 struct ena_admin_proto_input reserved3[ENA_ADMIN_RSS_PROTO_NUM];
677 struct ena_admin_feature_rss_flow_hash_input {
678 /* supported hash input sorting
679 * 1 : L3_sort - support swap L3 addresses if DA is
680 * smaller than SA
681 * 2 : L4_sort - support swap L4 ports if DP smaller
682 * SP
684 u16 supported_input_sort;
686 /* enabled hash input sorting
687 * 1 : enable_L3_sort - enable swap L3 addresses if
688 * DA smaller than SA
689 * 2 : enable_L4_sort - enable swap L4 ports if DP
690 * smaller than SP
692 u16 enabled_input_sort;
695 enum ena_admin_os_type {
696 ENA_ADMIN_OS_LINUX = 1,
698 ENA_ADMIN_OS_WIN = 2,
700 ENA_ADMIN_OS_DPDK = 3,
702 ENA_ADMIN_OS_FREEBSD = 4,
704 ENA_ADMIN_OS_IPXE = 5,
707 struct ena_admin_host_info {
708 /* defined in enum ena_admin_os_type */
709 u32 os_type;
711 /* os distribution string format */
712 u8 os_dist_str[128];
714 /* OS distribution numeric format */
715 u32 os_dist;
717 /* kernel version string format */
718 u8 kernel_ver_str[32];
720 /* Kernel version numeric format */
721 u32 kernel_ver;
723 /* 7:0 : major
724 * 15:8 : minor
725 * 23:16 : sub_minor
727 u32 driver_version;
729 /* features bitmap */
730 u32 supported_network_features[4];
733 struct ena_admin_rss_ind_table_entry {
734 u16 cq_idx;
736 u16 reserved;
739 struct ena_admin_feature_rss_ind_table {
740 /* min supported table size (2^min_size) */
741 u16 min_size;
743 /* max supported table size (2^max_size) */
744 u16 max_size;
746 /* table size (2^size) */
747 u16 size;
749 u16 reserved;
751 /* index of the inline entry. 0xFFFFFFFF means invalid */
752 u32 inline_index;
754 /* used for updating single entry, ignored when setting the entire
755 * table through the control buffer.
757 struct ena_admin_rss_ind_table_entry inline_entry;
760 /* When hint value is 0, driver should use it's own predefined value */
761 struct ena_admin_ena_hw_hints {
762 /* value in ms */
763 u16 mmio_read_timeout;
765 /* value in ms */
766 u16 driver_watchdog_timeout;
768 /* Per packet tx completion timeout. value in ms */
769 u16 missing_tx_completion_timeout;
771 u16 missed_tx_completion_count_threshold_to_reset;
773 /* value in ms */
774 u16 admin_completion_tx_timeout;
776 u16 netdev_wd_timeout;
778 u16 max_tx_sgl_size;
780 u16 max_rx_sgl_size;
782 u16 reserved[8];
785 struct ena_admin_get_feat_cmd {
786 struct ena_admin_aq_common_desc aq_common_descriptor;
788 struct ena_admin_ctrl_buff_info control_buffer;
790 struct ena_admin_get_set_feature_common_desc feat_common;
792 u32 raw[11];
795 struct ena_admin_get_feat_resp {
796 struct ena_admin_acq_common_desc acq_common_desc;
798 union {
799 u32 raw[14];
801 struct ena_admin_device_attr_feature_desc dev_attr;
803 struct ena_admin_queue_feature_desc max_queue;
805 struct ena_admin_feature_aenq_desc aenq;
807 struct ena_admin_get_feature_link_desc link;
809 struct ena_admin_feature_offload_desc offload;
811 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
813 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
815 struct ena_admin_feature_rss_ind_table ind_table;
817 struct ena_admin_feature_intr_moder_desc intr_moderation;
819 struct ena_admin_ena_hw_hints hw_hints;
820 } u;
823 struct ena_admin_set_feat_cmd {
824 struct ena_admin_aq_common_desc aq_common_descriptor;
826 struct ena_admin_ctrl_buff_info control_buffer;
828 struct ena_admin_get_set_feature_common_desc feat_common;
830 union {
831 u32 raw[11];
833 /* mtu size */
834 struct ena_admin_set_feature_mtu_desc mtu;
836 /* host attributes */
837 struct ena_admin_set_feature_host_attr_desc host_attr;
839 /* AENQ configuration */
840 struct ena_admin_feature_aenq_desc aenq;
842 /* rss flow hash function */
843 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
845 /* rss flow hash input */
846 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
848 /* rss indirection table */
849 struct ena_admin_feature_rss_ind_table ind_table;
850 } u;
853 struct ena_admin_set_feat_resp {
854 struct ena_admin_acq_common_desc acq_common_desc;
856 union {
857 u32 raw[14];
858 } u;
861 struct ena_admin_aenq_common_desc {
862 u16 group;
864 u16 syndrom;
866 /* 0 : phase */
867 u8 flags;
869 u8 reserved1[3];
871 u32 timestamp_low;
873 u32 timestamp_high;
876 /* asynchronous event notification groups */
877 enum ena_admin_aenq_group {
878 ENA_ADMIN_LINK_CHANGE = 0,
880 ENA_ADMIN_FATAL_ERROR = 1,
882 ENA_ADMIN_WARNING = 2,
884 ENA_ADMIN_NOTIFICATION = 3,
886 ENA_ADMIN_KEEP_ALIVE = 4,
888 ENA_ADMIN_AENQ_GROUPS_NUM = 5,
891 enum ena_admin_aenq_notification_syndrom {
892 ENA_ADMIN_SUSPEND = 0,
894 ENA_ADMIN_RESUME = 1,
896 ENA_ADMIN_UPDATE_HINTS = 2,
899 struct ena_admin_aenq_entry {
900 struct ena_admin_aenq_common_desc aenq_common_desc;
902 /* command specific inline data */
903 u32 inline_data_w4[12];
906 struct ena_admin_aenq_link_change_desc {
907 struct ena_admin_aenq_common_desc aenq_common_desc;
909 /* 0 : link_status */
910 u32 flags;
913 struct ena_admin_aenq_keep_alive_desc {
914 struct ena_admin_aenq_common_desc aenq_common_desc;
916 u32 rx_drops_low;
918 u32 rx_drops_high;
921 struct ena_admin_ena_mmio_req_read_less_resp {
922 u16 req_id;
924 u16 reg_off;
926 /* value is valid when poll is cleared */
927 u32 reg_val;
930 /* aq_common_desc */
931 #define ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
932 #define ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK BIT(0)
933 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT 1
934 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK BIT(1)
935 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT 2
936 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK BIT(2)
938 /* sq */
939 #define ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT 5
940 #define ENA_ADMIN_SQ_SQ_DIRECTION_MASK GENMASK(7, 5)
942 /* acq_common_desc */
943 #define ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
944 #define ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK BIT(0)
946 /* aq_create_sq_cmd */
947 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT 5
948 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK GENMASK(7, 5)
949 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK GENMASK(3, 0)
950 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT 4
951 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK GENMASK(6, 4)
952 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK BIT(0)
954 /* aq_create_cq_cmd */
955 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT 5
956 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
957 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
959 /* get_set_feature_common_desc */
960 #define ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK GENMASK(1, 0)
962 /* get_feature_link_desc */
963 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK BIT(0)
964 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT 1
965 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK BIT(1)
967 /* feature_offload_desc */
968 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK BIT(0)
969 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT 1
970 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK BIT(1)
971 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT 2
972 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK BIT(2)
973 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT 3
974 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK BIT(3)
975 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT 4
976 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK BIT(4)
977 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT 5
978 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK BIT(5)
979 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT 6
980 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK BIT(6)
981 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT 7
982 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK BIT(7)
983 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK BIT(0)
984 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT 1
985 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK BIT(1)
986 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT 2
987 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK BIT(2)
988 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT 3
989 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK BIT(3)
991 /* feature_rss_flow_hash_function */
992 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK GENMASK(7, 0)
993 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK GENMASK(7, 0)
995 /* feature_rss_flow_hash_input */
996 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT 1
997 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK BIT(1)
998 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT 2
999 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK BIT(2)
1000 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT 1
1001 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK BIT(1)
1002 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT 2
1003 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK BIT(2)
1005 /* host_info */
1006 #define ENA_ADMIN_HOST_INFO_MAJOR_MASK GENMASK(7, 0)
1007 #define ENA_ADMIN_HOST_INFO_MINOR_SHIFT 8
1008 #define ENA_ADMIN_HOST_INFO_MINOR_MASK GENMASK(15, 8)
1009 #define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT 16
1010 #define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK GENMASK(23, 16)
1012 /* aenq_common_desc */
1013 #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0)
1015 /* aenq_link_change_desc */
1016 #define ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK BIT(0)
1018 #endif /*_ENA_ADMIN_H_ */