LCOV - code coverage report
Current view: top level - drivers/net/intel/iavf - iavf.h (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 4 0.0 %
Date: 2026-06-01 18:36:17 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) 2017 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #ifndef _IAVF_ETHDEV_H_
       6                 :            : #define _IAVF_ETHDEV_H_
       7                 :            : 
       8                 :            : #include <sys/queue.h>
       9                 :            : 
      10                 :            : #include <rte_kvargs.h>
      11                 :            : #include <rte_tm_driver.h>
      12                 :            : 
      13                 :            : #include <iavf_prototype.h>
      14                 :            : #include <iavf_adminq_cmd.h>
      15                 :            : #include <iavf_type.h>
      16                 :            : 
      17                 :            : #include "iavf_log.h"
      18                 :            : #include "rte_pmd_iavf.h"
      19                 :            : 
      20                 :            : #define IAVF_AQ_LEN               32
      21                 :            : #define IAVF_AQ_BUF_SZ            4096
      22                 :            : #define IAVF_RESET_WAIT_CNT       2000
      23                 :            : #define IAVF_RESET_DETECTED_CNT   500
      24                 :            : #define IAVF_BUF_SIZE_MIN         1024
      25                 :            : #define IAVF_FRAME_SIZE_MAX       9728
      26                 :            : #define IAVF_QUEUE_BASE_ADDR_UNIT 128
      27                 :            : 
      28                 :            : #define IAVF_MAX_NUM_QUEUES_DFLT         16
      29                 :            : #define IAVF_MAX_NUM_QUEUES_LV           256
      30                 :            : #define IAVF_CFG_Q_NUM_PER_BUF           32
      31                 :            : #define IAVF_IRQ_MAP_NUM_PER_BUF         128
      32                 :            : #define IAVF_RXTX_QUEUE_CHUNKS_NUM       2
      33                 :            : 
      34                 :            : #define IAVF_NUM_MACADDR_MAX      64
      35                 :            : 
      36                 :            : #define IAVF_DEV_WATCHDOG_PERIOD     2000 /* microseconds, set 0 to disable*/
      37                 :            : 
      38                 :            : #define IAVF_DEFAULT_RX_PTHRESH      8
      39                 :            : #define IAVF_DEFAULT_RX_HTHRESH      8
      40                 :            : #define IAVF_DEFAULT_RX_WTHRESH      0
      41                 :            : 
      42                 :            : #define IAVF_DEFAULT_RX_FREE_THRESH  32
      43                 :            : 
      44                 :            : #define IAVF_DEFAULT_TX_PTHRESH      32
      45                 :            : #define IAVF_DEFAULT_TX_HTHRESH      0
      46                 :            : #define IAVF_DEFAULT_TX_WTHRESH      0
      47                 :            : 
      48                 :            : #define IAVF_DEFAULT_TX_FREE_THRESH  32
      49                 :            : #define IAVF_DEFAULT_TX_RS_THRESH 32
      50                 :            : 
      51                 :            : #define IAVF_BASIC_OFFLOAD_CAPS  ( \
      52                 :            :         VF_BASE_MODE_OFFLOADS | \
      53                 :            :         VIRTCHNL_VF_OFFLOAD_WB_ON_ITR | \
      54                 :            :         VIRTCHNL_VF_OFFLOAD_RX_POLLING)
      55                 :            : 
      56                 :            : #define IAVF_RSS_OFFLOAD_ALL ( \
      57                 :            :         RTE_ETH_RSS_IPV4 | \
      58                 :            :         RTE_ETH_RSS_FRAG_IPV4 |         \
      59                 :            :         RTE_ETH_RSS_NONFRAG_IPV4_TCP |  \
      60                 :            :         RTE_ETH_RSS_NONFRAG_IPV4_UDP |  \
      61                 :            :         RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \
      62                 :            :         RTE_ETH_RSS_NONFRAG_IPV4_OTHER | \
      63                 :            :         RTE_ETH_RSS_IPV6 | \
      64                 :            :         RTE_ETH_RSS_FRAG_IPV6 | \
      65                 :            :         RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
      66                 :            :         RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
      67                 :            :         RTE_ETH_RSS_NONFRAG_IPV6_SCTP | \
      68                 :            :         RTE_ETH_RSS_NONFRAG_IPV6_OTHER)
      69                 :            : 
      70                 :            : #define IAVF_MISC_VEC_ID                RTE_INTR_VEC_ZERO_OFFSET
      71                 :            : #define IAVF_RX_VEC_START               RTE_INTR_VEC_RXTX_OFFSET
      72                 :            : 
      73                 :            : /* Default queue interrupt throttling time in microseconds */
      74                 :            : #define IAVF_ITR_INDEX_DEFAULT          0
      75                 :            : #define IAVF_QUEUE_ITR_INTERVAL_DEFAULT 32 /* 32 us */
      76                 :            : #define IAVF_QUEUE_ITR_INTERVAL_MAX     8160 /* 8160 us */
      77                 :            : 
      78                 :            : #define IAVF_ALARM_INTERVAL 50000 /* us */
      79                 :            : #define IAVF_PHC_SYNC_ALARM_INTERVAL_US 200000
      80                 :            : 
      81                 :            : /* The overhead from MTU to max frame size.
      82                 :            :  * Considering QinQ packet, the VLAN tag needs to be counted twice.
      83                 :            :  */
      84                 :            : #define IAVF_ETH_OVERHEAD \
      85                 :            :         (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + RTE_VLAN_HLEN * 2)
      86                 :            : #define IAVF_ETH_MAX_LEN (RTE_ETHER_MTU + IAVF_ETH_OVERHEAD)
      87                 :            : 
      88                 :            : #define IAVF_32_BIT_WIDTH (CHAR_BIT * 4)
      89                 :            : #define IAVF_48_BIT_WIDTH (CHAR_BIT * 6)
      90                 :            : #define IAVF_48_BIT_MASK  RTE_LEN2MASK(IAVF_48_BIT_WIDTH, uint64_t)
      91                 :            : 
      92                 :            : #define IAVF_RX_DESC_EXT_STATUS_FLEXBH_MASK  0x03
      93                 :            : #define IAVF_RX_DESC_EXT_STATUS_FLEXBH_FD_ID 0x01
      94                 :            : 
      95                 :            : #define IAVF_BITS_PER_BYTE 8
      96                 :            : 
      97                 :            : #define IAVF_VLAN_TAG_PCP_OFFSET 13
      98                 :            : 
      99                 :            : #define IAVF_L2TPV2_FLAGS_LEN   0x4000
     100                 :            : 
     101                 :            : struct iavf_adapter;
     102                 :            : struct ci_rx_queue;
     103                 :            : struct ci_tx_queue;
     104                 :            : 
     105                 :            : 
     106                 :            : struct iavf_ipsec_crypto_stats {
     107                 :            :         uint64_t icount;
     108                 :            :         uint64_t ibytes;
     109                 :            :         struct {
     110                 :            :                 uint64_t count;
     111                 :            :                 uint64_t sad_miss;
     112                 :            :                 uint64_t not_processed;
     113                 :            :                 uint64_t icv_check;
     114                 :            :                 uint64_t ipsec_length;
     115                 :            :                 uint64_t misc;
     116                 :            :         } ierrors;
     117                 :            : };
     118                 :            : 
     119                 :            : struct iavf_mbuf_stats {
     120                 :            :         uint64_t tx_pkt_errors;
     121                 :            : };
     122                 :            : 
     123                 :            : struct iavf_eth_xstats {
     124                 :            :         struct virtchnl_eth_stats eth_stats;
     125                 :            :         struct iavf_ipsec_crypto_stats ips_stats;
     126                 :            :         struct iavf_mbuf_stats mbuf_stats;
     127                 :            : };
     128                 :            : 
     129                 :            : /* Structure that defines a VSI, associated with a adapter. */
     130                 :            : struct iavf_vsi {
     131                 :            :         struct iavf_adapter *adapter; /* Backreference to associated adapter */
     132                 :            :         uint16_t vsi_id;
     133                 :            :         uint16_t nb_qps;         /* Number of queue pairs VSI can occupy */
     134                 :            :         uint16_t nb_used_qps;    /* Number of queue pairs VSI uses */
     135                 :            :         uint16_t max_macaddrs;   /* Maximum number of MAC addresses */
     136                 :            :         uint16_t base_vector;
     137                 :            :         uint16_t msix_intr;      /* The MSIX interrupt binds to VSI */
     138                 :            :         struct iavf_eth_xstats eth_stats_offset;
     139                 :            : };
     140                 :            : 
     141                 :            : struct rte_flow;
     142                 :            : TAILQ_HEAD(iavf_flow_list, rte_flow);
     143                 :            : 
     144                 :            : struct iavf_flow_parser_node;
     145                 :            : TAILQ_HEAD(iavf_parser_list, iavf_flow_parser_node);
     146                 :            : 
     147                 :            : struct iavf_fdir_conf {
     148                 :            :         struct virtchnl_fdir_add add_fltr;
     149                 :            :         struct virtchnl_fdir_del del_fltr;
     150                 :            :         uint64_t input_set;
     151                 :            :         uint32_t flow_id;
     152                 :            :         uint32_t mark_flag;
     153                 :            : };
     154                 :            : 
     155                 :            : struct iavf_fdir_info {
     156                 :            :         struct iavf_fdir_conf conf;
     157                 :            : };
     158                 :            : 
     159                 :            : struct iavf_fsub_conf {
     160                 :            :         struct virtchnl_flow_sub sub_fltr;
     161                 :            :         struct virtchnl_flow_unsub unsub_fltr;
     162                 :            :         uint64_t input_set;
     163                 :            :         uint32_t flow_id;
     164                 :            : };
     165                 :            : 
     166                 :            : struct iavf_qv_map {
     167                 :            :         uint16_t queue_id;
     168                 :            :         uint16_t vector_id;
     169                 :            : };
     170                 :            : 
     171                 :            : /* Message type read in admin queue from PF */
     172                 :            : enum iavf_aq_result {
     173                 :            :         IAVF_MSG_ERR = -1, /* Meet error when accessing admin queue */
     174                 :            :         IAVF_MSG_NON,      /* Read nothing from admin queue */
     175                 :            :         IAVF_MSG_SYS,      /* Read system msg from admin queue */
     176                 :            :         IAVF_MSG_CMD,      /* Read async command result */
     177                 :            : };
     178                 :            : 
     179                 :            : /* Struct to store Traffic Manager node configuration. */
     180                 :            : struct iavf_tm_node {
     181                 :            :         TAILQ_ENTRY(iavf_tm_node) node;
     182                 :            :         uint32_t id;
     183                 :            :         uint32_t tc;
     184                 :            :         uint32_t priority;
     185                 :            :         uint32_t weight;
     186                 :            :         uint32_t reference_count;
     187                 :            :         struct iavf_tm_node *parent;
     188                 :            :         struct iavf_tm_shaper_profile *shaper_profile;
     189                 :            :         struct rte_tm_node_params params;
     190                 :            : };
     191                 :            : 
     192                 :            : TAILQ_HEAD(iavf_tm_node_list, iavf_tm_node);
     193                 :            : 
     194                 :            : struct iavf_tm_shaper_profile {
     195                 :            :         TAILQ_ENTRY(iavf_tm_shaper_profile) node;
     196                 :            :         uint32_t shaper_profile_id;
     197                 :            :         uint32_t reference_count;
     198                 :            :         struct rte_tm_shaper_params profile;
     199                 :            : };
     200                 :            : 
     201                 :            : TAILQ_HEAD(iavf_shaper_profile_list, iavf_tm_shaper_profile);
     202                 :            : 
     203                 :            : /* node type of Traffic Manager */
     204                 :            : enum iavf_tm_node_type {
     205                 :            :         IAVF_TM_NODE_TYPE_PORT,
     206                 :            :         IAVF_TM_NODE_TYPE_TC,
     207                 :            :         IAVF_TM_NODE_TYPE_QUEUE,
     208                 :            :         IAVF_TM_NODE_TYPE_MAX,
     209                 :            : };
     210                 :            : 
     211                 :            : /* Struct to store all the Traffic Manager configuration. */
     212                 :            : struct iavf_tm_conf {
     213                 :            :         struct iavf_tm_node *root; /* root node - vf vsi */
     214                 :            :         struct iavf_tm_node_list tc_list; /* node list for all the TCs */
     215                 :            :         struct iavf_tm_node_list queue_list; /* node list for all the queues */
     216                 :            :         struct iavf_shaper_profile_list shaper_profile_list;
     217                 :            :         uint32_t nb_tc_node;
     218                 :            :         uint32_t nb_queue_node;
     219                 :            :         bool committed;
     220                 :            : };
     221                 :            : 
     222                 :            : /* Struct to store queue TC mapping. Queue is continuous in one TC */
     223                 :            : struct iavf_qtc_map {
     224                 :            :         uint8_t tc;
     225                 :            :         uint16_t start_queue_id;
     226                 :            :         uint16_t queue_count;
     227                 :            : };
     228                 :            : 
     229                 :            : /* Structure to store private data specific for VF instance. */
     230                 :            : struct iavf_info {
     231                 :            :         uint16_t num_queue_pairs;
     232                 :            :         uint16_t max_pkt_len; /* Maximum packet length */
     233                 :            :         uint16_t mac_num;     /* Number of MAC addresses */
     234                 :            :         bool promisc_unicast_enabled;
     235                 :            :         bool promisc_multicast_enabled;
     236                 :            : 
     237                 :            :         struct virtchnl_version_info virtchnl_version;
     238                 :            :         struct virtchnl_vf_resource *vf_res; /* VF resource */
     239                 :            :         struct virtchnl_vsi_resource *vsi_res; /* LAN VSI */
     240                 :            :         struct virtchnl_vlan_caps vlan_v2_caps;
     241                 :            :         uint64_t supported_rxdid;
     242                 :            :         uint8_t *proto_xtr; /* proto xtr type for all queues */
     243                 :            :         volatile RTE_ATOMIC(enum virtchnl_ops) pend_cmd; /* pending command not finished */
     244                 :            :         RTE_ATOMIC(uint32_t) pend_cmd_count;
     245                 :            :         int cmd_retval; /* return value of the cmd response from PF */
     246                 :            :         uint8_t aq_resp[IAVF_AQ_BUF_SZ]; /* buffer to store the adminq response from PF */
     247                 :            :         bool aq_intr_enabled;
     248                 :            : 
     249                 :            :         /** iAVF watchdog enable */
     250                 :            :         bool watchdog_enabled;
     251                 :            : 
     252                 :            :         /* Event from pf */
     253                 :            :         bool dev_closed;
     254                 :            :         bool link_up;
     255                 :            :         uint32_t link_speed;
     256                 :            : 
     257                 :            :         /* Multicast addrs */
     258                 :            :         struct rte_ether_addr mc_addrs[IAVF_NUM_MACADDR_MAX];
     259                 :            :         uint16_t mc_addrs_num;   /* Multicast mac addresses number */
     260                 :            : 
     261                 :            :         struct iavf_vsi vsi;
     262                 :            :         bool vf_reset;  /* true for VF reset pending, false for no VF reset */
     263                 :            :         iavf_pre_reset_cb_t pre_reset_cb; /* Pre reset callback function ptr */
     264                 :            :         iavf_post_reset_cb_t post_reset_cb; /* Post reset callback function ptr */
     265                 :            :         void *pre_reset_cb_arg; /* Pre reset callback argument */
     266                 :            :         void *post_reset_cb_arg; /* Post reset callback argument */
     267                 :            :         uint64_t flags;
     268                 :            : 
     269                 :            :         uint8_t *rss_lut;
     270                 :            :         uint8_t *rss_key;
     271                 :            :         uint64_t rss_hf;
     272                 :            :         uint16_t nb_msix;   /* number of MSI-X interrupts on Rx */
     273                 :            :         uint16_t msix_base; /* msix vector base from */
     274                 :            :         uint16_t max_rss_qregion; /* max RSS queue region supported by PF */
     275                 :            :         struct iavf_qv_map *qv_map; /* queue vector mapping */
     276                 :            :         struct iavf_flow_list flow_list;
     277                 :            :         rte_spinlock_t flow_ops_lock;
     278                 :            :         rte_spinlock_t aq_lock;
     279                 :            :         struct iavf_parser_list rss_parser_list;
     280                 :            :         struct iavf_parser_list dist_parser_list;
     281                 :            :         struct iavf_parser_list ipsec_crypto_parser_list;
     282                 :            : 
     283                 :            :         struct iavf_fdir_info fdir; /* flow director info */
     284                 :            :         /* indicate large VF support enabled or not */
     285                 :            :         bool lv_enabled;
     286                 :            : 
     287                 :            :         struct virtchnl_qos_cap_list *qos_cap;
     288                 :            :         struct iavf_qtc_map *qtc_map;
     289                 :            :         struct iavf_tm_conf tm_conf;
     290                 :            : 
     291                 :            :         struct rte_eth_dev *eth_dev;
     292                 :            : 
     293                 :            :         bool in_reset_recovery;
     294                 :            : 
     295                 :            :         uint32_t ptp_caps;
     296                 :            :         rte_spinlock_t phc_time_aq_lock;
     297                 :            : };
     298                 :            : 
     299                 :            : #define IAVF_MAX_PKT_TYPE 1024
     300                 :            : 
     301                 :            : #define IAVF_MAX_QUEUE_NUM  2048
     302                 :            : 
     303                 :            : enum iavf_proto_xtr_type {
     304                 :            :         IAVF_PROTO_XTR_NONE,
     305                 :            :         IAVF_PROTO_XTR_VLAN,
     306                 :            :         IAVF_PROTO_XTR_IPV4,
     307                 :            :         IAVF_PROTO_XTR_IPV6,
     308                 :            :         IAVF_PROTO_XTR_IPV6_FLOW,
     309                 :            :         IAVF_PROTO_XTR_TCP,
     310                 :            :         IAVF_PROTO_XTR_IP_OFFSET,
     311                 :            :         IAVF_PROTO_XTR_IPSEC_CRYPTO_SAID,
     312                 :            :         IAVF_PROTO_XTR_MAX,
     313                 :            : };
     314                 :            : 
     315                 :            : /**
     316                 :            :  * Cache devargs parse result.
     317                 :            :  */
     318                 :            : struct iavf_devargs {
     319                 :            :         uint8_t proto_xtr_dflt;
     320                 :            :         uint8_t proto_xtr[IAVF_MAX_QUEUE_NUM];
     321                 :            :         uint16_t quanta_size;
     322                 :            :         uint32_t watchdog_period;
     323                 :            :         int auto_reset;
     324                 :            :         int auto_reconfig;
     325                 :            :         int no_poll_on_link_down;
     326                 :            :         uint64_t mbuf_check;
     327                 :            :         int enable_ptype_lldp;
     328                 :            : };
     329                 :            : 
     330                 :            : struct iavf_security_ctx;
     331                 :            : 
     332                 :            : enum iavf_rx_func_type {
     333                 :            :         IAVF_RX_DISABLED,
     334                 :            :         IAVF_RX_DEFAULT,
     335                 :            :         IAVF_RX_SCATTERED,
     336                 :            :         IAVF_RX_FLEX_RXD,
     337                 :            :         IAVF_RX_SCATTERED_FLEX_RXD,
     338                 :            :         IAVF_RX_BULK_ALLOC,
     339                 :            :         IAVF_RX_BULK_ALLOC_FLEX_RXD,
     340                 :            :         IAVF_RX_NEON,
     341                 :            :         IAVF_RX_NEON_SCATTERED,
     342                 :            :         IAVF_RX_NEON_FLEX_RXD,
     343                 :            :         IAVF_RX_NEON_SCATTERED_FLEX_RXD,
     344                 :            :         IAVF_RX_AVX2,
     345                 :            :         IAVF_RX_AVX2_SCATTERED,
     346                 :            :         IAVF_RX_AVX2_OFFLOAD,
     347                 :            :         IAVF_RX_AVX2_SCATTERED_OFFLOAD,
     348                 :            :         IAVF_RX_AVX2_FLEX_RXD,
     349                 :            :         IAVF_RX_AVX2_SCATTERED_FLEX_RXD,
     350                 :            :         IAVF_RX_AVX2_FLEX_RXD_OFFLOAD,
     351                 :            :         IAVF_RX_AVX2_SCATTERED_FLEX_RXD_OFFLOAD,
     352                 :            :         IAVF_RX_AVX512,
     353                 :            :         IAVF_RX_AVX512_SCATTERED,
     354                 :            :         IAVF_RX_AVX512_OFFLOAD,
     355                 :            :         IAVF_RX_AVX512_SCATTERED_OFFLOAD,
     356                 :            :         IAVF_RX_AVX512_FLEX_RXD,
     357                 :            :         IAVF_RX_AVX512_SCATTERED_FLEX_RXD,
     358                 :            :         IAVF_RX_AVX512_FLEX_RXD_OFFLOAD,
     359                 :            :         IAVF_RX_AVX512_SCATTERED_FLEX_RXD_OFFLOAD,
     360                 :            : };
     361                 :            : 
     362                 :            : enum iavf_tx_func_type {
     363                 :            :         IAVF_TX_DISABLED,
     364                 :            :         IAVF_TX_DEFAULT,
     365                 :            :         IAVF_TX_NEON,
     366                 :            :         IAVF_TX_AVX2,
     367                 :            :         IAVF_TX_AVX2_OFFLOAD,
     368                 :            :         IAVF_TX_AVX2_CTX,
     369                 :            :         IAVF_TX_AVX2_CTX_OFFLOAD,
     370                 :            :         IAVF_TX_AVX512,
     371                 :            :         IAVF_TX_AVX512_OFFLOAD,
     372                 :            :         IAVF_TX_AVX512_CTX,
     373                 :            :         IAVF_TX_AVX512_CTX_OFFLOAD,
     374                 :            : };
     375                 :            : 
     376                 :            : #define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
     377                 :            : #define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
     378                 :            : #define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
     379                 :            : #define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
     380                 :            : 
     381                 :            : /* Structure to store private data for each VF instance. */
     382                 :            : struct iavf_adapter {
     383                 :            :         struct iavf_hw hw;
     384                 :            :         struct rte_eth_dev_data *dev_data;
     385                 :            :         struct iavf_info vf;
     386                 :            :         struct iavf_security_ctx *security_ctx;
     387                 :            : 
     388                 :            :         bool rx_bulk_alloc_allowed;
     389                 :            :         alignas(RTE_CACHE_LINE_MIN_SIZE) uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE];
     390                 :            :         bool stopped;
     391                 :            :         bool closed;
     392                 :            :         bool no_poll;
     393                 :            :         enum iavf_rx_func_type rx_func_type;
     394                 :            :         enum iavf_tx_func_type tx_func_type;
     395                 :            :         uint16_t fdir_ref_cnt;
     396                 :            :         rte_spinlock_t phc_sync_lock;
     397                 :            :         uint8_t phc_sync_ticks;
     398                 :            :         bool phc_sync_paused;
     399                 :            :         struct iavf_devargs devargs;
     400                 :            :         bool mac_primary_set;
     401                 :            :         uint16_t tpid;  /* VLAN tag identifier */
     402                 :            : };
     403                 :            : 
     404                 :            : /* IAVF_DEV_PRIVATE_TO */
     405                 :            : #define IAVF_DEV_PRIVATE_TO_ADAPTER(adapter) \
     406                 :            :         ((struct iavf_adapter *)adapter)
     407                 :            : #define IAVF_DEV_PRIVATE_TO_VF(adapter) \
     408                 :            :         (&((struct iavf_adapter *)adapter)->vf)
     409                 :            : #define IAVF_DEV_PRIVATE_TO_HW(adapter) \
     410                 :            :         (&((struct iavf_adapter *)adapter)->hw)
     411                 :            : #define IAVF_DEV_PRIVATE_TO_IAVF_SECURITY_CTX(adapter) \
     412                 :            :         (((struct iavf_adapter *)adapter)->security_ctx)
     413                 :            : 
     414                 :            : /* IAVF_VSI_TO */
     415                 :            : #define IAVF_VSI_TO_HW(vsi) \
     416                 :            :         (&(((struct iavf_vsi *)vsi)->adapter->hw))
     417                 :            : #define IAVF_VSI_TO_VF(vsi) \
     418                 :            :         (&(((struct iavf_vsi *)vsi)->adapter->vf))
     419                 :            : 
     420                 :            : static inline void
     421                 :            : iavf_init_adminq_parameter(struct iavf_hw *hw)
     422                 :            : {
     423                 :          0 :         hw->aq.num_arq_entries = IAVF_AQ_LEN;
     424                 :          0 :         hw->aq.num_asq_entries = IAVF_AQ_LEN;
     425                 :          0 :         hw->aq.arq_buf_size = IAVF_AQ_BUF_SZ;
     426                 :          0 :         hw->aq.asq_buf_size = IAVF_AQ_BUF_SZ;
     427                 :            : }
     428                 :            : 
     429                 :            : static inline uint16_t
     430                 :            : iavf_calc_itr_interval(int16_t interval)
     431                 :            : {
     432                 :            :         if (interval < 0 || interval > IAVF_QUEUE_ITR_INTERVAL_MAX)
     433                 :            :                 interval = IAVF_QUEUE_ITR_INTERVAL_DEFAULT;
     434                 :            : 
     435                 :            :         /* Convert to hardware count, as writing each 1 represents 2 us */
     436                 :            :         return interval / 2;
     437                 :            : }
     438                 :            : 
     439                 :            : /* structure used for sending and checking response of virtchnl ops */
     440                 :            : struct iavf_cmd_info {
     441                 :            :         enum virtchnl_ops ops;
     442                 :            :         uint8_t *in_args;       /* buffer for sending */
     443                 :            :         uint32_t in_args_size;  /* buffer size for sending */
     444                 :            :         uint8_t *out_buffer;    /* buffer for response */
     445                 :            :         uint32_t out_size;      /* buffer size for response */
     446                 :            : };
     447                 :            : 
     448                 :            : int iavf_check_api_version(struct iavf_adapter *adapter);
     449                 :            : int iavf_get_vf_resource(struct iavf_adapter *adapter);
     450                 :            : void iavf_dev_event_post(struct rte_eth_dev *dev,
     451                 :            :                 enum rte_eth_event_type event,
     452                 :            :                 void *param, size_t param_alloc_size);
     453                 :            : void iavf_dev_event_handler_fini(void);
     454                 :            : int iavf_dev_event_handler_init(void);
     455                 :            : void iavf_handle_virtchnl_msg(struct rte_eth_dev *dev);
     456                 :            : int iavf_enable_vlan_strip(struct iavf_adapter *adapter);
     457                 :            : int iavf_disable_vlan_strip(struct iavf_adapter *adapter);
     458                 :            : int iavf_switch_queue(struct iavf_adapter *adapter, uint16_t qid,
     459                 :            :                      bool rx, bool on);
     460                 :            : int iavf_switch_queue_lv(struct iavf_adapter *adapter, uint16_t qid,
     461                 :            :                      bool rx, bool on);
     462                 :            : int iavf_enable_queues(struct iavf_adapter *adapter);
     463                 :            : int iavf_enable_queues_lv(struct iavf_adapter *adapter);
     464                 :            : int iavf_disable_queues(struct iavf_adapter *adapter);
     465                 :            : int iavf_disable_queues_lv(struct iavf_adapter *adapter);
     466                 :            : int iavf_configure_rss_lut(struct iavf_adapter *adapter);
     467                 :            : int iavf_configure_rss_key(struct iavf_adapter *adapter);
     468                 :            : int iavf_configure_queues(struct iavf_adapter *adapter, uint16_t num_queue_pairs);
     469                 :            : int iavf_get_supported_rxdid(struct iavf_adapter *adapter);
     470                 :            : int iavf_config_vlan_strip_v2(struct iavf_adapter *adapter, bool enable);
     471                 :            : int iavf_config_outer_vlan_strip_v2(struct iavf_adapter *adapter, bool enable);
     472                 :            : int iavf_config_vlan_insert_v2(struct iavf_adapter *adapter, bool enable);
     473                 :            : int iavf_config_outer_vlan_insert_v2(struct iavf_adapter *adapter, bool enable);
     474                 :            : int iavf_add_del_vlan_v2(struct iavf_adapter *adapter, uint16_t vlanid,
     475                 :            :                          bool add);
     476                 :            : int iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter);
     477                 :            : int iavf_config_irq_map(struct iavf_adapter *adapter);
     478                 :            : int iavf_config_irq_map_lv(struct iavf_adapter *adapter, uint16_t num);
     479                 :            : void iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add);
     480                 :            : int iavf_dev_link_update(struct rte_eth_dev *dev,
     481                 :            :                         __rte_unused int wait_to_complete);
     482                 :            : void iavf_dev_alarm_handler(void *param);
     483                 :            : void iavf_phc_sync_alarm_start(struct rte_eth_dev *dev);
     484                 :            : void iavf_phc_sync_alarm_stop(struct rte_eth_dev *dev);
     485                 :            : int iavf_query_stats(struct iavf_adapter *adapter,
     486                 :            :                     struct virtchnl_eth_stats *pstats);
     487                 :            : int iavf_config_promisc(struct iavf_adapter *adapter, bool enable_unicast,
     488                 :            :                        bool enable_multicast);
     489                 :            : int iavf_add_del_eth_addr(struct iavf_adapter *adapter,
     490                 :            :                          struct rte_ether_addr *addr, bool add, uint8_t type);
     491                 :            : int iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add);
     492                 :            : int iavf_fdir_add(struct iavf_adapter *adapter, struct iavf_fdir_conf *filter);
     493                 :            : int iavf_fdir_del(struct iavf_adapter *adapter, struct iavf_fdir_conf *filter);
     494                 :            : int iavf_fdir_check(struct iavf_adapter *adapter,
     495                 :            :                 struct iavf_fdir_conf *filter);
     496                 :            : int iavf_add_del_rss_cfg(struct iavf_adapter *adapter,
     497                 :            :                          struct virtchnl_rss_cfg *rss_cfg, bool add);
     498                 :            : int iavf_get_hena_caps(struct iavf_adapter *adapter, uint64_t *caps);
     499                 :            : int iavf_set_hena(struct iavf_adapter *adapter, uint64_t hena);
     500                 :            : int iavf_rss_hash_set(struct iavf_adapter *ad, uint64_t rss_hf, bool add);
     501                 :            : int iavf_add_del_mc_addr_list(struct iavf_adapter *adapter,
     502                 :            :                         struct rte_ether_addr *mc_addrs,
     503                 :            :                         uint32_t mc_addrs_num, bool add);
     504                 :            : int iavf_request_queues(struct rte_eth_dev *dev, uint16_t num);
     505                 :            : int iavf_get_max_rss_queue_region(struct iavf_adapter *adapter);
     506                 :            : int iavf_get_qos_cap(struct iavf_adapter *adapter);
     507                 :            : int iavf_set_q_bw(struct rte_eth_dev *dev,
     508                 :            :                   struct virtchnl_queues_bw_cfg *q_bw, uint16_t size);
     509                 :            : int iavf_set_q_tc_map(struct rte_eth_dev *dev,
     510                 :            :                         struct virtchnl_queue_tc_mapping *q_tc_mapping,
     511                 :            :                         uint16_t size);
     512                 :            : int iavf_set_vf_quanta_size(struct iavf_adapter *adapter, u16 start_queue_id,
     513                 :            :                             u16 num_queues);
     514                 :            : void iavf_tm_conf_init(struct rte_eth_dev *dev);
     515                 :            : void iavf_tm_conf_uninit(struct rte_eth_dev *dev);
     516                 :            : int iavf_ipsec_crypto_request(struct iavf_adapter *adapter,
     517                 :            :                 uint8_t *msg, size_t msg_len,
     518                 :            :                 uint8_t *resp_msg, size_t resp_msg_len);
     519                 :            : extern const struct rte_tm_ops iavf_tm_ops;
     520                 :            : int iavf_get_ptp_cap(struct iavf_adapter *adapter);
     521                 :            : int iavf_get_phc_time(struct ci_rx_queue *rxq);
     522                 :            : int iavf_flow_sub(struct iavf_adapter *adapter,
     523                 :            :                   struct iavf_fsub_conf *filter);
     524                 :            : int iavf_flow_unsub(struct iavf_adapter *adapter,
     525                 :            :                     struct iavf_fsub_conf *filter);
     526                 :            : int iavf_flow_sub_check(struct iavf_adapter *adapter,
     527                 :            :                         struct iavf_fsub_conf *filter);
     528                 :            : void iavf_dev_watchdog_enable(struct iavf_adapter *adapter);
     529                 :            : void iavf_dev_watchdog_disable(struct iavf_adapter *adapter);
     530                 :            : void iavf_handle_hw_reset(struct rte_eth_dev *dev, bool vf_initiated_reset);
     531                 :            : void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change);
     532                 :            : bool is_iavf_supported(struct rte_eth_dev *dev);
     533                 :            : void iavf_hash_uninit(struct iavf_adapter *ad);
     534                 :            : #endif /* _IAVF_ETHDEV_H_ */

Generated by: LCOV version 1.14