New upstream version 17.11-rc3
[deb_dpdk.git] / drivers / net / qede / base / ecore_int_api.h
index f6db807..24cdf5e 100644 (file)
@@ -26,7 +26,7 @@ enum ecore_int_mode {
 #endif
 
 struct ecore_sb_info {
-       struct status_block *sb_virt;
+       struct status_block_e4 *sb_virt;
        dma_addr_t sb_phys;
        u32 sb_ack;             /* Last given ack */
        u16 igu_sb_id;
@@ -41,10 +41,22 @@ struct ecore_sb_info {
        struct ecore_dev *p_dev;
 };
 
+struct ecore_sb_info_dbg {
+       u32 igu_prod;
+       u32 igu_cons;
+       u16 pi[PIS_PER_SB_E4];
+};
+
 struct ecore_sb_cnt_info {
-       int sb_cnt;
-       int sb_iov_cnt;
-       int sb_free_blk;
+       /* Original, current, and free SBs for PF */
+       int orig;
+       int cnt;
+       int free_cnt;
+
+       /* Original, current and free SBS for child VFs */
+       int iov_orig;
+       int iov_cnt;
+       int free_cnt_iov;
 };
 
 static OSAL_INLINE u16 ecore_sb_update_sb_idx(struct ecore_sb_info *sb_info)
@@ -55,7 +67,7 @@ static OSAL_INLINE u16 ecore_sb_update_sb_idx(struct ecore_sb_info *sb_info)
        /* barrier(); status block is written to by the chip */
        /* FIXME: need some sort of barrier. */
        prod = OSAL_LE32_TO_CPU(sb_info->sb_virt->prod_index) &
-           STATUS_BLOCK_PROD_INDEX_MASK;
+           STATUS_BLOCK_E4_PROD_INDEX_MASK;
        if (sb_info->sb_ack != prod) {
                sb_info->sb_ack = prod;
                rc |= ECORE_SB_IDX;
@@ -108,7 +120,7 @@ static OSAL_INLINE void __internal_ram_wr(struct ecore_hwfn *p_hwfn,
                                          void OSAL_IOMEM *addr,
                                          int size, u32 *data)
 #else
-static OSAL_INLINE void __internal_ram_wr(void *p_hwfn,
+static OSAL_INLINE void __internal_ram_wr(__rte_unused void *p_hwfn,
                                          void OSAL_IOMEM *addr,
                                          int size, u32 *data)
 #endif
@@ -119,20 +131,38 @@ static OSAL_INLINE void __internal_ram_wr(void *p_hwfn,
                DIRECT_REG_WR(p_hwfn, &((u32 OSAL_IOMEM *)addr)[i], data[i]);
 }
 
+#ifdef ECORE_CONFIG_DIRECT_HWFN
+static OSAL_INLINE void __internal_ram_wr_relaxed(struct ecore_hwfn *p_hwfn,
+                                                 void OSAL_IOMEM * addr,
+                                                 int size, u32 *data)
+#else
+static OSAL_INLINE void __internal_ram_wr_relaxed(__rte_unused void *p_hwfn,
+                                                 void OSAL_IOMEM * addr,
+                                                 int size, u32 *data)
+#endif
+{
+       unsigned int i;
+
+       for (i = 0; i < size / sizeof(*data); i++)
+               DIRECT_REG_WR_RELAXED(p_hwfn, &((u32 OSAL_IOMEM *)addr)[i],
+                                     data[i]);
+}
+
 #ifdef ECORE_CONFIG_DIRECT_HWFN
 static OSAL_INLINE void internal_ram_wr(struct ecore_hwfn *p_hwfn,
-                                       void OSAL_IOMEM *addr,
-                                       int size, u32 *data)
+                                               void OSAL_IOMEM * addr,
+                                               int size, u32 *data)
 {
-       __internal_ram_wr(p_hwfn, addr, size, data);
+       __internal_ram_wr_relaxed(p_hwfn, addr, size, data);
 }
 #else
 static OSAL_INLINE void internal_ram_wr(void OSAL_IOMEM *addr,
-                                       int size, u32 *data)
+                                               int size, u32 *data)
 {
-       __internal_ram_wr(OSAL_NULL, addr, size, data);
+       __internal_ram_wr_relaxed(OSAL_NULL, addr, size, data);
 }
 #endif
+
 #endif
 
 struct ecore_hwfn;
@@ -149,17 +179,17 @@ enum ecore_coalescing_fsm {
  *
  * @param p_hwfn
  * @param p_ptt
- * @param igu_sb_id
+ * @param p_sb
  * @param pi_index
  * @param state
  * @param timeset
  */
-void ecore_int_cau_conf_pi(struct ecore_hwfn *p_hwfn,
-                          struct ecore_ptt *p_ptt,
-                          u16 igu_sb_id,
-                          u32 pi_index,
-                          enum ecore_coalescing_fsm coalescing_fsm,
-                          u8 timeset);
+void ecore_int_cau_conf_pi(struct ecore_hwfn           *p_hwfn,
+                          struct ecore_ptt             *p_ptt,
+                          struct ecore_sb_info         *p_sb,
+                          u32                          pi_index,
+                          enum ecore_coalescing_fsm    coalescing_fsm,
+                          u8                           timeset);
 
 /**
  *
@@ -195,6 +225,7 @@ void ecore_int_igu_disable_int(struct ecore_hwfn *p_hwfn,
 u64 ecore_int_igu_read_sisr_reg(struct ecore_hwfn *p_hwfn);
 
 #define ECORE_SP_SB_ID 0xffff
+
 /**
  * @brief ecore_int_sb_init - Initializes the sb_info structure.
  *
@@ -274,4 +305,44 @@ void ecore_int_get_num_sbs(struct ecore_hwfn *p_hwfn,
  */
 void ecore_int_disable_post_isr_release(struct ecore_dev *p_dev);
 
+/**
+ * @brief ecore_int_attn_clr_enable - sets whether the general behavior is
+ *        preventing attentions from being reasserted, or following the
+ *        attributes of the specific attention.
+ *
+ * @param p_dev
+ * @param clr_enable
+ *
+ */
+void ecore_int_attn_clr_enable(struct ecore_dev *p_dev, bool clr_enable);
+
+/**
+ * @brief Read debug information regarding a given SB.
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ * @param p_sb - point to Status block for which we want to get info.
+ * @param p_info - pointer to struct to fill with information regarding SB.
+ *
+ * @return ECORE_SUCCESS if pointer is filled; failure otherwise.
+ */
+enum _ecore_status_t ecore_int_get_sb_dbg(struct ecore_hwfn *p_hwfn,
+                                         struct ecore_ptt *p_ptt,
+                                         struct ecore_sb_info *p_sb,
+                                         struct ecore_sb_info_dbg *p_info);
+
+/**
+ * @brief - Move a free Status block between PF and child VF
+ *
+ * @param p_hwfn
+ * @param p_ptt
+ * @param sb_id - The PF fastpath vector to be moved [re-assigned if claiming
+ *                from VF, given-up if moving to VF]
+ * @param b_to_vf - PF->VF == true, VF->PF == false
+ *
+ * @return ECORE_SUCCESS if SB successfully moved.
+ */
+enum _ecore_status_t
+ecore_int_igu_relocate_sb(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
+                         u16 sb_id, bool b_to_vf);
 #endif