net/sfc/base: import PHY statistics
[dpdk.git] / drivers / net / sfc / base / efx_impl.h
index 15bca37..2b81768 100644 (file)
 #endif
 
 
+#if EFSYS_OPT_SIENA
+#include "siena_impl.h"
+#endif /* EFSYS_OPT_SIENA */
+
+#if EFSYS_OPT_HUNTINGTON
+#include "hunt_impl.h"
+#endif /* EFSYS_OPT_HUNTINGTON */
+
+#if EFSYS_OPT_MEDFORD
+#include "medford_impl.h"
+#endif /* EFSYS_OPT_MEDFORD */
+
+#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+#include "ef10_impl.h"
+#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -81,6 +97,9 @@ typedef struct efx_ev_ops_s {
        efx_rc_t        (*eevo_qprime)(efx_evq_t *, unsigned int);
        void            (*eevo_qpost)(efx_evq_t *, uint16_t);
        efx_rc_t        (*eevo_qmoderate)(efx_evq_t *, unsigned int);
+#if EFSYS_OPT_QSTATS
+       void            (*eevo_qstats_update)(efx_evq_t *, efsys_stat_t *);
+#endif
 } efx_ev_ops_t;
 
 typedef struct efx_tx_ops_s {
@@ -120,6 +139,10 @@ typedef struct efx_tx_ops_s {
                                                efx_desc_t *, int);
        void            (*etxo_qdesc_vlantci_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 struct efx_rx_ops_s {
@@ -159,8 +182,47 @@ 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 *);
+#if EFSYS_OPT_PHY_STATS
+       efx_rc_t        (*epo_stats_update)(efx_nic_t *, efsys_mem_t *,
+                                           uint32_t *);
+#endif /* EFSYS_OPT_PHY_STATS */
+#if EFSYS_OPT_BIST
+       efx_rc_t        (*epo_bist_enable_offline)(efx_nic_t *);
+       efx_rc_t        (*epo_bist_start)(efx_nic_t *, efx_bist_type_t);
+       efx_rc_t        (*epo_bist_poll)(efx_nic_t *, efx_bist_type_t,
+                                        efx_bist_result_t *, uint32_t *,
+                                        unsigned long *, size_t);
+       void            (*epo_bist_stop)(efx_nic_t *, efx_bist_type_t);
+#endif /* EFSYS_OPT_BIST */
 } efx_phy_ops_t;
 
+#if EFSYS_OPT_FILTER
+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_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_reconfigure)(efx_nic_t *, uint8_t const *, boolean_t,
+                                  boolean_t, boolean_t, boolean_t,
+                                  uint8_t const *, uint32_t);
+} efx_filter_ops_t;
+
+extern __checkReturn   efx_rc_t
+efx_filter_reconfigure(
+       __in                            efx_nic_t *enp,
+       __in_ecount(6)                  uint8_t const *mac_addr,
+       __in                            boolean_t all_unicst,
+       __in                            boolean_t mulcst,
+       __in                            boolean_t all_mulcst,
+       __in                            boolean_t brdcst,
+       __in_ecount(6*count)            uint8_t const *addrs,
+       __in                            uint32_t count);
+
+#endif /* EFSYS_OPT_FILTER */
+
 
 typedef struct efx_port_s {
        efx_mac_type_t          ep_mac_type;
@@ -179,6 +241,9 @@ 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_PHY_FLAGS
+       uint32_t                ep_phy_flags;
+#endif /* EFSYS_OPT_PHY_FLAGS */
        efx_phy_media_type_t    ep_fixed_port_type;
        efx_phy_media_type_t    ep_module_type;
        uint32_t                ep_adv_cap_mask;
@@ -187,6 +252,9 @@ typedef struct efx_port_s {
        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
        const efx_mac_ops_t     *ep_emop;
        const efx_phy_ops_t     *ep_epop;
 } efx_port_t;
@@ -228,6 +296,9 @@ 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 *);
+#if EFSYS_OPT_DIAG
+       efx_rc_t        (*eno_register_test)(efx_nic_t *);
+#endif /* EFSYS_OPT_DIAG */
        void            (*eno_fini)(efx_nic_t *);
        void            (*eno_unprobe)(efx_nic_t *);
 } efx_nic_ops_t;
