net/sfc/base: handle manual and auto filter clashes in EF10
[dpdk.git] / drivers / net / sfc / base / efx_impl.h
index b7eeee7..9755f4d 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2007-2016 Solarflare Communications Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and should not be interpreted as representing official
- * policies, either expressed or implied, of the FreeBSD Project.
+ * Copyright (c) 2007-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #ifndef        _SYS_EFX_IMPL_H
@@ -34,6 +10,9 @@
 #include "efx.h"
 #include "efx_regs.h"
 #include "efx_regs_ef10.h"
+#if EFSYS_OPT_MCDI
+#include "efx_mcdi.h"
+#endif /* EFSYS_OPT_MCDI */
 
 /* FIXME: Add definition for driver generated software events */
 #ifndef        ESE_DZ_EV_CODE_DRV_GEN_EV
 #include "medford_impl.h"
 #endif /* EFSYS_OPT_MEDFORD */
 
-#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+#if EFSYS_OPT_MEDFORD2
+#include "medford2_impl.h"
+#endif /* EFSYS_OPT_MEDFORD2 */
+
+#if EFX_OPTS_EF10()
 #include "ef10_impl.h"
-#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
+#endif /* EFX_OPTS_EF10() */
 
 #ifdef __cplusplus
 extern "C" {
@@ -74,16 +57,21 @@ extern "C" {
 #define        EFX_MOD_MON             0x00000400
 #define        EFX_MOD_FILTER          0x00001000
 #define        EFX_MOD_LIC             0x00002000
+#define        EFX_MOD_TUNNEL          0x00004000
+#define        EFX_MOD_EVB             0x00008000
+#define        EFX_MOD_PROXY           0x00010000
 
 #define        EFX_RESET_PHY           0x00000001
 #define        EFX_RESET_RXQ_ERR       0x00000002
 #define        EFX_RESET_TXQ_ERR       0x00000004
+#define        EFX_RESET_HW_UNAVAIL    0x00000008
 
 typedef enum efx_mac_type_e {
        EFX_MAC_INVALID = 0,
        EFX_MAC_SIENA,
        EFX_MAC_HUNTINGTON,
        EFX_MAC_MEDFORD,
+       EFX_MAC_MEDFORD2,
        EFX_MAC_NTYPES
 } efx_mac_type_t;
 
@@ -135,33 +123,77 @@ typedef struct efx_tx_ops_s {
                                                uint32_t, uint8_t,
                                                efx_desc_t *);
        void            (*etxo_qdesc_tso2_create)(efx_txq_t *, uint16_t,
-                                               uint32_t, uint16_t,
+                                               uint16_t, uint32_t, uint16_t,
                                                efx_desc_t *, int);
        void            (*etxo_qdesc_vlantci_create)(efx_txq_t *, uint16_t,
                                                efx_desc_t *);
+       void            (*etxo_qdesc_checksum_create)(efx_txq_t *, uint16_t,
+                                               efx_desc_t *);
 #if EFSYS_OPT_QSTATS
        void            (*etxo_qstats_update)(efx_txq_t *,
                                              efsys_stat_t *);
 #endif
 } efx_tx_ops_t;
 
+typedef union efx_rxq_type_data_u {
+       struct {
+               size_t          ed_buf_size;
+       } ertd_default;
+#if EFSYS_OPT_RX_PACKED_STREAM
+       struct {
+               uint32_t        eps_buf_size;
+       } ertd_packed_stream;
+#endif
+#if EFSYS_OPT_RX_ES_SUPER_BUFFER
+       struct {
+               uint32_t        eessb_bufs_per_desc;
+               uint32_t        eessb_max_dma_len;
+               uint32_t        eessb_buf_stride;
+               uint32_t        eessb_hol_block_timeout;
+       } ertd_es_super_buffer;
+#endif
+} efx_rxq_type_data_t;
+
 typedef struct efx_rx_ops_s {
        efx_rc_t        (*erxo_init)(efx_nic_t *);
        void            (*erxo_fini)(efx_nic_t *);
 #if EFSYS_OPT_RX_SCATTER
        efx_rc_t        (*erxo_scatter_enable)(efx_nic_t *, unsigned int);
 #endif
+#if EFSYS_OPT_RX_SCALE
+       efx_rc_t        (*erxo_scale_context_alloc)(efx_nic_t *,
+                                                   efx_rx_scale_context_type_t,
+                                                   uint32_t, uint32_t *);
+       efx_rc_t        (*erxo_scale_context_free)(efx_nic_t *, uint32_t);
+       efx_rc_t        (*erxo_scale_mode_set)(efx_nic_t *, uint32_t,
+                                              efx_rx_hash_alg_t,
+                                              efx_rx_hash_type_t, boolean_t);
+       efx_rc_t        (*erxo_scale_key_set)(efx_nic_t *, uint32_t,
+                                             uint8_t *, size_t);
+       efx_rc_t        (*erxo_scale_tbl_set)(efx_nic_t *, uint32_t,
+                                             unsigned int *, size_t);
+       uint32_t        (*erxo_prefix_hash)(efx_nic_t *, efx_rx_hash_alg_t,
+                                           uint8_t *);
+#endif /* EFSYS_OPT_RX_SCALE */
        efx_rc_t        (*erxo_prefix_pktlen)(efx_nic_t *, uint8_t *,
                                              uint16_t *);
        void            (*erxo_qpost)(efx_rxq_t *, efsys_dma_addr_t *, size_t,
                                      unsigned int, unsigned int,
                                      unsigned int);
        void            (*erxo_qpush)(efx_rxq_t *, unsigned int, unsigned int *);
+#if EFSYS_OPT_RX_PACKED_STREAM
+       void            (*erxo_qpush_ps_credits)(efx_rxq_t *);
+       uint8_t *       (*erxo_qps_packet_info)(efx_rxq_t *, uint8_t *,
+                                               uint32_t, uint32_t,
+                                               uint16_t *, uint32_t *, uint32_t *);
+#endif
        efx_rc_t        (*erxo_qflush)(efx_rxq_t *);
        void            (*erxo_qenable)(efx_rxq_t *);
        efx_rc_t        (*erxo_qcreate)(efx_nic_t *enp, unsigned int,
                                        unsigned int, efx_rxq_type_t,
+                                       const efx_rxq_type_data_t *,
                                        efsys_mem_t *, size_t, uint32_t,
+                                       unsigned int,
                                        efx_evq_t *, efx_rxq_t *);
        void            (*erxo_qdestroy)(efx_rxq_t *);
 } efx_rx_ops_t;
@@ -177,8 +209,13 @@ typedef struct efx_mac_ops_s {
        efx_rc_t        (*emo_filter_default_rxq_set)(efx_nic_t *,
                                                      efx_rxq_t *, boolean_t);
        void            (*emo_filter_default_rxq_clear)(efx_nic_t *);
+#if EFSYS_OPT_LOOPBACK
+       efx_rc_t        (*emo_loopback_set)(efx_nic_t *, efx_link_mode_t,
+                                           efx_loopback_type_t);
+#endif /* EFSYS_OPT_LOOPBACK */
 #if EFSYS_OPT_MAC_STATS
        efx_rc_t        (*emo_stats_get_mask)(efx_nic_t *, uint32_t *, size_t);
+       efx_rc_t        (*emo_stats_clear)(efx_nic_t *);
        efx_rc_t        (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *);
        efx_rc_t        (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *,
                                              uint16_t, boolean_t);
@@ -193,6 +230,7 @@ typedef struct efx_phy_ops_s {
        efx_rc_t        (*epo_reconfigure)(efx_nic_t *);
        efx_rc_t        (*epo_verify)(efx_nic_t *);
        efx_rc_t        (*epo_oui_get)(efx_nic_t *, uint32_t *);
+       efx_rc_t        (*epo_link_state_get)(efx_nic_t *, efx_phy_link_state_t *);
 #if EFSYS_OPT_PHY_STATS
        efx_rc_t        (*epo_stats_update)(efx_nic_t *, efsys_mem_t *,
                                            uint32_t *);
@@ -208,14 +246,34 @@ typedef struct efx_phy_ops_s {
 } efx_phy_ops_t;
 
 #if EFSYS_OPT_FILTER
+
+/*
+ * Policy for replacing existing filter when inserting a new one.
+ * Note that all policies allow for storing the new lower priority
+ * filters as overridden by existing higher priority ones. It is needed
+ * to restore the lower priority filters on higher priority ones removal.
+ */
+typedef enum efx_filter_replacement_policy_e {
+       /* Cannot replace existing filter */
+       EFX_FILTER_REPLACEMENT_NEVER,
+       /* Higher priority filters can replace lower priotiry ones */
+       EFX_FILTER_REPLACEMENT_HIGHER_PRIORITY,
+       /*
+        * Higher priority filters can replace lower priority ones and
+        * equal priority filters can replace each other.
+        */
+       EFX_FILTER_REPLACEMENT_HIGHER_OR_EQUAL_PRIORITY,
+} efx_filter_replacement_policy_t;
+
 typedef struct efx_filter_ops_s {
        efx_rc_t        (*efo_init)(efx_nic_t *);
        void            (*efo_fini)(efx_nic_t *);
        efx_rc_t        (*efo_restore)(efx_nic_t *);
        efx_rc_t        (*efo_add)(efx_nic_t *, efx_filter_spec_t *,
-                                  boolean_t may_replace);
+                                  efx_filter_replacement_policy_t policy);
        efx_rc_t        (*efo_delete)(efx_nic_t *, efx_filter_spec_t *);
-       efx_rc_t        (*efo_supported_filters)(efx_nic_t *, uint32_t *, size_t *);
+       efx_rc_t        (*efo_supported_filters)(efx_nic_t *, uint32_t *,
+                                  size_t, size_t *);
        efx_rc_t        (*efo_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t,
                                   boolean_t, boolean_t, boolean_t,
                                   uint8_t const *, uint32_t);
@@ -234,6 +292,12 @@ efx_filter_reconfigure(
 
 #endif /* EFSYS_OPT_FILTER */
 
+#if EFSYS_OPT_TUNNEL
+typedef struct efx_tunnel_ops_s {
+       boolean_t       (*eto_udp_encap_supported)(efx_nic_t *);
+       efx_rc_t        (*eto_reconfigure)(efx_nic_t *);
+} efx_tunnel_ops_t;
+#endif /* EFSYS_OPT_TUNNEL */
 
 typedef struct efx_port_s {
        efx_mac_type_t          ep_mac_type;
@@ -252,6 +316,10 @@ typedef struct efx_port_s {
        uint8_t                 ep_mulcst_addr_list[EFX_MAC_ADDR_LEN *
                                                    EFX_MAC_MULTICAST_LIST_MAX];
        uint32_t                ep_mulcst_addr_count;
+#if EFSYS_OPT_LOOPBACK
+       efx_loopback_type_t     ep_loopback_type;
+       efx_link_mode_t         ep_loopback_link_mode;
+#endif /* EFSYS_OPT_LOOPBACK */
 #if EFSYS_OPT_PHY_FLAGS
        uint32_t                ep_phy_flags;
 #endif /* EFSYS_OPT_PHY_FLAGS */
@@ -265,7 +333,6 @@ typedef struct efx_port_s {
        uint32_t                ep_default_adv_cap_mask;
        uint32_t                ep_phy_cap_mask;
        boolean_t               ep_mac_drain;
-       boolean_t               ep_mac_stats_pending;
 #if EFSYS_OPT_BIST
        efx_bist_type_t         ep_current_bist;
 #endif
@@ -274,6 +341,12 @@ typedef struct efx_port_s {
 } efx_port_t;
 
 typedef struct efx_mon_ops_s {
+#if EFSYS_OPT_MON_STATS
+       efx_rc_t        (*emo_stats_update)(efx_nic_t *, efsys_mem_t *,
+                                           efx_mon_stat_value_t *);
+       efx_rc_t        (*emo_limits_update)(efx_nic_t *,
+                                            efx_mon_stat_limits_t *);
+#endif /* EFSYS_OPT_MON_STATS */
 } efx_mon_ops_t;
 
 typedef struct efx_mon_s {
@@ -310,6 +383,8 @@ typedef struct efx_nic_ops_s {
        efx_rc_t        (*eno_get_vi_pool)(efx_nic_t *, uint32_t *);
        efx_rc_t        (*eno_get_bar_region)(efx_nic_t *, efx_nic_region_t,
                                        uint32_t *, size_t *);
+       boolean_t       (*eno_hw_unavailable)(efx_nic_t *);
+       void            (*eno_set_hw_unavailable)(efx_nic_t *);
 #if EFSYS_OPT_DIAG
        efx_rc_t        (*eno_register_test)(efx_nic_t *);
 #endif /* EFSYS_OPT_DIAG */
@@ -323,12 +398,7 @@ typedef struct efx_nic_ops_s {
 #ifndef EFX_RXQ_LIMIT_TARGET
 #define        EFX_RXQ_LIMIT_TARGET 512
 #endif
-#ifndef EFX_TXQ_DC_SIZE
-#define        EFX_TXQ_DC_SIZE 1 /* 16 descriptors */
-#endif
-#ifndef EFX_RXQ_DC_SIZE
-#define        EFX_RXQ_DC_SIZE 3 /* 64 descriptors */
-#endif
+
 
 #if EFSYS_OPT_FILTER
 
@@ -385,9 +455,9 @@ typedef struct efx_filter_s {
 #if EFSYS_OPT_SIENA
        siena_filter_t          *ef_siena_filter;
 #endif /* EFSYS_OPT_SIENA */
-#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
+#if EFX_OPTS_EF10()
        ef10_filter_table_t     *ef_ef10_filter_table;
-#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
+#endif /* EFX_OPTS_EF10() */
 } efx_filter_t;
 
 #if EFSYS_OPT_SIENA
@@ -403,6 +473,22 @@ siena_filter_tbl_clear(
 
 #if EFSYS_OPT_MCDI
 
+#define        EFX_TUNNEL_MAXNENTRIES  (16)
+
+#if EFSYS_OPT_TUNNEL
+
+typedef struct efx_tunnel_udp_entry_s {
+       uint16_t                        etue_port; /* host/cpu-endian */
+       uint16_t                        etue_protocol;
+} efx_tunnel_udp_entry_t;
+
+typedef struct efx_tunnel_cfg_s {
+       efx_tunnel_udp_entry_t  etc_udp_entries[EFX_TUNNEL_MAXNENTRIES];
+       unsigned int            etc_udp_entries_num;
+} efx_tunnel_cfg_t;
+
+#endif /* EFSYS_OPT_TUNNEL */
+
 typedef struct efx_mcdi_ops_s {
        efx_rc_t        (*emco_init)(efx_nic_t *, const efx_mcdi_transport_t *);
        void            (*emco_send_request)(efx_nic_t *, void *, size_t,
@@ -425,6 +511,239 @@ typedef struct efx_mcdi_s {
 
 #endif /* EFSYS_OPT_MCDI */
 
+#if EFSYS_OPT_NVRAM
+
+/* Invalid partition ID for en_nvram_partn_locked field of efx_nc_t */
+#define        EFX_NVRAM_PARTN_INVALID         (0xffffffffu)
+
+typedef struct efx_nvram_ops_s {
+#if EFSYS_OPT_DIAG
+       efx_rc_t        (*envo_test)(efx_nic_t *);
+#endif /* EFSYS_OPT_DIAG */
+       efx_rc_t        (*envo_type_to_partn)(efx_nic_t *, efx_nvram_type_t,
+                                           uint32_t *);
+       efx_rc_t        (*envo_partn_info)(efx_nic_t *, uint32_t,
+                                           efx_nvram_info_t *);
+       efx_rc_t        (*envo_partn_rw_start)(efx_nic_t *, uint32_t, size_t *);
+       efx_rc_t        (*envo_partn_read)(efx_nic_t *, uint32_t,
+                                           unsigned int, caddr_t, size_t);
+       efx_rc_t        (*envo_partn_read_backup)(efx_nic_t *, uint32_t,
+                                           unsigned int, caddr_t, size_t);
+       efx_rc_t        (*envo_partn_erase)(efx_nic_t *, uint32_t,
+                                           unsigned int, size_t);
+       efx_rc_t        (*envo_partn_write)(efx_nic_t *, uint32_t,
+                                           unsigned int, caddr_t, size_t);
+       efx_rc_t        (*envo_partn_rw_finish)(efx_nic_t *, uint32_t,
+                                           uint32_t *);
+       efx_rc_t        (*envo_partn_get_version)(efx_nic_t *, uint32_t,
+                                           uint32_t *, uint16_t *);
+       efx_rc_t        (*envo_partn_set_version)(efx_nic_t *, uint32_t,
+                                           uint16_t *);
+       efx_rc_t        (*envo_buffer_validate)(uint32_t,
+                                           caddr_t, size_t);
+} efx_nvram_ops_t;
+#endif /* EFSYS_OPT_NVRAM */
+
+#if EFSYS_OPT_VPD
+typedef struct efx_vpd_ops_s {
+       efx_rc_t        (*evpdo_init)(efx_nic_t *);
+       efx_rc_t        (*evpdo_size)(efx_nic_t *, size_t *);
+       efx_rc_t        (*evpdo_read)(efx_nic_t *, caddr_t, size_t);
+       efx_rc_t        (*evpdo_verify)(efx_nic_t *, caddr_t, size_t);
+       efx_rc_t        (*evpdo_reinit)(efx_nic_t *, caddr_t, size_t);
+       efx_rc_t        (*evpdo_get)(efx_nic_t *, caddr_t, size_t,
+                                       efx_vpd_value_t *);
+       efx_rc_t        (*evpdo_set)(efx_nic_t *, caddr_t, size_t,
+                                       efx_vpd_value_t *);
+       efx_rc_t        (*evpdo_next)(efx_nic_t *, caddr_t, size_t,
+                                       efx_vpd_value_t *, unsigned int *);
+       efx_rc_t        (*evpdo_write)(efx_nic_t *, caddr_t, size_t);
+       void            (*evpdo_fini)(efx_nic_t *);
+} efx_vpd_ops_t;
+#endif /* EFSYS_OPT_VPD */
+
+#if EFSYS_OPT_VPD || EFSYS_OPT_NVRAM
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_partitions(
+       __in                    efx_nic_t *enp,
+       __out_bcount(size)      caddr_t data,
+       __in                    size_t size,
+       __out                   unsigned int *npartnp);
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_metadata(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __out                   uint32_t *subtypep,
+       __out_ecount(4)         uint16_t version[4],
+       __out_bcount_opt(size)  char *descp,
+       __in                    size_t size);
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_info(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __out                   efx_nvram_info_t *eni);
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_update_start(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn);
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_read(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __in                    uint32_t offset,
+       __out_bcount(size)      caddr_t data,
+       __in                    size_t size,
+       __in                    uint32_t mode);
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_erase(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __in                    uint32_t offset,
+       __in                    size_t size);
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_write(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __in                    uint32_t offset,
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size);
+
+#define        EFX_NVRAM_UPDATE_FLAGS_BACKGROUND       0x00000001
+#define        EFX_NVRAM_UPDATE_FLAGS_POLL             0x00000002
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_update_finish(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn,
+       __in                    boolean_t reboot,
+       __in                    uint32_t flags,
+       __out_opt               uint32_t *verify_resultp);
+
+#if EFSYS_OPT_DIAG
+
+       __checkReturn           efx_rc_t
+efx_mcdi_nvram_test(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t partn);
+
+#endif /* EFSYS_OPT_DIAG */
+
+#endif /* EFSYS_OPT_VPD || EFSYS_OPT_NVRAM */
+
+#if EFSYS_OPT_LICENSING
+
+typedef struct efx_lic_ops_s {
+       efx_rc_t        (*elo_update_licenses)(efx_nic_t *);
+       efx_rc_t        (*elo_get_key_stats)(efx_nic_t *, efx_key_stats_t *);
+       efx_rc_t        (*elo_app_state)(efx_nic_t *, uint64_t, boolean_t *);
+       efx_rc_t        (*elo_get_id)(efx_nic_t *, size_t, uint32_t *,
+                                     size_t *, uint8_t *);
+       efx_rc_t        (*elo_find_start)
+                               (efx_nic_t *, caddr_t, size_t, uint32_t *);
+       efx_rc_t        (*elo_find_end)(efx_nic_t *, caddr_t, size_t,
+                               uint32_t, uint32_t *);
+       boolean_t       (*elo_find_key)(efx_nic_t *, caddr_t, size_t,
+                               uint32_t, uint32_t *, uint32_t *);
+       boolean_t       (*elo_validate_key)(efx_nic_t *,
+                               caddr_t, uint32_t);
+       efx_rc_t        (*elo_read_key)(efx_nic_t *,
+                               caddr_t, size_t, uint32_t, uint32_t,
+                               caddr_t, size_t, uint32_t *);
+       efx_rc_t        (*elo_write_key)(efx_nic_t *,
+                               caddr_t, size_t, uint32_t,
+                               caddr_t, uint32_t, uint32_t *);
+       efx_rc_t        (*elo_delete_key)(efx_nic_t *,
+                               caddr_t, size_t, uint32_t,
+                               uint32_t, uint32_t, uint32_t *);
+       efx_rc_t        (*elo_create_partition)(efx_nic_t *,
+                               caddr_t, size_t);
+       efx_rc_t        (*elo_finish_partition)(efx_nic_t *,
+                               caddr_t, size_t);
+} efx_lic_ops_t;
+
+#endif
+
+#if EFSYS_OPT_EVB
+
+struct efx_vswitch_s {
+       efx_nic_t               *ev_enp;
+       efx_vswitch_id_t        ev_vswitch_id;
+       uint32_t                ev_num_vports;
+       /*
+        * Vport configuration array: index 0 to store PF configuration
+        * and next ev_num_vports-1 entries hold VFs configuration.
+        */
+       efx_vport_config_t      *ev_evcp;
+};
+
+typedef struct efx_evb_ops_s {
+       efx_rc_t        (*eeo_init)(efx_nic_t *);
+       void            (*eeo_fini)(efx_nic_t *);
+       efx_rc_t        (*eeo_vswitch_alloc)(efx_nic_t *, efx_vswitch_id_t *);
+       efx_rc_t        (*eeo_vswitch_free)(efx_nic_t *, efx_vswitch_id_t);
+       efx_rc_t        (*eeo_vport_alloc)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_type_t, uint16_t,
+                                               boolean_t, efx_vport_id_t *);
+       efx_rc_t        (*eeo_vport_free)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_id_t);
+       efx_rc_t        (*eeo_vport_mac_addr_add)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_id_t, uint8_t *);
+       efx_rc_t        (*eeo_vport_mac_addr_del)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_id_t, uint8_t *);
+       efx_rc_t        (*eeo_vadaptor_alloc)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_id_t);
+       efx_rc_t        (*eeo_vadaptor_free)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_id_t);
+       efx_rc_t        (*eeo_vport_assign)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_id_t, uint32_t);
+       efx_rc_t        (*eeo_vport_reconfigure)(efx_nic_t *, efx_vswitch_id_t,
+                                                       efx_vport_id_t,
+                                                       uint16_t *, uint8_t *,
+                                                       boolean_t *);
+       efx_rc_t        (*eeo_vport_stats)(efx_nic_t *, efx_vswitch_id_t,
+                                               efx_vport_id_t, efsys_mem_t *);
+} efx_evb_ops_t;
+
+extern __checkReturn   boolean_t
+efx_is_zero_eth_addr(
+       __in_bcount(EFX_MAC_ADDR_LEN)   const uint8_t *addrp);
+
+#endif /* EFSYS_OPT_EVB */
+
+#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER
+
+#define        EFX_PROXY_CONFIGURE_MAGIC       0xAB2015EF
+
+
+typedef struct efx_proxy_ops_s {
+       efx_rc_t        (*epo_init)(efx_nic_t *);
+       void            (*epo_fini)(efx_nic_t *);
+       efx_rc_t        (*epo_mc_config)(efx_nic_t *, efsys_mem_t *,
+                                       efsys_mem_t *, efsys_mem_t *,
+                                       uint32_t, uint32_t *, size_t);
+       efx_rc_t        (*epo_disable)(efx_nic_t *);
+       efx_rc_t        (*epo_privilege_modify)(efx_nic_t *, uint32_t, uint32_t,
+                                       uint32_t, uint32_t, uint32_t);
+       efx_rc_t        (*epo_set_privilege_mask)(efx_nic_t *, uint32_t,
+                                       uint32_t, uint32_t);
+       efx_rc_t        (*epo_complete_request)(efx_nic_t *, uint32_t,
+                                       uint32_t, uint32_t);
+       efx_rc_t        (*epo_exec_cmd)(efx_nic_t *, efx_proxy_cmd_params_t *);
+       efx_rc_t        (*epo_get_privilege_mask)(efx_nic_t *, uint32_t,
+                                       uint32_t, uint32_t *);
+} efx_proxy_ops_t;
+
+#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
+
+#define        EFX_DRV_VER_MAX         20
+
 typedef struct efx_drv_cfg_s {
        uint32_t                edc_min_vi_count;
        uint32_t                edc_max_vi_count;
@@ -454,28 +773,61 @@ struct efx_nic_s {
        const efx_ev_ops_t      *en_eevop;
        const efx_tx_ops_t      *en_etxop;
        const efx_rx_ops_t      *en_erxop;
+       efx_fw_variant_t        efv;
+       char                    en_drv_version[EFX_DRV_VER_MAX];
 #if EFSYS_OPT_FILTER
        efx_filter_t            en_filter;
        const efx_filter_ops_t  *en_efop;
 #endif /* EFSYS_OPT_FILTER */
+#if EFSYS_OPT_TUNNEL
+       efx_tunnel_cfg_t        en_tunnel_cfg;
+       const efx_tunnel_ops_t  *en_etop;
+#endif /* EFSYS_OPT_TUNNEL */
 #if EFSYS_OPT_MCDI
        efx_mcdi_t              en_mcdi;
 #endif /* EFSYS_OPT_MCDI */
+#if EFSYS_OPT_NVRAM
+       uint32_t                en_nvram_partn_locked;
+       const efx_nvram_ops_t   *en_envop;
+#endif /* EFSYS_OPT_NVRAM */
+#if EFSYS_OPT_VPD
+       const efx_vpd_ops_t     *en_evpdop;
+#endif /* EFSYS_OPT_VPD */
+#if EFSYS_OPT_RX_SCALE
+       efx_rx_hash_support_t           en_hash_support;
+       efx_rx_scale_context_type_t     en_rss_context_type;
+       uint32_t                        en_rss_context;
+#endif /* EFSYS_OPT_RX_SCALE */
        uint32_t                en_vport_id;
+#if EFSYS_OPT_LICENSING
+       const efx_lic_ops_t     *en_elop;
+       boolean_t               en_licensing_supported;
+#endif
        union {
 #if EFSYS_OPT_SIENA
                struct {
+#if EFSYS_OPT_NVRAM || EFSYS_OPT_VPD
+                       unsigned int            enu_partn_mask;
+#endif /* EFSYS_OPT_NVRAM || EFSYS_OPT_VPD */
+#if EFSYS_OPT_VPD
+                       caddr_t                 enu_svpd;
+                       size_t                  enu_svpd_length;
+#endif /* EFSYS_OPT_VPD */
                        int                     enu_unused;
                } siena;
 #endif /* EFSYS_OPT_SIENA */
                int     enu_unused;
        } en_u;
-#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+#if EFX_OPTS_EF10()
        union en_arch {
                struct {
                        int                     ena_vi_base;
                        int                     ena_vi_count;
                        int                     ena_vi_shift;
+#if EFSYS_OPT_VPD
+                       caddr_t                 ena_svpd;
+                       size_t                  ena_svpd_length;
+#endif /* EFSYS_OPT_VPD */
                        efx_piobuf_handle_t     ena_piobuf_handle[EF10_MAX_PIOBUF_NBUFS];
                        uint32_t                ena_piobuf_count;
                        uint32_t                ena_pio_alloc_map[EF10_MAX_PIOBUF_NBUFS];
@@ -487,9 +839,21 @@ struct efx_nic_s {
                        size_t                  ena_wc_mem_map_size;
                } ef10;
        } en_arch;
-#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
+#endif /* EFX_OPTS_EF10() */
+#if EFSYS_OPT_EVB
+       const efx_evb_ops_t     *en_eeop;
+       struct efx_vswitch_s    *en_vswitchp;
+#endif /* EFSYS_OPT_EVB */
+#if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER
+       const efx_proxy_ops_t   *en_epop;
+#endif /* EFSYS_OPT_MCDI_PROXY_AUTH_SERVER */
 };
 
+#define        EFX_FAMILY_IS_EF10(_enp) \
+       ((_enp)->en_family == EFX_FAMILY_MEDFORD2 || \
+        (_enp)->en_family == EFX_FAMILY_MEDFORD || \
+        (_enp)->en_family == EFX_FAMILY_HUNTINGTON)
+
 
 #define        EFX_NIC_MAGIC   0x02121996
 
@@ -499,10 +863,18 @@ typedef   boolean_t (*efx_ev_handler_t)(efx_evq_t *, efx_qword_t *,
 typedef struct efx_evq_rxq_state_s {
        unsigned int                    eers_rx_read_ptr;
        unsigned int                    eers_rx_mask;
+#if EFSYS_OPT_RX_PACKED_STREAM || EFSYS_OPT_RX_ES_SUPER_BUFFER
+       unsigned int                    eers_rx_stream_npackets;
+       boolean_t                       eers_rx_packed_stream;
+#endif
+#if EFSYS_OPT_RX_PACKED_STREAM
+       unsigned int                    eers_rx_packed_stream_credits;
+#endif
 } efx_evq_rxq_state_t;
 
 struct efx_evq_s {
        uint32_t                        ee_magic;
+       uint32_t                        ee_flags;
        efx_nic_t                       *ee_enp;
        unsigned int                    ee_index;
        unsigned int                    ee_mask;
@@ -521,14 +893,22 @@ struct efx_evq_s {
 #endif /* EFSYS_OPT_MCDI */
 
        efx_evq_rxq_state_t             ee_rxq_state[EFX_EV_RX_NLABELS];
-
-       uint32_t                        ee_flags;
 };
 
 #define        EFX_EVQ_MAGIC   0x08081997
 
 #define        EFX_EVQ_SIENA_TIMER_QUANTUM_NS  6144 /* 768 cycles */
 
+#if EFSYS_OPT_QSTATS
+#define        EFX_EV_QSTAT_INCR(_eep, _stat)                                  \
+       do {                                                            \
+               (_eep)->ee_stat[_stat]++;                               \
+       _NOTE(CONSTANTCONDITION)                                        \
+       } while (B_FALSE)
+#else
+#define        EFX_EV_QSTAT_INCR(_eep, _stat)
+#endif
+
 struct efx_rxq_s {
        uint32_t                        er_magic;
        efx_nic_t                       *er_enp;
@@ -536,7 +916,9 @@ struct efx_rxq_s {
        unsigned int                    er_index;
        unsigned int                    er_label;
        unsigned int                    er_mask;
+       size_t                          er_buf_size;
        efsys_mem_t                     *er_esmp;
+       efx_evq_rxq_state_t             *er_ev_qstate;
 };
 
 #define        EFX_RXQ_MAGIC   0x15022005
@@ -602,6 +984,10 @@ struct efx_txq_s {
                        rev = 'E';                                      \
                        break;                                          \
                                                                        \
+               case EFX_FAMILY_MEDFORD2:                               \
+                       rev = 'F';                                      \
+                       break;                                          \
+                                                                       \
                default:                                                \
                        rev = '?';                                      \
                        break;                                          \
@@ -692,6 +1078,15 @@ struct efx_txq_s {
        _NOTE(CONSTANTCONDITION)                                        \
        } while (B_FALSE)
 
+/*
+ * Accessors for memory BAR non-VI tables.
+ *
+ * Code used on EF10 *must* use EFX_BAR_VI_*() macros for per-VI registers,
+ * to ensure the correct runtime VI window size is used on Medford2.
+ *
+ * Siena-only code may continue using EFX_BAR_TBL_*() macros for VI registers.
+ */
+
 #define        EFX_BAR_TBL_READD(_enp, _reg, _index, _edp, _lock)              \
        do {                                                            \
                EFX_CHECK_REG((_enp), (_reg));                          \
@@ -718,21 +1113,6 @@ struct efx_txq_s {
        _NOTE(CONSTANTCONDITION)                                        \
        } while (B_FALSE)
 
-#define        EFX_BAR_TBL_WRITED2(_enp, _reg, _index, _edp, _lock)            \
-       do {                                                            \
-               EFX_CHECK_REG((_enp), (_reg));                          \
-               EFSYS_PROBE4(efx_bar_tbl_writed, const char *, #_reg,   \
-                   uint32_t, (_index),                                 \
-                   uint32_t, _reg ## _OFST,                            \
-                   uint32_t, (_edp)->ed_u32[0]);                       \
-               EFSYS_BAR_WRITED((_enp)->en_esbp,                       \
-                   (_reg ## _OFST +                                    \
-                   (2 * sizeof (efx_dword_t)) +                        \
-                   ((_index) * _reg ## _STEP)),                        \
-                   (_edp), (_lock));                                   \
-       _NOTE(CONSTANTCONDITION)                                        \
-       } while (B_FALSE)
-
 #define        EFX_BAR_TBL_WRITED3(_enp, _reg, _index, _edp, _lock)            \
        do {                                                            \
                EFX_CHECK_REG((_enp), (_reg));                          \
@@ -809,18 +1189,67 @@ struct efx_txq_s {
        } while (B_FALSE)
 
 /*
- * Allow drivers to perform optimised 128-bit doorbell writes.
+ * Accessors for memory BAR per-VI registers.
+ *
+ * The VI window size is 8KB for Medford and all earlier controllers.
+ * For Medford2, the VI window size can be 8KB, 16KB or 64KB.
+ */
+
+#define        EFX_BAR_VI_READD(_enp, _reg, _index, _edp, _lock)               \
+       do {                                                            \
+               EFX_CHECK_REG((_enp), (_reg));                          \
+               EFSYS_BAR_READD((_enp)->en_esbp,                        \
+                   ((_reg ## _OFST) +                                  \
+                   ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
+                   (_edp), (_lock));                                   \
+               EFSYS_PROBE4(efx_bar_vi_readd, const char *, #_reg,     \
+                   uint32_t, (_index),                                 \
+                   uint32_t, _reg ## _OFST,                            \
+                   uint32_t, (_edp)->ed_u32[0]);                       \
+       _NOTE(CONSTANTCONDITION)                                        \
+       } while (B_FALSE)
+
+#define        EFX_BAR_VI_WRITED(_enp, _reg, _index, _edp, _lock)              \
+       do {                                                            \
+               EFX_CHECK_REG((_enp), (_reg));                          \
+               EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg,    \
+                   uint32_t, (_index),                                 \
+                   uint32_t, _reg ## _OFST,                            \
+                   uint32_t, (_edp)->ed_u32[0]);                       \
+               EFSYS_BAR_WRITED((_enp)->en_esbp,                       \
+                   ((_reg ## _OFST) +                                  \
+                   ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
+                   (_edp), (_lock));                                   \
+       _NOTE(CONSTANTCONDITION)                                        \
+       } while (B_FALSE)
+
+#define        EFX_BAR_VI_WRITED2(_enp, _reg, _index, _edp, _lock)             \
+       do {                                                            \
+               EFX_CHECK_REG((_enp), (_reg));                          \
+               EFSYS_PROBE4(efx_bar_vi_writed, const char *, #_reg,    \
+                   uint32_t, (_index),                                 \
+                   uint32_t, _reg ## _OFST,                            \
+                   uint32_t, (_edp)->ed_u32[0]);                       \
+               EFSYS_BAR_WRITED((_enp)->en_esbp,                       \
+                   ((_reg ## _OFST) +                                  \
+                   (2 * sizeof (efx_dword_t)) +                        \
+                   ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
+                   (_edp), (_lock));                                   \
+       _NOTE(CONSTANTCONDITION)                                        \
+       } while (B_FALSE)
+
+/*
+ * Allow drivers to perform optimised 128-bit VI doorbell writes.
  * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are
  * special-cased in the BIU on the Falcon/Siena and EF10 architectures to avoid
  * the need for locking in the host, and are the only ones known to be safe to
  * use 128-bites write with.
  */
-#define        EFX_BAR_TBL_DOORBELL_WRITEO(_enp, _reg, _index, _eop)           \
+#define        EFX_BAR_VI_DOORBELL_WRITEO(_enp, _reg, _index, _eop)            \
        do {                                                            \
                EFX_CHECK_REG((_enp), (_reg));                          \
-               EFSYS_PROBE7(efx_bar_tbl_doorbell_writeo,               \
-                   const char *,                                       \
-                   #_reg,                                              \
+               EFSYS_PROBE7(efx_bar_vi_doorbell_writeo,                \
+                   const char *, #_reg,                                \
                    uint32_t, (_index),                                 \
                    uint32_t, _reg ## _OFST,                            \
                    uint32_t, (_eop)->eo_u32[3],                        \
@@ -828,7 +1257,8 @@ struct efx_txq_s {
                    uint32_t, (_eop)->eo_u32[1],                        \
                    uint32_t, (_eop)->eo_u32[0]);                       \
                EFSYS_BAR_DOORBELL_WRITEO((_enp)->en_esbp,              \
-                   (_reg ## _OFST + ((_index) * _reg ## _STEP)),       \
+                   (_reg ## _OFST +                                    \
+                   ((_index) << (_enp)->en_nic_cfg.enc_vi_window_shift)), \
                    (_eop));                                            \
        _NOTE(CONSTANTCONDITION)                                        \
        } while (B_FALSE)
@@ -854,10 +1284,6 @@ struct efx_txq_s {
        _NOTE(CONSTANTCONDITION)                                        \
        } while (B_FALSE)
 
-extern __checkReturn   efx_rc_t
-efx_nic_biu_test(
-       __in            efx_nic_t *enp);
-
 extern __checkReturn   efx_rc_t
 efx_mac_select(
        __in            efx_nic_t *enp);
@@ -877,31 +1303,54 @@ extern                   void
 efx_phy_unprobe(
        __in            efx_nic_t *enp);
 
-#if EFSYS_OPT_DIAG
+#if EFSYS_OPT_VPD
 
-extern efx_sram_pattern_fn_t   __efx_sram_pattern_fns[];
+/* VPD utility functions */
 
-typedef struct efx_register_set_s {
-       unsigned int            address;
-       unsigned int            step;
-       unsigned int            rows;
-       efx_oword_t             mask;
-} efx_register_set_t;
+extern __checkReturn           efx_rc_t
+efx_vpd_hunk_length(
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size,
+       __out                   size_t *lengthp);
 
-extern __checkReturn   efx_rc_t
-efx_nic_test_registers(
-       __in            efx_nic_t *enp,
-       __in            efx_register_set_t *rsp,
-       __in            size_t count);
+extern __checkReturn           efx_rc_t
+efx_vpd_hunk_verify(
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size,
+       __out_opt               boolean_t *cksummedp);
 
-extern __checkReturn   efx_rc_t
-efx_nic_test_tables(
-       __in            efx_nic_t *enp,
-       __in            efx_register_set_t *rsp,
-       __in            efx_pattern_type_t pattern,
-       __in            size_t count);
+extern __checkReturn           efx_rc_t
+efx_vpd_hunk_reinit(
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size,
+       __in                    boolean_t wantpid);
 
-#endif /* EFSYS_OPT_DIAG */
+extern __checkReturn           efx_rc_t
+efx_vpd_hunk_get(
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size,
+       __in                    efx_vpd_tag_t tag,
+       __in                    efx_vpd_keyword_t keyword,
+       __out                   unsigned int *payloadp,
+       __out                   uint8_t *paylenp);
+
+extern __checkReturn                   efx_rc_t
+efx_vpd_hunk_next(
+       __in_bcount(size)               caddr_t data,
+       __in                            size_t size,
+       __out                           efx_vpd_tag_t *tagp,
+       __out                           efx_vpd_keyword_t *keyword,
+       __out_opt                       unsigned int *payloadp,
+       __out_opt                       uint8_t *paylenp,
+       __inout                         unsigned int *contp);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_hunk_set(
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size,
+       __in                    efx_vpd_value_t *evvp);
+
+#endif /* EFSYS_OPT_VPD */
 
 #if EFSYS_OPT_MCDI
 
@@ -932,6 +1381,14 @@ struct efx_mac_stats_range {
        efx_mac_stat_t          last;
 };
 
+typedef enum efx_stats_action_e {
+       EFX_STATS_CLEAR,
+       EFX_STATS_UPLOAD,
+       EFX_STATS_ENABLE_NOEVENTS,
+       EFX_STATS_ENABLE_EVENTS,
+       EFX_STATS_DISABLE,
+} efx_stats_action_t;
+
 extern                                 efx_rc_t
 efx_mac_stats_mask_add_ranges(
        __inout_bcount(mask_size)       uint32_t *maskp,
@@ -939,6 +1396,14 @@ efx_mac_stats_mask_add_ranges(
        __in_ecount(rng_count)          const struct efx_mac_stats_range *rngp,
        __in                            unsigned int rng_count);
 
+extern __checkReturn   efx_rc_t
+efx_mcdi_mac_stats(
+       __in            efx_nic_t *enp,
+       __in            uint32_t vport_id,
+       __in_opt        efsys_mem_t *esmp,
+       __in            efx_stats_action_t action,
+       __in            uint16_t period_ms);
+
 #endif /* EFSYS_OPT_MAC_STATS */
 
 #ifdef __cplusplus