1*14b24e2bSVaishali Kulkarni /*
2*14b24e2bSVaishali Kulkarni * CDDL HEADER START
3*14b24e2bSVaishali Kulkarni *
4*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the
5*14b24e2bSVaishali Kulkarni * Common Development and Distribution License, v.1,  (the "License").
6*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
7*14b24e2bSVaishali Kulkarni *
8*14b24e2bSVaishali Kulkarni * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*14b24e2bSVaishali Kulkarni * or http://opensource.org/licenses/CDDL-1.0.
10*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions
11*14b24e2bSVaishali Kulkarni * and limitations under the License.
12*14b24e2bSVaishali Kulkarni *
13*14b24e2bSVaishali Kulkarni * When distributing Covered Code, include this CDDL HEADER in each
14*14b24e2bSVaishali Kulkarni * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*14b24e2bSVaishali Kulkarni * If applicable, add the following below this CDDL HEADER, with the
16*14b24e2bSVaishali Kulkarni * fields enclosed by brackets "[]" replaced with your own identifying
17*14b24e2bSVaishali Kulkarni * information: Portions Copyright [yyyy] [name of copyright owner]
18*14b24e2bSVaishali Kulkarni *
19*14b24e2bSVaishali Kulkarni * CDDL HEADER END
20*14b24e2bSVaishali Kulkarni */
21*14b24e2bSVaishali Kulkarni 
22*14b24e2bSVaishali Kulkarni /*
23*14b24e2bSVaishali Kulkarni * Copyright 2014-2017 Cavium, Inc.
24*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the Common Development
25*14b24e2bSVaishali Kulkarni * and Distribution License, v.1,  (the "License").
26*14b24e2bSVaishali Kulkarni 
27*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
28*14b24e2bSVaishali Kulkarni 
29*14b24e2bSVaishali Kulkarni * You can obtain a copy of the License at available
30*14b24e2bSVaishali Kulkarni * at http://opensource.org/licenses/CDDL-1.0
31*14b24e2bSVaishali Kulkarni 
32*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions and
33*14b24e2bSVaishali Kulkarni * limitations under the License.
34*14b24e2bSVaishali Kulkarni */
35*14b24e2bSVaishali Kulkarni 
36*14b24e2bSVaishali Kulkarni #ifndef __ECORE_HSI_INIT_FUNC__
37*14b24e2bSVaishali Kulkarni #define __ECORE_HSI_INIT_FUNC__
38*14b24e2bSVaishali Kulkarni /********************************/
39*14b24e2bSVaishali Kulkarni /* HSI Init Functions constants */
40*14b24e2bSVaishali Kulkarni /********************************/
41*14b24e2bSVaishali Kulkarni 
42*14b24e2bSVaishali Kulkarni /* Number of VLAN priorities */
43*14b24e2bSVaishali Kulkarni #define NUM_OF_VLAN_PRIORITIES			8
44*14b24e2bSVaishali Kulkarni 
45*14b24e2bSVaishali Kulkarni /* Size of CRC8 lookup table */
46*14b24e2bSVaishali Kulkarni #ifndef LINUX_REMOVE
47*14b24e2bSVaishali Kulkarni #define CRC8_TABLE_SIZE					256
48*14b24e2bSVaishali Kulkarni #endif
49*14b24e2bSVaishali Kulkarni 
50*14b24e2bSVaishali Kulkarni /*
51*14b24e2bSVaishali Kulkarni  * BRB RAM init requirements
52*14b24e2bSVaishali Kulkarni  */
53*14b24e2bSVaishali Kulkarni struct init_brb_ram_req
54*14b24e2bSVaishali Kulkarni {
55*14b24e2bSVaishali Kulkarni 	__le32 guranteed_per_tc /* guaranteed size per TC, in bytes */;
56*14b24e2bSVaishali Kulkarni 	__le32 headroom_per_tc /* headroom size per TC, in bytes */;
57*14b24e2bSVaishali Kulkarni 	__le32 min_pkt_size /* min packet size, in bytes */;
58*14b24e2bSVaishali Kulkarni 	__le32 max_ports_per_engine /* min packet size, in bytes */;
59*14b24e2bSVaishali Kulkarni 	u8 num_active_tcs[MAX_NUM_PORTS] /* number of active TCs per port */;
60*14b24e2bSVaishali Kulkarni };
61*14b24e2bSVaishali Kulkarni 
62*14b24e2bSVaishali Kulkarni 
63*14b24e2bSVaishali Kulkarni /*
64*14b24e2bSVaishali Kulkarni  * ETS per-TC init requirements
65*14b24e2bSVaishali Kulkarni  */
66*14b24e2bSVaishali Kulkarni struct init_ets_tc_req
67*14b24e2bSVaishali Kulkarni {
68*14b24e2bSVaishali Kulkarni 	u8 use_sp /* if set, this TC participates in the arbitration with a strict priority (the priority is equal to the TC ID) */;
69*14b24e2bSVaishali Kulkarni 	u8 use_wfq /* if set, this TC participates in the arbitration with a WFQ weight (indicated by the weight field) */;
70*14b24e2bSVaishali Kulkarni 	__le16 weight /* An arbitration weight. Valid only if use_wfq is set. */;
71*14b24e2bSVaishali Kulkarni };
72*14b24e2bSVaishali Kulkarni 
73*14b24e2bSVaishali Kulkarni /*
74*14b24e2bSVaishali Kulkarni  * ETS init requirements
75*14b24e2bSVaishali Kulkarni  */
76*14b24e2bSVaishali Kulkarni struct init_ets_req
77*14b24e2bSVaishali Kulkarni {
78*14b24e2bSVaishali Kulkarni 	__le32 mtu /* Max packet size (in bytes) */;
79*14b24e2bSVaishali Kulkarni 	struct init_ets_tc_req tc_req[NUM_OF_TCS] /* ETS initialization requirements per TC. */;
80*14b24e2bSVaishali Kulkarni };
81*14b24e2bSVaishali Kulkarni 
82*14b24e2bSVaishali Kulkarni 
83*14b24e2bSVaishali Kulkarni 
84*14b24e2bSVaishali Kulkarni /*
85*14b24e2bSVaishali Kulkarni  * NIG LB RL init requirements
86*14b24e2bSVaishali Kulkarni  */
87*14b24e2bSVaishali Kulkarni struct init_nig_lb_rl_req
88*14b24e2bSVaishali Kulkarni {
89*14b24e2bSVaishali Kulkarni 	__le16 lb_mac_rate /* Global MAC+LB RL rate (in Mbps). If set to 0, the RL will be disabled. */;
90*14b24e2bSVaishali Kulkarni 	__le16 lb_rate /* Global LB RL rate (in Mbps). If set to 0, the RL will be disabled. */;
91*14b24e2bSVaishali Kulkarni 	__le32 mtu /* Max packet size (in bytes) */;
92*14b24e2bSVaishali Kulkarni 	__le16 tc_rate[NUM_OF_PHYS_TCS] /* RL rate per physical TC (in Mbps). If set to 0, the RL will be disabled. */;
93*14b24e2bSVaishali Kulkarni };
94*14b24e2bSVaishali Kulkarni 
95*14b24e2bSVaishali Kulkarni 
96*14b24e2bSVaishali Kulkarni /*
97*14b24e2bSVaishali Kulkarni  * NIG TC mapping for each priority
98*14b24e2bSVaishali Kulkarni  */
99*14b24e2bSVaishali Kulkarni struct init_nig_pri_tc_map_entry
100*14b24e2bSVaishali Kulkarni {
101*14b24e2bSVaishali Kulkarni 	u8 tc_id /* the mapped TC ID */;
102*14b24e2bSVaishali Kulkarni 	u8 valid /* indicates if the mapping entry is valid */;
103*14b24e2bSVaishali Kulkarni };
104*14b24e2bSVaishali Kulkarni 
105*14b24e2bSVaishali Kulkarni 
106*14b24e2bSVaishali Kulkarni /*
107*14b24e2bSVaishali Kulkarni  * NIG priority to TC map init requirements
108*14b24e2bSVaishali Kulkarni  */
109*14b24e2bSVaishali Kulkarni struct init_nig_pri_tc_map_req
110*14b24e2bSVaishali Kulkarni {
111*14b24e2bSVaishali Kulkarni 	struct init_nig_pri_tc_map_entry pri[NUM_OF_VLAN_PRIORITIES];
112*14b24e2bSVaishali Kulkarni };
113*14b24e2bSVaishali Kulkarni 
114*14b24e2bSVaishali Kulkarni 
115*14b24e2bSVaishali Kulkarni /*
116*14b24e2bSVaishali Kulkarni  * QM per-port init parameters
117*14b24e2bSVaishali Kulkarni  */
118*14b24e2bSVaishali Kulkarni struct init_qm_port_params
119*14b24e2bSVaishali Kulkarni {
120*14b24e2bSVaishali Kulkarni 	u8 active /* Indicates if this port is active */;
121*14b24e2bSVaishali Kulkarni 	u8 active_phys_tcs /* Vector of valid bits for active TCs used by this port */;
122*14b24e2bSVaishali Kulkarni 	__le16 num_pbf_cmd_lines /* number of PBF command lines that can be used by this port */;
123*14b24e2bSVaishali Kulkarni 	__le16 num_btb_blocks /* number of BTB blocks that can be used by this port */;
124*14b24e2bSVaishali Kulkarni 	__le16 reserved;
125*14b24e2bSVaishali Kulkarni };
126*14b24e2bSVaishali Kulkarni 
127*14b24e2bSVaishali Kulkarni 
128*14b24e2bSVaishali Kulkarni /*
129*14b24e2bSVaishali Kulkarni  * QM per-PQ init parameters
130*14b24e2bSVaishali Kulkarni  */
131*14b24e2bSVaishali Kulkarni struct init_qm_pq_params
132*14b24e2bSVaishali Kulkarni {
133*14b24e2bSVaishali Kulkarni 	u8 vport_id /* VPORT ID */;
134*14b24e2bSVaishali Kulkarni 	u8 tc_id /* TC ID */;
135*14b24e2bSVaishali Kulkarni 	u8 wrr_group /* WRR group */;
136*14b24e2bSVaishali Kulkarni 	u8 rl_valid /* Indicates if a rate limiter should be allocated for the PQ (0/1) */;
137*14b24e2bSVaishali Kulkarni };
138*14b24e2bSVaishali Kulkarni 
139*14b24e2bSVaishali Kulkarni 
140*14b24e2bSVaishali Kulkarni /*
141*14b24e2bSVaishali Kulkarni  * QM per-vport init parameters
142*14b24e2bSVaishali Kulkarni  */
143*14b24e2bSVaishali Kulkarni struct init_qm_vport_params
144*14b24e2bSVaishali Kulkarni {
145*14b24e2bSVaishali Kulkarni 	__le32 vport_rl /* rate limit in Mb/sec units. a value of 0 means dont configure. ignored if VPORT RL is globally disabled. */;
146*14b24e2bSVaishali Kulkarni 	__le16 vport_wfq /* WFQ weight. A value of 0 means dont configure. ignored if VPORT WFQ is globally disabled. */;
147*14b24e2bSVaishali Kulkarni 	__le16 first_tx_pq_id[NUM_OF_TCS] /* the first Tx PQ ID associated with this VPORT for each TC. */;
148*14b24e2bSVaishali Kulkarni };
149*14b24e2bSVaishali Kulkarni 
150*14b24e2bSVaishali Kulkarni #endif /* __ECORE_HSI_INIT_FUNC__ */