@@ -245,6 +316,101 @@ typedef struct efx_nic_ops_s {
 #define        EFX_RXQ_DC_SIZE 3 /* 64 descriptors */
 #endif
 
+#if EFSYS_OPT_FILTER
+
+#if EFSYS_OPT_SIENA
+
+typedef struct siena_filter_spec_s {
+       uint8_t         sfs_type;
+       uint32_t        sfs_flags;
+       uint32_t        sfs_dmaq_id;
+       uint32_t        sfs_dword[3];
+} siena_filter_spec_t;
+
+typedef enum siena_filter_type_e {
+       EFX_SIENA_FILTER_RX_TCP_FULL,   /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
+       EFX_SIENA_FILTER_RX_TCP_WILD,   /* TCP/IPv4 {dIP,dTCP,  -,   -} */
+       EFX_SIENA_FILTER_RX_UDP_FULL,   /* UDP/IPv4 {dIP,dUDP,sIP,sUDP} */
+       EFX_SIENA_FILTER_RX_UDP_WILD,   /* UDP/IPv4 {dIP,dUDP,  -,   -} */
+       EFX_SIENA_FILTER_RX_MAC_FULL,   /* Ethernet {dMAC,VLAN} */
+       EFX_SIENA_FILTER_RX_MAC_WILD,   /* Ethernet {dMAC,   -} */
+
+       EFX_SIENA_FILTER_TX_TCP_FULL,   /* TCP/IPv4 {dIP,dTCP,sIP,sTCP} */
+       EFX_SIENA_FILTER_TX_TCP_WILD,   /* TCP/IPv4 {  -,   -,sIP,sTCP} */
+       EFX_SIENA_FILTER_TX_UDP_FULL,   /* UDP/IPv4 {dIP,dTCP,sIP,sTCP} */
+       EFX_SIENA_FILTER_TX_UDP_WILD,   /* UDP/IPv4 {  -,   -,sIP,sUDP} */
+       EFX_SIENA_FILTER_TX_MAC_FULL,   /* Ethernet {sMAC,VLAN} */
+       EFX_SIENA_FILTER_TX_MAC_WILD,   /* Ethernet {sMAC,   -} */
+
+       EFX_SIENA_FILTER_NTYPES
+} siena_filter_type_t;
+
+typedef enum siena_filter_tbl_id_e {
+       EFX_SIENA_FILTER_TBL_RX_IP = 0,
+       EFX_SIENA_FILTER_TBL_RX_MAC,
+       EFX_SIENA_FILTER_TBL_TX_IP,
+       EFX_SIENA_FILTER_TBL_TX_MAC,
+       EFX_SIENA_FILTER_NTBLS
+} siena_filter_tbl_id_t;
+
+typedef struct siena_filter_tbl_s {
+       int                     sft_size;       /* number of entries */
+       int                     sft_used;       /* active count */
+       uint32_t                *sft_bitmap;    /* active bitmap */
+       siena_filter_spec_t     *sft_spec;      /* array of saved specs */
+} siena_filter_tbl_t;
+
+typedef struct siena_filter_s {
+       siena_filter_tbl_t      sf_tbl[EFX_SIENA_FILTER_NTBLS];
+       unsigned int            sf_depth[EFX_SIENA_FILTER_NTYPES];
+} siena_filter_t;
+
+#endif /* EFSYS_OPT_SIENA */
+
+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
+       ef10_filter_table_t     *ef_ef10_filter_table;
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
+} efx_filter_t;
+
+#if EFSYS_OPT_SIENA
+
+extern                 void
+siena_filter_tbl_clear(
+       __in            efx_nic_t *enp,
+       __in            siena_filter_tbl_id_t tbl);
+
+#endif /* EFSYS_OPT_SIENA */
+
+#endif /* EFSYS_OPT_FILTER */
+
+#if EFSYS_OPT_MCDI
+
+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,
+                                       void *, size_t);
+       efx_rc_t        (*emco_poll_reboot)(efx_nic_t *);
+       boolean_t       (*emco_poll_response)(efx_nic_t *);
+       void            (*emco_read_response)(efx_nic_t *, void *, size_t, size_t);
+       void            (*emco_fini)(efx_nic_t *);
+       efx_rc_t        (*emco_feature_supported)(efx_nic_t *,
+                                           efx_mcdi_feature_id_t, boolean_t *);
+       void            (*emco_get_timeout)(efx_nic_t *, efx_mcdi_req_t *,
+                                           uint32_t *);
+} efx_mcdi_ops_t;
+
+typedef struct efx_mcdi_s {
+       const efx_mcdi_ops_t            *em_emcop;
+       const efx_mcdi_transport_t      *em_emtp;
+       efx_mcdi_iface_t                em_emip;
+} efx_mcdi_t;
+
+#endif /* EFSYS_OPT_MCDI */
+
 typedef struct efx_drv_cfg_s {
        uint32_t                edc_min_vi_count;
        uint32_t                edc_max_vi_count;
@@ -274,10 +440,40 @@ 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;
+#if EFSYS_OPT_FILTER
+       efx_filter_t            en_filter;
+       const efx_filter_ops_t  *en_efop;
+#endif /* EFSYS_OPT_FILTER */
+#if EFSYS_OPT_MCDI
+       efx_mcdi_t              en_mcdi;
+#endif /* EFSYS_OPT_MCDI */
        uint32_t                en_vport_id;
        union {
+#if EFSYS_OPT_SIENA
+               struct {
+                       int                     enu_unused;
+               } siena;
+#endif /* EFSYS_OPT_SIENA */
                int     enu_unused;
        } en_u;
+#if (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD)
+       union en_arch {
+               struct {
+                       int                     ena_vi_base;
+                       int                     ena_vi_count;
+                       int                     ena_vi_shift;
+                       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];
+                       uint32_t                ena_pio_write_vi_base;
+                       /* Memory BAR mapping regions */
+                       uint32_t                ena_uc_mem_map_offset;
+                       size_t                  ena_uc_mem_map_size;
+                       uint32_t                ena_wc_mem_map_offset;
+                       size_t                  ena_wc_mem_map_size;
+               } ef10;
+       } en_arch;
+#endif /* (EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD) */
 };
 
 
