net/qede/base: support doorbell overflow recovery
[dpdk.git] / drivers / net / qede / base / ecore.h
index 31470b6..d921d9e 100644 (file)
@@ -31,7 +31,7 @@
 #define ECORE_MAJOR_VERSION            8
 #define ECORE_MINOR_VERSION            18
 #define ECORE_REVISION_VERSION         7
-#define ECORE_ENGINEERING_VERSION      0
+#define ECORE_ENGINEERING_VERSION      1
 
 #define ECORE_VERSION                                                  \
        ((ECORE_MAJOR_VERSION << 24) | (ECORE_MINOR_VERSION << 16) |    \
@@ -66,6 +66,7 @@ enum ecore_nvm_cmd {
        ECORE_NVM_READ_NVRAM = DRV_MSG_CODE_NVM_READ_NVRAM,
        ECORE_NVM_WRITE_NVRAM = DRV_MSG_CODE_NVM_WRITE_NVRAM,
        ECORE_NVM_DEL_FILE = DRV_MSG_CODE_NVM_DEL_FILE,
+       ECORE_EXT_PHY_FW_UPGRADE = DRV_MSG_CODE_EXT_PHY_FW_UPGRADE,
        ECORE_NVM_SET_SECURE_MODE = DRV_MSG_CODE_SET_SECURE_MODE,
        ECORE_PHY_RAW_READ = DRV_MSG_CODE_PHY_RAW_READ,
        ECORE_PHY_RAW_WRITE = DRV_MSG_CODE_PHY_RAW_WRITE,
@@ -97,16 +98,16 @@ do {                                                                        \
 
 #define GET_FIELD(value, name)                                         \
        (((value) >> (name##_SHIFT)) & name##_MASK)
-#endif
 
-#define ECORE_MFW_GET_FIELD(name, field)                               \
-       (((name) & (field ## _MASK)) >> (field ## _SHIFT))
+#define GET_MFW_FIELD(name, field)                             \
+       (((name) & (field ## _MASK)) >> (field ## _OFFSET))
 
-#define ECORE_MFW_SET_FIELD(name, field, value)                                \
+#define SET_MFW_FIELD(name, field, value)                              \
 do {                                                                   \
-       (name) &= ~((field ## _MASK) << (field ## _SHIFT));             \
-       (name) |= (((value) << (field ## _SHIFT)) & (field ## _MASK));  \
+       (name) &= ~((field ## _MASK));          \
+       (name) |= (((value) << (field ## _OFFSET)) & (field ## _MASK)); \
 } while (0)
+#endif
 
 static OSAL_INLINE u32 DB_ADDR(u32 cid, u32 DEMS)
 {
@@ -279,7 +280,6 @@ struct ecore_qm_iids {
  * is received from MFW.
  */
 enum ecore_resources {
-       ECORE_SB,
        ECORE_L2_QUEUE,
        ECORE_VPORT,
        ECORE_RSS_ENG,
@@ -293,7 +293,13 @@ enum ecore_resources {
        ECORE_CMDQS_CQS,
        ECORE_RDMA_STATS_QUEUE,
        ECORE_BDQ,
-       ECORE_MAX_RESC,                 /* must be last */
+
+       /* This is needed only internally for matching against the IGU.
+        * In case of legacy MFW, would be set to `0'.
+        */
+       ECORE_SB,
+
+       ECORE_MAX_RESC,
 };
 
 /* Features that require resources, given as input to the resource management
@@ -345,6 +351,12 @@ enum ecore_hw_err_type {
 };
 #endif
 
+enum ecore_db_rec_exec {
+       DB_REC_DRY_RUN,
+       DB_REC_REAL_DEAL,
+       DB_REC_ONCE,
+};
+
 struct ecore_hw_info {
        /* PCI personality */
        enum ecore_pci_personality personality;
@@ -473,6 +485,12 @@ struct ecore_qm_info {
        u8                      num_pf_rls;
 };
 
+struct ecore_db_recovery_info {
+       osal_list_t list;
+       osal_spinlock_t lock;
+       u32 db_recovery_counter;
+};
+
 struct storm_stats {
        u32 address;
        u32 len;
@@ -556,10 +574,6 @@ struct ecore_hwfn {
        bool                            b_rdma_enabled_in_prs;
        u32                             rdma_prs_search_reg;
 
-       /* Array of sb_info of all status blocks */
-       struct ecore_sb_info            *sbs_info[MAX_SB_PER_PF_MIMD];
-       u16                             num_sbs;
-
        struct ecore_cxt_mngr           *p_cxt_mngr;
 
        /* Flag indicating whether interrupts are enabled or not*/
@@ -603,6 +617,9 @@ struct ecore_hwfn {
        /* L2-related */
        struct ecore_l2_info            *p_l2_info;
 
+       /* Mechanism for recovering from doorbell drop */
+       struct ecore_db_recovery_info   db_recovery_info;
+
        /* @DPDK */
        struct ecore_ptt                *p_arfs_ptt;
 };
@@ -632,15 +649,18 @@ enum qed_dbg_features {
        DBG_FEATURE_NUM
 };
 
+enum ecore_dev_type {
+       ECORE_DEV_TYPE_BB,
+       ECORE_DEV_TYPE_AH,
+};
+
 struct ecore_dev {
        u32                             dp_module;
        u8                              dp_level;
        char                            name[NAME_SIZE];
        void                            *dp_ctx;
 
-       u8                              type;
-#define ECORE_DEV_TYPE_BB      (0 << 0)
-#define ECORE_DEV_TYPE_AH      (1 << 0)
+       enum ecore_dev_type             type;
 /* Translate type/revision combo into the proper conditions */
 #define ECORE_IS_BB(dev)       ((dev)->type == ECORE_DEV_TYPE_BB)
 #define ECORE_IS_BB_A0(dev)    (ECORE_IS_BB(dev) && CHIP_REV_IS_A0(dev))
@@ -653,13 +673,12 @@ struct ecore_dev {
 #define ECORE_IS_AH(dev)       ((dev)->type == ECORE_DEV_TYPE_AH)
 #define ECORE_IS_K2(dev)       ECORE_IS_AH(dev)
 
+       u16 vendor_id;
+       u16 device_id;
 #define ECORE_DEV_ID_MASK      0xff00
 #define ECORE_DEV_ID_MASK_BB   0x1600
 #define ECORE_DEV_ID_MASK_AH   0x8000
 
-       u16 vendor_id;
-       u16 device_id;
-
        u16                             chip_num;
        #define CHIP_NUM_MASK                   0xffff
        #define CHIP_NUM_SHIFT                  16
@@ -750,6 +769,7 @@ struct ecore_dev {
 #define IS_ECORE_SRIOV(p_dev)          (!!(p_dev)->p_iov_info)
        struct ecore_tunnel_info        tunnel;
        bool                            b_is_vf;
+       bool                            b_dont_override_vf_msix;
 
        u32                             drv_type;
 
@@ -770,7 +790,7 @@ struct ecore_dev {
        bool                            attn_clr_en;
 
        /* Indicates whether allowing the MFW to collect a crash dump */
-       bool                            mdump_en;
+       bool                            allow_mdump;
 
        /* Indicates if the reg_fifo is checked after any register access */
        bool                            chk_reg_fifo;
@@ -808,8 +828,8 @@ struct ecore_dev {
  *
  * @return OSAL_INLINE u8
  */
-static OSAL_INLINE u8 ecore_concrete_to_sw_fid(struct ecore_dev *p_dev,
-                                         u32 concrete_fid)
+static OSAL_INLINE u8
+ecore_concrete_to_sw_fid(__rte_unused struct ecore_dev *p_dev, u32 concrete_fid)
 {
        u8 vfid     = GET_FIELD(concrete_fid, PXP_CONCRETE_FID_VFID);
        u8 pfid     = GET_FIELD(concrete_fid, PXP_CONCRETE_FID_PFID);
@@ -829,6 +849,7 @@ static OSAL_INLINE u8 ecore_concrete_to_sw_fid(struct ecore_dev *p_dev,
 
 int ecore_configure_vport_wfq(struct ecore_dev *p_dev, u16 vp_id, u32 rate);
 void ecore_configure_vp_wfq_on_link_change(struct ecore_dev *p_dev,
+                                          struct ecore_ptt *p_ptt,
                                           u32 min_pf_rate);
 
 int ecore_configure_pf_max_bandwidth(struct ecore_dev *p_dev, u8 max_bw);
@@ -854,6 +875,13 @@ u16 ecore_get_cm_pq_idx_mcos(struct ecore_hwfn *p_hwfn, u8 tc);
 u16 ecore_get_cm_pq_idx_vf(struct ecore_hwfn *p_hwfn, u16 vf);
 u16 ecore_get_cm_pq_idx_rl(struct ecore_hwfn *p_hwfn, u8 qpid);
 
+const char *ecore_hw_get_resc_name(enum ecore_resources res_id);
+
+/* doorbell recovery mechanism */
+void ecore_db_recovery_dp(struct ecore_hwfn *p_hwfn);
+void ecore_db_recovery_execute(struct ecore_hwfn *p_hwfn,
+                              enum ecore_db_rec_exec);
+
 /* amount of resources used in qm init */
 u8 ecore_init_qm_get_num_tcs(struct ecore_hwfn *p_hwfn);
 u16 ecore_init_qm_get_num_vfs(struct ecore_hwfn *p_hwfn);
@@ -863,6 +891,4 @@ u16 ecore_init_qm_get_num_pqs(struct ecore_hwfn *p_hwfn);
 
 #define ECORE_LEADING_HWFN(dev)        (&dev->hwfns[0])
 
-const char *ecore_hw_get_resc_name(enum ecore_resources res_id);
-
 #endif /* __ECORE_H */