4 * Copyright (c) 2015-2016 Amazon.com, Inc. or its affiliates.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 /* admin commands opcodes */
38 enum ena_admin_aq_opcode {
39 /* create submission queue */
40 ENA_ADMIN_CREATE_SQ = 1,
42 /* destroy submission queue */
43 ENA_ADMIN_DESTROY_SQ = 2,
45 /* create completion queue */
46 ENA_ADMIN_CREATE_CQ = 3,
48 /* destroy completion queue */
49 ENA_ADMIN_DESTROY_CQ = 4,
51 /* get capabilities of particular feature */
52 ENA_ADMIN_GET_FEATURE = 8,
54 /* get capabilities of particular feature */
55 ENA_ADMIN_SET_FEATURE = 9,
58 ENA_ADMIN_GET_STATS = 11,
61 /* admin command completion status codes */
62 enum ena_admin_aq_completion_status {
63 /* Request completed successfully */
64 ENA_ADMIN_SUCCESS = 0,
66 /* no resources to satisfy request */
67 ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE = 1,
69 /* Bad opcode in request descriptor */
70 ENA_ADMIN_BAD_OPCODE = 2,
72 /* Unsupported opcode in request descriptor */
73 ENA_ADMIN_UNSUPPORTED_OPCODE = 3,
75 /* Wrong request format */
76 ENA_ADMIN_MALFORMED_REQUEST = 4,
78 /* One of parameters is not valid. Provided in ACQ entry
81 ENA_ADMIN_ILLEGAL_PARAMETER = 5,
83 /* unexpected error */
84 ENA_ADMIN_UNKNOWN_ERROR = 6,
87 /* get/set feature subcommands opcodes */
88 enum ena_admin_aq_feature_id {
89 /* list of all supported attributes/capabilities in the ENA */
90 ENA_ADMIN_DEVICE_ATTRIBUTES = 1,
92 /* max number of supported queues per for every queues type */
93 ENA_ADMIN_MAX_QUEUES_NUM = 2,
95 /* Receive Side Scaling (RSS) function */
96 ENA_ADMIN_RSS_HASH_FUNCTION = 10,
98 /* stateless TCP/UDP/IP offload capabilities. */
99 ENA_ADMIN_STATELESS_OFFLOAD_CONFIG = 11,
101 /* Multiple tuples flow table configuration */
102 ENA_ADMIN_RSS_REDIRECTION_TABLE_CONFIG = 12,
104 /* max MTU, current MTU */
107 /* Receive Side Scaling (RSS) hash input */
108 ENA_ADMIN_RSS_HASH_INPUT = 18,
110 /* interrupt moderation parameters */
111 ENA_ADMIN_INTERRUPT_MODERATION = 20,
113 /* AENQ configuration */
114 ENA_ADMIN_AENQ_CONFIG = 26,
116 /* Link configuration */
117 ENA_ADMIN_LINK_CONFIG = 27,
119 /* Host attributes configuration */
120 ENA_ADMIN_HOST_ATTR_CONFIG = 28,
122 /* Number of valid opcodes */
123 ENA_ADMIN_FEATURES_OPCODE_NUM = 32,
126 /* descriptors and headers placement */
127 enum ena_admin_placement_policy_type {
128 /* descriptors and headers are in OS memory */
129 ENA_ADMIN_PLACEMENT_POLICY_HOST = 1,
131 /* descriptors and headers in device memory (a.k.a Low Latency
134 ENA_ADMIN_PLACEMENT_POLICY_DEV = 3,
138 enum ena_admin_link_types {
139 ENA_ADMIN_LINK_SPEED_1G = 0x1,
141 ENA_ADMIN_LINK_SPEED_2_HALF_G = 0x2,
143 ENA_ADMIN_LINK_SPEED_5G = 0x4,
145 ENA_ADMIN_LINK_SPEED_10G = 0x8,
147 ENA_ADMIN_LINK_SPEED_25G = 0x10,
149 ENA_ADMIN_LINK_SPEED_40G = 0x20,
151 ENA_ADMIN_LINK_SPEED_50G = 0x40,
153 ENA_ADMIN_LINK_SPEED_100G = 0x80,
155 ENA_ADMIN_LINK_SPEED_200G = 0x100,
157 ENA_ADMIN_LINK_SPEED_400G = 0x200,
160 /* completion queue update policy */
161 enum ena_admin_completion_policy_type {
162 /* cqe for each sq descriptor */
163 ENA_ADMIN_COMPLETION_POLICY_DESC = 0,
165 /* cqe upon request in sq descriptor */
166 ENA_ADMIN_COMPLETION_POLICY_DESC_ON_DEMAND = 1,
168 /* current queue head pointer is updated in OS memory upon sq
171 ENA_ADMIN_COMPLETION_POLICY_HEAD_ON_DEMAND = 2,
173 /* current queue head pointer is updated in OS memory for each sq
176 ENA_ADMIN_COMPLETION_POLICY_HEAD = 3,
179 /* type of get statistics command */
180 enum ena_admin_get_stats_type {
181 /* Basic statistics */
182 ENA_ADMIN_GET_STATS_TYPE_BASIC = 0,
184 /* Extended statistics */
185 ENA_ADMIN_GET_STATS_TYPE_EXTENDED = 1,
188 /* scope of get statistics command */
189 enum ena_admin_get_stats_scope {
190 ENA_ADMIN_SPECIFIC_QUEUE = 0,
192 ENA_ADMIN_ETH_TRAFFIC = 1,
195 /* ENA Admin Queue (AQ) common descriptor */
196 struct ena_admin_aq_common_desc {
198 /* command identificator to associate it with the completion
204 /* as appears in ena_aq_opcode */
208 * 1 : ctrl_data - control buffer address valid
209 * 2 : ctrl_data_indirect - control buffer address
210 * points to list of pages with addresses of control
217 /* used in ena_aq_entry. Can point directly to control data, or to a page
218 * list chunk. Used also at the end of indirect mode page list chunks, for
221 struct ena_admin_ctrl_buff_info {
222 /* word 0 : indicates length of the buffer pointed by
223 * control_buffer_address.
227 /* words 1:2 : points to control buffer (direct or indirect) */
228 struct ena_common_mem_addr address;
231 /* submission queue full identification */
232 struct ena_admin_sq {
238 * 7:5 : sq_direction - 0x1 - Tx; 0x2 - Rx
245 /* AQ entry format */
246 struct ena_admin_aq_entry {
248 struct ena_admin_aq_common_desc aq_common_descriptor;
252 /* command specific inline data */
253 uint32_t inline_data_w1[3];
255 /* words 1:3 : points to control buffer (direct or
256 * indirect, chained if needed)
258 struct ena_admin_ctrl_buff_info control_buffer;
261 /* command specific inline data */
262 uint32_t inline_data_w4[12];
265 /* ENA Admin Completion Queue (ACQ) common descriptor */
266 struct ena_admin_acq_common_desc {
268 /* command identifier to associate it with the aq descriptor
274 /* status of request execution */
283 /* provides additional info */
284 uint16_t extended_status;
286 /* submission queue head index, serves as a hint what AQ entries can
289 uint16_t sq_head_indx;
292 /* ACQ entry format */
293 struct ena_admin_acq_entry {
295 struct ena_admin_acq_common_desc acq_common_descriptor;
297 /* response type specific data */
298 uint32_t response_specific_data[14];
301 /* ENA AQ Create Submission Queue command. Placed in control buffer pointed
304 struct ena_admin_aq_create_sq_cmd {
306 struct ena_admin_aq_common_desc aq_common_descriptor;
309 /* 4:0 : reserved0_w1
310 * 7:5 : sq_direction - 0x1 - Tx, 0x2 - Rx
314 uint8_t reserved8_w1;
316 /* 3:0 : placement_policy - Describing where the SQ
317 * descriptor ring and the SQ packet headers reside:
318 * 0x1 - descriptors and headers are in OS memory,
319 * 0x3 - descriptors and headers in device memory
320 * (a.k.a Low Latency Queue)
321 * 6:4 : completion_policy - Describing what policy
322 * to use for generation completion entry (cqe) in
323 * the CQ associated with this SQ: 0x0 - cqe for each
324 * sq descriptor, 0x1 - cqe upon request in sq
325 * descriptor, 0x2 - current queue head pointer is
326 * updated in OS memory upon sq descriptor request
327 * 0x3 - current queue head pointer is updated in OS
328 * memory for each sq descriptor
333 /* 0 : is_physically_contiguous - Described if the
334 * queue ring memory is allocated in physical
335 * contiguous pages or split.
336 * 7:1 : reserved17_w1
341 /* associated completion queue id. This CQ must be created prior to
346 /* submission queue depth in entries */
349 /* words 3:4 : SQ physical base address in OS memory. This field
350 * should not be used for Low Latency queues. Has to be page
353 struct ena_common_mem_addr sq_ba;
355 /* words 5:6 : specifies queue head writeback location in OS
356 * memory. Valid if completion_policy is set to
357 * completion_policy_head_on_demand or completion_policy_head. Has
358 * to be cache aligned
360 struct ena_common_mem_addr sq_head_writeback;
362 /* word 7 : reserved word */
363 uint32_t reserved0_w7;
365 /* word 8 : reserved word */
366 uint32_t reserved0_w8;
369 /* submission queue direction */
370 enum ena_admin_sq_direction {
371 ENA_ADMIN_SQ_DIRECTION_TX = 1,
373 ENA_ADMIN_SQ_DIRECTION_RX = 2,
376 /* ENA Response for Create SQ Command. Appears in ACQ entry as
377 * response_specific_data
379 struct ena_admin_acq_create_sq_resp_desc {
380 /* words 0:1 : Common Admin Queue completion descriptor */
381 struct ena_admin_acq_common_desc acq_common_desc;
389 /* word 3 : queue doorbell address as an offset to PCIe MMIO REG BAR */
390 uint32_t sq_doorbell_offset;
392 /* word 4 : low latency queue ring base address as an offset to
393 * PCIe MMIO LLQ_MEM BAR
395 uint32_t llq_descriptors_offset;
397 /* word 5 : low latency queue headers' memory as an offset to PCIe
400 uint32_t llq_headers_offset;
403 /* ENA AQ Destroy Submission Queue command. Placed in control buffer
404 * pointed by AQ entry
406 struct ena_admin_aq_destroy_sq_cmd {
408 struct ena_admin_aq_common_desc aq_common_descriptor;
411 struct ena_admin_sq sq;
414 /* ENA Response for Destroy SQ Command. Appears in ACQ entry as
415 * response_specific_data
417 struct ena_admin_acq_destroy_sq_resp_desc {
418 /* words 0:1 : Common Admin Queue completion descriptor */
419 struct ena_admin_acq_common_desc acq_common_desc;
422 /* ENA AQ Create Completion Queue command */
423 struct ena_admin_aq_create_cq_cmd {
425 struct ena_admin_aq_common_desc aq_common_descriptor;
429 * 5 : interrupt_mode_enabled - if set, cq operates
430 * in interrupt mode, otherwise - polling
435 /* 4:0 : cq_entry_size_words - size of CQ entry in
436 * 32-bit words, valid values: 4, 8.
441 /* completion queue depth in # of entries. must be power of 2 */
444 /* word 2 : msix vector assigned to this cq */
445 uint32_t msix_vector;
447 /* words 3:4 : cq physical base address in OS memory. CQ must be
448 * physically contiguous
450 struct ena_common_mem_addr cq_ba;
453 /* ENA Response for Create CQ Command. Appears in ACQ entry as response
456 struct ena_admin_acq_create_cq_resp_desc {
457 /* words 0:1 : Common Admin Queue completion descriptor */
458 struct ena_admin_acq_common_desc acq_common_desc;
464 /* actual cq depth in # of entries */
465 uint16_t cq_actual_depth;
467 /* word 3 : cpu numa node address as an offset to PCIe MMIO REG BAR */
468 uint32_t numa_node_register_offset;
470 /* word 4 : completion head doorbell address as an offset to PCIe
473 uint32_t cq_head_db_register_offset;
475 /* word 5 : interrupt unmask register address as an offset into
478 uint32_t cq_interrupt_unmask_register_offset;
481 /* ENA AQ Destroy Completion Queue command. Placed in control buffer
482 * pointed by AQ entry
484 struct ena_admin_aq_destroy_cq_cmd {
486 struct ena_admin_aq_common_desc aq_common_descriptor;
489 /* associated queue id. */
495 /* ENA Response for Destroy CQ Command. Appears in ACQ entry as
496 * response_specific_data
498 struct ena_admin_acq_destroy_cq_resp_desc {
499 /* words 0:1 : Common Admin Queue completion descriptor */
500 struct ena_admin_acq_common_desc acq_common_desc;
503 /* ENA AQ Get Statistics command. Extended statistics are placed in control
504 * buffer pointed by AQ entry
506 struct ena_admin_aq_get_stats_cmd {
508 struct ena_admin_aq_common_desc aq_common_descriptor;
512 /* command specific inline data */
513 uint32_t inline_data_w1[3];
515 /* words 1:3 : points to control buffer (direct or
516 * indirect, chained if needed)
518 struct ena_admin_ctrl_buff_info control_buffer;
522 /* stats type as defined in enum ena_admin_get_stats_type */
525 /* stats scope defined in enum ena_admin_get_stats_scope */
531 /* queue id. used when scope is specific_queue */
534 /* device id, value 0xFFFF means mine. only privileged device can get
535 * stats of other device
540 /* Basic Statistics Command. */
541 struct ena_admin_basic_stats {
543 uint32_t tx_bytes_low;
546 uint32_t tx_bytes_high;
549 uint32_t tx_pkts_low;
552 uint32_t tx_pkts_high;
555 uint32_t rx_bytes_low;
558 uint32_t rx_bytes_high;
561 uint32_t rx_pkts_low;
564 uint32_t rx_pkts_high;
567 uint32_t rx_drops_low;
570 uint32_t rx_drops_high;
573 /* ENA Response for Get Statistics Command. Appears in ACQ entry as
574 * response_specific_data
576 struct ena_admin_acq_get_stats_resp {
577 /* words 0:1 : Common Admin Queue completion descriptor */
578 struct ena_admin_acq_common_desc acq_common_desc;
581 struct ena_admin_basic_stats basic_stats;
584 /* ENA Get/Set Feature common descriptor. Appears as inline word in
587 struct ena_admin_get_set_feature_common_desc {
589 /* 1:0 : select - 0x1 - current value; 0x3 - default
595 /* as appears in ena_feature_id */
602 /* ENA Device Attributes Feature descriptor. */
603 struct ena_admin_device_attr_feature_desc {
604 /* word 0 : implementation id */
607 /* word 1 : device version */
608 uint32_t device_version;
610 /* word 2 : bit map of which bits are supported value of 1
611 * indicated that this feature is supported and can perform SET/GET
614 uint32_t supported_features;
619 /* word 4 : Indicates how many bits are used physical address
622 uint32_t phys_addr_width;
624 /* word 5 : Indicates how many bits are used virtual address access. */
625 uint32_t virt_addr_width;
627 /* unicast MAC address (in Network byte order) */
630 uint8_t reserved7[2];
632 /* word 8 : Max supported MTU value */
636 /* ENA Max Queues Feature descriptor. */
637 struct ena_admin_queue_feature_desc {
638 /* word 0 : Max number of submission queues (including LLQs) */
641 /* word 1 : Max submission queue depth */
642 uint32_t max_sq_depth;
644 /* word 2 : Max number of completion queues */
647 /* word 3 : Max completion queue depth */
648 uint32_t max_cq_depth;
650 /* word 4 : Max number of LLQ submission queues */
651 uint32_t max_llq_num;
653 /* word 5 : Max submission queue depth of LLQ */
654 uint32_t max_llq_depth;
656 /* word 6 : Max header size */
657 uint32_t max_header_size;
660 /* Maximum Descriptors number, including meta descriptors, allowed
661 * for a single Tx packet
663 uint16_t max_packet_tx_descs;
665 /* Maximum Descriptors number allowed for a single Rx packet */
666 uint16_t max_packet_rx_descs;
669 /* ENA MTU Set Feature descriptor. */
670 struct ena_admin_set_feature_mtu_desc {
671 /* word 0 : mtu payload size (exclude L2) */
675 /* ENA host attributes Set Feature descriptor. */
676 struct ena_admin_set_feature_host_attr_desc {
677 /* words 0:1 : host OS info base address in OS memory. host info is
678 * 4KB of physically contiguous
680 struct ena_common_mem_addr os_info_ba;
682 /* words 2:3 : host debug area base address in OS memory. debug
683 * area must be physically contiguous
685 struct ena_common_mem_addr debug_ba;
687 /* word 4 : debug area size */
688 uint32_t debug_area_size;
691 /* ENA Interrupt Moderation Get Feature descriptor. */
692 struct ena_admin_feature_intr_moder_desc {
694 /* interrupt delay granularity in usec */
695 uint16_t intr_delay_resolution;
700 /* ENA Link Get Feature descriptor. */
701 struct ena_admin_get_feature_link_desc {
702 /* word 0 : Link speed in Mb */
705 /* word 1 : supported speeds (bit field of enum ena_admin_link
711 /* 0 : autoneg - auto negotiation
712 * 1 : duplex - Full Duplex
718 /* ENA AENQ Feature descriptor. */
719 struct ena_admin_feature_aenq_desc {
720 /* word 0 : bitmask for AENQ groups the device can report */
721 uint32_t supported_groups;
723 /* word 1 : bitmask for AENQ groups to report */
724 uint32_t enabled_groups;
727 /* ENA Stateless Offload Feature descriptor. */
728 struct ena_admin_feature_offload_desc {
730 /* Trasmit side stateless offload
731 * 0 : TX_L3_csum_ipv4 - IPv4 checksum
732 * 1 : TX_L4_ipv4_csum_part - TCP/UDP over IPv4
733 * checksum, the checksum field should be initialized
734 * with pseudo header checksum
735 * 2 : TX_L4_ipv4_csum_full - TCP/UDP over IPv4
737 * 3 : TX_L4_ipv6_csum_part - TCP/UDP over IPv6
738 * checksum, the checksum field should be initialized
739 * with pseudo header checksum
740 * 4 : TX_L4_ipv6_csum_full - TCP/UDP over IPv6
742 * 5 : tso_ipv4 - TCP/IPv4 Segmentation Offloading
743 * 6 : tso_ipv6 - TCP/IPv6 Segmentation Offloading
744 * 7 : tso_ecn - TCP Segmentation with ECN
749 /* Receive side supported stateless offload
750 * 0 : RX_L3_csum_ipv4 - IPv4 checksum
751 * 1 : RX_L4_ipv4_csum - TCP/UDP/IPv4 checksum
752 * 2 : RX_L4_ipv6_csum - TCP/UDP/IPv6 checksum
753 * 3 : RX_hash - Hash calculation
755 uint32_t rx_supported;
758 /* Receive side enabled stateless offload */
763 enum ena_admin_hash_functions {
765 ENA_ADMIN_TOEPLITZ = 1,
771 /* ENA RSS flow hash control buffer structure */
772 struct ena_admin_feature_rss_flow_hash_control {
773 /* word 0 : number of valid keys */
783 /* ENA RSS Flow Hash Function */
784 struct ena_admin_feature_rss_flow_hash_function {
786 /* supported hash functions
787 * 7:0 : funcs - supported hash functions (bitmask
788 * accroding to ena_admin_hash_functions)
790 uint32_t supported_func;
793 /* selected hash func
794 * 7:0 : selected_func - selected hash function
795 * (bitmask accroding to ena_admin_hash_functions)
797 uint32_t selected_func;
799 /* word 2 : initial value */
803 /* RSS flow hash protocols */
804 enum ena_admin_flow_hash_proto {
806 ENA_ADMIN_RSS_TCP4 = 0,
809 ENA_ADMIN_RSS_UDP4 = 1,
812 ENA_ADMIN_RSS_TCP6 = 2,
815 ENA_ADMIN_RSS_UDP6 = 3,
817 /* ipv4 not tcp/udp */
818 ENA_ADMIN_RSS_IP4 = 4,
820 /* ipv6 not tcp/udp */
821 ENA_ADMIN_RSS_IP6 = 5,
823 /* fragmented ipv4 */
824 ENA_ADMIN_RSS_IP4_FRAG = 6,
827 ENA_ADMIN_RSS_NOT_IP = 7,
829 /* max number of protocols */
830 ENA_ADMIN_RSS_PROTO_NUM = 16,
833 /* RSS flow hash fields */
834 enum ena_admin_flow_hash_fields {
835 /* Ethernet Dest Addr */
836 ENA_ADMIN_RSS_L2_DA = 0,
838 /* Ethernet Src Addr */
839 ENA_ADMIN_RSS_L2_SA = 1,
841 /* ipv4/6 Dest Addr */
842 ENA_ADMIN_RSS_L3_DA = 2,
844 /* ipv4/6 Src Addr */
845 ENA_ADMIN_RSS_L3_SA = 5,
847 /* tcp/udp Dest Port */
848 ENA_ADMIN_RSS_L4_DP = 6,
850 /* tcp/udp Src Port */
851 ENA_ADMIN_RSS_L4_SP = 7,
854 /* hash input fields for flow protocol */
855 struct ena_admin_proto_input {
857 /* flow hash fields (bitwise according to ena_admin_flow_hash_fields) */
863 /* ENA RSS hash control buffer structure */
864 struct ena_admin_feature_rss_hash_control {
865 /* supported input fields */
866 struct ena_admin_proto_input supported_fields[ENA_ADMIN_RSS_PROTO_NUM];
868 /* selected input fields */
869 struct ena_admin_proto_input selected_fields[ENA_ADMIN_RSS_PROTO_NUM];
871 struct ena_admin_proto_input reserved2[ENA_ADMIN_RSS_PROTO_NUM];
873 struct ena_admin_proto_input reserved3[ENA_ADMIN_RSS_PROTO_NUM];
876 /* ENA RSS flow hash input */
877 struct ena_admin_feature_rss_flow_hash_input {
879 /* supported hash input sorting
880 * 1 : L3_sort - support swap L3 addresses if DA
882 * 2 : L4_sort - support swap L4 ports if DP smaller
885 uint16_t supported_input_sort;
887 /* enabled hash input sorting
888 * 1 : enable_L3_sort - enable swap L3 addresses if
890 * 2 : enable_L4_sort - enable swap L4 ports if DP
893 uint16_t enabled_input_sort;
896 /* Operating system type */
897 enum ena_admin_os_type {
899 ENA_ADMIN_OS_LINUX = 1,
902 ENA_ADMIN_OS_WIN = 2,
905 ENA_ADMIN_OS_DPDK = 3,
908 ENA_ADMIN_OS_FREEBSD = 4,
911 ENA_ADMIN_OS_IPXE = 5,
915 struct ena_admin_host_info {
916 /* word 0 : OS type defined in enum ena_os_type */
919 /* os distribution string format */
920 uint8_t os_dist_str[128];
922 /* word 33 : OS distribution numeric format */
925 /* kernel version string format */
926 uint8_t kernel_ver_str[32];
928 /* word 42 : Kernel version numeric format */
933 * 7:0 : major - major
934 * 15:8 : minor - minor
935 * 23:16 : sub_minor - sub minor
937 uint32_t driver_version;
939 /* features bitmap */
940 uint32_t supported_network_features[4];
943 /* ENA RSS indirection table entry */
944 struct ena_admin_rss_ind_table_entry {
952 /* ENA RSS indirection table */
953 struct ena_admin_feature_rss_ind_table {
955 /* min supported table size (2^min_size) */
958 /* max supported table size (2^max_size) */
962 /* table size (2^size) */
967 /* word 2 : index of the inline entry. 0xFFFFFFFF means invalid */
968 uint32_t inline_index;
970 /* words 3 : used for updating single entry, ignored when setting
971 * the entire table through the control buffer.
973 struct ena_admin_rss_ind_table_entry inline_entry;
976 /* ENA Get Feature command */
977 struct ena_admin_get_feat_cmd {
979 struct ena_admin_aq_common_desc aq_common_descriptor;
981 /* words 1:3 : points to control buffer (direct or indirect,
984 struct ena_admin_ctrl_buff_info control_buffer;
987 struct ena_admin_get_set_feature_common_desc feat_common;
996 /* ENA Get Feature command response */
997 struct ena_admin_get_feat_resp {
999 struct ena_admin_acq_common_desc acq_common_desc;
1006 /* words 2:10 : Get Device Attributes */
1007 struct ena_admin_device_attr_feature_desc dev_attr;
1009 /* words 2:5 : Max queues num */
1010 struct ena_admin_queue_feature_desc max_queue;
1012 /* words 2:3 : AENQ configuration */
1013 struct ena_admin_feature_aenq_desc aenq;
1015 /* words 2:4 : Get Link configuration */
1016 struct ena_admin_get_feature_link_desc link;
1018 /* words 2:4 : offload configuration */
1019 struct ena_admin_feature_offload_desc offload;
1021 /* words 2:4 : rss flow hash function */
1022 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
1024 /* words 2 : rss flow hash input */
1025 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
1027 /* words 2:3 : rss indirection table */
1028 struct ena_admin_feature_rss_ind_table ind_table;
1030 /* words 2 : interrupt moderation configuration */
1031 struct ena_admin_feature_intr_moder_desc intr_moderation;
1035 /* ENA Set Feature command */
1036 struct ena_admin_set_feat_cmd {
1038 struct ena_admin_aq_common_desc aq_common_descriptor;
1040 /* words 1:3 : points to control buffer (direct or indirect,
1041 * chained if needed)
1043 struct ena_admin_ctrl_buff_info control_buffer;
1046 struct ena_admin_get_set_feature_common_desc feat_common;
1053 /* words 5 : mtu size */
1054 struct ena_admin_set_feature_mtu_desc mtu;
1056 /* words 5:7 : host attributes */
1057 struct ena_admin_set_feature_host_attr_desc host_attr;
1059 /* words 5:6 : AENQ configuration */
1060 struct ena_admin_feature_aenq_desc aenq;
1062 /* words 5:7 : rss flow hash function */
1063 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
1065 /* words 5 : rss flow hash input */
1066 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
1068 /* words 5:6 : rss indirection table */
1069 struct ena_admin_feature_rss_ind_table ind_table;
1073 /* ENA Set Feature command response */
1074 struct ena_admin_set_feat_resp {
1076 struct ena_admin_acq_common_desc acq_common_desc;
1085 /* ENA Asynchronous Event Notification Queue descriptor. */
1086 struct ena_admin_aenq_common_desc {
1096 uint8_t reserved1[3];
1098 /* word 2 : Timestamp LSB */
1099 uint32_t timestamp_low;
1101 /* word 3 : Timestamp MSB */
1102 uint32_t timestamp_high;
1105 /* asynchronous event notification groups */
1106 enum ena_admin_aenq_group {
1107 /* Link State Change */
1108 ENA_ADMIN_LINK_CHANGE = 0,
1110 ENA_ADMIN_FATAL_ERROR = 1,
1112 ENA_ADMIN_WARNING = 2,
1114 ENA_ADMIN_NOTIFICATION = 3,
1116 ENA_ADMIN_KEEP_ALIVE = 4,
1118 ENA_ADMIN_AENQ_GROUPS_NUM = 5,
1121 /* syndorm of AENQ notification group */
1122 enum ena_admin_aenq_notification_syndrom {
1123 ENA_ADMIN_SUSPEND = 0,
1125 ENA_ADMIN_RESUME = 1,
1128 /* ENA Asynchronous Event Notification generic descriptor. */
1129 struct ena_admin_aenq_entry {
1131 struct ena_admin_aenq_common_desc aenq_common_desc;
1133 /* command specific inline data */
1134 uint32_t inline_data_w4[12];
1137 /* ENA Asynchronous Event Notification Queue Link Change descriptor. */
1138 struct ena_admin_aenq_link_change_desc {
1140 struct ena_admin_aenq_common_desc aenq_common_desc;
1143 /* 0 : link_status */
1147 /* ENA MMIO Readless response interface */
1148 struct ena_admin_ena_mmio_req_read_less_resp {
1153 /* register offset */
1156 /* word 1 : value is valid when poll is cleared */
1160 /* aq_common_desc */
1161 #define ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
1162 #define ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK BIT(0)
1163 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT 1
1164 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK BIT(1)
1165 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT 2
1166 #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK BIT(2)
1169 #define ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT 5
1170 #define ENA_ADMIN_SQ_SQ_DIRECTION_MASK GENMASK(7, 5)
1172 /* acq_common_desc */
1173 #define ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK GENMASK(11, 0)
1174 #define ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK BIT(0)
1176 /* aq_create_sq_cmd */
1177 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT 5
1178 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK GENMASK(7, 5)
1179 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK GENMASK(3, 0)
1180 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT 4
1181 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK GENMASK(6, 4)
1182 #define ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK BIT(0)
1184 /* aq_create_cq_cmd */
1185 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT 5
1186 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
1187 #define ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
1189 /* get_set_feature_common_desc */
1190 #define ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK GENMASK(1, 0)
1192 /* get_feature_link_desc */
1193 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK BIT(0)
1194 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT 1
1195 #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK BIT(1)
1197 /* feature_offload_desc */
1198 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK BIT(0)
1199 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT 1
1200 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK BIT(1)
1201 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT 2
1202 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK BIT(2)
1203 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT 3
1204 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK BIT(3)
1205 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT 4
1206 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK BIT(4)
1207 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT 5
1208 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK BIT(5)
1209 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT 6
1210 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK BIT(6)
1211 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT 7
1212 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK BIT(7)
1213 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK BIT(0)
1214 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT 1
1215 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK BIT(1)
1216 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT 2
1217 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK BIT(2)
1218 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT 3
1219 #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK BIT(3)
1221 /* feature_rss_flow_hash_function */
1222 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK GENMASK(7, 0)
1223 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK \
1226 /* feature_rss_flow_hash_input */
1227 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT 1
1228 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK BIT(1)
1229 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT 2
1230 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK BIT(2)
1231 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT 1
1232 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK BIT(1)
1233 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT 2
1234 #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK BIT(2)
1237 #define ENA_ADMIN_HOST_INFO_MAJOR_MASK GENMASK(7, 0)
1238 #define ENA_ADMIN_HOST_INFO_MINOR_SHIFT 8
1239 #define ENA_ADMIN_HOST_INFO_MINOR_MASK GENMASK(15, 8)
1240 #define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT 16
1241 #define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK GENMASK(23, 16)
1243 /* aenq_common_desc */
1244 #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK BIT(0)
1246 /* aenq_link_change_desc */
1247 #define ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK BIT(0)
1249 #if !defined(ENA_DEFS_LINUX_MAINLINE)
1250 static inline uint16_t
1251 get_ena_admin_aq_common_desc_command_id(
1252 const struct ena_admin_aq_common_desc *p)
1254 return p->command_id & ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK;
1258 set_ena_admin_aq_common_desc_command_id(struct ena_admin_aq_common_desc *p,
1261 p->command_id |= val & ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK;
1264 static inline uint8_t
1265 get_ena_admin_aq_common_desc_phase(const struct ena_admin_aq_common_desc *p)
1267 return p->flags & ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK;
1271 set_ena_admin_aq_common_desc_phase(struct ena_admin_aq_common_desc *p,
1274 p->flags |= val & ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK;
1277 static inline uint8_t
1278 get_ena_admin_aq_common_desc_ctrl_data(
1279 const struct ena_admin_aq_common_desc *p)
1281 return (p->flags & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK) >>
1282 ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT;
1286 set_ena_admin_aq_common_desc_ctrl_data(struct ena_admin_aq_common_desc *p,
1289 p->flags |= (val << ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT)
1290 & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK;
1293 static inline uint8_t
1294 get_ena_admin_aq_common_desc_ctrl_data_indirect(
1295 const struct ena_admin_aq_common_desc *p)
1297 return (p->flags & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK)
1298 >> ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT;
1302 set_ena_admin_aq_common_desc_ctrl_data_indirect(
1303 struct ena_admin_aq_common_desc *p,
1306 p->flags |= (val << ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT)
1307 & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK;
1310 static inline uint8_t
1311 get_ena_admin_sq_sq_direction(const struct ena_admin_sq *p)
1313 return (p->sq_identity & ENA_ADMIN_SQ_SQ_DIRECTION_MASK)
1314 >> ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT;
1318 set_ena_admin_sq_sq_direction(struct ena_admin_sq *p, uint8_t val)
1320 p->sq_identity |= (val << ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT) &
1321 ENA_ADMIN_SQ_SQ_DIRECTION_MASK;
1324 static inline uint16_t
1325 get_ena_admin_acq_common_desc_command_id(
1326 const struct ena_admin_acq_common_desc *p)
1328 return p->command & ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK;
1332 set_ena_admin_acq_common_desc_command_id(struct ena_admin_acq_common_desc *p,
1335 p->command |= val & ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK;
1338 static inline uint8_t
1339 get_ena_admin_acq_common_desc_phase(const struct ena_admin_acq_common_desc *p)
1341 return p->flags & ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK;
1345 set_ena_admin_acq_common_desc_phase(struct ena_admin_acq_common_desc *p,
1348 p->flags |= val & ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK;
1351 static inline uint8_t
1352 get_ena_admin_aq_create_sq_cmd_sq_direction(
1353 const struct ena_admin_aq_create_sq_cmd *p)
1355 return (p->sq_identity & ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK)
1356 >> ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT;
1360 set_ena_admin_aq_create_sq_cmd_sq_direction(
1361 struct ena_admin_aq_create_sq_cmd *p,
1364 p->sq_identity |= (val <<
1365 ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT)
1366 & ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK;
1369 static inline uint8_t
1370 get_ena_admin_aq_create_sq_cmd_placement_policy(
1371 const struct ena_admin_aq_create_sq_cmd *p)
1373 return p->sq_caps_2 & ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK;
1377 set_ena_admin_aq_create_sq_cmd_placement_policy(
1378 struct ena_admin_aq_create_sq_cmd *p,
1381 p->sq_caps_2 |= val & ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK;
1384 static inline uint8_t
1385 get_ena_admin_aq_create_sq_cmd_completion_policy(
1386 const struct ena_admin_aq_create_sq_cmd *p)
1388 return (p->sq_caps_2
1389 & ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK)
1390 >> ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT;
1394 set_ena_admin_aq_create_sq_cmd_completion_policy(
1395 struct ena_admin_aq_create_sq_cmd *p,
1399 (val << ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT)
1400 & ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK;
1403 static inline uint8_t
1404 get_ena_admin_aq_create_sq_cmd_is_physically_contiguous(
1405 const struct ena_admin_aq_create_sq_cmd *p)
1407 return p->sq_caps_3 &
1408 ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK;
1412 set_ena_admin_aq_create_sq_cmd_is_physically_contiguous(
1413 struct ena_admin_aq_create_sq_cmd *p,
1416 p->sq_caps_3 |= val &
1417 ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK;
1420 static inline uint8_t
1421 get_ena_admin_aq_create_cq_cmd_interrupt_mode_enabled(
1422 const struct ena_admin_aq_create_cq_cmd *p)
1424 return (p->cq_caps_1 &
1425 ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK)
1426 >> ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT;
1430 set_ena_admin_aq_create_cq_cmd_interrupt_mode_enabled(
1431 struct ena_admin_aq_create_cq_cmd *p,
1435 (val << ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT)
1436 & ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK;
1439 static inline uint8_t
1440 get_ena_admin_aq_create_cq_cmd_cq_entry_size_words(
1441 const struct ena_admin_aq_create_cq_cmd *p)
1444 & ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK;
1448 set_ena_admin_aq_create_cq_cmd_cq_entry_size_words(
1449 struct ena_admin_aq_create_cq_cmd *p,
1453 val & ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK;
1456 static inline uint8_t
1457 get_ena_admin_get_set_feature_common_desc_select(
1458 const struct ena_admin_get_set_feature_common_desc *p)
1460 return p->flags & ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK;
1464 set_ena_admin_get_set_feature_common_desc_select(
1465 struct ena_admin_get_set_feature_common_desc *p,
1468 p->flags |= val & ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK;
1471 static inline uint32_t
1472 get_ena_admin_get_feature_link_desc_autoneg(
1473 const struct ena_admin_get_feature_link_desc *p)
1475 return p->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK;
1479 set_ena_admin_get_feature_link_desc_autoneg(
1480 struct ena_admin_get_feature_link_desc *p,
1483 p->flags |= val & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK;
1486 static inline uint32_t
1487 get_ena_admin_get_feature_link_desc_duplex(
1488 const struct ena_admin_get_feature_link_desc *p)
1490 return (p->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK)
1491 >> ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT;
1495 set_ena_admin_get_feature_link_desc_duplex(
1496 struct ena_admin_get_feature_link_desc *p,
1499 p->flags |= (val << ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT)
1500 & ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK;
1503 static inline uint32_t
1504 get_ena_admin_feature_offload_desc_TX_L3_csum_ipv4(
1505 const struct ena_admin_feature_offload_desc *p)
1507 return p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK;
1511 set_ena_admin_feature_offload_desc_TX_L3_csum_ipv4(
1512 struct ena_admin_feature_offload_desc *p,
1515 p->tx |= val & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK;
1518 static inline uint32_t
1519 get_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_part(
1520 const struct ena_admin_feature_offload_desc *p)
1523 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK)
1524 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT;
1528 set_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_part(
1529 struct ena_admin_feature_offload_desc *p,
1533 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT)
1534 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK;
1537 static inline uint32_t
1538 get_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_full(
1539 const struct ena_admin_feature_offload_desc *p)
1542 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK)
1543 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT;
1547 set_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_full(
1548 struct ena_admin_feature_offload_desc *p,
1552 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT)
1553 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK;
1556 static inline uint32_t
1557 get_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_part(
1558 const struct ena_admin_feature_offload_desc *p)
1561 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK)
1562 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT;
1566 set_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_part(
1567 struct ena_admin_feature_offload_desc *p,
1571 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT)
1572 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK;
1575 static inline uint32_t
1576 get_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_full(
1577 const struct ena_admin_feature_offload_desc *p)
1580 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK)
1581 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT;
1585 set_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_full(
1586 struct ena_admin_feature_offload_desc *p,
1590 ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT)
1591 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK;
1594 static inline uint32_t
1595 get_ena_admin_feature_offload_desc_tso_ipv4(
1596 const struct ena_admin_feature_offload_desc *p)
1598 return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK)
1599 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT;
1603 set_ena_admin_feature_offload_desc_tso_ipv4(
1604 struct ena_admin_feature_offload_desc *p,
1607 p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT)
1608 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK;
1611 static inline uint32_t
1612 get_ena_admin_feature_offload_desc_tso_ipv6(
1613 const struct ena_admin_feature_offload_desc *p)
1615 return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK)
1616 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT;
1620 set_ena_admin_feature_offload_desc_tso_ipv6(
1621 struct ena_admin_feature_offload_desc *p,
1624 p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT)
1625 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK;
1628 static inline uint32_t
1629 get_ena_admin_feature_offload_desc_tso_ecn(
1630 const struct ena_admin_feature_offload_desc *p)
1632 return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK)
1633 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT;
1637 set_ena_admin_feature_offload_desc_tso_ecn(
1638 struct ena_admin_feature_offload_desc *p,
1641 p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT)
1642 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK;
1645 static inline uint32_t
1646 get_ena_admin_feature_offload_desc_RX_L3_csum_ipv4(
1647 const struct ena_admin_feature_offload_desc *p)
1649 return p->rx_supported &
1650 ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK;
1654 set_ena_admin_feature_offload_desc_RX_L3_csum_ipv4(
1655 struct ena_admin_feature_offload_desc *p,
1659 val & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK;
1662 static inline uint32_t
1663 get_ena_admin_feature_offload_desc_RX_L4_ipv4_csum(
1664 const struct ena_admin_feature_offload_desc *p)
1666 return (p->rx_supported &
1667 ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK)
1668 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT;
1672 set_ena_admin_feature_offload_desc_RX_L4_ipv4_csum(
1673 struct ena_admin_feature_offload_desc *p,
1677 (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT)
1678 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK;
1681 static inline uint32_t
1682 get_ena_admin_feature_offload_desc_RX_L4_ipv6_csum(
1683 const struct ena_admin_feature_offload_desc *p)
1685 return (p->rx_supported &
1686 ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK)
1687 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT;
1691 set_ena_admin_feature_offload_desc_RX_L4_ipv6_csum(
1692 struct ena_admin_feature_offload_desc *p,
1696 (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT)
1697 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK;
1700 static inline uint32_t
1701 get_ena_admin_feature_offload_desc_RX_hash(
1702 const struct ena_admin_feature_offload_desc *p)
1704 return (p->rx_supported &
1705 ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK)
1706 >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT;
1710 set_ena_admin_feature_offload_desc_RX_hash(
1711 struct ena_admin_feature_offload_desc *p,
1715 (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT)
1716 & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK;
1719 static inline uint32_t
1720 get_ena_admin_feature_rss_flow_hash_function_funcs(
1721 const struct ena_admin_feature_rss_flow_hash_function *p)
1723 return p->supported_func &
1724 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK;
1728 set_ena_admin_feature_rss_flow_hash_function_funcs(
1729 struct ena_admin_feature_rss_flow_hash_function *p,
1732 p->supported_func |=
1733 val & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK;
1736 static inline uint32_t
1737 get_ena_admin_feature_rss_flow_hash_function_selected_func(
1738 const struct ena_admin_feature_rss_flow_hash_function *p)
1740 return p->selected_func &
1741 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK;
1745 set_ena_admin_feature_rss_flow_hash_function_selected_func(
1746 struct ena_admin_feature_rss_flow_hash_function *p,
1751 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK;
1754 static inline uint16_t
1755 get_ena_admin_feature_rss_flow_hash_input_L3_sort(
1756 const struct ena_admin_feature_rss_flow_hash_input *p)
1758 return (p->supported_input_sort &
1759 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK)
1760 >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT;
1764 set_ena_admin_feature_rss_flow_hash_input_L3_sort(
1765 struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
1767 p->supported_input_sort |=
1768 (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT)
1769 & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK;
1772 static inline uint16_t
1773 get_ena_admin_feature_rss_flow_hash_input_L4_sort(
1774 const struct ena_admin_feature_rss_flow_hash_input *p)
1776 return (p->supported_input_sort &
1777 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK)
1778 >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT;
1782 set_ena_admin_feature_rss_flow_hash_input_L4_sort(
1783 struct ena_admin_feature_rss_flow_hash_input *p,
1786 p->supported_input_sort |=
1787 (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT)
1788 & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK;
1791 static inline uint16_t
1792 get_ena_admin_feature_rss_flow_hash_input_enable_L3_sort(
1793 const struct ena_admin_feature_rss_flow_hash_input *p)
1795 return (p->enabled_input_sort &
1796 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK)
1797 >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT;
1801 set_ena_admin_feature_rss_flow_hash_input_enable_L3_sort(
1802 struct ena_admin_feature_rss_flow_hash_input *p,
1805 p->enabled_input_sort |=
1807 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT)
1808 & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK;
1811 static inline uint16_t
1812 get_ena_admin_feature_rss_flow_hash_input_enable_L4_sort(
1813 const struct ena_admin_feature_rss_flow_hash_input *p)
1815 return (p->enabled_input_sort &
1816 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK)
1817 >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT;
1821 set_ena_admin_feature_rss_flow_hash_input_enable_L4_sort(
1822 struct ena_admin_feature_rss_flow_hash_input *p,
1825 p->enabled_input_sort |=
1827 ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT)
1828 & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK;
1831 static inline uint32_t
1832 get_ena_admin_host_info_major(const struct ena_admin_host_info *p)
1834 return p->driver_version & ENA_ADMIN_HOST_INFO_MAJOR_MASK;
1838 set_ena_admin_host_info_major(struct ena_admin_host_info *p, uint32_t val)
1840 p->driver_version |= val & ENA_ADMIN_HOST_INFO_MAJOR_MASK;
1843 static inline uint32_t
1844 get_ena_admin_host_info_minor(const struct ena_admin_host_info *p)
1846 return (p->driver_version & ENA_ADMIN_HOST_INFO_MINOR_MASK)
1847 >> ENA_ADMIN_HOST_INFO_MINOR_SHIFT;
1851 set_ena_admin_host_info_minor(struct ena_admin_host_info *p, uint32_t val)
1853 p->driver_version |= (val << ENA_ADMIN_HOST_INFO_MINOR_SHIFT)
1854 & ENA_ADMIN_HOST_INFO_MINOR_MASK;
1857 static inline uint32_t
1858 get_ena_admin_host_info_sub_minor(const struct ena_admin_host_info *p)
1860 return (p->driver_version & ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK)
1861 >> ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT;
1865 set_ena_admin_host_info_sub_minor(struct ena_admin_host_info *p, uint32_t val)
1867 p->driver_version |= (val << ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT)
1868 & ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK;
1871 static inline uint8_t
1872 get_ena_admin_aenq_common_desc_phase(
1873 const struct ena_admin_aenq_common_desc *p)
1875 return p->flags & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK;
1879 set_ena_admin_aenq_common_desc_phase(
1880 struct ena_admin_aenq_common_desc *p,
1883 p->flags |= val & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK;
1886 static inline uint32_t
1887 get_ena_admin_aenq_link_change_desc_link_status(
1888 const struct ena_admin_aenq_link_change_desc *p)
1890 return p->flags & ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK;
1894 set_ena_admin_aenq_link_change_desc_link_status(
1895 struct ena_admin_aenq_link_change_desc *p,
1898 p->flags |= val & ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK;
1901 #endif /* !defined(ENA_DEFS_LINUX_MAINLINE) */
1902 #endif /*_ENA_ADMIN_H_ */