net/bnxt: fix max ring count
[dpdk.git] / drivers / net / bnxt / bnxt.h
index 0a6b350..12fed1e 100644 (file)
@@ -433,6 +433,13 @@ struct bnxt_ctx_mem_info {
        struct bnxt_ctx_pg_info *tqm_mem[BNXT_MAX_TC_Q];
 };
 
+struct bnxt_ctx_mem_buf_info {
+       void            *va;
+       rte_iova_t      dma;
+       uint16_t        ctx_id;
+       size_t          size;
+};
+
 /* Maximum Firmware Reset bail out value in milliseconds */
 #define BNXT_MAX_FW_RESET_TIMEOUT      6000
 /* Minimum time required for the firmware readiness in milliseconds */
@@ -473,6 +480,11 @@ struct bnxt_error_recovery_info {
        uint32_t        last_reset_counter;
 };
 
+/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */
+#define BNXT_IF_CHANGE_RETRY_INTERVAL  50
+/* Maximum retry count for FUNC_DRV_IF_CHANGE */
+#define BNXT_IF_CHANGE_RETRY_COUNT     40
+
 struct bnxt_mark_info {
        uint32_t        mark_id;
        bool            valid;
@@ -495,6 +507,10 @@ struct bnxt_mark_info {
 #define BNXT_GRCP_WINDOW_2_BASE                0x2000
 #define BNXT_GRCP_WINDOW_3_BASE                0x3000
 
+#define BNXT_GRCP_BASE_MASK            0xfffff000
+#define BNXT_GRCP_OFFSET_MASK          0x00000ffc
+
+#define BNXT_FW_STATUS_HEALTHY         0x8000
 #define BNXT_FW_STATUS_SHUTDOWN                0x100000
 
 #define BNXT_HWRM_SHORT_REQ_LEN                sizeof(struct hwrm_short_input)
@@ -530,7 +546,7 @@ struct bnxt {
 #define BNXT_FLAG_NEW_RM                       BIT(20)
 #define BNXT_FLAG_NPAR_PF                      BIT(21)
 #define BNXT_FLAG_FW_CAP_ONE_STEP_TX_TS                BIT(22)
-#define BNXT_FLAG_ADV_FLOW_MGMT                        BIT(23)
+#define BNXT_FLAG_FC_THREAD                    BIT(23)
 #define BNXT_FLAG_RX_VECTOR_PKT_MODE           BIT(24)
 #define BNXT_PF(bp)            (!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)            ((bp)->flags & BNXT_FLAG_VF)
@@ -550,6 +566,9 @@ struct bnxt {
 #define BNXT_FW_CAP_IF_CHANGE          BIT(1)
 #define BNXT_FW_CAP_ERROR_RECOVERY     BIT(2)
 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD BIT(3)
+#define BNXT_FW_CAP_ADV_FLOW_MGMT      BIT(5)
+#define BNXT_FW_CAP_ADV_FLOW_COUNTERS  BIT(6)
+#define BNXT_FW_CAP_HCOMM_FW_STATUS    BIT(7)
 
        uint32_t                flow_flags;
 #define BNXT_FLOW_FLAG_L2_HDR_SRC_FILTER_EN    BIT(0)
@@ -634,10 +653,10 @@ struct bnxt {
 #define MAX_STINGRAY_RINGS             128U
 /* For sake of symmetry, max Tx rings == max Rx rings, one stat ctx for each */
 #define BNXT_MAX_RX_RINGS(bp) \
-       (BNXT_STINGRAY(bp) ? RTE_MIN(RTE_MIN(bp->max_rx_rings, \
+       (BNXT_STINGRAY(bp) ? RTE_MIN(RTE_MIN(bp->max_rx_rings / 2U, \
                                             MAX_STINGRAY_RINGS), \
                                     bp->max_stat_ctx / 2U) : \
-                               RTE_MIN(bp->max_rx_rings, \
+                               RTE_MIN(bp->max_rx_rings / 2U, \
                                        bp->max_stat_ctx / 2U))
 #define BNXT_MAX_TX_RINGS(bp) \
        (RTE_MIN((bp)->max_tx_rings, BNXT_MAX_RX_RINGS(bp)))
@@ -690,8 +709,17 @@ struct bnxt {
        struct tf               tfp;
        struct bnxt_ulp_context ulp_ctx;
        uint8_t                 truflow;
+       uint16_t                max_fc;
+       struct bnxt_ctx_mem_buf_info rx_fc_in_tbl;
+       struct bnxt_ctx_mem_buf_info rx_fc_out_tbl;
+       struct bnxt_ctx_mem_buf_info tx_fc_in_tbl;
+       struct bnxt_ctx_mem_buf_info tx_fc_out_tbl;
+       uint16_t                flow_count;
+       uint8_t                 flow_xstat;
 };
 
+#define BNXT_FC_TIMER  1 /* Timer freq in Sec Flow Counters */
+
 int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu);
 int bnxt_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete,
                     bool exp_link_status);
@@ -737,5 +765,10 @@ void bnxt_ulp_deinit(struct bnxt *bp);
 
 uint16_t bnxt_get_vnic_id(uint16_t port);
 uint16_t bnxt_get_svif(uint16_t port_id, bool func_svif);
+uint16_t bnxt_get_fw_func_id(uint16_t port);
 
+void bnxt_cancel_fc_thread(struct bnxt *bp);
+void bnxt_flow_cnt_alarm_cb(void *arg);
+int bnxt_flow_stats_req(struct bnxt *bp);
+int bnxt_flow_stats_cnt(struct bnxt *bp);
 #endif