1316485Sdavidcs/*
2316485Sdavidcs * Copyright (c) 2017-2018 Cavium, Inc.
3316485Sdavidcs * All rights reserved.
4316485Sdavidcs *
5316485Sdavidcs *  Redistribution and use in source and binary forms, with or without
6316485Sdavidcs *  modification, are permitted provided that the following conditions
7316485Sdavidcs *  are met:
8316485Sdavidcs *
9316485Sdavidcs *  1. Redistributions of source code must retain the above copyright
10316485Sdavidcs *     notice, this list of conditions and the following disclaimer.
11316485Sdavidcs *  2. Redistributions in binary form must reproduce the above copyright
12316485Sdavidcs *     notice, this list of conditions and the following disclaimer in the
13316485Sdavidcs *     documentation and/or other materials provided with the distribution.
14316485Sdavidcs *
15316485Sdavidcs *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16316485Sdavidcs *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17316485Sdavidcs *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18316485Sdavidcs *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19316485Sdavidcs *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20316485Sdavidcs *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21316485Sdavidcs *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22316485Sdavidcs *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23316485Sdavidcs *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24316485Sdavidcs *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25316485Sdavidcs *  POSSIBILITY OF SUCH DAMAGE.
26316485Sdavidcs *
27316485Sdavidcs * $FreeBSD: stable/10/sys/dev/qlnx/qlnxe/ecore_hsi_init_func.h 337519 2018-08-09 01:39:47Z davidcs $
28316485Sdavidcs *
29316485Sdavidcs */
30316485Sdavidcs
31316485Sdavidcs#ifndef __ECORE_HSI_INIT_FUNC__
32316485Sdavidcs#define __ECORE_HSI_INIT_FUNC__
33316485Sdavidcs/********************************/
34316485Sdavidcs/* HSI Init Functions constants */
35316485Sdavidcs/********************************/
36316485Sdavidcs
37316485Sdavidcs/* Number of VLAN priorities */
38316485Sdavidcs#define NUM_OF_VLAN_PRIORITIES			8
39316485Sdavidcs
40316485Sdavidcs/* Size of CRC8 lookup table */
41337519Sdavidcs#ifndef LINUX_REMOVE
42316485Sdavidcs#define CRC8_TABLE_SIZE					256
43337519Sdavidcs#endif
44316485Sdavidcs
45316485Sdavidcs/*
46316485Sdavidcs * BRB RAM init requirements
47316485Sdavidcs */
48316485Sdavidcsstruct init_brb_ram_req
49316485Sdavidcs{
50337519Sdavidcs	u32 guranteed_per_tc /* guaranteed size per TC, in bytes */;
51337519Sdavidcs	u32 headroom_per_tc /* headroom size per TC, in bytes */;
52337519Sdavidcs	u32 min_pkt_size /* min packet size, in bytes */;
53337519Sdavidcs	u32 max_ports_per_engine /* min packet size, in bytes */;
54316485Sdavidcs	u8 num_active_tcs[MAX_NUM_PORTS] /* number of active TCs per port */;
55316485Sdavidcs};
56316485Sdavidcs
57316485Sdavidcs
58316485Sdavidcs/*
59316485Sdavidcs * ETS per-TC init requirements
60316485Sdavidcs */
61316485Sdavidcsstruct init_ets_tc_req
62316485Sdavidcs{
63316485Sdavidcs	u8 use_sp /* if set, this TC participates in the arbitration with a strict priority (the priority is equal to the TC ID) */;
64316485Sdavidcs	u8 use_wfq /* if set, this TC participates in the arbitration with a WFQ weight (indicated by the weight field) */;
65337519Sdavidcs	u16 weight /* An arbitration weight. Valid only if use_wfq is set. */;
66316485Sdavidcs};
67316485Sdavidcs
68316485Sdavidcs/*
69316485Sdavidcs * ETS init requirements
70316485Sdavidcs */
71316485Sdavidcsstruct init_ets_req
72316485Sdavidcs{
73337519Sdavidcs	u32 mtu /* Max packet size (in bytes) */;
74316485Sdavidcs	struct init_ets_tc_req tc_req[NUM_OF_TCS] /* ETS initialization requirements per TC. */;
75316485Sdavidcs};
76316485Sdavidcs
77316485Sdavidcs
78316485Sdavidcs
79316485Sdavidcs/*
80316485Sdavidcs * NIG LB RL init requirements
81316485Sdavidcs */
82316485Sdavidcsstruct init_nig_lb_rl_req
83316485Sdavidcs{
84337519Sdavidcs	u16 lb_mac_rate /* Global MAC+LB RL rate (in Mbps). If set to 0, the RL will be disabled. */;
85337519Sdavidcs	u16 lb_rate /* Global LB RL rate (in Mbps). If set to 0, the RL will be disabled. */;
86337519Sdavidcs	u32 mtu /* Max packet size (in bytes) */;
87337519Sdavidcs	u16 tc_rate[NUM_OF_PHYS_TCS] /* RL rate per physical TC (in Mbps). If set to 0, the RL will be disabled. */;
88316485Sdavidcs};
89316485Sdavidcs
90316485Sdavidcs
91316485Sdavidcs/*
92316485Sdavidcs * NIG TC mapping for each priority
93316485Sdavidcs */
94316485Sdavidcsstruct init_nig_pri_tc_map_entry
95316485Sdavidcs{
96316485Sdavidcs	u8 tc_id /* the mapped TC ID */;
97316485Sdavidcs	u8 valid /* indicates if the mapping entry is valid */;
98316485Sdavidcs};
99316485Sdavidcs
100316485Sdavidcs
101316485Sdavidcs/*
102316485Sdavidcs * NIG priority to TC map init requirements
103316485Sdavidcs */
104316485Sdavidcsstruct init_nig_pri_tc_map_req
105316485Sdavidcs{
106316485Sdavidcs	struct init_nig_pri_tc_map_entry pri[NUM_OF_VLAN_PRIORITIES];
107316485Sdavidcs};
108316485Sdavidcs
109316485Sdavidcs
110316485Sdavidcs/*
111316485Sdavidcs * QM per-port init parameters
112316485Sdavidcs */
113316485Sdavidcsstruct init_qm_port_params
114316485Sdavidcs{
115316485Sdavidcs	u8 active /* Indicates if this port is active */;
116316485Sdavidcs	u8 active_phys_tcs /* Vector of valid bits for active TCs used by this port */;
117337519Sdavidcs	u16 num_pbf_cmd_lines /* number of PBF command lines that can be used by this port */;
118337519Sdavidcs	u16 num_btb_blocks /* number of BTB blocks that can be used by this port */;
119337519Sdavidcs	u16 reserved;
120316485Sdavidcs};
121316485Sdavidcs
122316485Sdavidcs
123316485Sdavidcs/*
124316485Sdavidcs * QM per-PQ init parameters
125316485Sdavidcs */
126316485Sdavidcsstruct init_qm_pq_params
127316485Sdavidcs{
128316485Sdavidcs	u8 vport_id /* VPORT ID */;
129316485Sdavidcs	u8 tc_id /* TC ID */;
130316485Sdavidcs	u8 wrr_group /* WRR group */;
131316485Sdavidcs	u8 rl_valid /* Indicates if a rate limiter should be allocated for the PQ (0/1) */;
132316485Sdavidcs};
133316485Sdavidcs
134316485Sdavidcs
135316485Sdavidcs/*
136316485Sdavidcs * QM per-vport init parameters
137316485Sdavidcs */
138316485Sdavidcsstruct init_qm_vport_params
139316485Sdavidcs{
140337519Sdavidcs	u32 vport_rl /* rate limit in Mb/sec units. a value of 0 means dont configure. ignored if VPORT RL is globally disabled. */;
141337519Sdavidcs	u16 vport_wfq /* WFQ weight. A value of 0 means dont configure. ignored if VPORT WFQ is globally disabled. */;
142337519Sdavidcs	u16 first_tx_pq_id[NUM_OF_TCS] /* the first Tx PQ ID associated with this VPORT for each TC. */;
143316485Sdavidcs};
144316485Sdavidcs
145316485Sdavidcs#endif /* __ECORE_HSI_INIT_FUNC__ */
146