net/bnxt: refactor the query stats
[dpdk.git] / drivers / net / bnxt / bnxt.h
index f7cf9d1..e411704 100644 (file)
@@ -35,6 +35,7 @@
 #define _BNXT_H_
 
 #include <inttypes.h>
+#include <stdbool.h>
 #include <sys/queue.h>
 
 #include <rte_ethdev.h>
@@ -44,7 +45,7 @@
 
 #include "bnxt_cpr.h"
 
-#define BNXT_MAX_MTU           9000
+#define BNXT_MAX_MTU           9500
 #define VLAN_TAG_SIZE          4
 
 enum bnxt_hw_context {
@@ -54,16 +55,20 @@ enum bnxt_hw_context {
        HW_CONTEXT_IS_LB    = 3,
 };
 
-struct bnxt_vf_info {
-       uint16_t                fw_fid;
-       uint8_t                 mac_addr[ETHER_ADDR_LEN];
-       uint16_t                max_rsscos_ctx;
-       uint16_t                max_cp_rings;
-       uint16_t                max_tx_rings;
-       uint16_t                max_rx_rings;
-       uint16_t                max_l2_ctx;
-       uint16_t                max_vnics;
-       struct bnxt_pf_info     *pf;
+struct bnxt_vlan_table_entry {
+       uint16_t                tpid;
+       uint16_t                vid;
+} __attribute__((packed));
+
+struct bnxt_child_vf_info {
+       void                    *req_buf;
+       struct bnxt_vlan_table_entry    *vlan_table;
+       STAILQ_HEAD(, bnxt_filter_info) filter;
+       uint32_t                func_cfg_flags;
+       uint32_t                l2_rx_mask;
+       uint16_t                fid;
+       uint16_t                dflt_vlan;
+       bool                    random_mac;
 };
 
 struct bnxt_pf_info {
@@ -72,29 +77,27 @@ struct bnxt_pf_info {
 #define BNXT_FIRST_VF_FID      128
 #define BNXT_PF_RINGS_USED(bp) bnxt_get_num_queues(bp)
 #define BNXT_PF_RINGS_AVAIL(bp)        (bp->pf.max_cp_rings - BNXT_PF_RINGS_USED(bp))
-       uint32_t                fw_fid;
        uint8_t                 port_id;
-       uint8_t                 mac_addr[ETHER_ADDR_LEN];
-       uint16_t                max_rsscos_ctx;
-       uint16_t                max_cp_rings;
-       uint16_t                max_tx_rings;
-       uint16_t                max_rx_rings;
-       uint16_t                max_l2_ctx;
-       uint16_t                max_vnics;
        uint16_t                first_vf_id;
        uint16_t                active_vfs;
        uint16_t                max_vfs;
+       uint32_t                func_cfg_flags;
        void                    *vf_req_buf;
        phys_addr_t             vf_req_buf_dma_addr;
        uint32_t                vf_req_fwd[8];
-       struct bnxt_vf_info     *vf;
+       uint16_t                total_vnics;
+       struct bnxt_child_vf_info       *vf_info;
+#define BNXT_EVB_MODE_NONE     0
+#define BNXT_EVB_MODE_VEB      1
+#define BNXT_EVB_MODE_VEPA     2
+       uint8_t                 evb_mode;
 };
 
 /* Max wait time is 10 * 100ms = 1s */
 #define BNXT_LINK_WAIT_CNT     10
 #define BNXT_LINK_WAIT_INTERVAL        100
 struct bnxt_link_info {
-       uint8_t                 phy_flags;
+       uint32_t                phy_flags;
        uint8_t                 mac_type;
        uint8_t                 phy_link_status;
        uint8_t                 loop_back;
@@ -128,19 +131,31 @@ struct bnxt {
        uint32_t                flags;
 #define BNXT_FLAG_REGISTERED   (1 << 0)
 #define BNXT_FLAG_VF           (1 << 1)
+#define BNXT_FLAG_PORT_STATS   (1 << 2)
+#define BNXT_FLAG_JUMBO                (1 << 3)
 #define BNXT_PF(bp)            (!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)            ((bp)->flags & BNXT_FLAG_VF)
+#define BNXT_NPAR_ENABLED(bp)  ((bp)->port_partition_type)
+#define BNXT_NPAR_PF(bp)       (BNXT_PF(bp) && BNXT_NPAR_ENABLED(bp))
 
        unsigned int            rx_nr_rings;
        unsigned int            rx_cp_nr_rings;
        struct bnxt_rx_queue **rx_queues;
+       const void              *rx_mem_zone;
+       struct rx_port_stats    *hw_rx_port_stats;
+       phys_addr_t             hw_rx_port_stats_map;
 
        unsigned int            tx_nr_rings;
        unsigned int            tx_cp_nr_rings;
        struct bnxt_tx_queue **tx_queues;
+       const void              *tx_mem_zone;
+       struct tx_port_stats    *hw_tx_port_stats;
+       phys_addr_t             hw_tx_port_stats_map;
 
        /* Default completion ring */
        struct bnxt_cp_ring_info        *def_cp_ring;
+       uint32_t                max_ring_grps;
+       struct bnxt_ring_grp_info       *grp_info;
 
        unsigned int            nr_vnics;
 
@@ -154,6 +169,8 @@ struct bnxt {
 #define MAX_FF_POOLS   ETH_64_POOLS
        STAILQ_HEAD(, bnxt_vnic_info)   ff_pool[MAX_FF_POOLS];
 
+       struct bnxt_irq         *irq_tbl;
+
 #define MAX_NUM_MAC_ADDR       32
        uint8_t                 mac_addr[ETHER_ADDR_LEN];
 
@@ -167,8 +184,57 @@ struct bnxt {
        struct bnxt_link_info   link_info;
        struct bnxt_cos_queue_info      cos_queue[BNXT_COS_QUEUE_COUNT];
 
+       uint16_t                fw_fid;
+       uint8_t                 dflt_mac_addr[ETHER_ADDR_LEN];
+       uint16_t                max_rsscos_ctx;
+       uint16_t                max_cp_rings;
+       uint16_t                max_tx_rings;
+       uint16_t                max_rx_rings;
+       uint16_t                max_l2_ctx;
+       uint16_t                max_vnics;
+       uint16_t                max_stat_ctx;
+       uint16_t                vlan;
        struct bnxt_pf_info             pf;
-       struct bnxt_vf_info             vf;
+       uint8_t                 port_partition_type;
+       uint8_t                 dev_stopped;
+       uint8_t                 vxlan_port_cnt;
+       uint8_t                 geneve_port_cnt;
+       uint16_t                vxlan_port;
+       uint16_t                geneve_port;
+       uint16_t                vxlan_fw_dst_port_id;
+       uint16_t                geneve_fw_dst_port_id;
+       uint32_t                fw_ver;
+       rte_atomic64_t          rx_mbuf_alloc_fail;
 };
 
+/*
+ * Response sent back to the caller after callback
+ */
+enum rte_pmd_bnxt_mb_event_rsp {
+       RTE_PMD_BNXT_MB_EVENT_NOOP_ACK,  /**< skip mbox request and ACK */
+       RTE_PMD_BNXT_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */
+       RTE_PMD_BNXT_MB_EVENT_PROCEED,  /**< proceed with mbox request  */
+       RTE_PMD_BNXT_MB_EVENT_MAX       /**< max value of this enum */
+};
+
+/* mailbox message types */
+#define BNXT_VF_RESET                  0x01 /* VF requests reset */
+#define BNXT_VF_SET_MAC_ADDR   0x02 /* VF requests PF to set MAC addr */
+#define BNXT_VF_SET_VLAN               0x03 /* VF requests PF to set VLAN */
+#define BNXT_VF_SET_MTU                        0x04 /* VF requests PF to set MTU */
+#define BNXT_VF_SET_MRU                        0x05 /* VF requests PF to set MRU */
+
+/*
+ * Data sent to the caller when the callback is executed.
+ */
+struct rte_pmd_bnxt_mb_event_param {
+       uint16_t vf_id; /* Virtual Function number */
+       int     retval; /* return value */
+       void    *msg;   /* pointer to message */
+};
+
+int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
+int bnxt_rcv_msg_from_vf(struct bnxt *bp, uint16_t vf_id, void *msg);
+
+#define RX_PROD_AGG_BD_TYPE_RX_PROD_AGG                0x6
 #endif