New upstream version 18.05
[deb_dpdk.git] / drivers / net / bnxt / bnxt_vnic.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2018 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _BNXT_VNIC_H_
7 #define _BNXT_VNIC_H_
8
9 #include <sys/queue.h>
10 #include <stdbool.h>
11
12 struct bnxt_vnic_info {
13         STAILQ_ENTRY(bnxt_vnic_info)    next;
14         uint8_t         ff_pool_idx;
15
16         uint16_t        fw_vnic_id; /* returned by Chimp during alloc */
17         uint16_t        rss_rule;
18 #define MAX_NUM_TRAFFIC_CLASSES         8
19 #define MAX_NUM_RSS_QUEUES_PER_VNIC     16
20 #define MAX_QUEUES_PER_VNIC     (MAX_NUM_RSS_QUEUES_PER_VNIC + \
21                                  MAX_NUM_TRAFFIC_CLASSES)
22         uint16_t        start_grp_id;
23         uint16_t        end_grp_id;
24         uint16_t        fw_grp_ids[MAX_QUEUES_PER_VNIC];
25         uint16_t        dflt_ring_grp;
26         uint16_t        mru;
27         uint16_t        hash_type;
28         uint8_t         hash_mode;
29         rte_iova_t      rss_table_dma_addr;
30         uint16_t        *rss_table;
31         rte_iova_t      rss_hash_key_dma_addr;
32         void            *rss_hash_key;
33         rte_iova_t      mc_list_dma_addr;
34         char            *mc_list;
35         uint32_t        mc_addr_cnt;
36 #define BNXT_MAX_MC_ADDRS               16
37         uint32_t        flags;
38 #define BNXT_VNIC_INFO_PROMISC                  (1 << 0)
39 #define BNXT_VNIC_INFO_ALLMULTI                 (1 << 1)
40 #define BNXT_VNIC_INFO_BCAST                    (1 << 2)
41 #define BNXT_VNIC_INFO_UCAST                    (1 << 3)
42 #define BNXT_VNIC_INFO_MCAST                    (1 << 4)
43 #define BNXT_VNIC_INFO_TAGGED                   (1 << 5)
44 #define BNXT_VNIC_INFO_UNTAGGED                 (1 << 6)
45
46         uint16_t        cos_rule;
47         uint16_t        lb_rule;
48         bool            vlan_strip;
49         bool            func_default;
50         bool            bd_stall;
51         bool            roce_dual;
52         bool            roce_only;
53         bool            rss_dflt_cr;
54
55         STAILQ_HEAD(, bnxt_filter_info) filter;
56         STAILQ_HEAD(, rte_flow) flow_list;
57 };
58
59 struct bnxt;
60 void bnxt_init_vnics(struct bnxt *bp);
61 int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
62                           int pool);
63 struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp);
64 void bnxt_free_all_vnics(struct bnxt *bp);
65 void bnxt_free_vnic_attributes(struct bnxt *bp);
66 int bnxt_alloc_vnic_attributes(struct bnxt *bp);
67 void bnxt_free_vnic_mem(struct bnxt *bp);
68 int bnxt_alloc_vnic_mem(struct bnxt *bp);
69 #endif