xref: /f-stack/dpdk/drivers/net/bnxt/bnxt_vnic.h (revision 2d9fd380)
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 #define INVALID_VNIC_ID		((uint16_t)-1)
13 
14 #define BNXT_RSS_LEVEL_INNERMOST        0x2
15 #define BNXT_RSS_LEVEL_OUTERMOST        0x1
16 
17 struct bnxt_vnic_info {
18 	STAILQ_ENTRY(bnxt_vnic_info)	next;
19 	uint8_t		ff_pool_idx;
20 
21 	uint16_t	fw_vnic_id; /* returned by Chimp during alloc */
22 	uint16_t	rss_rule;
23 	uint16_t	start_grp_id;
24 	uint16_t	end_grp_id;
25 	uint16_t	*fw_grp_ids;
26 	uint16_t	num_lb_ctxts;
27 	uint16_t	dflt_ring_grp;
28 	uint16_t	mru;
29 	uint16_t	hash_type;
30 	uint8_t		hash_mode;
31 	rte_iova_t	rss_table_dma_addr;
32 	uint16_t	*rss_table;
33 	rte_iova_t	rss_hash_key_dma_addr;
34 	void		*rss_hash_key;
35 	rte_iova_t	mc_list_dma_addr;
36 	char		*mc_list;
37 	uint32_t	mc_addr_cnt;
38 #define BNXT_MAX_MC_ADDRS		16
39 	uint32_t	flags;
40 #define BNXT_VNIC_INFO_PROMISC			(1 << 0)
41 #define BNXT_VNIC_INFO_ALLMULTI			(1 << 1)
42 #define BNXT_VNIC_INFO_BCAST			(1 << 2)
43 #define BNXT_VNIC_INFO_UCAST			(1 << 3)
44 #define BNXT_VNIC_INFO_MCAST			(1 << 4)
45 #define BNXT_VNIC_INFO_TAGGED			(1 << 5)
46 #define BNXT_VNIC_INFO_UNTAGGED			(1 << 6)
47 
48 	uint16_t	cos_rule;
49 	uint16_t	lb_rule;
50 	uint16_t	rx_queue_cnt;
51 	uint16_t	cos_queue_id;
52 	bool		vlan_strip;
53 	bool		func_default;
54 	bool		bd_stall;
55 	bool		roce_dual;
56 	bool		roce_only;
57 	bool		rss_dflt_cr;
58 
59 	STAILQ_HEAD(, bnxt_filter_info)	filter;
60 	STAILQ_HEAD(, rte_flow)	flow_list;
61 };
62 
63 struct bnxt;
64 int bnxt_free_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic,
65 			  int pool);
66 struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp);
67 void bnxt_free_all_vnics(struct bnxt *bp);
68 void bnxt_free_vnic_attributes(struct bnxt *bp);
69 int bnxt_alloc_vnic_attributes(struct bnxt *bp);
70 void bnxt_free_vnic_mem(struct bnxt *bp);
71 int bnxt_alloc_vnic_mem(struct bnxt *bp);
72 int bnxt_vnic_grp_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
73 void prandom_bytes(void *dest_ptr, size_t len);
74 uint16_t bnxt_rte_to_hwrm_hash_types(uint64_t rte_type);
75 int bnxt_rte_to_hwrm_hash_level(struct bnxt *bp, uint64_t hash_f, uint32_t lvl);
76 uint64_t bnxt_hwrm_to_rte_rss_level(struct bnxt *bp, uint32_t mode);
77 #endif
78