net/bnxt: fix allocation of flow stat related structs
[dpdk.git] / drivers / net / bnxt / bnxt.h
index ffb3a0e..b714354 100644 (file)
 #define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT      12
 
 struct bnxt_led_info {
+       uint8_t      num_leds;
        uint8_t      led_id;
        uint8_t      led_type;
        uint8_t      led_group_id;
@@ -362,7 +363,6 @@ struct bnxt_coal {
 #define BNXT_MAX_TC    8
 #define BNXT_MAX_QUEUE 8
 #define BNXT_MAX_TC_Q  (BNXT_MAX_TC + 1)
-#define BNXT_MAX_Q     (bp->max_q + 1)
 #define BNXT_PAGE_SHFT 12
 #define BNXT_PAGE_SIZE (1 << BNXT_PAGE_SHFT)
 #define MAX_CTX_PAGES  (BNXT_PAGE_SIZE / 8)
@@ -421,6 +421,7 @@ struct bnxt_ctx_mem_info {
        uint16_t        tim_entry_size;
        uint32_t        tim_max_entries;
        uint8_t         tqm_entries_multiple;
+       uint8_t         tqm_fp_rings_count;
 
        uint32_t        flags;
 #define BNXT_CTX_FLAG_INITED    0x01
@@ -480,6 +481,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;
@@ -502,9 +508,23 @@ 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)
+
+struct bnxt_flow_stat_info {
+       uint16_t                max_fc;
+       uint16_t                flow_count;
+       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;
+};
+
 struct bnxt {
        void                            *bar0;
 
@@ -539,6 +559,7 @@ struct bnxt {
 #define BNXT_FLAG_FW_CAP_ONE_STEP_TX_TS                BIT(22)
 #define BNXT_FLAG_FC_THREAD                    BIT(23)
 #define BNXT_FLAG_RX_VECTOR_PKT_MODE           BIT(24)
+#define BNXT_FLAG_FLOW_XSTATS_EN               BIT(25)
 #define BNXT_PF(bp)            (!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)            ((bp)->flags & BNXT_FLAG_VF)
 #define BNXT_NPAR(bp)          ((bp)->flags & BNXT_FLAG_NPAR_PF)
@@ -551,6 +572,7 @@ struct bnxt {
 #define BNXT_STINGRAY(bp)      ((bp)->flags & BNXT_FLAG_STINGRAY)
 #define BNXT_HAS_NQ(bp)                BNXT_CHIP_THOR(bp)
 #define BNXT_HAS_RING_GRPS(bp) (!BNXT_CHIP_THOR(bp))
+#define BNXT_FLOW_XSTATS_EN(bp)        ((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN)
 
        uint32_t                fw_cap;
 #define BNXT_FW_CAP_HOT_RESET          BIT(0)
@@ -559,6 +581,7 @@ struct bnxt {
 #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)
@@ -626,8 +649,8 @@ struct bnxt {
        uint32_t                        hwrm_cmd_timeout;
 
        struct bnxt_link_info   link_info;
-       struct bnxt_cos_queue_info      rx_cos_queue[BNXT_COS_QUEUE_COUNT];
-       struct bnxt_cos_queue_info      tx_cos_queue[BNXT_COS_QUEUE_COUNT];
+       struct bnxt_cos_queue_info      *rx_cos_queue;
+       struct bnxt_cos_queue_info      *tx_cos_queue;
        uint8_t                 tx_cosq_id[BNXT_COS_QUEUE_COUNT];
        uint8_t                 rx_cosq_cnt;
        uint8_t                 max_tc;
@@ -643,10 +666,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)))
@@ -676,8 +699,7 @@ struct bnxt {
        uint32_t                fw_ver;
        uint32_t                hwrm_spec_code;
 
-       struct bnxt_led_info    leds[BNXT_MAX_LED];
-       uint8_t                 num_leds;
+       struct bnxt_led_info    *leds;
        struct bnxt_ptp_cfg     *ptp_cfg;
        uint16_t                vf_resv_strategy;
        struct bnxt_ctx_mem_info        *ctx;
@@ -699,12 +721,7 @@ 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;
+       struct bnxt_flow_stat_info *flow_stat;
        uint8_t                 flow_xstat;
 };
 
@@ -755,6 +772,7 @@ 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);