net/sfc/base: support new link modes
[dpdk.git] / drivers / net / sfc / base / efx.h
index ec65dcf..1b92027 100644 (file)
@@ -1,31 +1,7 @@
-/*
- * Copyright (c) 2006-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:
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * 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.
- *
- * 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) 2006-2018 Solarflare Communications Inc.
+ * All rights reserved.
  */
 
 #ifndef        _SYS_EFX_H
@@ -64,6 +40,7 @@ typedef enum efx_family_e {
        EFX_FAMILY_SIENA,
        EFX_FAMILY_HUNTINGTON,
        EFX_FAMILY_MEDFORD,
+       EFX_FAMILY_MEDFORD2,
        EFX_FAMILY_NTYPES
 } efx_family_t;
 
@@ -71,7 +48,8 @@ extern        __checkReturn   efx_rc_t
 efx_family(
        __in            uint16_t venid,
        __in            uint16_t devid,
-       __out           efx_family_t *efp);
+       __out           efx_family_t *efp,
+       __out           unsigned int *membarp);
 
 
 #define        EFX_PCI_VENID_SFC                       0x1924
@@ -93,7 +71,21 @@ efx_family(
 #define        EFX_PCI_DEVID_MEDFORD                   0x0A03  /* SFC9240 PF */
 #define        EFX_PCI_DEVID_MEDFORD_VF                0x1A03  /* SFC9240 VF */
 
-#define        EFX_MEM_BAR     2
+#define        EFX_PCI_DEVID_MEDFORD2_PF_UNINIT        0x0B13
+#define        EFX_PCI_DEVID_MEDFORD2                  0x0B03  /* SFC9250 PF */
+#define        EFX_PCI_DEVID_MEDFORD2_VF               0x1B03  /* SFC9250 VF */
+
+
+#define        EFX_MEM_BAR_SIENA                       2
+
+#define        EFX_MEM_BAR_HUNTINGTON_PF               2
+#define        EFX_MEM_BAR_HUNTINGTON_VF               0
+
+#define        EFX_MEM_BAR_MEDFORD_PF                  2
+#define        EFX_MEM_BAR_MEDFORD_VF                  0
+
+#define        EFX_MEM_BAR_MEDFORD2                    0
+
 
 /* Error codes */
 
@@ -195,7 +187,7 @@ efx_nic_check_pcie_link_speed(
 
 #if EFSYS_OPT_MCDI
 
-#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
 /* Huntington and Medford require MCDIv2 commands */
 #define        WITH_MCDI_V2 1
 #endif
@@ -432,6 +424,9 @@ typedef enum efx_link_mode_e {
        EFX_LINK_1000FDX,
        EFX_LINK_10000FDX,
        EFX_LINK_40000FDX,
+       EFX_LINK_25000FDX,
+       EFX_LINK_50000FDX,
+       EFX_LINK_100000FDX,
        EFX_LINK_NMODES
 } efx_link_mode_t;
 
@@ -627,7 +622,7 @@ efx_mon_init(
 #define        EFX_MON_STATS_PAGE_SIZE 0x100
 #define        EFX_MON_MASK_ELEMENT_SIZE 32
 
-/* START MKCONFIG GENERATED MonitorHeaderStatsBlock aa0233c80156308e */
+/* START MKCONFIG GENERATED MonitorHeaderStatsBlock fcc1b6748432e1ac */
 typedef enum efx_mon_stat_e {
        EFX_MON_STAT_2_5V,
        EFX_MON_STAT_VCCP1,
@@ -708,6 +703,8 @@ typedef enum efx_mon_stat_e {
        EFX_MON_STAT_BOARD_BACK_TEMP,
        EFX_MON_STAT_I1V8,
        EFX_MON_STAT_I2V5,
+       EFX_MON_STAT_I3V3,
+       EFX_MON_STAT_I12V0,
        EFX_MON_NSTATS
 } efx_mon_stat_t;
 
@@ -867,6 +864,10 @@ typedef enum efx_phy_cap_type_e {
        EFX_PHY_CAP_ASYM,
        EFX_PHY_CAP_AN,
        EFX_PHY_CAP_40000FDX,
+       EFX_PHY_CAP_DDM,
+       EFX_PHY_CAP_100000FDX,
+       EFX_PHY_CAP_25000FDX,
+       EFX_PHY_CAP_50000FDX,
        EFX_PHY_CAP_NTYPES
 } efx_phy_cap_type_t;
 
@@ -1104,6 +1105,13 @@ typedef enum efx_tunnel_protocol_e {
        EFX_TUNNEL_NPROTOS
 } efx_tunnel_protocol_t;
 
+typedef enum efx_vi_window_shift_e {
+       EFX_VI_WINDOW_SHIFT_INVALID = 0,
+       EFX_VI_WINDOW_SHIFT_8K = 13,
+       EFX_VI_WINDOW_SHIFT_16K = 14,
+       EFX_VI_WINDOW_SHIFT_64K = 16,
+} efx_vi_window_shift_t;
+
 typedef struct efx_nic_cfg_s {
        uint32_t                enc_board_type;
        uint32_t                enc_phy_type;
@@ -1117,6 +1125,7 @@ typedef struct efx_nic_cfg_s {
        uint32_t                enc_mon_stat_mask[(EFX_MON_NSTATS + 31) / 32];
 #endif
        unsigned int            enc_features;
+       efx_vi_window_shift_t   enc_vi_window_shift;
        uint8_t                 enc_mac_addr[6];
        uint8_t                 enc_port;       /* PHY port number */
        uint32_t                enc_intr_vec_base;
@@ -1161,11 +1170,11 @@ typedef struct efx_nic_cfg_s {
 #if EFSYS_OPT_BIST
        uint32_t                enc_bist_mask;
 #endif /* EFSYS_OPT_BIST */
-#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD
+#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
        uint32_t                enc_pf;
        uint32_t                enc_vf;
        uint32_t                enc_privilege_mask;
-#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */
+#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
        boolean_t               enc_bug26807_workaround;
        boolean_t               enc_bug35388_workaround;
        boolean_t               enc_bug41750_workaround;
@@ -1205,6 +1214,11 @@ typedef struct efx_nic_cfg_s {
        boolean_t               enc_pm_and_rxdp_counters;
        boolean_t               enc_mac_stats_40g_tx_size_bins;
        uint32_t                enc_tunnel_encapsulations_supported;
+       /*
+        * NIC global maximum for unique UDP tunnel ports shared by all
+        * functions.
+        */
+       uint32_t                enc_tunnel_config_udp_entries_max;
        /* External port identifier */
        uint8_t                 enc_external_port;
        uint32_t                enc_mcdi_max_payload_length;
@@ -2256,6 +2270,12 @@ efx_tx_qdesc_vlantci_create(
        __in    uint16_t tci,
        __out   efx_desc_t *edp);
 
+extern void
+efx_tx_qdesc_checksum_create(
+       __in    efx_txq_t *etp,
+       __in    uint16_t flags,
+       __out   efx_desc_t *edp);
+
 #if EFSYS_OPT_QSTATS
 
 #if EFSYS_OPT_NAMES
@@ -2631,6 +2651,52 @@ efx_lic_finish_partition(
 
 #endif /* EFSYS_OPT_LICENSING */
 
+/* TUNNEL */
+
+#if EFSYS_OPT_TUNNEL
+
+extern __checkReturn   efx_rc_t
+efx_tunnel_init(
+       __in            efx_nic_t *enp);
+
+extern                 void
+efx_tunnel_fini(
+       __in            efx_nic_t *enp);
+
+/*
+ * For overlay network encapsulation using UDP, the firmware needs to know
+ * the configured UDP port for the overlay so it can decode encapsulated
+ * frames correctly.
+ * The UDP port/protocol list is global.
+ */
+
+extern __checkReturn   efx_rc_t
+efx_tunnel_config_udp_add(
+       __in            efx_nic_t *enp,
+       __in            uint16_t port /* host/cpu-endian */,
+       __in            efx_tunnel_protocol_t protocol);
+
+extern __checkReturn   efx_rc_t
+efx_tunnel_config_udp_remove(
+       __in            efx_nic_t *enp,
+       __in            uint16_t port /* host/cpu-endian */,
+       __in            efx_tunnel_protocol_t protocol);
+
+extern                 void
+efx_tunnel_config_clear(
+       __in            efx_nic_t *enp);
+
+/**
+ * Apply tunnel UDP ports configuration to hardware.
+ *
+ * EAGAIN is returned if hardware will be reset (datapath and managment CPU
+ * reboot).
+ */
+extern __checkReturn   efx_rc_t
+efx_tunnel_reconfigure(
+       __in            efx_nic_t *enp);
+
+#endif /* EFSYS_OPT_TUNNEL */
 
 
 #ifdef __cplusplus