4 * Copyright(c) Broadcom Limited.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Broadcom Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <sys/queue.h>
40 #include <rte_ethdev.h>
41 #include <rte_memory.h>
42 #include <rte_lcore.h>
43 #include <rte_spinlock.h>
47 uint8_t mac_addr[ETHER_ADDR_LEN];
48 uint16_t max_rsscos_ctx;
49 uint16_t max_cp_rings;
50 uint16_t max_tx_rings;
51 uint16_t max_rx_rings;
54 struct bnxt_pf_info *pf;
58 #define BNXT_FIRST_PF_FID 1
59 #define BNXT_MAX_VFS(bp) (bp->pf.max_vfs)
60 #define BNXT_FIRST_VF_FID 128
61 #define BNXT_PF_RINGS_USED(bp) bnxt_get_num_queues(bp)
62 #define BNXT_PF_RINGS_AVAIL(bp) (bp->pf.max_cp_rings - BNXT_PF_RINGS_USED(bp))
65 uint8_t mac_addr[ETHER_ADDR_LEN];
66 uint16_t max_rsscos_ctx;
67 uint16_t max_cp_rings;
68 uint16_t max_tx_rings;
69 uint16_t max_rx_rings;
76 phys_addr_t vf_req_buf_dma_addr;
77 uint32_t vf_req_fwd[8];
78 struct bnxt_vf_info *vf;
81 #define BNXT_COS_QUEUE_COUNT 8
82 struct bnxt_cos_queue_info {
90 struct rte_eth_dev *eth_dev;
91 struct rte_pci_device *pdev;
94 #define BNXT_FLAG_VF (1 << 1)
95 #define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF))
96 #define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF)
98 #define MAX_NUM_MAC_ADDR 32
99 uint8_t mac_addr[ETHER_ADDR_LEN];
101 uint16_t hwrm_cmd_seq;
102 void *hwrm_cmd_resp_addr;
103 phys_addr_t hwrm_cmd_resp_dma_addr;
104 rte_spinlock_t hwrm_lock;
105 uint16_t max_req_len;
106 uint16_t max_resp_len;
108 struct bnxt_cos_queue_info cos_queue[BNXT_COS_QUEUE_COUNT];
110 struct bnxt_pf_info pf;
111 struct bnxt_vf_info vf;