@@ -297,12 +493,18 @@ struct efx_evq_s {
        unsigned int                    ee_index;
        unsigned int                    ee_mask;
        efsys_mem_t                     *ee_esmp;
+#if EFSYS_OPT_QSTATS
+       uint32_t                        ee_stat[EV_NQSTATS];
+#endif /* EFSYS_OPT_QSTATS */
 
        efx_ev_handler_t                ee_rx;
        efx_ev_handler_t                ee_tx;
        efx_ev_handler_t                ee_driver;
        efx_ev_handler_t                ee_global;
        efx_ev_handler_t                ee_drv_gen;
+#if EFSYS_OPT_MCDI
+       efx_ev_handler_t                ee_mcdi;
+#endif /* EFSYS_OPT_MCDI */
 
        efx_evq_rxq_state_t             ee_rxq_state[EFX_EV_RX_NLABELS];
 
@@ -331,6 +533,16 @@ struct efx_txq_s {
        unsigned int                    et_index;
        unsigned int                    et_mask;
        efsys_mem_t                     *et_esmp;
+#if EFSYS_OPT_HUNTINGTON
+       uint32_t                        et_pio_bufnum;
+       uint32_t                        et_pio_blknum;
+       uint32_t                        et_pio_write_offset;
+       uint32_t                        et_pio_offset;
+       size_t                          et_pio_size;
+#endif
+#if EFSYS_OPT_QSTATS
+       uint32_t                        et_stat[TX_NQSTATS];
+#endif /* EFSYS_OPT_QSTATS */
 };
 
 #define        EFX_TXQ_MAGIC   0x05092005
@@ -651,6 +863,49 @@ extern                     void
 efx_phy_unprobe(
        __in            efx_nic_t *enp);
 
+#if EFSYS_OPT_DIAG
+
+extern efx_sram_pattern_fn_t   __efx_sram_pattern_fns[];
+
+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_nic_test_registers(
+       __in            efx_nic_t *enp,
+       __in            efx_register_set_t *rsp,
+       __in            size_t count);
+
+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);
+
+#endif /* EFSYS_OPT_DIAG */
+
+#if EFSYS_OPT_MCDI
+
+extern __checkReturn           efx_rc_t
+efx_mcdi_set_workaround(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t type,
+       __in                    boolean_t enabled,
+       __out_opt               uint32_t *flagsp);
+
+extern __checkReturn           efx_rc_t
+efx_mcdi_get_workarounds(
+       __in                    efx_nic_t *enp,
+       __out_opt               uint32_t *implementedp,
+       __out_opt               uint32_t *enabledp);
+
+#endif /* EFSYS_OPT_MCDI */
+
 #ifdef __cplusplus
 }
 #endif