LCOV - code coverage report
Current view: top level - drivers/net/ena/base/ena_defs - ena_admin_defs.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 1 0.0 %
Date: 2024-01-22 15:35:40 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright (c) 2015-2020 Amazon.com, Inc. or its affiliates.
       3                 :            :  * All rights reserved.
       4                 :            :  */
       5                 :            : #ifndef _ENA_ADMIN_H_
       6                 :            : #define _ENA_ADMIN_H_
       7                 :            : 
       8                 :            : #define ENA_ADMIN_EXTRA_PROPERTIES_STRING_LEN 32
       9                 :            : #define ENA_ADMIN_EXTRA_PROPERTIES_COUNT     32
      10                 :            : 
      11                 :            : #define ENA_ADMIN_RSS_KEY_PARTS              10
      12                 :            : 
      13                 :            : #define ENA_ADMIN_CUSTOMER_METRICS_SUPPORT_MASK 0x3F
      14                 :            : #define ENA_ADMIN_CUSTOMER_METRICS_MIN_SUPPORT_MASK 0x1F
      15                 :            : 
      16                 :            :  /* customer metrics - in correlation with
      17                 :            :   * ENA_ADMIN_CUSTOMER_METRICS_SUPPORT_MASK
      18                 :            :   */
      19                 :            : enum ena_admin_customer_metrics_id {
      20                 :            :         ENA_ADMIN_BW_IN_ALLOWANCE_EXCEEDED         = 0,
      21                 :            :         ENA_ADMIN_BW_OUT_ALLOWANCE_EXCEEDED        = 1,
      22                 :            :         ENA_ADMIN_PPS_ALLOWANCE_EXCEEDED           = 2,
      23                 :            :         ENA_ADMIN_CONNTRACK_ALLOWANCE_EXCEEDED     = 3,
      24                 :            :         ENA_ADMIN_LINKLOCAL_ALLOWANCE_EXCEEDED     = 4,
      25                 :            :         ENA_ADMIN_CONNTRACK_ALLOWANCE_AVAILABLE    = 5,
      26                 :            : };
      27                 :            : 
      28                 :            : enum ena_admin_aq_opcode {
      29                 :            :         ENA_ADMIN_CREATE_SQ                         = 1,
      30                 :            :         ENA_ADMIN_DESTROY_SQ                        = 2,
      31                 :            :         ENA_ADMIN_CREATE_CQ                         = 3,
      32                 :            :         ENA_ADMIN_DESTROY_CQ                        = 4,
      33                 :            :         ENA_ADMIN_GET_FEATURE                       = 8,
      34                 :            :         ENA_ADMIN_SET_FEATURE                       = 9,
      35                 :            :         ENA_ADMIN_GET_STATS                         = 11,
      36                 :            : };
      37                 :            : 
      38                 :            : enum ena_admin_aq_completion_status {
      39                 :            :         ENA_ADMIN_SUCCESS                           = 0,
      40                 :            :         ENA_ADMIN_RESOURCE_ALLOCATION_FAILURE       = 1,
      41                 :            :         ENA_ADMIN_BAD_OPCODE                        = 2,
      42                 :            :         ENA_ADMIN_UNSUPPORTED_OPCODE                = 3,
      43                 :            :         ENA_ADMIN_MALFORMED_REQUEST                 = 4,
      44                 :            :         /* Additional status is provided in ACQ entry extended_status */
      45                 :            :         ENA_ADMIN_ILLEGAL_PARAMETER                 = 5,
      46                 :            :         ENA_ADMIN_UNKNOWN_ERROR                     = 6,
      47                 :            :         ENA_ADMIN_RESOURCE_BUSY                     = 7,
      48                 :            : };
      49                 :            : 
      50                 :            : /* subcommands for the set/get feature admin commands */
      51                 :            : enum ena_admin_aq_feature_id {
      52                 :            :         ENA_ADMIN_DEVICE_ATTRIBUTES                 = 1,
      53                 :            :         ENA_ADMIN_MAX_QUEUES_NUM                    = 2,
      54                 :            :         ENA_ADMIN_HW_HINTS                          = 3,
      55                 :            :         ENA_ADMIN_LLQ                               = 4,
      56                 :            :         ENA_ADMIN_EXTRA_PROPERTIES_STRINGS          = 5,
      57                 :            :         ENA_ADMIN_EXTRA_PROPERTIES_FLAGS            = 6,
      58                 :            :         ENA_ADMIN_MAX_QUEUES_EXT                    = 7,
      59                 :            :         ENA_ADMIN_RSS_HASH_FUNCTION                 = 10,
      60                 :            :         ENA_ADMIN_STATELESS_OFFLOAD_CONFIG          = 11,
      61                 :            :         ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG      = 12,
      62                 :            :         ENA_ADMIN_MTU                               = 14,
      63                 :            :         ENA_ADMIN_RSS_HASH_INPUT                    = 18,
      64                 :            :         ENA_ADMIN_INTERRUPT_MODERATION              = 20,
      65                 :            :         ENA_ADMIN_AENQ_CONFIG                       = 26,
      66                 :            :         ENA_ADMIN_LINK_CONFIG                       = 27,
      67                 :            :         ENA_ADMIN_HOST_ATTR_CONFIG                  = 28,
      68                 :            :         ENA_ADMIN_PHC_CONFIG                        = 29,
      69                 :            :         ENA_ADMIN_FEATURES_OPCODE_NUM               = 32,
      70                 :            : };
      71                 :            : 
      72                 :            : /* feature version for the set/get ENA_ADMIN_LLQ feature admin commands */
      73                 :            : enum ena_admin_llq_feature_version {
      74                 :            :         /* legacy base version in older drivers */
      75                 :            :         ENA_ADMIN_LLQ_FEATURE_VERSION_0_LEGACY      = 0,
      76                 :            :         /* support entry_size recommendation by device */
      77                 :            :         ENA_ADMIN_LLQ_FEATURE_VERSION_1             = 1,
      78                 :            : };
      79                 :            : 
      80                 :            : /* device capabilities */
      81                 :            : enum ena_admin_aq_caps_id {
      82                 :            :         ENA_ADMIN_ENI_STATS                         = 0,
      83                 :            :         /* ENA SRD customer metrics */
      84                 :            :         ENA_ADMIN_ENA_SRD_INFO                      = 1,
      85                 :            :         ENA_ADMIN_CUSTOMER_METRICS                  = 2,
      86                 :            :         ENA_ADMIN_EXTENDED_RESET_REASONS            = 3,
      87                 :            : };
      88                 :            : 
      89                 :            : enum ena_admin_placement_policy_type {
      90                 :            :         /* descriptors and headers are in host memory */
      91                 :            :         ENA_ADMIN_PLACEMENT_POLICY_HOST             = 1,
      92                 :            :         /* descriptors and headers are in device memory (a.k.a Low Latency
      93                 :            :          * Queue)
      94                 :            :          */
      95                 :            :         ENA_ADMIN_PLACEMENT_POLICY_DEV              = 3,
      96                 :            : };
      97                 :            : 
      98                 :            : enum ena_admin_link_types {
      99                 :            :         ENA_ADMIN_LINK_SPEED_1G                     = 0x1,
     100                 :            :         ENA_ADMIN_LINK_SPEED_2_HALF_G               = 0x2,
     101                 :            :         ENA_ADMIN_LINK_SPEED_5G                     = 0x4,
     102                 :            :         ENA_ADMIN_LINK_SPEED_10G                    = 0x8,
     103                 :            :         ENA_ADMIN_LINK_SPEED_25G                    = 0x10,
     104                 :            :         ENA_ADMIN_LINK_SPEED_40G                    = 0x20,
     105                 :            :         ENA_ADMIN_LINK_SPEED_50G                    = 0x40,
     106                 :            :         ENA_ADMIN_LINK_SPEED_100G                   = 0x80,
     107                 :            :         ENA_ADMIN_LINK_SPEED_200G                   = 0x100,
     108                 :            :         ENA_ADMIN_LINK_SPEED_400G                   = 0x200,
     109                 :            : };
     110                 :            : 
     111                 :            : enum ena_admin_completion_policy_type {
     112                 :            :         /* completion queue entry for each sq descriptor */
     113                 :            :         ENA_ADMIN_COMPLETION_POLICY_DESC            = 0,
     114                 :            :         /* completion queue entry upon request in sq descriptor */
     115                 :            :         ENA_ADMIN_COMPLETION_POLICY_DESC_ON_DEMAND  = 1,
     116                 :            :         /* current queue head pointer is updated in OS memory upon sq
     117                 :            :          * descriptor request
     118                 :            :          */
     119                 :            :         ENA_ADMIN_COMPLETION_POLICY_HEAD_ON_DEMAND  = 2,
     120                 :            :         /* current queue head pointer is updated in OS memory for each sq
     121                 :            :          * descriptor
     122                 :            :          */
     123                 :            :         ENA_ADMIN_COMPLETION_POLICY_HEAD            = 3,
     124                 :            : };
     125                 :            : 
     126                 :            : /* basic stats return ena_admin_basic_stats while extanded stats return a
     127                 :            :  * buffer (string format) with additional statistics per queue and per
     128                 :            :  * device id
     129                 :            :  */
     130                 :            : enum ena_admin_get_stats_type {
     131                 :            :         ENA_ADMIN_GET_STATS_TYPE_BASIC              = 0,
     132                 :            :         ENA_ADMIN_GET_STATS_TYPE_EXTENDED           = 1,
     133                 :            :         /* extra HW stats for specific network interface */
     134                 :            :         ENA_ADMIN_GET_STATS_TYPE_ENI                = 2,
     135                 :            :         /* extra HW stats for ENA SRD */
     136                 :            :         ENA_ADMIN_GET_STATS_TYPE_ENA_SRD            = 3,
     137                 :            :         ENA_ADMIN_GET_STATS_TYPE_CUSTOMER_METRICS   = 4,
     138                 :            : 
     139                 :            : };
     140                 :            : 
     141                 :            : enum ena_admin_get_stats_scope {
     142                 :            :         ENA_ADMIN_SPECIFIC_QUEUE                    = 0,
     143                 :            :         ENA_ADMIN_ETH_TRAFFIC                       = 1,
     144                 :            : };
     145                 :            : 
     146                 :            : enum ena_admin_get_phc_type {
     147                 :            :         ENA_ADMIN_PHC_TYPE_READLESS                 = 0,
     148                 :            : };
     149                 :            : 
     150                 :            : /* ENA SRD configuration for ENI */
     151                 :            : enum ena_admin_ena_srd_flags {
     152                 :            :         /* Feature enabled */
     153                 :            :         ENA_ADMIN_ENA_SRD_ENABLED                   = BIT(0),
     154                 :            :         /* UDP support enabled */
     155                 :            :         ENA_ADMIN_ENA_SRD_UDP_ENABLED               = BIT(1),
     156                 :            :         /* Bypass Rx UDP ordering */
     157                 :            :         ENA_ADMIN_ENA_SRD_UDP_ORDERING_BYPASS_ENABLED = BIT(2),
     158                 :            : };
     159                 :            : 
     160                 :            : struct ena_admin_aq_common_desc {
     161                 :            :         /* 11:0 : command_id
     162                 :            :          * 15:12 : reserved12
     163                 :            :          */
     164                 :            :         uint16_t command_id;
     165                 :            : 
     166                 :            :         /* as appears in ena_admin_aq_opcode */
     167                 :            :         uint8_t opcode;
     168                 :            : 
     169                 :            :         /* 0 : phase
     170                 :            :          * 1 : ctrl_data - control buffer address valid
     171                 :            :          * 2 : ctrl_data_indirect - control buffer address
     172                 :            :          *    points to list of pages with addresses of control
     173                 :            :          *    buffers
     174                 :            :          * 7:3 : reserved3
     175                 :            :          */
     176                 :            :         uint8_t flags;
     177                 :            : };
     178                 :            : 
     179                 :            : /* used in ena_admin_aq_entry. Can point directly to control data, or to a
     180                 :            :  * page list chunk. Used also at the end of indirect mode page list chunks,
     181                 :            :  * for chaining.
     182                 :            :  */
     183                 :            : struct ena_admin_ctrl_buff_info {
     184                 :            :         uint32_t length;
     185                 :            : 
     186                 :            :         struct ena_common_mem_addr address;
     187                 :            : };
     188                 :            : 
     189                 :            : struct ena_admin_sq {
     190                 :            :         uint16_t sq_idx;
     191                 :            : 
     192                 :            :         /* 4:0 : reserved
     193                 :            :          * 7:5 : sq_direction - 0x1 - Tx; 0x2 - Rx
     194                 :            :          */
     195                 :            :         uint8_t sq_identity;
     196                 :            : 
     197                 :            :         uint8_t reserved1;
     198                 :            : };
     199                 :            : 
     200                 :            : struct ena_admin_aq_entry {
     201                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
     202                 :            : 
     203                 :            :         union {
     204                 :            :                 uint32_t inline_data_w1[3];
     205                 :            : 
     206                 :            :                 struct ena_admin_ctrl_buff_info control_buffer;
     207                 :            :         } u;
     208                 :            : 
     209                 :            :         uint32_t inline_data_w4[12];
     210                 :            : };
     211                 :            : 
     212                 :            : struct ena_admin_acq_common_desc {
     213                 :            :         /* command identifier to associate it with the aq descriptor
     214                 :            :          * 11:0 : command_id
     215                 :            :          * 15:12 : reserved12
     216                 :            :          */
     217                 :            :         uint16_t command;
     218                 :            : 
     219                 :            :         uint8_t status;
     220                 :            : 
     221                 :            :         /* 0 : phase
     222                 :            :          * 7:1 : reserved1
     223                 :            :          */
     224                 :            :         uint8_t flags;
     225                 :            : 
     226                 :            :         uint16_t extended_status;
     227                 :            : 
     228                 :            :         /* indicates to the driver which AQ entry has been consumed by the
     229                 :            :          * device and could be reused
     230                 :            :          */
     231                 :            :         uint16_t sq_head_indx;
     232                 :            : };
     233                 :            : 
     234                 :            : struct ena_admin_acq_entry {
     235                 :            :         struct ena_admin_acq_common_desc acq_common_descriptor;
     236                 :            : 
     237                 :            :         uint32_t response_specific_data[14];
     238                 :            : };
     239                 :            : 
     240                 :            : struct ena_admin_aq_create_sq_cmd {
     241                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
     242                 :            : 
     243                 :            :         /* 4:0 : reserved0_w1
     244                 :            :          * 7:5 : sq_direction - 0x1 - Tx, 0x2 - Rx
     245                 :            :          */
     246                 :            :         uint8_t sq_identity;
     247                 :            : 
     248                 :            :         uint8_t reserved8_w1;
     249                 :            : 
     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
     264                 :            :          */
     265                 :            :         uint8_t sq_caps_2;
     266                 :            : 
     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
     271                 :            :          */
     272                 :            :         uint8_t sq_caps_3;
     273                 :            : 
     274                 :            :         /* associated completion queue id. This CQ must be created prior to SQ
     275                 :            :          * creation
     276                 :            :          */
     277                 :            :         uint16_t cq_idx;
     278                 :            : 
     279                 :            :         /* submission queue depth in entries */
     280                 :            :         uint16_t sq_depth;
     281                 :            : 
     282                 :            :         /* SQ physical base address in OS memory. This field should not be
     283                 :            :          * used for Low Latency queues. Has to be page aligned.
     284                 :            :          */
     285                 :            :         struct ena_common_mem_addr sq_ba;
     286                 :            : 
     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
     290                 :            :          */
     291                 :            :         struct ena_common_mem_addr sq_head_writeback;
     292                 :            : 
     293                 :            :         uint32_t reserved0_w7;
     294                 :            : 
     295                 :            :         uint32_t reserved0_w8;
     296                 :            : };
     297                 :            : 
     298                 :            : enum ena_admin_sq_direction {
     299                 :            :         ENA_ADMIN_SQ_DIRECTION_TX                   = 1,
     300                 :            :         ENA_ADMIN_SQ_DIRECTION_RX                   = 2,
     301                 :            : };
     302                 :            : 
     303                 :            : struct ena_admin_acq_create_sq_resp_desc {
     304                 :            :         struct ena_admin_acq_common_desc acq_common_desc;
     305                 :            : 
     306                 :            :         uint16_t sq_idx;
     307                 :            : 
     308                 :            :         uint16_t reserved;
     309                 :            : 
     310                 :            :         /* queue doorbell address as an offset to PCIe MMIO REG BAR */
     311                 :            :         uint32_t sq_doorbell_offset;
     312                 :            : 
     313                 :            :         /* low latency queue ring base address as an offset to PCIe MMIO
     314                 :            :          * LLQ_MEM BAR
     315                 :            :          */
     316                 :            :         uint32_t llq_descriptors_offset;
     317                 :            : 
     318                 :            :         /* low latency queue headers' memory as an offset to PCIe MMIO
     319                 :            :          * LLQ_MEM BAR
     320                 :            :          */
     321                 :            :         uint32_t llq_headers_offset;
     322                 :            : };
     323                 :            : 
     324                 :            : struct ena_admin_aq_destroy_sq_cmd {
     325                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
     326                 :            : 
     327                 :            :         struct ena_admin_sq sq;
     328                 :            : };
     329                 :            : 
     330                 :            : struct ena_admin_acq_destroy_sq_resp_desc {
     331                 :            :         struct ena_admin_acq_common_desc acq_common_desc;
     332                 :            : };
     333                 :            : 
     334                 :            : struct ena_admin_aq_create_cq_cmd {
     335                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
     336                 :            : 
     337                 :            :         /* 4:0 : reserved5
     338                 :            :          * 5 : interrupt_mode_enabled - if set, cq operates
     339                 :            :          *    in interrupt mode, otherwise - polling
     340                 :            :          * 7:6 : reserved6
     341                 :            :          */
     342                 :            :         uint8_t cq_caps_1;
     343                 :            : 
     344                 :            :         /* 4:0 : cq_entry_size_words - size of CQ entry in
     345                 :            :          *    32-bit words, valid values: 4, 8.
     346                 :            :          * 7:5 : reserved7
     347                 :            :          */
     348                 :            :         uint8_t cq_caps_2;
     349                 :            : 
     350                 :            :         /* completion queue depth in # of entries. must be power of 2 */
     351                 :            :         uint16_t cq_depth;
     352                 :            : 
     353                 :            :         /* msix vector assigned to this cq */
     354                 :            :         uint32_t msix_vector;
     355                 :            : 
     356                 :            :         /* cq physical base address in OS memory. CQ must be physically
     357                 :            :          * contiguous
     358                 :            :          */
     359                 :            :         struct ena_common_mem_addr cq_ba;
     360                 :            : };
     361                 :            : 
     362                 :            : struct ena_admin_acq_create_cq_resp_desc {
     363                 :            :         struct ena_admin_acq_common_desc acq_common_desc;
     364                 :            : 
     365                 :            :         uint16_t cq_idx;
     366                 :            : 
     367                 :            :         /* actual cq depth in number of entries */
     368                 :            :         uint16_t cq_actual_depth;
     369                 :            : 
     370                 :            :         uint32_t numa_node_register_offset;
     371                 :            : 
     372                 :            :         uint32_t cq_head_db_register_offset;
     373                 :            : 
     374                 :            :         uint32_t cq_interrupt_unmask_register_offset;
     375                 :            : };
     376                 :            : 
     377                 :            : struct ena_admin_aq_destroy_cq_cmd {
     378                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
     379                 :            : 
     380                 :            :         uint16_t cq_idx;
     381                 :            : 
     382                 :            :         uint16_t reserved1;
     383                 :            : };
     384                 :            : 
     385                 :            : struct ena_admin_acq_destroy_cq_resp_desc {
     386                 :            :         struct ena_admin_acq_common_desc acq_common_desc;
     387                 :            : };
     388                 :            : 
     389                 :            : /* ENA AQ Get Statistics command. Extended statistics are placed in control
     390                 :            :  * buffer pointed by AQ entry
     391                 :            :  */
     392                 :            : struct ena_admin_aq_get_stats_cmd {
     393                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
     394                 :            : 
     395                 :            :         union {
     396                 :            :                 /* command specific inline data */
     397                 :            :                 uint32_t inline_data_w1[3];
     398                 :            : 
     399                 :            :                 struct ena_admin_ctrl_buff_info control_buffer;
     400                 :            :         } u;
     401                 :            : 
     402                 :            :         /* stats type as defined in enum ena_admin_get_stats_type */
     403                 :            :         uint8_t type;
     404                 :            : 
     405                 :            :         /* stats scope defined in enum ena_admin_get_stats_scope */
     406                 :            :         uint8_t scope;
     407                 :            : 
     408                 :            :         uint16_t reserved3;
     409                 :            : 
     410                 :            :         /* queue id. used when scope is specific_queue */
     411                 :            :         uint16_t queue_idx;
     412                 :            : 
     413                 :            :         /* device id, value 0xFFFF means mine. only privileged device can get
     414                 :            :          * stats of other device
     415                 :            :          */
     416                 :            :         uint16_t device_id;
     417                 :            : 
     418                 :            :         /* a bitmap representing the requested metric values */
     419                 :            :         uint64_t requested_metrics;
     420                 :            : };
     421                 :            : 
     422                 :            : /* Basic Statistics Command. */
     423                 :            : struct ena_admin_basic_stats {
     424                 :            :         uint32_t tx_bytes_low;
     425                 :            : 
     426                 :            :         uint32_t tx_bytes_high;
     427                 :            : 
     428                 :            :         uint32_t tx_pkts_low;
     429                 :            : 
     430                 :            :         uint32_t tx_pkts_high;
     431                 :            : 
     432                 :            :         uint32_t rx_bytes_low;
     433                 :            : 
     434                 :            :         uint32_t rx_bytes_high;
     435                 :            : 
     436                 :            :         uint32_t rx_pkts_low;
     437                 :            : 
     438                 :            :         uint32_t rx_pkts_high;
     439                 :            : 
     440                 :            :         uint32_t rx_drops_low;
     441                 :            : 
     442                 :            :         uint32_t rx_drops_high;
     443                 :            : 
     444                 :            :         uint32_t tx_drops_low;
     445                 :            : 
     446                 :            :         uint32_t tx_drops_high;
     447                 :            : 
     448                 :            :         uint32_t rx_overruns_low;
     449                 :            : 
     450                 :            :         uint32_t rx_overruns_high;
     451                 :            : };
     452                 :            : 
     453                 :            : /* ENI Statistics Command. */
     454                 :            : struct ena_admin_eni_stats {
     455                 :            :         /* The number of packets shaped due to inbound aggregate BW
     456                 :            :          * allowance being exceeded
     457                 :            :          */
     458                 :            :         uint64_t bw_in_allowance_exceeded;
     459                 :            : 
     460                 :            :         /* The number of packets shaped due to outbound aggregate BW
     461                 :            :          * allowance being exceeded
     462                 :            :          */
     463                 :            :         uint64_t bw_out_allowance_exceeded;
     464                 :            : 
     465                 :            :         /* The number of packets shaped due to PPS allowance being exceeded */
     466                 :            :         uint64_t pps_allowance_exceeded;
     467                 :            : 
     468                 :            :         /* The number of packets shaped due to connection tracking
     469                 :            :          * allowance being exceeded and leading to failure in establishment
     470                 :            :          * of new connections
     471                 :            :          */
     472                 :            :         uint64_t conntrack_allowance_exceeded;
     473                 :            : 
     474                 :            :         /* The number of packets shaped due to linklocal packet rate
     475                 :            :          * allowance being exceeded
     476                 :            :          */
     477                 :            :         uint64_t linklocal_allowance_exceeded;
     478                 :            : };
     479                 :            : 
     480                 :            : struct ena_admin_ena_srd_stats {
     481                 :            :         /* Number of packets transmitted over ENA SRD */
     482                 :            :         uint64_t ena_srd_tx_pkts;
     483                 :            : 
     484                 :            :         /* Number of packets transmitted or could have been
     485                 :            :          * transmitted over ENA SRD
     486                 :            :          */
     487                 :            :         uint64_t ena_srd_eligible_tx_pkts;
     488                 :            : 
     489                 :            :         /* Number of packets received over ENA SRD */
     490                 :            :         uint64_t ena_srd_rx_pkts;
     491                 :            : 
     492                 :            :         /* Percentage of the ENA SRD resources that is in use */
     493                 :            :         uint64_t ena_srd_resource_utilization;
     494                 :            : };
     495                 :            : 
     496                 :            : /* ENA SRD Statistics Command */
     497                 :            : struct ena_admin_ena_srd_info {
     498                 :            :         /* ENA SRD configuration bitmap. See ena_admin_ena_srd_flags for
     499                 :            :          * details
     500                 :            :          */
     501                 :            :         uint64_t flags;
     502                 :            : 
     503                 :            :         struct ena_admin_ena_srd_stats ena_srd_stats;
     504                 :            : };
     505                 :            : 
     506                 :            : /* Customer Metrics Command. */
     507                 :            : struct ena_admin_customer_metrics {
     508                 :            :         /* A bitmap representing the reported customer metrics according to
     509                 :            :          * the order they are reported
     510                 :            :          */
     511                 :            :         uint64_t reported_metrics;
     512                 :            : };
     513                 :            : 
     514                 :            : struct ena_admin_acq_get_stats_resp {
     515                 :            :         struct ena_admin_acq_common_desc acq_common_desc;
     516                 :            : 
     517                 :            :         union {
     518                 :            :                 uint64_t raw[7];
     519                 :            : 
     520                 :            :                 struct ena_admin_basic_stats basic_stats;
     521                 :            : 
     522                 :            :                 struct ena_admin_eni_stats eni_stats;
     523                 :            : 
     524                 :            :                 struct ena_admin_ena_srd_info ena_srd_info;
     525                 :            : 
     526                 :            :                 struct ena_admin_customer_metrics customer_metrics;
     527                 :            :         } u;
     528                 :            : };
     529                 :            : 
     530                 :            : struct ena_admin_get_set_feature_common_desc {
     531                 :            :         /* 1:0 : select - 0x1 - current value; 0x3 - default
     532                 :            :          *    value
     533                 :            :          * 7:3 : reserved3
     534                 :            :          */
     535                 :            :         uint8_t flags;
     536                 :            : 
     537                 :            :         /* as appears in ena_admin_aq_feature_id */
     538                 :            :         uint8_t feature_id;
     539                 :            : 
     540                 :            :         /* The driver specifies the max feature version it supports and the
     541                 :            :          * device responds with the currently supported feature version. The
     542                 :            :          * field is zero based
     543                 :            :          */
     544                 :            :         uint8_t feature_version;
     545                 :            : 
     546                 :            :         uint8_t reserved8;
     547                 :            : };
     548                 :            : 
     549                 :            : struct ena_admin_device_attr_feature_desc {
     550                 :            :         uint32_t impl_id;
     551                 :            : 
     552                 :            :         uint32_t device_version;
     553                 :            : 
     554                 :            :         /* bitmap of ena_admin_aq_feature_id, which represents supported
     555                 :            :          * subcommands for the set/get feature admin commands.
     556                 :            :          */
     557                 :            :         uint32_t supported_features;
     558                 :            : 
     559                 :            :         /* bitmap of ena_admin_aq_caps_id, which represents device
     560                 :            :          * capabilities.
     561                 :            :          */
     562                 :            :         uint32_t capabilities;
     563                 :            : 
     564                 :            :         /* Indicates how many bits are used physical address access. */
     565                 :            :         uint32_t phys_addr_width;
     566                 :            : 
     567                 :            :         /* Indicates how many bits are used virtual address access. */
     568                 :            :         uint32_t virt_addr_width;
     569                 :            : 
     570                 :            :         /* unicast MAC address (in Network byte order) */
     571                 :            :         uint8_t mac_addr[6];
     572                 :            : 
     573                 :            :         uint8_t reserved7[2];
     574                 :            : 
     575                 :            :         uint32_t max_mtu;
     576                 :            : };
     577                 :            : 
     578                 :            : enum ena_admin_llq_header_location {
     579                 :            :         /* header is in descriptor list */
     580                 :            :         ENA_ADMIN_INLINE_HEADER                     = 1,
     581                 :            :         /* header in a separate ring, implies 16B descriptor list entry */
     582                 :            :         ENA_ADMIN_HEADER_RING                       = 2,
     583                 :            : };
     584                 :            : 
     585                 :            : enum ena_admin_llq_ring_entry_size {
     586                 :            :         ENA_ADMIN_LIST_ENTRY_SIZE_128B              = 1,
     587                 :            :         ENA_ADMIN_LIST_ENTRY_SIZE_192B              = 2,
     588                 :            :         ENA_ADMIN_LIST_ENTRY_SIZE_256B              = 4,
     589                 :            : };
     590                 :            : 
     591                 :            : enum ena_admin_llq_num_descs_before_header {
     592                 :            :         ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_0     = 0,
     593                 :            :         ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_1     = 1,
     594                 :            :         ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_2     = 2,
     595                 :            :         ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_4     = 4,
     596                 :            :         ENA_ADMIN_LLQ_NUM_DESCS_BEFORE_HEADER_8     = 8,
     597                 :            : };
     598                 :            : 
     599                 :            : /* packet descriptor list entry always starts with one or more descriptors,
     600                 :            :  * followed by a header. The rest of the descriptors are located in the
     601                 :            :  * beginning of the subsequent entry. Stride refers to how the rest of the
     602                 :            :  * descriptors are placed. This field is relevant only for inline header
     603                 :            :  * mode
     604                 :            :  */
     605                 :            : enum ena_admin_llq_stride_ctrl {
     606                 :            :         ENA_ADMIN_SINGLE_DESC_PER_ENTRY             = 1,
     607                 :            :         ENA_ADMIN_MULTIPLE_DESCS_PER_ENTRY          = 2,
     608                 :            : };
     609                 :            : 
     610                 :            : enum ena_admin_accel_mode_feat {
     611                 :            :         ENA_ADMIN_DISABLE_META_CACHING              = 0,
     612                 :            :         ENA_ADMIN_LIMIT_TX_BURST                    = 1,
     613                 :            : };
     614                 :            : 
     615                 :            : struct ena_admin_accel_mode_get {
     616                 :            :         /* bit field of enum ena_admin_accel_mode_feat */
     617                 :            :         uint16_t supported_flags;
     618                 :            : 
     619                 :            :         /* maximum burst size between two doorbells. The size is in bytes */
     620                 :            :         uint16_t max_tx_burst_size;
     621                 :            : };
     622                 :            : 
     623                 :            : struct ena_admin_accel_mode_set {
     624                 :            :         /* bit field of enum ena_admin_accel_mode_feat */
     625                 :            :         uint16_t enabled_flags;
     626                 :            : 
     627                 :            :         uint16_t reserved;
     628                 :            : };
     629                 :            : 
     630                 :            : struct ena_admin_accel_mode_req {
     631                 :            :         union {
     632                 :            :                 uint32_t raw[2];
     633                 :            : 
     634                 :            :                 struct ena_admin_accel_mode_get get;
     635                 :            : 
     636                 :            :                 struct ena_admin_accel_mode_set set;
     637                 :            :         } u;
     638                 :            : };
     639                 :            : 
     640                 :            : struct ena_admin_feature_llq_desc {
     641                 :            :         uint32_t max_llq_num;
     642                 :            : 
     643                 :            :         uint32_t max_llq_depth;
     644                 :            : 
     645                 :            :         /* specify the header locations the device supports. bitfield of enum
     646                 :            :          * ena_admin_llq_header_location.
     647                 :            :          */
     648                 :            :         uint16_t header_location_ctrl_supported;
     649                 :            : 
     650                 :            :         /* the header location the driver selected to use. */
     651                 :            :         uint16_t header_location_ctrl_enabled;
     652                 :            : 
     653                 :            :         /* if inline header is specified - this is the size of descriptor list
     654                 :            :          * entry. If header in a separate ring is specified - this is the size
     655                 :            :          * of header ring entry. bitfield of enum ena_admin_llq_ring_entry_size.
     656                 :            :          * specify the entry sizes the device supports
     657                 :            :          */
     658                 :            :         uint16_t entry_size_ctrl_supported;
     659                 :            : 
     660                 :            :         /* the entry size the driver selected to use. */
     661                 :            :         uint16_t entry_size_ctrl_enabled;
     662                 :            : 
     663                 :            :         /* valid only if inline header is specified. First entry associated with
     664                 :            :          * the packet includes descriptors and header. Rest of the entries
     665                 :            :          * occupied by descriptors. This parameter defines the max number of
     666                 :            :          * descriptors precedding the header in the first entry. The field is
     667                 :            :          * bitfield of enum ena_admin_llq_num_descs_before_header and specify
     668                 :            :          * the values the device supports
     669                 :            :          */
     670                 :            :         uint16_t desc_num_before_header_supported;
     671                 :            : 
     672                 :            :         /* the desire field the driver selected to use */
     673                 :            :         uint16_t desc_num_before_header_enabled;
     674                 :            : 
     675                 :            :         /* valid only if inline was chosen. bitfield of enum
     676                 :            :          * ena_admin_llq_stride_ctrl
     677                 :            :          */
     678                 :            :         uint16_t descriptors_stride_ctrl_supported;
     679                 :            : 
     680                 :            :         /* the stride control the driver selected to use */
     681                 :            :         uint16_t descriptors_stride_ctrl_enabled;
     682                 :            : 
     683                 :            :         /* feature version of device resp to either GET/SET commands. */
     684                 :            :         uint8_t feature_version;
     685                 :            : 
     686                 :            :         /* llq entry size recommended by the device,
     687                 :            :          * values correlated to enum ena_admin_llq_ring_entry_size.
     688                 :            :          * used only for GET command.
     689                 :            :          */
     690                 :            :         uint8_t entry_size_recommended;
     691                 :            : 
     692                 :            :         /* reserved */
     693                 :            :         uint8_t reserved1[2];
     694                 :            : 
     695                 :            :         /* accelerated low latency queues requirement. driver needs to
     696                 :            :          * support those requirements in order to use accelerated llq
     697                 :            :          */
     698                 :            :         struct ena_admin_accel_mode_req accel_mode;
     699                 :            : };
     700                 :            : 
     701                 :            : struct ena_admin_queue_ext_feature_fields {
     702                 :            :         uint32_t max_tx_sq_num;
     703                 :            : 
     704                 :            :         uint32_t max_tx_cq_num;
     705                 :            : 
     706                 :            :         uint32_t max_rx_sq_num;
     707                 :            : 
     708                 :            :         uint32_t max_rx_cq_num;
     709                 :            : 
     710                 :            :         uint32_t max_tx_sq_depth;
     711                 :            : 
     712                 :            :         uint32_t max_tx_cq_depth;
     713                 :            : 
     714                 :            :         uint32_t max_rx_sq_depth;
     715                 :            : 
     716                 :            :         uint32_t max_rx_cq_depth;
     717                 :            : 
     718                 :            :         uint32_t max_tx_header_size;
     719                 :            : 
     720                 :            :         /* Maximum Descriptors number, including meta descriptor, allowed for a
     721                 :            :          * single Tx packet
     722                 :            :          */
     723                 :            :         uint16_t max_per_packet_tx_descs;
     724                 :            : 
     725                 :            :         /* Maximum Descriptors number allowed for a single Rx packet */
     726                 :            :         uint16_t max_per_packet_rx_descs;
     727                 :            : };
     728                 :            : 
     729                 :            : struct ena_admin_queue_feature_desc {
     730                 :            :         uint32_t max_sq_num;
     731                 :            : 
     732                 :            :         uint32_t max_sq_depth;
     733                 :            : 
     734                 :            :         uint32_t max_cq_num;
     735                 :            : 
     736                 :            :         uint32_t max_cq_depth;
     737                 :            : 
     738                 :            :         uint32_t max_legacy_llq_num;
     739                 :            : 
     740                 :            :         uint32_t max_legacy_llq_depth;
     741                 :            : 
     742                 :            :         uint32_t max_header_size;
     743                 :            : 
     744                 :            :         /* Maximum Descriptors number, including meta descriptor, allowed for a
     745                 :            :          * single Tx packet
     746                 :            :          */
     747                 :            :         uint16_t max_packet_tx_descs;
     748                 :            : 
     749                 :            :         /* Maximum Descriptors number allowed for a single Rx packet */
     750                 :            :         uint16_t max_packet_rx_descs;
     751                 :            : };
     752                 :            : 
     753                 :            : struct ena_admin_set_feature_mtu_desc {
     754                 :            :         /* exclude L2 */
     755                 :            :         uint32_t mtu;
     756                 :            : };
     757                 :            : 
     758                 :            : struct ena_admin_get_extra_properties_strings_desc {
     759                 :            :         uint32_t count;
     760                 :            : };
     761                 :            : 
     762                 :            : struct ena_admin_get_extra_properties_flags_desc {
     763                 :            :         uint32_t flags;
     764                 :            : };
     765                 :            : 
     766                 :            : struct ena_admin_set_feature_host_attr_desc {
     767                 :            :         /* host OS info base address in OS memory. host info is 4KB of
     768                 :            :          * physically contiguous
     769                 :            :          */
     770                 :            :         struct ena_common_mem_addr os_info_ba;
     771                 :            : 
     772                 :            :         /* host debug area base address in OS memory. debug area must be
     773                 :            :          * physically contiguous
     774                 :            :          */
     775                 :            :         struct ena_common_mem_addr debug_ba;
     776                 :            : 
     777                 :            :         /* debug area size */
     778                 :            :         uint32_t debug_area_size;
     779                 :            : };
     780                 :            : 
     781                 :            : struct ena_admin_feature_intr_moder_desc {
     782                 :            :         /* interrupt delay granularity in usec */
     783                 :            :         uint16_t intr_delay_resolution;
     784                 :            : 
     785                 :            :         uint16_t reserved;
     786                 :            : };
     787                 :            : 
     788                 :            : struct ena_admin_get_feature_link_desc {
     789                 :            :         /* Link speed in Mb */
     790                 :            :         uint32_t speed;
     791                 :            : 
     792                 :            :         /* bit field of enum ena_admin_link types */
     793                 :            :         uint32_t supported;
     794                 :            : 
     795                 :            :         /* 0 : autoneg
     796                 :            :          * 1 : duplex - Full Duplex
     797                 :            :          * 31:2 : reserved2
     798                 :            :          */
     799                 :            :         uint32_t flags;
     800                 :            : };
     801                 :            : 
     802                 :            : struct ena_admin_feature_aenq_desc {
     803                 :            :         /* bitmask for AENQ groups the device can report */
     804                 :            :         uint32_t supported_groups;
     805                 :            : 
     806                 :            :         /* bitmask for AENQ groups to report */
     807                 :            :         uint32_t enabled_groups;
     808                 :            : };
     809                 :            : 
     810                 :            : struct ena_admin_feature_offload_desc {
     811                 :            :         /* 0 : TX_L3_csum_ipv4
     812                 :            :          * 1 : TX_L4_ipv4_csum_part - The checksum field
     813                 :            :          *    should be initialized with pseudo header checksum
     814                 :            :          * 2 : TX_L4_ipv4_csum_full
     815                 :            :          * 3 : TX_L4_ipv6_csum_part - The checksum field
     816                 :            :          *    should be initialized with pseudo header checksum
     817                 :            :          * 4 : TX_L4_ipv6_csum_full
     818                 :            :          * 5 : tso_ipv4
     819                 :            :          * 6 : tso_ipv6
     820                 :            :          * 7 : tso_ecn
     821                 :            :          */
     822                 :            :         uint32_t tx;
     823                 :            : 
     824                 :            :         /* Receive side supported stateless offload
     825                 :            :          * 0 : RX_L3_csum_ipv4 - IPv4 checksum
     826                 :            :          * 1 : RX_L4_ipv4_csum - TCP/UDP/IPv4 checksum
     827                 :            :          * 2 : RX_L4_ipv6_csum - TCP/UDP/IPv6 checksum
     828                 :            :          * 3 : RX_hash - Hash calculation
     829                 :            :          */
     830                 :            :         uint32_t rx_supported;
     831                 :            : 
     832                 :            :         uint32_t rx_enabled;
     833                 :            : };
     834                 :            : 
     835                 :            : enum ena_admin_hash_functions {
     836                 :            :         ENA_ADMIN_TOEPLITZ                          = 1,
     837                 :            :         ENA_ADMIN_CRC32                             = 2,
     838                 :            : };
     839                 :            : 
     840                 :            : struct ena_admin_feature_rss_flow_hash_control {
     841                 :            :         uint32_t key_parts;
     842                 :            : 
     843                 :            :         uint32_t reserved;
     844                 :            : 
     845                 :            :         uint32_t key[ENA_ADMIN_RSS_KEY_PARTS];
     846                 :            : };
     847                 :            : 
     848                 :            : struct ena_admin_feature_rss_flow_hash_function {
     849                 :            :         /* 7:0 : funcs - bitmask of ena_admin_hash_functions */
     850                 :            :         uint32_t supported_func;
     851                 :            : 
     852                 :            :         /* 7:0 : selected_func - bitmask of
     853                 :            :          *    ena_admin_hash_functions
     854                 :            :          */
     855                 :            :         uint32_t selected_func;
     856                 :            : 
     857                 :            :         /* initial value */
     858                 :            :         uint32_t init_val;
     859                 :            : };
     860                 :            : 
     861                 :            : /* RSS flow hash protocols */
     862                 :            : enum ena_admin_flow_hash_proto {
     863                 :            :         ENA_ADMIN_RSS_TCP4                          = 0,
     864                 :            :         ENA_ADMIN_RSS_UDP4                          = 1,
     865                 :            :         ENA_ADMIN_RSS_TCP6                          = 2,
     866                 :            :         ENA_ADMIN_RSS_UDP6                          = 3,
     867                 :            :         ENA_ADMIN_RSS_IP4                           = 4,
     868                 :            :         ENA_ADMIN_RSS_IP6                           = 5,
     869                 :            :         ENA_ADMIN_RSS_IP4_FRAG                      = 6,
     870                 :            :         ENA_ADMIN_RSS_NOT_IP                        = 7,
     871                 :            :         /* TCPv6 with extension header */
     872                 :            :         ENA_ADMIN_RSS_TCP6_EX                       = 8,
     873                 :            :         /* IPv6 with extension header */
     874                 :            :         ENA_ADMIN_RSS_IP6_EX                        = 9,
     875                 :            :         ENA_ADMIN_RSS_PROTO_NUM                     = 16,
     876                 :            : };
     877                 :            : 
     878                 :            : /* RSS flow hash fields */
     879                 :            : enum ena_admin_flow_hash_fields {
     880                 :            :         /* Ethernet Dest Addr */
     881                 :            :         ENA_ADMIN_RSS_L2_DA                         = BIT(0),
     882                 :            :         /* Ethernet Src Addr */
     883                 :            :         ENA_ADMIN_RSS_L2_SA                         = BIT(1),
     884                 :            :         /* ipv4/6 Dest Addr */
     885                 :            :         ENA_ADMIN_RSS_L3_DA                         = BIT(2),
     886                 :            :         /* ipv4/6 Src Addr */
     887                 :            :         ENA_ADMIN_RSS_L3_SA                         = BIT(3),
     888                 :            :         /* tcp/udp Dest Port */
     889                 :            :         ENA_ADMIN_RSS_L4_DP                         = BIT(4),
     890                 :            :         /* tcp/udp Src Port */
     891                 :            :         ENA_ADMIN_RSS_L4_SP                         = BIT(5),
     892                 :            : };
     893                 :            : 
     894                 :            : struct ena_admin_proto_input {
     895                 :            :         /* flow hash fields (bitwise according to ena_admin_flow_hash_fields) */
     896                 :            :         uint16_t fields;
     897                 :            : 
     898                 :            :         uint16_t reserved2;
     899                 :            : };
     900                 :            : 
     901                 :            : struct ena_admin_feature_rss_hash_control {
     902                 :            :         struct ena_admin_proto_input supported_fields[ENA_ADMIN_RSS_PROTO_NUM];
     903                 :            : 
     904                 :            :         struct ena_admin_proto_input selected_fields[ENA_ADMIN_RSS_PROTO_NUM];
     905                 :            : 
     906                 :            :         struct ena_admin_proto_input reserved2[ENA_ADMIN_RSS_PROTO_NUM];
     907                 :            : 
     908                 :            :         struct ena_admin_proto_input reserved3[ENA_ADMIN_RSS_PROTO_NUM];
     909                 :            : };
     910                 :            : 
     911                 :            : struct ena_admin_feature_rss_flow_hash_input {
     912                 :            :         /* supported hash input sorting
     913                 :            :          * 1 : L3_sort - support swap L3 addresses if DA is
     914                 :            :          *    smaller than SA
     915                 :            :          * 2 : L4_sort - support swap L4 ports if DP smaller
     916                 :            :          *    SP
     917                 :            :          */
     918                 :            :         uint16_t supported_input_sort;
     919                 :            : 
     920                 :            :         /* enabled hash input sorting
     921                 :            :          * 1 : enable_L3_sort - enable swap L3 addresses if
     922                 :            :          *    DA smaller than SA
     923                 :            :          * 2 : enable_L4_sort - enable swap L4 ports if DP
     924                 :            :          *    smaller than SP
     925                 :            :          */
     926                 :            :         uint16_t enabled_input_sort;
     927                 :            : };
     928                 :            : 
     929                 :            : enum ena_admin_os_type {
     930                 :            :         ENA_ADMIN_OS_LINUX                          = 1,
     931                 :            :         ENA_ADMIN_OS_WIN                            = 2,
     932                 :            :         ENA_ADMIN_OS_DPDK                           = 3,
     933                 :            :         ENA_ADMIN_OS_FREEBSD                        = 4,
     934                 :            :         ENA_ADMIN_OS_IPXE                           = 5,
     935                 :            :         ENA_ADMIN_OS_ESXI                           = 6,
     936                 :            :         ENA_ADMIN_OS_MACOS                          = 7,
     937                 :            :         ENA_ADMIN_OS_GROUPS_NUM                     = 7,
     938                 :            : };
     939                 :            : 
     940                 :            : struct ena_admin_host_info {
     941                 :            :         /* defined in enum ena_admin_os_type */
     942                 :            :         uint32_t os_type;
     943                 :            : 
     944                 :            :         /* os distribution string format */
     945                 :            :         uint8_t os_dist_str[128];
     946                 :            : 
     947                 :            :         /* OS distribution numeric format */
     948                 :            :         uint32_t os_dist;
     949                 :            : 
     950                 :            :         /* kernel version string format */
     951                 :            :         uint8_t kernel_ver_str[32];
     952                 :            : 
     953                 :            :         /* Kernel version numeric format */
     954                 :            :         uint32_t kernel_ver;
     955                 :            : 
     956                 :            :         /* 7:0 : major
     957                 :            :          * 15:8 : minor
     958                 :            :          * 23:16 : sub_minor
     959                 :            :          * 31:24 : module_type
     960                 :            :          */
     961                 :            :         uint32_t driver_version;
     962                 :            : 
     963                 :            :         /* features bitmap */
     964                 :            :         uint32_t supported_network_features[2];
     965                 :            : 
     966                 :            :         /* ENA spec version of driver */
     967                 :            :         uint16_t ena_spec_version;
     968                 :            : 
     969                 :            :         /* ENA device's Bus, Device and Function
     970                 :            :          * 2:0 : function
     971                 :            :          * 7:3 : device
     972                 :            :          * 15:8 : bus
     973                 :            :          */
     974                 :            :         uint16_t bdf;
     975                 :            : 
     976                 :            :         /* Number of CPUs */
     977                 :            :         uint16_t num_cpus;
     978                 :            : 
     979                 :            :         uint16_t reserved;
     980                 :            : 
     981                 :            :         /* 0 : reserved
     982                 :            :          * 1 : rx_offset
     983                 :            :          * 2 : interrupt_moderation
     984                 :            :          * 3 : rx_buf_mirroring
     985                 :            :          * 4 : rss_configurable_function_key
     986                 :            :          * 5 : reserved
     987                 :            :          * 6 : rx_page_reuse
     988                 :            :          * 31:7 : reserved
     989                 :            :          */
     990                 :            :         uint32_t driver_supported_features;
     991                 :            : };
     992                 :            : 
     993                 :            : struct ena_admin_rss_ind_table_entry {
     994                 :            :         uint16_t cq_idx;
     995                 :            : 
     996                 :            :         uint16_t reserved;
     997                 :            : };
     998                 :            : 
     999                 :            : struct ena_admin_feature_rss_ind_table {
    1000                 :            :         /* min supported table size (2^min_size) */
    1001                 :            :         uint16_t min_size;
    1002                 :            : 
    1003                 :            :         /* max supported table size (2^max_size) */
    1004                 :            :         uint16_t max_size;
    1005                 :            : 
    1006                 :            :         /* table size (2^size) */
    1007                 :            :         uint16_t size;
    1008                 :            : 
    1009                 :            :         /* 0 : one_entry_update - The ENA device supports
    1010                 :            :          *    setting a single RSS table entry
    1011                 :            :          */
    1012                 :            :         uint8_t flags;
    1013                 :            : 
    1014                 :            :         uint8_t reserved;
    1015                 :            : 
    1016                 :            :         /* index of the inline entry. 0xFFFFFFFF means invalid */
    1017                 :            :         uint32_t inline_index;
    1018                 :            : 
    1019                 :            :         /* used for updating single entry, ignored when setting the entire
    1020                 :            :          * table through the control buffer.
    1021                 :            :          */
    1022                 :            :         struct ena_admin_rss_ind_table_entry inline_entry;
    1023                 :            : };
    1024                 :            : 
    1025                 :            : /* When hint value is 0, driver should use it's own predefined value */
    1026                 :            : struct ena_admin_ena_hw_hints {
    1027                 :            :         /* value in ms */
    1028                 :            :         uint16_t mmio_read_timeout;
    1029                 :            : 
    1030                 :            :         /* value in ms */
    1031                 :            :         uint16_t driver_watchdog_timeout;
    1032                 :            : 
    1033                 :            :         /* Per packet tx completion timeout. value in ms */
    1034                 :            :         uint16_t missing_tx_completion_timeout;
    1035                 :            : 
    1036                 :            :         uint16_t missed_tx_completion_count_threshold_to_reset;
    1037                 :            : 
    1038                 :            :         /* value in ms */
    1039                 :            :         uint16_t admin_completion_tx_timeout;
    1040                 :            : 
    1041                 :            :         uint16_t netdev_wd_timeout;
    1042                 :            : 
    1043                 :            :         uint16_t max_tx_sgl_size;
    1044                 :            : 
    1045                 :            :         uint16_t max_rx_sgl_size;
    1046                 :            : 
    1047                 :            :         uint16_t reserved[8];
    1048                 :            : };
    1049                 :            : 
    1050                 :            : struct ena_admin_get_feat_cmd {
    1051                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
    1052                 :            : 
    1053                 :            :         struct ena_admin_ctrl_buff_info control_buffer;
    1054                 :            : 
    1055                 :            :         struct ena_admin_get_set_feature_common_desc feat_common;
    1056                 :            : 
    1057                 :            :         uint32_t raw[11];
    1058                 :            : };
    1059                 :            : 
    1060                 :            : struct ena_admin_queue_ext_feature_desc {
    1061                 :            :         /* version */
    1062                 :            :         uint8_t version;
    1063                 :            : 
    1064                 :            :         uint8_t reserved1[3];
    1065                 :            : 
    1066                 :            :         union {
    1067                 :            :                 struct ena_admin_queue_ext_feature_fields max_queue_ext;
    1068                 :            : 
    1069                 :            :                 uint32_t raw[10];
    1070                 :            :         };
    1071                 :            : };
    1072                 :            : 
    1073                 :            : struct ena_admin_feature_phc_desc {
    1074                 :            :         /* PHC type as defined in enum ena_admin_get_phc_type,
    1075                 :            :          * used only for GET command.
    1076                 :            :          */
    1077                 :            :         uint8_t type;
    1078                 :            : 
    1079                 :            :         /* Reserved - MBZ */
    1080                 :            :         uint8_t reserved1[3];
    1081                 :            : 
    1082                 :            :         /* PHC doorbell address as an offset to PCIe MMIO REG BAR,
    1083                 :            :          * used only for GET command.
    1084                 :            :          */
    1085                 :            :         uint32_t doorbell_offset;
    1086                 :            : 
    1087                 :            :         /* Max time for valid PHC retrieval, passing this threshold will
    1088                 :            :          * fail the get-time request and block PHC requests for
    1089                 :            :          * block_timeout_usec, used only for GET command.
    1090                 :            :          */
    1091                 :            :         uint32_t expire_timeout_usec;
    1092                 :            : 
    1093                 :            :         /* PHC requests block period, blocking starts if PHC request expired
    1094                 :            :          * in order to prevent floods on busy device,
    1095                 :            :          * used only for GET command.
    1096                 :            :          */
    1097                 :            :         uint32_t block_timeout_usec;
    1098                 :            : 
    1099                 :            :         /* Shared PHC physical address (ena_admin_phc_resp),
    1100                 :            :          * used only for SET command.
    1101                 :            :          */
    1102                 :            :         struct ena_common_mem_addr output_address;
    1103                 :            : 
    1104                 :            :         /* Shared PHC Size (ena_admin_phc_resp),
    1105                 :            :          * used only for SET command.
    1106                 :            :          */
    1107                 :            :         uint32_t output_length;
    1108                 :            : };
    1109                 :            : 
    1110                 :            : struct ena_admin_get_feat_resp {
    1111                 :            :         struct ena_admin_acq_common_desc acq_common_desc;
    1112                 :            : 
    1113                 :            :         union {
    1114                 :            :                 uint32_t raw[14];
    1115                 :            : 
    1116                 :            :                 struct ena_admin_device_attr_feature_desc dev_attr;
    1117                 :            : 
    1118                 :            :                 struct ena_admin_feature_llq_desc llq;
    1119                 :            : 
    1120                 :            :                 struct ena_admin_queue_feature_desc max_queue;
    1121                 :            : 
    1122                 :            :                 struct ena_admin_queue_ext_feature_desc max_queue_ext;
    1123                 :            : 
    1124                 :            :                 struct ena_admin_feature_aenq_desc aenq;
    1125                 :            : 
    1126                 :            :                 struct ena_admin_get_feature_link_desc link;
    1127                 :            : 
    1128                 :            :                 struct ena_admin_feature_offload_desc offload;
    1129                 :            : 
    1130                 :            :                 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
    1131                 :            : 
    1132                 :            :                 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
    1133                 :            : 
    1134                 :            :                 struct ena_admin_feature_rss_ind_table ind_table;
    1135                 :            : 
    1136                 :            :                 struct ena_admin_feature_intr_moder_desc intr_moderation;
    1137                 :            : 
    1138                 :            :                 struct ena_admin_ena_hw_hints hw_hints;
    1139                 :            : 
    1140                 :            :                 struct ena_admin_feature_phc_desc phc;
    1141                 :            : 
    1142                 :            :                 struct ena_admin_get_extra_properties_strings_desc extra_properties_strings;
    1143                 :            : 
    1144                 :            :                 struct ena_admin_get_extra_properties_flags_desc extra_properties_flags;
    1145                 :            :         } u;
    1146                 :            : };
    1147                 :            : 
    1148                 :            : struct ena_admin_set_feat_cmd {
    1149                 :            :         struct ena_admin_aq_common_desc aq_common_descriptor;
    1150                 :            : 
    1151                 :            :         struct ena_admin_ctrl_buff_info control_buffer;
    1152                 :            : 
    1153                 :            :         struct ena_admin_get_set_feature_common_desc feat_common;
    1154                 :            : 
    1155                 :            :         union {
    1156                 :            :                 uint32_t raw[11];
    1157                 :            : 
    1158                 :            :                 /* mtu size */
    1159                 :            :                 struct ena_admin_set_feature_mtu_desc mtu;
    1160                 :            : 
    1161                 :            :                 /* host attributes */
    1162                 :            :                 struct ena_admin_set_feature_host_attr_desc host_attr;
    1163                 :            : 
    1164                 :            :                 /* AENQ configuration */
    1165                 :            :                 struct ena_admin_feature_aenq_desc aenq;
    1166                 :            : 
    1167                 :            :                 /* rss flow hash function */
    1168                 :            :                 struct ena_admin_feature_rss_flow_hash_function flow_hash_func;
    1169                 :            : 
    1170                 :            :                 /* rss flow hash input */
    1171                 :            :                 struct ena_admin_feature_rss_flow_hash_input flow_hash_input;
    1172                 :            : 
    1173                 :            :                 /* rss indirection table */
    1174                 :            :                 struct ena_admin_feature_rss_ind_table ind_table;
    1175                 :            : 
    1176                 :            :                 /* LLQ configuration */
    1177                 :            :                 struct ena_admin_feature_llq_desc llq;
    1178                 :            : 
    1179                 :            :                 /* PHC configuration */
    1180                 :            :                 struct ena_admin_feature_phc_desc phc;
    1181                 :            :         } u;
    1182                 :            : };
    1183                 :            : 
    1184                 :            : struct ena_admin_set_feat_resp {
    1185                 :            :         struct ena_admin_acq_common_desc acq_common_desc;
    1186                 :            : 
    1187                 :            :         union {
    1188                 :            :                 uint32_t raw[14];
    1189                 :            :         } u;
    1190                 :            : };
    1191                 :            : 
    1192                 :            : struct ena_admin_aenq_common_desc {
    1193                 :            :         uint16_t group;
    1194                 :            : 
    1195                 :            :         uint16_t syndrome;
    1196                 :            : 
    1197                 :            :         /* 0 : phase
    1198                 :            :          * 7:1 : reserved - MBZ
    1199                 :            :          */
    1200                 :            :         uint8_t flags;
    1201                 :            : 
    1202                 :            :         uint8_t reserved1[3];
    1203                 :            : 
    1204                 :            :         uint32_t timestamp_low;
    1205                 :            : 
    1206                 :            :         uint32_t timestamp_high;
    1207                 :            : };
    1208                 :            : 
    1209                 :            : /* asynchronous event notification groups */
    1210                 :            : enum ena_admin_aenq_group {
    1211                 :            :         ENA_ADMIN_LINK_CHANGE                       = 0,
    1212                 :            :         ENA_ADMIN_FATAL_ERROR                       = 1,
    1213                 :            :         ENA_ADMIN_WARNING                           = 2,
    1214                 :            :         ENA_ADMIN_NOTIFICATION                      = 3,
    1215                 :            :         ENA_ADMIN_KEEP_ALIVE                        = 4,
    1216                 :            :         ENA_ADMIN_REFRESH_CAPABILITIES              = 5,
    1217                 :            :         ENA_ADMIN_AENQ_GROUPS_NUM                   = 6,
    1218                 :            : };
    1219                 :            : 
    1220                 :            : enum ena_admin_aenq_notification_syndrome {
    1221                 :            :         ENA_ADMIN_UPDATE_HINTS                      = 2,
    1222                 :            : };
    1223                 :            : 
    1224                 :            : struct ena_admin_aenq_entry {
    1225                 :            :         struct ena_admin_aenq_common_desc aenq_common_desc;
    1226                 :            : 
    1227                 :            :         /* command specific inline data */
    1228                 :            :         uint32_t inline_data_w4[12];
    1229                 :            : };
    1230                 :            : 
    1231                 :            : struct ena_admin_aenq_link_change_desc {
    1232                 :            :         struct ena_admin_aenq_common_desc aenq_common_desc;
    1233                 :            : 
    1234                 :            :         /* 0 : link_status */
    1235                 :            :         uint32_t flags;
    1236                 :            : };
    1237                 :            : 
    1238                 :            : struct ena_admin_aenq_keep_alive_desc {
    1239                 :            :         struct ena_admin_aenq_common_desc aenq_common_desc;
    1240                 :            : 
    1241                 :            :         uint32_t rx_drops_low;
    1242                 :            : 
    1243                 :            :         uint32_t rx_drops_high;
    1244                 :            : 
    1245                 :            :         uint32_t tx_drops_low;
    1246                 :            : 
    1247                 :            :         uint32_t tx_drops_high;
    1248                 :            : 
    1249                 :            :         uint32_t rx_overruns_low;
    1250                 :            : 
    1251                 :            :         uint32_t rx_overruns_high;
    1252                 :            : };
    1253                 :            : 
    1254                 :            : struct ena_admin_ena_mmio_req_read_less_resp {
    1255                 :            :         uint16_t req_id;
    1256                 :            : 
    1257                 :            :         uint16_t reg_off;
    1258                 :            : 
    1259                 :            :         /* value is valid when poll is cleared */
    1260                 :            :         uint32_t reg_val;
    1261                 :            : };
    1262                 :            : 
    1263                 :            : struct ena_admin_phc_resp {
    1264                 :            :         uint16_t req_id;
    1265                 :            : 
    1266                 :            :         uint8_t reserved1[6];
    1267                 :            : 
    1268                 :            :         uint64_t timestamp;
    1269                 :            : 
    1270                 :            :         uint8_t reserved2[48];
    1271                 :            : };
    1272                 :            : 
    1273                 :            : /* aq_common_desc */
    1274                 :            : #define ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK            GENMASK(11, 0)
    1275                 :            : #define ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK                 BIT(0)
    1276                 :            : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT            1
    1277                 :            : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK             BIT(1)
    1278                 :            : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT   2
    1279                 :            : #define ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK    BIT(2)
    1280                 :            : 
    1281                 :            : /* sq */
    1282                 :            : #define ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT                     5
    1283                 :            : #define ENA_ADMIN_SQ_SQ_DIRECTION_MASK                      GENMASK(7, 5)
    1284                 :            : 
    1285                 :            : /* acq_common_desc */
    1286                 :            : #define ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK           GENMASK(11, 0)
    1287                 :            : #define ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK                BIT(0)
    1288                 :            : 
    1289                 :            : /* aq_create_sq_cmd */
    1290                 :            : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT       5
    1291                 :            : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK        GENMASK(7, 5)
    1292                 :            : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK    GENMASK(3, 0)
    1293                 :            : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT  4
    1294                 :            : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK   GENMASK(6, 4)
    1295                 :            : #define ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK BIT(0)
    1296                 :            : 
    1297                 :            : /* aq_create_cq_cmd */
    1298                 :            : #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT 5
    1299                 :            : #define ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
    1300                 :            : #define ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK GENMASK(4, 0)
    1301                 :            : 
    1302                 :            : /* get_set_feature_common_desc */
    1303                 :            : #define ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK   GENMASK(1, 0)
    1304                 :            : 
    1305                 :            : /* get_feature_link_desc */
    1306                 :            : #define ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK        BIT(0)
    1307                 :            : #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT        1
    1308                 :            : #define ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK         BIT(1)
    1309                 :            : 
    1310                 :            : /* feature_offload_desc */
    1311                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK BIT(0)
    1312                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT 1
    1313                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK BIT(1)
    1314                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT 2
    1315                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK BIT(2)
    1316                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT 3
    1317                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK BIT(3)
    1318                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT 4
    1319                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK BIT(4)
    1320                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT       5
    1321                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK        BIT(5)
    1322                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT       6
    1323                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK        BIT(6)
    1324                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT        7
    1325                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK         BIT(7)
    1326                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK BIT(0)
    1327                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT 1
    1328                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK BIT(1)
    1329                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT 2
    1330                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK BIT(2)
    1331                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT        3
    1332                 :            : #define ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK         BIT(3)
    1333                 :            : 
    1334                 :            : /* feature_rss_flow_hash_function */
    1335                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK GENMASK(7, 0)
    1336                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK GENMASK(7, 0)
    1337                 :            : 
    1338                 :            : /* feature_rss_flow_hash_input */
    1339                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT 1
    1340                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK  BIT(1)
    1341                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT 2
    1342                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK  BIT(2)
    1343                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT 1
    1344                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK BIT(1)
    1345                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT 2
    1346                 :            : #define ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK BIT(2)
    1347                 :            : 
    1348                 :            : /* host_info */
    1349                 :            : #define ENA_ADMIN_HOST_INFO_MAJOR_MASK                      GENMASK(7, 0)
    1350                 :            : #define ENA_ADMIN_HOST_INFO_MINOR_SHIFT                     8
    1351                 :            : #define ENA_ADMIN_HOST_INFO_MINOR_MASK                      GENMASK(15, 8)
    1352                 :            : #define ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT                 16
    1353                 :            : #define ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK                  GENMASK(23, 16)
    1354                 :            : #define ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT               24
    1355                 :            : #define ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK                GENMASK(31, 24)
    1356                 :            : #define ENA_ADMIN_HOST_INFO_FUNCTION_MASK                   GENMASK(2, 0)
    1357                 :            : #define ENA_ADMIN_HOST_INFO_DEVICE_SHIFT                    3
    1358                 :            : #define ENA_ADMIN_HOST_INFO_DEVICE_MASK                     GENMASK(7, 3)
    1359                 :            : #define ENA_ADMIN_HOST_INFO_BUS_SHIFT                       8
    1360                 :            : #define ENA_ADMIN_HOST_INFO_BUS_MASK                        GENMASK(15, 8)
    1361                 :            : #define ENA_ADMIN_HOST_INFO_RX_OFFSET_SHIFT                 1
    1362                 :            : #define ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK                  BIT(1)
    1363                 :            : #define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT      2
    1364                 :            : #define ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK       BIT(2)
    1365                 :            : #define ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_SHIFT          3
    1366                 :            : #define ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_MASK           BIT(3)
    1367                 :            : #define ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_SHIFT 4
    1368                 :            : #define ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_MASK BIT(4)
    1369                 :            : #define ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_SHIFT             6
    1370                 :            : #define ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_MASK              BIT(6)
    1371                 :            : 
    1372                 :            : /* feature_rss_ind_table */
    1373                 :            : #define ENA_ADMIN_FEATURE_RSS_IND_TABLE_ONE_ENTRY_UPDATE_MASK BIT(0)
    1374                 :            : 
    1375                 :            : /* aenq_common_desc */
    1376                 :            : #define ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK               BIT(0)
    1377                 :            : 
    1378                 :            : /* aenq_link_change_desc */
    1379                 :            : #define ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK    BIT(0)
    1380                 :            : 
    1381                 :            : #if !defined(DEFS_LINUX_MAINLINE)
    1382                 :            : static inline uint16_t get_ena_admin_aq_common_desc_command_id(const struct ena_admin_aq_common_desc *p)
    1383                 :            : {
    1384                 :            :         return p->command_id & ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK;
    1385                 :            : }
    1386                 :            : 
    1387                 :            : static inline void set_ena_admin_aq_common_desc_command_id(struct ena_admin_aq_common_desc *p, uint16_t val)
    1388                 :            : {
    1389                 :            :         p->command_id |= val & ENA_ADMIN_AQ_COMMON_DESC_COMMAND_ID_MASK;
    1390                 :            : }
    1391                 :            : 
    1392                 :            : static inline uint8_t get_ena_admin_aq_common_desc_phase(const struct ena_admin_aq_common_desc *p)
    1393                 :            : {
    1394                 :            :         return p->flags & ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK;
    1395                 :            : }
    1396                 :            : 
    1397                 :            : static inline void set_ena_admin_aq_common_desc_phase(struct ena_admin_aq_common_desc *p, uint8_t val)
    1398                 :            : {
    1399                 :            :         p->flags |= val & ENA_ADMIN_AQ_COMMON_DESC_PHASE_MASK;
    1400                 :            : }
    1401                 :            : 
    1402                 :            : static inline uint8_t get_ena_admin_aq_common_desc_ctrl_data(const struct ena_admin_aq_common_desc *p)
    1403                 :            : {
    1404                 :            :         return (p->flags & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK) >> ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT;
    1405                 :            : }
    1406                 :            : 
    1407                 :            : static inline void set_ena_admin_aq_common_desc_ctrl_data(struct ena_admin_aq_common_desc *p, uint8_t val)
    1408                 :            : {
    1409                 :            :         p->flags |= (val << ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_SHIFT) & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_MASK;
    1410                 :            : }
    1411                 :            : 
    1412                 :            : static inline uint8_t get_ena_admin_aq_common_desc_ctrl_data_indirect(const struct ena_admin_aq_common_desc *p)
    1413                 :            : {
    1414                 :            :         return (p->flags & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK) >> ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT;
    1415                 :            : }
    1416                 :            : 
    1417                 :            : static inline void set_ena_admin_aq_common_desc_ctrl_data_indirect(struct ena_admin_aq_common_desc *p, uint8_t val)
    1418                 :            : {
    1419                 :            :         p->flags |= (val << ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_SHIFT) & ENA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT_MASK;
    1420                 :            : }
    1421                 :            : 
    1422                 :            : static inline uint8_t get_ena_admin_sq_sq_direction(const struct ena_admin_sq *p)
    1423                 :            : {
    1424                 :            :         return (p->sq_identity & ENA_ADMIN_SQ_SQ_DIRECTION_MASK) >> ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT;
    1425                 :            : }
    1426                 :            : 
    1427                 :            : static inline void set_ena_admin_sq_sq_direction(struct ena_admin_sq *p, uint8_t val)
    1428                 :            : {
    1429                 :            :         p->sq_identity |= (val << ENA_ADMIN_SQ_SQ_DIRECTION_SHIFT) & ENA_ADMIN_SQ_SQ_DIRECTION_MASK;
    1430                 :            : }
    1431                 :            : 
    1432                 :            : static inline uint16_t get_ena_admin_acq_common_desc_command_id(const struct ena_admin_acq_common_desc *p)
    1433                 :            : {
    1434                 :            :         return p->command & ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK;
    1435                 :            : }
    1436                 :            : 
    1437                 :            : static inline void set_ena_admin_acq_common_desc_command_id(struct ena_admin_acq_common_desc *p, uint16_t val)
    1438                 :            : {
    1439                 :            :         p->command |= val & ENA_ADMIN_ACQ_COMMON_DESC_COMMAND_ID_MASK;
    1440                 :            : }
    1441                 :            : 
    1442                 :            : static inline uint8_t get_ena_admin_acq_common_desc_phase(const struct ena_admin_acq_common_desc *p)
    1443                 :            : {
    1444                 :            :         return p->flags & ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK;
    1445                 :            : }
    1446                 :            : 
    1447                 :            : static inline void set_ena_admin_acq_common_desc_phase(struct ena_admin_acq_common_desc *p, uint8_t val)
    1448                 :            : {
    1449                 :            :         p->flags |= val & ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK;
    1450                 :            : }
    1451                 :            : 
    1452                 :            : static inline uint8_t get_ena_admin_aq_create_sq_cmd_sq_direction(const struct ena_admin_aq_create_sq_cmd *p)
    1453                 :            : {
    1454                 :            :         return (p->sq_identity & ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK) >> ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT;
    1455                 :            : }
    1456                 :            : 
    1457                 :            : static inline void set_ena_admin_aq_create_sq_cmd_sq_direction(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
    1458                 :            : {
    1459                 :            :         p->sq_identity |= (val << ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_SHIFT) & ENA_ADMIN_AQ_CREATE_SQ_CMD_SQ_DIRECTION_MASK;
    1460                 :            : }
    1461                 :            : 
    1462                 :            : static inline uint8_t get_ena_admin_aq_create_sq_cmd_placement_policy(const struct ena_admin_aq_create_sq_cmd *p)
    1463                 :            : {
    1464                 :            :         return p->sq_caps_2 & ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK;
    1465                 :            : }
    1466                 :            : 
    1467                 :            : static inline void set_ena_admin_aq_create_sq_cmd_placement_policy(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
    1468                 :            : {
    1469                 :            :         p->sq_caps_2 |= val & ENA_ADMIN_AQ_CREATE_SQ_CMD_PLACEMENT_POLICY_MASK;
    1470                 :            : }
    1471                 :            : 
    1472                 :            : static inline uint8_t get_ena_admin_aq_create_sq_cmd_completion_policy(const struct ena_admin_aq_create_sq_cmd *p)
    1473                 :            : {
    1474                 :            :         return (p->sq_caps_2 & ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK) >> ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT;
    1475                 :            : }
    1476                 :            : 
    1477                 :            : static inline void set_ena_admin_aq_create_sq_cmd_completion_policy(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
    1478                 :            : {
    1479                 :            :         p->sq_caps_2 |= (val << ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_SHIFT) & ENA_ADMIN_AQ_CREATE_SQ_CMD_COMPLETION_POLICY_MASK;
    1480                 :            : }
    1481                 :            : 
    1482                 :            : static inline uint8_t get_ena_admin_aq_create_sq_cmd_is_physically_contiguous(const struct ena_admin_aq_create_sq_cmd *p)
    1483                 :            : {
    1484                 :            :         return p->sq_caps_3 & ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK;
    1485                 :            : }
    1486                 :            : 
    1487                 :            : static inline void set_ena_admin_aq_create_sq_cmd_is_physically_contiguous(struct ena_admin_aq_create_sq_cmd *p, uint8_t val)
    1488                 :            : {
    1489                 :            :         p->sq_caps_3 |= val & ENA_ADMIN_AQ_CREATE_SQ_CMD_IS_PHYSICALLY_CONTIGUOUS_MASK;
    1490                 :            : }
    1491                 :            : 
    1492                 :            : static inline uint8_t get_ena_admin_aq_create_cq_cmd_interrupt_mode_enabled(const struct ena_admin_aq_create_cq_cmd *p)
    1493                 :            : {
    1494                 :            :         return (p->cq_caps_1 & ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK) >> ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT;
    1495                 :            : }
    1496                 :            : 
    1497                 :            : static inline void set_ena_admin_aq_create_cq_cmd_interrupt_mode_enabled(struct ena_admin_aq_create_cq_cmd *p, uint8_t val)
    1498                 :            : {
    1499                 :            :         p->cq_caps_1 |= (val << ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_SHIFT) & ENA_ADMIN_AQ_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK;
    1500                 :            : }
    1501                 :            : 
    1502                 :            : static inline uint8_t get_ena_admin_aq_create_cq_cmd_cq_entry_size_words(const struct ena_admin_aq_create_cq_cmd *p)
    1503                 :            : {
    1504                 :            :         return p->cq_caps_2 & ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK;
    1505                 :            : }
    1506                 :            : 
    1507                 :            : static inline void set_ena_admin_aq_create_cq_cmd_cq_entry_size_words(struct ena_admin_aq_create_cq_cmd *p, uint8_t val)
    1508                 :            : {
    1509                 :            :         p->cq_caps_2 |= val & ENA_ADMIN_AQ_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK;
    1510                 :            : }
    1511                 :            : 
    1512                 :            : static inline uint8_t get_ena_admin_get_set_feature_common_desc_select(const struct ena_admin_get_set_feature_common_desc *p)
    1513                 :            : {
    1514                 :            :         return p->flags & ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK;
    1515                 :            : }
    1516                 :            : 
    1517                 :            : static inline void set_ena_admin_get_set_feature_common_desc_select(struct ena_admin_get_set_feature_common_desc *p, uint8_t val)
    1518                 :            : {
    1519                 :            :         p->flags |= val & ENA_ADMIN_GET_SET_FEATURE_COMMON_DESC_SELECT_MASK;
    1520                 :            : }
    1521                 :            : 
    1522                 :            : static inline uint32_t get_ena_admin_get_feature_link_desc_autoneg(const struct ena_admin_get_feature_link_desc *p)
    1523                 :            : {
    1524                 :            :         return p->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK;
    1525                 :            : }
    1526                 :            : 
    1527                 :            : static inline void set_ena_admin_get_feature_link_desc_autoneg(struct ena_admin_get_feature_link_desc *p, uint32_t val)
    1528                 :            : {
    1529                 :            :         p->flags |= val & ENA_ADMIN_GET_FEATURE_LINK_DESC_AUTONEG_MASK;
    1530                 :            : }
    1531                 :            : 
    1532                 :            : static inline uint32_t get_ena_admin_get_feature_link_desc_duplex(const struct ena_admin_get_feature_link_desc *p)
    1533                 :            : {
    1534                 :            :         return (p->flags & ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK) >> ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT;
    1535                 :            : }
    1536                 :            : 
    1537                 :            : static inline void set_ena_admin_get_feature_link_desc_duplex(struct ena_admin_get_feature_link_desc *p, uint32_t val)
    1538                 :            : {
    1539                 :            :         p->flags |= (val << ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_SHIFT) & ENA_ADMIN_GET_FEATURE_LINK_DESC_DUPLEX_MASK;
    1540                 :            : }
    1541                 :            : 
    1542                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L3_csum_ipv4(const struct ena_admin_feature_offload_desc *p)
    1543                 :            : {
    1544                 :            :         return p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK;
    1545                 :            : }
    1546                 :            : 
    1547                 :            : static inline void set_ena_admin_feature_offload_desc_TX_L3_csum_ipv4(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1548                 :            : {
    1549                 :            :         p->tx |= val & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L3_CSUM_IPV4_MASK;
    1550                 :            : }
    1551                 :            : 
    1552                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_part(const struct ena_admin_feature_offload_desc *p)
    1553                 :            : {
    1554                 :            :         return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT;
    1555                 :            : }
    1556                 :            : 
    1557                 :            : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_part(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1558                 :            : {
    1559                 :            :         p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_PART_MASK;
    1560                 :            : }
    1561                 :            : 
    1562                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_full(const struct ena_admin_feature_offload_desc *p)
    1563                 :            : {
    1564                 :            :         return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT;
    1565                 :            : }
    1566                 :            : 
    1567                 :            : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv4_csum_full(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1568                 :            : {
    1569                 :            :         p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV4_CSUM_FULL_MASK;
    1570                 :            : }
    1571                 :            : 
    1572                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_part(const struct ena_admin_feature_offload_desc *p)
    1573                 :            : {
    1574                 :            :         return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT;
    1575                 :            : }
    1576                 :            : 
    1577                 :            : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_part(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1578                 :            : {
    1579                 :            :         p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_PART_MASK;
    1580                 :            : }
    1581                 :            : 
    1582                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_full(const struct ena_admin_feature_offload_desc *p)
    1583                 :            : {
    1584                 :            :         return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT;
    1585                 :            : }
    1586                 :            : 
    1587                 :            : static inline void set_ena_admin_feature_offload_desc_TX_L4_ipv6_csum_full(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1588                 :            : {
    1589                 :            :         p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TX_L4_IPV6_CSUM_FULL_MASK;
    1590                 :            : }
    1591                 :            : 
    1592                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_tso_ipv4(const struct ena_admin_feature_offload_desc *p)
    1593                 :            : {
    1594                 :            :         return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT;
    1595                 :            : }
    1596                 :            : 
    1597                 :            : static inline void set_ena_admin_feature_offload_desc_tso_ipv4(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1598                 :            : {
    1599                 :            :         p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK;
    1600                 :            : }
    1601                 :            : 
    1602                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_tso_ipv6(const struct ena_admin_feature_offload_desc *p)
    1603                 :            : {
    1604                 :            :         return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT;
    1605                 :            : }
    1606                 :            : 
    1607                 :            : static inline void set_ena_admin_feature_offload_desc_tso_ipv6(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1608                 :            : {
    1609                 :            :         p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV6_MASK;
    1610                 :            : }
    1611                 :            : 
    1612                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_tso_ecn(const struct ena_admin_feature_offload_desc *p)
    1613                 :            : {
    1614                 :            :         return (p->tx & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT;
    1615                 :            : }
    1616                 :            : 
    1617                 :            : static inline void set_ena_admin_feature_offload_desc_tso_ecn(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1618                 :            : {
    1619                 :            :         p->tx |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_ECN_MASK;
    1620                 :            : }
    1621                 :            : 
    1622                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_RX_L3_csum_ipv4(const struct ena_admin_feature_offload_desc *p)
    1623                 :            : {
    1624                 :            :         return p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK;
    1625                 :            : }
    1626                 :            : 
    1627                 :            : static inline void set_ena_admin_feature_offload_desc_RX_L3_csum_ipv4(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1628                 :            : {
    1629                 :            :         p->rx_supported |= val & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L3_CSUM_IPV4_MASK;
    1630                 :            : }
    1631                 :            : 
    1632                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_RX_L4_ipv4_csum(const struct ena_admin_feature_offload_desc *p)
    1633                 :            : {
    1634                 :            :         return (p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT;
    1635                 :            : }
    1636                 :            : 
    1637                 :            : static inline void set_ena_admin_feature_offload_desc_RX_L4_ipv4_csum(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1638                 :            : {
    1639                 :            :         p->rx_supported |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK;
    1640                 :            : }
    1641                 :            : 
    1642                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_RX_L4_ipv6_csum(const struct ena_admin_feature_offload_desc *p)
    1643                 :            : {
    1644                 :            :         return (p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT;
    1645                 :            : }
    1646                 :            : 
    1647                 :            : static inline void set_ena_admin_feature_offload_desc_RX_L4_ipv6_csum(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1648                 :            : {
    1649                 :            :         p->rx_supported |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV6_CSUM_MASK;
    1650                 :            : }
    1651                 :            : 
    1652                 :            : static inline uint32_t get_ena_admin_feature_offload_desc_RX_hash(const struct ena_admin_feature_offload_desc *p)
    1653                 :            : {
    1654                 :            :         return (p->rx_supported & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK) >> ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT;
    1655                 :            : }
    1656                 :            : 
    1657                 :            : static inline void set_ena_admin_feature_offload_desc_RX_hash(struct ena_admin_feature_offload_desc *p, uint32_t val)
    1658                 :            : {
    1659                 :            :         p->rx_supported |= (val << ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_SHIFT) & ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_HASH_MASK;
    1660                 :            : }
    1661                 :            : 
    1662                 :            : static inline uint32_t get_ena_admin_feature_rss_flow_hash_function_funcs(const struct ena_admin_feature_rss_flow_hash_function *p)
    1663                 :            : {
    1664                 :            :         return p->supported_func & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK;
    1665                 :            : }
    1666                 :            : 
    1667                 :            : static inline void set_ena_admin_feature_rss_flow_hash_function_funcs(struct ena_admin_feature_rss_flow_hash_function *p, uint32_t val)
    1668                 :            : {
    1669                 :            :         p->supported_func |= val & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_FUNCS_MASK;
    1670                 :            : }
    1671                 :            : 
    1672                 :            : static inline uint32_t get_ena_admin_feature_rss_flow_hash_function_selected_func(const struct ena_admin_feature_rss_flow_hash_function *p)
    1673                 :            : {
    1674                 :            :         return p->selected_func & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK;
    1675                 :            : }
    1676                 :            : 
    1677                 :            : static inline void set_ena_admin_feature_rss_flow_hash_function_selected_func(struct ena_admin_feature_rss_flow_hash_function *p, uint32_t val)
    1678                 :            : {
    1679                 :            :         p->selected_func |= val & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_FUNCTION_SELECTED_FUNC_MASK;
    1680                 :            : }
    1681                 :            : 
    1682                 :            : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_L3_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
    1683                 :            : {
    1684                 :            :         return (p->supported_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT;
    1685                 :            : }
    1686                 :            : 
    1687                 :            : static inline void set_ena_admin_feature_rss_flow_hash_input_L3_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
    1688                 :            : {
    1689                 :            :         p->supported_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L3_SORT_MASK;
    1690                 :            : }
    1691                 :            : 
    1692                 :            : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_L4_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
    1693                 :            : {
    1694                 :            :         return (p->supported_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT;
    1695                 :            : }
    1696                 :            : 
    1697                 :            : static inline void set_ena_admin_feature_rss_flow_hash_input_L4_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
    1698                 :            : {
    1699                 :            :         p->supported_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_L4_SORT_MASK;
    1700                 :            : }
    1701                 :            : 
    1702                 :            : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_enable_L3_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
    1703                 :            : {
    1704                 :            :         return (p->enabled_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT;
    1705                 :            : }
    1706                 :            : 
    1707                 :            : static inline void set_ena_admin_feature_rss_flow_hash_input_enable_L3_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
    1708                 :            : {
    1709                 :            :         p->enabled_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L3_SORT_MASK;
    1710                 :            : }
    1711                 :            : 
    1712                 :            : static inline uint16_t get_ena_admin_feature_rss_flow_hash_input_enable_L4_sort(const struct ena_admin_feature_rss_flow_hash_input *p)
    1713                 :            : {
    1714                 :            :         return (p->enabled_input_sort & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK) >> ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT;
    1715                 :            : }
    1716                 :            : 
    1717                 :            : static inline void set_ena_admin_feature_rss_flow_hash_input_enable_L4_sort(struct ena_admin_feature_rss_flow_hash_input *p, uint16_t val)
    1718                 :            : {
    1719                 :            :         p->enabled_input_sort |= (val << ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_SHIFT) & ENA_ADMIN_FEATURE_RSS_FLOW_HASH_INPUT_ENABLE_L4_SORT_MASK;
    1720                 :            : }
    1721                 :            : 
    1722                 :            : static inline uint32_t get_ena_admin_host_info_major(const struct ena_admin_host_info *p)
    1723                 :            : {
    1724                 :            :         return p->driver_version & ENA_ADMIN_HOST_INFO_MAJOR_MASK;
    1725                 :            : }
    1726                 :            : 
    1727                 :            : static inline void set_ena_admin_host_info_major(struct ena_admin_host_info *p, uint32_t val)
    1728                 :            : {
    1729                 :            :         p->driver_version |= val & ENA_ADMIN_HOST_INFO_MAJOR_MASK;
    1730                 :            : }
    1731                 :            : 
    1732                 :            : static inline uint32_t get_ena_admin_host_info_minor(const struct ena_admin_host_info *p)
    1733                 :            : {
    1734                 :            :         return (p->driver_version & ENA_ADMIN_HOST_INFO_MINOR_MASK) >> ENA_ADMIN_HOST_INFO_MINOR_SHIFT;
    1735                 :            : }
    1736                 :            : 
    1737                 :            : static inline void set_ena_admin_host_info_minor(struct ena_admin_host_info *p, uint32_t val)
    1738                 :            : {
    1739                 :            :         p->driver_version |= (val << ENA_ADMIN_HOST_INFO_MINOR_SHIFT) & ENA_ADMIN_HOST_INFO_MINOR_MASK;
    1740                 :            : }
    1741                 :            : 
    1742                 :            : static inline uint32_t get_ena_admin_host_info_sub_minor(const struct ena_admin_host_info *p)
    1743                 :            : {
    1744                 :            :         return (p->driver_version & ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK) >> ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT;
    1745                 :            : }
    1746                 :            : 
    1747                 :            : static inline void set_ena_admin_host_info_sub_minor(struct ena_admin_host_info *p, uint32_t val)
    1748                 :            : {
    1749                 :            :         p->driver_version |= (val << ENA_ADMIN_HOST_INFO_SUB_MINOR_SHIFT) & ENA_ADMIN_HOST_INFO_SUB_MINOR_MASK;
    1750                 :            : }
    1751                 :            : 
    1752                 :            : static inline uint32_t get_ena_admin_host_info_module_type(const struct ena_admin_host_info *p)
    1753                 :            : {
    1754                 :            :         return (p->driver_version & ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK) >> ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT;
    1755                 :            : }
    1756                 :            : 
    1757                 :            : static inline void set_ena_admin_host_info_module_type(struct ena_admin_host_info *p, uint32_t val)
    1758                 :            : {
    1759                 :            :         p->driver_version |= (val << ENA_ADMIN_HOST_INFO_MODULE_TYPE_SHIFT) & ENA_ADMIN_HOST_INFO_MODULE_TYPE_MASK;
    1760                 :            : }
    1761                 :            : 
    1762                 :            : static inline uint16_t get_ena_admin_host_info_function(const struct ena_admin_host_info *p)
    1763                 :            : {
    1764                 :            :         return p->bdf & ENA_ADMIN_HOST_INFO_FUNCTION_MASK;
    1765                 :            : }
    1766                 :            : 
    1767                 :            : static inline void set_ena_admin_host_info_function(struct ena_admin_host_info *p, uint16_t val)
    1768                 :            : {
    1769                 :            :         p->bdf |= val & ENA_ADMIN_HOST_INFO_FUNCTION_MASK;
    1770                 :            : }
    1771                 :            : 
    1772                 :            : static inline uint16_t get_ena_admin_host_info_device(const struct ena_admin_host_info *p)
    1773                 :            : {
    1774                 :            :         return (p->bdf & ENA_ADMIN_HOST_INFO_DEVICE_MASK) >> ENA_ADMIN_HOST_INFO_DEVICE_SHIFT;
    1775                 :            : }
    1776                 :            : 
    1777                 :            : static inline void set_ena_admin_host_info_device(struct ena_admin_host_info *p, uint16_t val)
    1778                 :            : {
    1779                 :            :         p->bdf |= (val << ENA_ADMIN_HOST_INFO_DEVICE_SHIFT) & ENA_ADMIN_HOST_INFO_DEVICE_MASK;
    1780                 :            : }
    1781                 :            : 
    1782                 :            : static inline uint16_t get_ena_admin_host_info_bus(const struct ena_admin_host_info *p)
    1783                 :            : {
    1784                 :            :         return (p->bdf & ENA_ADMIN_HOST_INFO_BUS_MASK) >> ENA_ADMIN_HOST_INFO_BUS_SHIFT;
    1785                 :            : }
    1786                 :            : 
    1787                 :            : static inline void set_ena_admin_host_info_bus(struct ena_admin_host_info *p, uint16_t val)
    1788                 :            : {
    1789                 :            :         p->bdf |= (val << ENA_ADMIN_HOST_INFO_BUS_SHIFT) & ENA_ADMIN_HOST_INFO_BUS_MASK;
    1790                 :            : }
    1791                 :            : 
    1792                 :            : static inline uint32_t get_ena_admin_host_info_rx_offset(const struct ena_admin_host_info *p)
    1793                 :            : {
    1794                 :            :         return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK) >> ENA_ADMIN_HOST_INFO_RX_OFFSET_SHIFT;
    1795                 :            : }
    1796                 :            : 
    1797                 :            : static inline void set_ena_admin_host_info_rx_offset(struct ena_admin_host_info *p, uint32_t val)
    1798                 :            : {
    1799                 :            :         p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RX_OFFSET_SHIFT) & ENA_ADMIN_HOST_INFO_RX_OFFSET_MASK;
    1800                 :            : }
    1801                 :            : 
    1802                 :            : static inline uint32_t get_ena_admin_host_info_interrupt_moderation(const struct ena_admin_host_info *p)
    1803                 :            : {
    1804                 :            :         return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK) >> ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT;
    1805                 :            : }
    1806                 :            : 
    1807                 :            : static inline void set_ena_admin_host_info_interrupt_moderation(struct ena_admin_host_info *p, uint32_t val)
    1808                 :            : {
    1809                 :            :         p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_SHIFT) & ENA_ADMIN_HOST_INFO_INTERRUPT_MODERATION_MASK;
    1810                 :            : }
    1811                 :            : 
    1812                 :            : static inline uint32_t get_ena_admin_host_info_rx_buf_mirroring(const struct ena_admin_host_info *p)
    1813                 :            : {
    1814                 :            :         return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_MASK) >> ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_SHIFT;
    1815                 :            : }
    1816                 :            : 
    1817                 :            : static inline void set_ena_admin_host_info_rx_buf_mirroring(struct ena_admin_host_info *p, uint32_t val)
    1818                 :            : {
    1819                 :            :         p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_SHIFT) & ENA_ADMIN_HOST_INFO_RX_BUF_MIRRORING_MASK;
    1820                 :            : }
    1821                 :            : 
    1822                 :            : static inline uint32_t get_ena_admin_host_info_rss_configurable_function_key(const struct ena_admin_host_info *p)
    1823                 :            : {
    1824                 :            :         return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_MASK) >> ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_SHIFT;
    1825                 :            : }
    1826                 :            : 
    1827                 :            : static inline void set_ena_admin_host_info_rss_configurable_function_key(struct ena_admin_host_info *p, uint32_t val)
    1828                 :            : {
    1829                 :            :         p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_SHIFT) & ENA_ADMIN_HOST_INFO_RSS_CONFIGURABLE_FUNCTION_KEY_MASK;
    1830                 :            : }
    1831                 :            : 
    1832                 :            : static inline uint32_t get_ena_admin_host_info_rx_page_reuse(const struct ena_admin_host_info *p)
    1833                 :            : {
    1834                 :            :         return (p->driver_supported_features & ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_MASK) >>
    1835                 :            :                         ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_SHIFT;
    1836                 :            : }
    1837                 :            : 
    1838                 :            : static inline void set_ena_admin_host_info_rx_page_reuse(struct ena_admin_host_info *p,
    1839                 :            :                                                                     uint32_t val)
    1840                 :            : {
    1841                 :            :         p->driver_supported_features |= (val << ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_SHIFT) &
    1842                 :            :                         ENA_ADMIN_HOST_INFO_RX_PAGE_REUSE_MASK;
    1843                 :            : }
    1844                 :            : 
    1845                 :            : static inline uint8_t get_ena_admin_feature_rss_ind_table_one_entry_update(const struct ena_admin_feature_rss_ind_table *p)
    1846                 :            : {
    1847                 :            :         return p->flags & ENA_ADMIN_FEATURE_RSS_IND_TABLE_ONE_ENTRY_UPDATE_MASK;
    1848                 :            : }
    1849                 :            : 
    1850                 :            : static inline void set_ena_admin_feature_rss_ind_table_one_entry_update(struct ena_admin_feature_rss_ind_table *p, uint8_t val)
    1851                 :            : {
    1852                 :            :         p->flags |= val & ENA_ADMIN_FEATURE_RSS_IND_TABLE_ONE_ENTRY_UPDATE_MASK;
    1853                 :            : }
    1854                 :            : 
    1855                 :            : static inline uint8_t get_ena_admin_aenq_common_desc_phase(const struct ena_admin_aenq_common_desc *p)
    1856                 :            : {
    1857                 :            :         return p->flags & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK;
    1858                 :            : }
    1859                 :            : 
    1860                 :            : static inline void set_ena_admin_aenq_common_desc_phase(struct ena_admin_aenq_common_desc *p, uint8_t val)
    1861                 :            : {
    1862                 :            :         p->flags |= val & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK;
    1863                 :            : }
    1864                 :            : 
    1865                 :            : static inline uint32_t get_ena_admin_aenq_link_change_desc_link_status(const struct ena_admin_aenq_link_change_desc *p)
    1866                 :            : {
    1867                 :          0 :         return p->flags & ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK;
    1868                 :            : }
    1869                 :            : 
    1870                 :            : static inline void set_ena_admin_aenq_link_change_desc_link_status(struct ena_admin_aenq_link_change_desc *p, uint32_t val)
    1871                 :            : {
    1872                 :            :         p->flags |= val & ENA_ADMIN_AENQ_LINK_CHANGE_DESC_LINK_STATUS_MASK;
    1873                 :            : }
    1874                 :            : 
    1875                 :            : #endif /* !defined(DEFS_LINUX_MAINLINE) */
    1876                 :            : #endif /* _ENA_ADMIN_H_ */

Generated by: LCOV version 1.14