net/bnxt: support async link notification
[dpdk.git] / drivers / net / bnxt / bnxt.h
index f8707b2..4418c7f 100644 (file)
 #include <rte_lcore.h>
 #include <rte_spinlock.h>
 
+#include "bnxt_cpr.h"
+
 #define BNXT_MAX_MTU           9000
 #define VLAN_TAG_SIZE          4
 
+enum bnxt_hw_context {
+       HW_CONTEXT_NONE     = 0,
+       HW_CONTEXT_IS_RSS   = 1,
+       HW_CONTEXT_IS_COS   = 2,
+       HW_CONTEXT_IS_LB    = 3,
+};
+
 struct bnxt_vf_info {
        uint16_t                fw_fid;
        uint8_t                 mac_addr[ETHER_ADDR_LEN];
@@ -54,6 +63,7 @@ struct bnxt_vf_info {
        uint16_t                max_rx_rings;
        uint16_t                max_l2_ctx;
        uint16_t                max_vnics;
+       uint16_t                vlan;
        struct bnxt_pf_info     *pf;
 };
 
@@ -81,6 +91,29 @@ struct bnxt_pf_info {
        struct bnxt_vf_info     *vf;
 };
 
+/* Max wait time is 10 * 100ms = 1s */
+#define BNXT_LINK_WAIT_CNT     10
+#define BNXT_LINK_WAIT_INTERVAL        100
+struct bnxt_link_info {
+       uint32_t                phy_flags;
+       uint8_t                 mac_type;
+       uint8_t                 phy_link_status;
+       uint8_t                 loop_back;
+       uint8_t                 link_up;
+       uint8_t                 duplex;
+       uint8_t                 pause;
+       uint8_t                 force_pause;
+       uint8_t                 auto_pause;
+       uint8_t                 auto_mode;
+#define PHY_VER_LEN            3
+       uint8_t                 phy_ver[PHY_VER_LEN];
+       uint16_t                link_speed;
+       uint16_t                support_speeds;
+       uint16_t                auto_link_speed;
+       uint16_t                auto_link_speed_mask;
+       uint32_t                preemphasis;
+};
+
 #define BNXT_COS_QUEUE_COUNT   8
 struct bnxt_cos_queue_info {
        uint8_t id;
@@ -98,6 +131,35 @@ struct bnxt {
 #define BNXT_FLAG_VF           (1 << 1)
 #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;
+
+       unsigned int            tx_nr_rings;
+       unsigned int            tx_cp_nr_rings;
+       struct bnxt_tx_queue **tx_queues;
+
+       /* 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;
+
+       struct bnxt_vnic_info   *vnic_info;
+       STAILQ_HEAD(, bnxt_vnic_info)   free_vnic_list;
+
+       struct bnxt_filter_info *filter_info;
+       STAILQ_HEAD(, bnxt_filter_info) free_filter_list;
+
+       /* VNIC pointer for flow filter (VMDq) pools */
+#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];
@@ -109,10 +171,15 @@ struct bnxt {
        uint16_t                        max_req_len;
        uint16_t                        max_resp_len;
 
+       struct bnxt_link_info   link_info;
        struct bnxt_cos_queue_info      cos_queue[BNXT_COS_QUEUE_COUNT];
 
        struct bnxt_pf_info             pf;
        struct bnxt_vf_info             vf;
+       uint8_t                 port_partition_type;
+       uint8_t                 dev_stopped;
 };
 
+int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete);
+
 #endif