net/sfc/base: provide information about supported tunnels
[dpdk.git] / drivers / net / sfc / base / efx.h
index 85fd6f1..c227546 100644 (file)
@@ -559,6 +559,10 @@ efx_mac_stats_get_mask(
 
 #define        EFX_MAC_STATS_SIZE 0x400
 
+extern __checkReturn                   efx_rc_t
+efx_mac_stats_clear(
+       __in                            efx_nic_t *enp);
+
 /*
  * Upload mac statistics supported by the hardware into the given buffer.
  *
@@ -1084,6 +1088,14 @@ efx_bist_stop(
 #define        EFX_FEATURE_FW_ASSISTED_TSO_V2  0x00002000
 #define        EFX_FEATURE_PACKED_STREAM       0x00004000
 
+typedef enum efx_tunnel_protocol_e {
+       EFX_TUNNEL_PROTOCOL_NONE = 0,
+       EFX_TUNNEL_PROTOCOL_VXLAN,
+       EFX_TUNNEL_PROTOCOL_GENEVE,
+       EFX_TUNNEL_PROTOCOL_NVGRE,
+       EFX_TUNNEL_NPROTOS
+} efx_tunnel_protocol_t;
+
 typedef struct efx_nic_cfg_s {
        uint32_t                enc_board_type;
        uint32_t                enc_phy_type;
@@ -1154,6 +1166,13 @@ typedef struct efx_nic_cfg_s {
        uint32_t                enc_rx_batch_max;
        /* Number of rx descriptors the hardware requires for a push. */
        uint32_t                enc_rx_push_align;
+       /* Maximum amount of data in DMA descriptor */
+       uint32_t                enc_tx_dma_desc_size_max;
+       /*
+        * Boundary which DMA descriptor data must not cross or 0 if no
+        * limitation.
+        */
+       uint32_t                enc_tx_dma_desc_boundary;
        /*
         * Maximum number of bytes into the packet the TCP header can start for
         * the hardware to apply TSO packet edits.
@@ -1176,6 +1195,7 @@ typedef struct efx_nic_cfg_s {
        boolean_t               enc_rx_var_packed_stream_supported;
        boolean_t               enc_pm_and_rxdp_counters;
        boolean_t               enc_mac_stats_40g_tx_size_bins;
+       uint32_t                enc_tunnel_encapsulations_supported;
        /* External port identifier */
        uint8_t                 enc_external_port;
        uint32_t                enc_mcdi_max_payload_length;
@@ -1200,6 +1220,24 @@ extern                   const efx_nic_cfg_t *
 efx_nic_cfg_get(
        __in            efx_nic_t *enp);
 
+typedef struct efx_nic_fw_info_s {
+       /* Basic FW version information */
+       uint16_t        enfi_mc_fw_version[4];
+       /*
+        * If datapath capabilities can be detected,
+        * additional FW information is to be shown
+        */
+       boolean_t       enfi_dpcpu_fw_ids_valid;
+       /* Rx and Tx datapath CPU FW IDs */
+       uint16_t        enfi_rx_dpcpu_fw_id;
+       uint16_t        enfi_tx_dpcpu_fw_id;
+} efx_nic_fw_info_t;
+
+extern __checkReturn           efx_rc_t
+efx_nic_get_fw_version(
+       __in                    efx_nic_t *enp,
+       __out                   efx_nic_fw_info_t *enfip);
+
 /* Driver resource limits (minimum required/maximum usable). */
 typedef struct efx_drv_limits_s {
        uint32_t        edl_min_evq_count;
@@ -1241,8 +1279,225 @@ efx_nic_get_vi_pool(
        __out           uint32_t *txq_countp);
 
 
+#if EFSYS_OPT_VPD
+
+typedef enum efx_vpd_tag_e {
+       EFX_VPD_ID = 0x02,
+       EFX_VPD_END = 0x0f,
+       EFX_VPD_RO = 0x10,
+       EFX_VPD_RW = 0x11,
+} efx_vpd_tag_t;
+
+typedef uint16_t efx_vpd_keyword_t;
+
+typedef struct efx_vpd_value_s {
+       efx_vpd_tag_t           evv_tag;
+       efx_vpd_keyword_t       evv_keyword;
+       uint8_t                 evv_length;
+       uint8_t                 evv_value[0x100];
+} efx_vpd_value_t;
+
+
+#define        EFX_VPD_KEYWORD(x, y) ((x) | ((y) << 8))
+
+extern __checkReturn           efx_rc_t
+efx_vpd_init(
+       __in                    efx_nic_t *enp);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_size(
+       __in                    efx_nic_t *enp,
+       __out                   size_t *sizep);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_read(
+       __in                    efx_nic_t *enp,
+       __out_bcount(size)      caddr_t data,
+       __in                    size_t size);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_verify(
+       __in                    efx_nic_t *enp,
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_reinit(
+       __in                    efx_nic_t *enp,
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_get(
+       __in                    efx_nic_t *enp,
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size,
+       __inout                 efx_vpd_value_t *evvp);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_set(
+       __in                    efx_nic_t *enp,
+       __inout_bcount(size)    caddr_t data,
+       __in                    size_t size,
+       __in                    efx_vpd_value_t *evvp);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_next(
+       __in                    efx_nic_t *enp,
+       __inout_bcount(size)    caddr_t data,
+       __in                    size_t size,
+       __out                   efx_vpd_value_t *evvp,
+       __inout                 unsigned int *contp);
+
+extern __checkReturn           efx_rc_t
+efx_vpd_write(
+       __in                    efx_nic_t *enp,
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size);
+
+extern                         void
+efx_vpd_fini(
+       __in                    efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_VPD */
+
 /* NVRAM */
 
+#if EFSYS_OPT_NVRAM
+
+typedef enum efx_nvram_type_e {
+       EFX_NVRAM_INVALID = 0,
+       EFX_NVRAM_BOOTROM,
+       EFX_NVRAM_BOOTROM_CFG,
+       EFX_NVRAM_MC_FIRMWARE,
+       EFX_NVRAM_MC_GOLDEN,
+       EFX_NVRAM_PHY,
+       EFX_NVRAM_NULLPHY,
+       EFX_NVRAM_FPGA,
+       EFX_NVRAM_FCFW,
+       EFX_NVRAM_CPLD,
+       EFX_NVRAM_FPGA_BACKUP,
+       EFX_NVRAM_DYNAMIC_CFG,
+       EFX_NVRAM_LICENSE,
+       EFX_NVRAM_UEFIROM,
+       EFX_NVRAM_NTYPES,
+} efx_nvram_type_t;
+
+extern __checkReturn           efx_rc_t
+efx_nvram_init(
+       __in                    efx_nic_t *enp);
+
+#if EFSYS_OPT_DIAG
+
+extern __checkReturn           efx_rc_t
+efx_nvram_test(
+       __in                    efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_DIAG */
+
+extern __checkReturn           efx_rc_t
+efx_nvram_size(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type,
+       __out                   size_t *sizep);
+
+extern __checkReturn           efx_rc_t
+efx_nvram_rw_start(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type,
+       __out_opt               size_t *pref_chunkp);
+
+extern __checkReturn           efx_rc_t
+efx_nvram_rw_finish(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type);
+
+extern __checkReturn           efx_rc_t
+efx_nvram_get_version(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type,
+       __out                   uint32_t *subtypep,
+       __out_ecount(4)         uint16_t version[4]);
+
+extern __checkReturn           efx_rc_t
+efx_nvram_read_chunk(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type,
+       __in                    unsigned int offset,
+       __out_bcount(size)      caddr_t data,
+       __in                    size_t size);
+
+extern __checkReturn           efx_rc_t
+efx_nvram_set_version(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type,
+       __in_ecount(4)          uint16_t version[4]);
+
+extern __checkReturn           efx_rc_t
+efx_nvram_validate(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type,
+       __in_bcount(partn_size) caddr_t partn_data,
+       __in                    size_t partn_size);
+
+extern  __checkReturn          efx_rc_t
+efx_nvram_erase(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type);
+
+extern __checkReturn           efx_rc_t
+efx_nvram_write_chunk(
+       __in                    efx_nic_t *enp,
+       __in                    efx_nvram_type_t type,
+       __in                    unsigned int offset,
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size);
+
+extern                         void
+efx_nvram_fini(
+       __in                    efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_NVRAM */
+
+#if EFSYS_OPT_BOOTCFG
+
+/* Report size and offset of bootcfg sector in NVRAM partition. */
+extern __checkReturn           efx_rc_t
+efx_bootcfg_sector_info(
+       __in                    efx_nic_t *enp,
+       __in                    uint32_t pf,
+       __out_opt               uint32_t *sector_countp,
+       __out                   size_t *offsetp,
+       __out                   size_t *max_sizep);
+
+/*
+ * Copy bootcfg sector data to a target buffer which may differ in size.
+ * Optionally corrects format errors in source buffer.
+ */
+extern                         efx_rc_t
+efx_bootcfg_copy_sector(
+       __in                    efx_nic_t *enp,
+       __inout_bcount(sector_length)
+                               uint8_t *sector,
+       __in                    size_t sector_length,
+       __out_bcount(data_size) uint8_t *data,
+       __in                    size_t data_size,
+       __in                    boolean_t handle_format_errors);
+
+extern                         efx_rc_t
+efx_bootcfg_read(
+       __in                    efx_nic_t *enp,
+       __out_bcount(size)      caddr_t data,
+       __in                    size_t size);
+
+extern                         efx_rc_t
+efx_bootcfg_write(
+       __in                    efx_nic_t *enp,
+       __in_bcount(size)       caddr_t data,
+       __in                    size_t size);
+
+#endif /* EFSYS_OPT_BOOTCFG */
+
 #if EFSYS_OPT_DIAG
 
 typedef enum efx_pattern_type_t {
@@ -1634,12 +1889,12 @@ typedef enum efx_rx_hash_alg_e {
        EFX_RX_HASHALG_TOEPLITZ
 } efx_rx_hash_alg_t;
 
-typedef enum efx_rx_hash_type_e {
-       EFX_RX_HASH_IPV4 = 0,
-       EFX_RX_HASH_TCPIPV4,
-       EFX_RX_HASH_IPV6,
-       EFX_RX_HASH_TCPIPV6,
-} efx_rx_hash_type_t;
+#define        EFX_RX_HASH_IPV4        (1U << 0)
+#define        EFX_RX_HASH_TCPIPV4     (1U << 1)
+#define        EFX_RX_HASH_IPV6        (1U << 2)
+#define        EFX_RX_HASH_TCPIPV6     (1U << 3)
+
+typedef unsigned int efx_rx_hash_type_t;
 
 typedef enum efx_rx_hash_support_e {
        EFX_RX_HASH_UNAVAILABLE = 0,    /* Hardware hash not inserted */
@@ -2000,10 +2255,10 @@ typedef enum efx_filter_match_flags_e {
        EFX_FILTER_MATCH_OUTER_VID = 0x0100,    /* Match by outer VLAN ID */
        EFX_FILTER_MATCH_IP_PROTO = 0x0200,     /* Match by IP transport
                                                 * protocol */
-       EFX_FILTER_MATCH_LOC_MAC_IG = 0x0400,   /* Match by local MAC address
-                                                * I/G bit. Used for RX default
-                                                * unicast and multicast/
-                                                * broadcast filters. */
+       /* Match otherwise-unmatched multicast and broadcast packets */
+       EFX_FILTER_MATCH_UNKNOWN_MCAST_DST = 0x40000000,
+       /* Match otherwise-unmatched unicast packets */
+       EFX_FILTER_MATCH_UNKNOWN_UCAST_DST = 0x80000000,
 } efx_filter_match_flags_t;
 
 typedef enum efx_filter_priority_s {
@@ -2025,7 +2280,7 @@ typedef enum efx_filter_priority_s {
  */
 
 typedef struct efx_filter_spec_s {
-       uint32_t        efs_match_flags:12;
+       uint32_t        efs_match_flags;
        uint32_t        efs_priority:2;
        uint32_t        efs_flags:6;
        uint32_t        efs_dmaq_id:12;
@@ -2072,9 +2327,10 @@ efx_filter_restore(
 
 extern __checkReturn   efx_rc_t
 efx_filter_supported_filters(
-       __in            efx_nic_t *enp,
-       __out           uint32_t *list,
-       __out           size_t *length);
+       __in                            efx_nic_t *enp,
+       __out_ecount(buffer_length)     uint32_t *buffer,
+       __in                            size_t buffer_length,
+       __out                           size_t *list_lengthp);
 
 extern                 void
 efx_filter_spec_init_rx(
@@ -2134,6 +2390,151 @@ efx_hash_bytes(
        __in                    size_t length,
        __in                    uint32_t init);
 
+#if EFSYS_OPT_LICENSING
+
+/* LICENSING */
+
+typedef struct efx_key_stats_s {
+       uint32_t        eks_valid;
+       uint32_t        eks_invalid;
+       uint32_t        eks_blacklisted;
+       uint32_t        eks_unverifiable;
+       uint32_t        eks_wrong_node;
+       uint32_t        eks_licensed_apps_lo;
+       uint32_t        eks_licensed_apps_hi;
+       uint32_t        eks_licensed_features_lo;
+       uint32_t        eks_licensed_features_hi;
+} efx_key_stats_t;
+
+extern __checkReturn           efx_rc_t
+efx_lic_init(
+       __in                    efx_nic_t *enp);
+
+extern                         void
+efx_lic_fini(
+       __in                    efx_nic_t *enp);
+
+extern __checkReturn   boolean_t
+efx_lic_check_support(
+       __in                    efx_nic_t *enp);
+
+extern __checkReturn   efx_rc_t
+efx_lic_update_licenses(
+       __in            efx_nic_t *enp);
+
+extern __checkReturn   efx_rc_t
+efx_lic_get_key_stats(
+       __in            efx_nic_t *enp,
+       __out           efx_key_stats_t *ksp);
+
+extern __checkReturn   efx_rc_t
+efx_lic_app_state(
+       __in            efx_nic_t *enp,
+       __in            uint64_t app_id,
+       __out           boolean_t *licensedp);
+
+extern __checkReturn   efx_rc_t
+efx_lic_get_id(
+       __in            efx_nic_t *enp,
+       __in            size_t buffer_size,
+       __out           uint32_t *typep,
+       __out           size_t *lengthp,
+       __out_opt       uint8_t *bufferp);
+
+
+extern __checkReturn           efx_rc_t
+efx_lic_find_start(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size,
+       __out                   uint32_t *startp
+       );
+
+extern __checkReturn           efx_rc_t
+efx_lic_find_end(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size,
+       __in                    uint32_t offset,
+       __out                   uint32_t *endp
+       );
+
+extern __checkReturn   __success(return != B_FALSE)    boolean_t
+efx_lic_find_key(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size,
+       __in                    uint32_t offset,
+       __out                   uint32_t *startp,
+       __out                   uint32_t *lengthp
+       );
+
+extern __checkReturn   __success(return != B_FALSE)    boolean_t
+efx_lic_validate_key(
+       __in                    efx_nic_t *enp,
+       __in_bcount(length)     caddr_t keyp,
+       __in                    uint32_t length
+       );
+
+extern __checkReturn           efx_rc_t
+efx_lic_read_key(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size,
+       __in                    uint32_t offset,
+       __in                    uint32_t length,
+       __out_bcount_part(key_max_size, *lengthp)
+                               caddr_t keyp,
+       __in                    size_t key_max_size,
+       __out                   uint32_t *lengthp
+       );
+
+extern __checkReturn           efx_rc_t
+efx_lic_write_key(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size,
+       __in                    uint32_t offset,
+       __in_bcount(length)     caddr_t keyp,
+       __in                    uint32_t length,
+       __out                   uint32_t *lengthp
+       );
+
+       __checkReturn           efx_rc_t
+efx_lic_delete_key(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size,
+       __in                    uint32_t offset,
+       __in                    uint32_t length,
+       __in                    uint32_t end,
+       __out                   uint32_t *deltap
+       );
+
+extern __checkReturn           efx_rc_t
+efx_lic_create_partition(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size
+       );
+
+extern __checkReturn           efx_rc_t
+efx_lic_finish_partition(
+       __in                    efx_nic_t *enp,
+       __in_bcount(buffer_size)
+                               caddr_t bufferp,
+       __in                    size_t buffer_size
+       );
+
+#endif /* EFSYS_OPT_LICENSING */
+
 
 
 #ifdef __cplusplus