New upstream version 18.08
[deb_dpdk.git] / drivers / net / bnxt / bnxt.h
index b5a0bad..db5c4eb 100644 (file)
@@ -1,34 +1,6 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) Broadcom Limited.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Broadcom Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2014-2018 Broadcom
+ * All rights reserved.
  */
 
 #ifndef _BNXT_H_
 
 #define BNXT_MAX_MTU           9500
 #define VLAN_TAG_SIZE          4
+#define BNXT_VF_RSV_NUM_RSS_CTX        1
+#define BNXT_VF_RSV_NUM_L2_CTX 4
+/* TODO: For now, do not support VMDq/RFS on VFs. */
+#define BNXT_VF_RSV_NUM_VNIC   1
 #define BNXT_MAX_LED           4
+#define BNXT_NUM_VLANS         2
+#define BNXT_MIN_RING_DESC     16
+#define BNXT_MAX_TX_RING_DESC  4096
+#define BNXT_MAX_RX_RING_DESC  8192
+#define BNXT_DB_SIZE           0x80
+
+#define BNXT_INT_LAT_TMR_MIN                   75
+#define BNXT_INT_LAT_TMR_MAX                   150
+#define BNXT_NUM_CMPL_AGGR_INT                 36
+#define BNXT_CMPL_AGGR_DMA_TMR                 37
+#define BNXT_NUM_CMPL_DMA_AGGR                 36
+#define BNXT_CMPL_AGGR_DMA_TMR_DURING_INT      50
+#define BNXT_NUM_CMPL_DMA_AGGR_DURING_INT      12
 
 struct bnxt_led_info {
        uint8_t      led_id;
@@ -125,6 +114,7 @@ struct bnxt_child_vf_info {
 struct bnxt_pf_info {
 #define BNXT_FIRST_PF_FID      1
 #define BNXT_MAX_VFS(bp)       (bp->pf.max_vfs)
+#define BNXT_TOTAL_VFS(bp)     ((bp)->pf.total_vfs)
 #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))
@@ -132,6 +122,9 @@ struct bnxt_pf_info {
        uint16_t                first_vf_id;
        uint16_t                active_vfs;
        uint16_t                max_vfs;
+       uint16_t                total_vfs; /* Total VFs possible.
+                                           * Not necessarily enabled.
+                                           */
        uint32_t                func_cfg_flags;
        void                    *vf_req_buf;
        rte_iova_t              vf_req_buf_dma_addr;
@@ -229,6 +222,16 @@ struct bnxt_ptp_cfg {
        uint32_t                        tx_mapped_regs[BNXT_PTP_TX_REGS];
 };
 
+struct bnxt_coal {
+       uint16_t                        num_cmpl_aggr_int;
+       uint16_t                        num_cmpl_dma_aggr;
+       uint16_t                        num_cmpl_dma_aggr_during_int;
+       uint16_t                        int_lat_tmr_max;
+       uint16_t                        int_lat_tmr_min;
+       uint16_t                        cmpl_aggr_dma_tmr;
+       uint16_t                        cmpl_aggr_dma_tmr_during_int;
+};
+
 #define BNXT_HWRM_SHORT_REQ_LEN                sizeof(struct hwrm_short_input)
 struct bnxt {
        void                            *bar0;
@@ -236,6 +239,7 @@ struct bnxt {
        struct rte_eth_dev              *eth_dev;
        struct rte_eth_rss_conf         rss_conf;
        struct rte_pci_device           *pdev;
+       void                            *doorbell_base;
 
        uint32_t                flags;
 #define BNXT_FLAG_REGISTERED   (1 << 0)
@@ -246,6 +250,7 @@ struct bnxt {
 #define BNXT_FLAG_UPDATE_HASH  (1 << 5)
 #define BNXT_FLAG_PTP_SUPPORTED        (1 << 6)
 #define BNXT_FLAG_MULTI_HOST    (1 << 7)
+#define BNXT_FLAG_NEW_RM       (1 << 30)
 #define BNXT_FLAG_INIT_DONE    (1 << 31)
 #define BNXT_PF(bp)            (!((bp)->flags & BNXT_FLAG_VF))
 #define BNXT_VF(bp)            ((bp)->flags & BNXT_FLAG_VF)
@@ -300,6 +305,7 @@ struct bnxt {
 
        struct bnxt_link_info   link_info;
        struct bnxt_cos_queue_info      cos_queue[BNXT_COS_QUEUE_COUNT];
+       uint8_t                 tx_cosq_id;
 
        uint16_t                fw_fid;
        uint8_t                 dflt_mac_addr[ETHER_ADDR_LEN];
@@ -321,19 +327,19 @@ struct bnxt {
        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;
+       uint32_t                hwrm_spec_code;
 
        struct bnxt_led_info    leds[BNXT_MAX_LED];
        uint8_t                 num_leds;
        struct bnxt_ptp_cfg     *ptp_cfg;
+       uint16_t                vf_resv_strategy;
 };
 
 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
-
 bool is_bnxt_supported(struct rte_eth_dev *dev);
+bool bnxt_stratus_device(struct bnxt *bp);
 extern const struct rte_flow_ops bnxt_flow_ops;
 
 extern int bnxt_logtype_driver;