xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_hsi_init_func.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc.
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
9  *  1. Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  *  2. Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  *
15  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  *  POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef __ECORE_HSI_INIT_FUNC__
30 #define __ECORE_HSI_INIT_FUNC__
31 /********************************/
32 /* HSI Init Functions constants */
33 /********************************/
34 
35 /* Number of VLAN priorities */
36 #define NUM_OF_VLAN_PRIORITIES			8
37 
38 /* Size of CRC8 lookup table */
39 #ifndef LINUX_REMOVE
40 #define CRC8_TABLE_SIZE					256
41 #endif
42 
43 /*
44  * BRB RAM init requirements
45  */
46 struct init_brb_ram_req
47 {
48 	u32 guranteed_per_tc /* guaranteed size per TC, in bytes */;
49 	u32 headroom_per_tc /* headroom size per TC, in bytes */;
50 	u32 min_pkt_size /* min packet size, in bytes */;
51 	u32 max_ports_per_engine /* min packet size, in bytes */;
52 	u8 num_active_tcs[MAX_NUM_PORTS] /* number of active TCs per port */;
53 };
54 
55 /*
56  * ETS per-TC init requirements
57  */
58 struct init_ets_tc_req
59 {
60 	u8 use_sp /* if set, this TC participates in the arbitration with a strict priority (the priority is equal to the TC ID) */;
61 	u8 use_wfq /* if set, this TC participates in the arbitration with a WFQ weight (indicated by the weight field) */;
62 	u16 weight /* An arbitration weight. Valid only if use_wfq is set. */;
63 };
64 
65 /*
66  * ETS init requirements
67  */
68 struct init_ets_req
69 {
70 	u32 mtu /* Max packet size (in bytes) */;
71 	struct init_ets_tc_req tc_req[NUM_OF_TCS] /* ETS initialization requirements per TC. */;
72 };
73 
74 /*
75  * NIG LB RL init requirements
76  */
77 struct init_nig_lb_rl_req
78 {
79 	u16 lb_mac_rate /* Global MAC+LB RL rate (in Mbps). If set to 0, the RL will be disabled. */;
80 	u16 lb_rate /* Global LB RL rate (in Mbps). If set to 0, the RL will be disabled. */;
81 	u32 mtu /* Max packet size (in bytes) */;
82 	u16 tc_rate[NUM_OF_PHYS_TCS] /* RL rate per physical TC (in Mbps). If set to 0, the RL will be disabled. */;
83 };
84 
85 /*
86  * NIG TC mapping for each priority
87  */
88 struct init_nig_pri_tc_map_entry
89 {
90 	u8 tc_id /* the mapped TC ID */;
91 	u8 valid /* indicates if the mapping entry is valid */;
92 };
93 
94 /*
95  * NIG priority to TC map init requirements
96  */
97 struct init_nig_pri_tc_map_req
98 {
99 	struct init_nig_pri_tc_map_entry pri[NUM_OF_VLAN_PRIORITIES];
100 };
101 
102 /*
103  * QM per-port init parameters
104  */
105 struct init_qm_port_params
106 {
107 	u8 active /* Indicates if this port is active */;
108 	u8 active_phys_tcs /* Vector of valid bits for active TCs used by this port */;
109 	u16 num_pbf_cmd_lines /* number of PBF command lines that can be used by this port */;
110 	u16 num_btb_blocks /* number of BTB blocks that can be used by this port */;
111 	u16 reserved;
112 };
113 
114 /*
115  * QM per-PQ init parameters
116  */
117 struct init_qm_pq_params
118 {
119 	u8 vport_id /* VPORT ID */;
120 	u8 tc_id /* TC ID */;
121 	u8 wrr_group /* WRR group */;
122 	u8 rl_valid /* Indicates if a rate limiter should be allocated for the PQ (0/1) */;
123 };
124 
125 /*
126  * QM per-vport init parameters
127  */
128 struct init_qm_vport_params
129 {
130 	u32 vport_rl /* rate limit in Mb/sec units. a value of 0 means dont configure. ignored if VPORT RL is globally disabled. */;
131 	u16 vport_wfq /* WFQ weight. A value of 0 means dont configure. ignored if VPORT WFQ is globally disabled. */;
132 	u16 first_tx_pq_id[NUM_OF_TCS] /* the first Tx PQ ID associated with this VPORT for each TC. */;
133 };
134 
135 #endif /* __ECORE_HSI_INIT_FUNC__ */
136