xref: /freebsd/sys/dev/liquidio/base/lio_config.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1*f173c2b7SSean Bruno /*
2*f173c2b7SSean Bruno  *   BSD LICENSE
3*f173c2b7SSean Bruno  *
4*f173c2b7SSean Bruno  *   Copyright(c) 2017 Cavium, Inc.. All rights reserved.
5*f173c2b7SSean Bruno  *   All rights reserved.
6*f173c2b7SSean Bruno  *
7*f173c2b7SSean Bruno  *   Redistribution and use in source and binary forms, with or without
8*f173c2b7SSean Bruno  *   modification, are permitted provided that the following conditions
9*f173c2b7SSean Bruno  *   are met:
10*f173c2b7SSean Bruno  *
11*f173c2b7SSean Bruno  *     * Redistributions of source code must retain the above copyright
12*f173c2b7SSean Bruno  *       notice, this list of conditions and the following disclaimer.
13*f173c2b7SSean Bruno  *     * Redistributions in binary form must reproduce the above copyright
14*f173c2b7SSean Bruno  *       notice, this list of conditions and the following disclaimer in
15*f173c2b7SSean Bruno  *       the documentation and/or other materials provided with the
16*f173c2b7SSean Bruno  *       distribution.
17*f173c2b7SSean Bruno  *     * Neither the name of Cavium, Inc. nor the names of its
18*f173c2b7SSean Bruno  *       contributors may be used to endorse or promote products derived
19*f173c2b7SSean Bruno  *       from this software without specific prior written permission.
20*f173c2b7SSean Bruno  *
21*f173c2b7SSean Bruno  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22*f173c2b7SSean Bruno  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23*f173c2b7SSean Bruno  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24*f173c2b7SSean Bruno  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25*f173c2b7SSean Bruno  *   OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26*f173c2b7SSean Bruno  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27*f173c2b7SSean Bruno  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28*f173c2b7SSean Bruno  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29*f173c2b7SSean Bruno  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30*f173c2b7SSean Bruno  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31*f173c2b7SSean Bruno  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32*f173c2b7SSean Bruno  */
33*f173c2b7SSean Bruno 
34*f173c2b7SSean Bruno /*  \file  lio_config.h
35*f173c2b7SSean Bruno  *  \brief Host Driver: Configuration data structures for the host driver.
36*f173c2b7SSean Bruno  */
37*f173c2b7SSean Bruno 
38*f173c2b7SSean Bruno #ifndef __LIO_CONFIG_H__
39*f173c2b7SSean Bruno #define __LIO_CONFIG_H__
40*f173c2b7SSean Bruno 
41*f173c2b7SSean Bruno /*--------------------------CONFIG VALUES------------------------*/
42*f173c2b7SSean Bruno 
43*f173c2b7SSean Bruno /*
44*f173c2b7SSean Bruno  * The following macros affect the way the driver data structures
45*f173c2b7SSean Bruno  * are generated for Octeon devices.
46*f173c2b7SSean Bruno  * They can be modified.
47*f173c2b7SSean Bruno  */
48*f173c2b7SSean Bruno 
49*f173c2b7SSean Bruno /*
50*f173c2b7SSean Bruno  * Maximum octeon devices defined as LIO_MAX_IF to support
51*f173c2b7SSean Bruno  * multiple(<= LIO_MAX_IF) Miniports
52*f173c2b7SSean Bruno  */
53*f173c2b7SSean Bruno #define LIO_MAX_IF			128
54*f173c2b7SSean Bruno #define LIO_MAX_DEVICES			LIO_MAX_IF
55*f173c2b7SSean Bruno #define LIO_MAX_MULTICAST_ADDR		32
56*f173c2b7SSean Bruno 
57*f173c2b7SSean Bruno /* CN23xx IQ configuration macros */
58*f173c2b7SSean Bruno #define LIO_CN23XX_PF_MAX_RINGS		64
59*f173c2b7SSean Bruno 
60*f173c2b7SSean Bruno #define LIO_BR_SIZE			4096
61*f173c2b7SSean Bruno 
62*f173c2b7SSean Bruno #define LIO_CN23XX_PF_MAX_INPUT_QUEUES		LIO_CN23XX_PF_MAX_RINGS
63*f173c2b7SSean Bruno #define LIO_CN23XX_MAX_IQ_DESCRIPTORS		2048
64*f173c2b7SSean Bruno #define LIO_CN23XX_DEFAULT_IQ_DESCRIPTORS	512
65*f173c2b7SSean Bruno #define LIO_CN23XX_MIN_IQ_DESCRIPTORS		128
66*f173c2b7SSean Bruno #define LIO_CN23XX_DB_MIN			1
67*f173c2b7SSean Bruno #define LIO_CN23XX_DB_TIMEOUT			1
68*f173c2b7SSean Bruno 
69*f173c2b7SSean Bruno #define LIO_CN23XX_PF_MAX_OUTPUT_QUEUES		LIO_CN23XX_PF_MAX_RINGS
70*f173c2b7SSean Bruno #define LIO_CN23XX_MAX_OQ_DESCRIPTORS		2048
71*f173c2b7SSean Bruno #define LIO_CN23XX_DEFAULT_OQ_DESCRIPTORS	512
72*f173c2b7SSean Bruno #define LIO_CN23XX_MIN_OQ_DESCRIPTORS		128
73*f173c2b7SSean Bruno #define LIO_CN23XX_OQ_BUF_SIZE			MCLBYTES
74*f173c2b7SSean Bruno #define LIO_CN23XX_OQ_PKTS_PER_INTR		128
75*f173c2b7SSean Bruno #define LIO_CN23XX_OQ_REFIL_THRESHOLD		16
76*f173c2b7SSean Bruno 
77*f173c2b7SSean Bruno #define LIO_CN23XX_OQ_INTR_PKT			64
78*f173c2b7SSean Bruno #define LIO_CN23XX_OQ_INTR_TIME			100
79*f173c2b7SSean Bruno #define LIO_CN23XX_DEFAULT_NUM_PORTS		1
80*f173c2b7SSean Bruno 
81*f173c2b7SSean Bruno #define LIO_CN23XX_CFG_IO_QUEUES		LIO_CN23XX_PF_MAX_RINGS
82*f173c2b7SSean Bruno 
83*f173c2b7SSean Bruno #define LIO_CN23XX_DEF_IQ_INTR_THRESHOLD	32
84*f173c2b7SSean Bruno #define LIO_CN23XX_PKI_MAX_FRAME_SIZE		65535
85*f173c2b7SSean Bruno #define LIO_CN23XX_RAW_FRONT_SIZE		48
86*f173c2b7SSean Bruno /*
87*f173c2b7SSean Bruno  * this is the max jabber value.Any packets greater than this size sent over
88*f173c2b7SSean Bruno  * DPI will be truncated.
89*f173c2b7SSean Bruno  */
90*f173c2b7SSean Bruno #define LIO_CN23XX_MAX_INPUT_JABBER  (LIO_CN23XX_PKI_MAX_FRAME_SIZE - \
91*f173c2b7SSean Bruno 				      LIO_CN23XX_RAW_FRONT_SIZE)
92*f173c2b7SSean Bruno 
93*f173c2b7SSean Bruno /* common OCTEON configuration macros */
94*f173c2b7SSean Bruno #define LIO_64BYTE_INSTR		64
95*f173c2b7SSean Bruno 
96*f173c2b7SSean Bruno #define LIO_MAX_TXQS_PER_INTF		8
97*f173c2b7SSean Bruno #define LIO_MAX_RXQS_PER_INTF		8
98*f173c2b7SSean Bruno #define LIO_DEF_TXQS_PER_INTF		4
99*f173c2b7SSean Bruno #define LIO_DEF_RXQS_PER_INTF		4
100*f173c2b7SSean Bruno 
101*f173c2b7SSean Bruno /* Macros to get octeon config params */
102*f173c2b7SSean Bruno #define LIO_GET_IQ_CFG(cfg)			((cfg)->iq)
103*f173c2b7SSean Bruno #define LIO_GET_IQ_MAX_Q_CFG(cfg)		((cfg)->iq.max_iqs)
104*f173c2b7SSean Bruno #define LIO_GET_IQ_INSTR_TYPE_CFG(cfg)		((cfg)->iq.instr_type)
105*f173c2b7SSean Bruno 
106*f173c2b7SSean Bruno #define LIO_GET_IQ_INTR_PKT_CFG(cfg)		((cfg)->iq.iq_intr_pkt)
107*f173c2b7SSean Bruno 
108*f173c2b7SSean Bruno #define LIO_GET_OQ_MAX_Q_CFG(cfg)		((cfg)->oq.max_oqs)
109*f173c2b7SSean Bruno #define LIO_GET_OQ_PKTS_PER_INTR_CFG(cfg)	((cfg)->oq.pkts_per_intr)
110*f173c2b7SSean Bruno #define LIO_GET_OQ_REFILL_THRESHOLD_CFG(cfg)	((cfg)->oq.refill_threshold)
111*f173c2b7SSean Bruno #define LIO_GET_OQ_INTR_PKT_CFG(cfg)		((cfg)->oq.oq_intr_pkt)
112*f173c2b7SSean Bruno #define LIO_GET_OQ_INTR_TIME_CFG(cfg)		((cfg)->oq.oq_intr_time)
113*f173c2b7SSean Bruno 
114*f173c2b7SSean Bruno #define LIO_GET_NUM_NIC_PORTS_CFG(cfg)		((cfg)->num_nic_ports)
115*f173c2b7SSean Bruno #define LIO_GET_NUM_DEF_TX_DESCS_CFG(cfg)	((cfg)->num_def_tx_descs)
116*f173c2b7SSean Bruno #define LIO_GET_NUM_DEF_RX_DESCS_CFG(cfg)	((cfg)->num_def_rx_descs)
117*f173c2b7SSean Bruno #define LIO_GET_DEF_RX_BUF_SIZE_CFG(cfg)	((cfg)->def_rx_buf_size)
118*f173c2b7SSean Bruno 
119*f173c2b7SSean Bruno #define LIO_GET_NUM_RX_DESCS_NIC_IF_CFG(cfg, idx)	\
120*f173c2b7SSean Bruno 		((cfg)->nic_if_cfg[idx].num_rx_descs)
121*f173c2b7SSean Bruno #define LIO_GET_NUM_TX_DESCS_NIC_IF_CFG(cfg, idx)	\
122*f173c2b7SSean Bruno 		((cfg)->nic_if_cfg[idx].num_tx_descs)
123*f173c2b7SSean Bruno #define LIO_GET_NUM_RX_BUF_SIZE_NIC_IF_CFG(cfg, idx)	\
124*f173c2b7SSean Bruno 		((cfg)->nic_if_cfg[idx].rx_buf_size)
125*f173c2b7SSean Bruno 
126*f173c2b7SSean Bruno #define LIO_GET_IS_SLI_BP_ON_CFG(cfg)	((cfg)->misc.enable_sli_oq_bp)
127*f173c2b7SSean Bruno 
128*f173c2b7SSean Bruno /* Max IOQs per OCTEON Link */
129*f173c2b7SSean Bruno #define LIO_MAX_IOQS_PER_NICIF			64
130*f173c2b7SSean Bruno 
131*f173c2b7SSean Bruno #define LIO_SET_NUM_RX_DESCS_NIC_IF(cfg, idx, value)		\
132*f173c2b7SSean Bruno 		((cfg)->nic_if_cfg[idx].num_rx_descs = value)
133*f173c2b7SSean Bruno #define LIO_SET_NUM_TX_DESCS_NIC_IF(cfg, idx, value)		\
134*f173c2b7SSean Bruno 		((cfg)->nic_if_cfg[idx].num_tx_descs = value)
135*f173c2b7SSean Bruno 
136*f173c2b7SSean Bruno /* TX/RX process pkt budget */
137*f173c2b7SSean Bruno #define LIO_DEFAULT_TX_PKTS_PROCESS_BUDGET	64
138*f173c2b7SSean Bruno #define LIO_DEFAULT_RX_PKTS_PROCESS_BUDGET	64
139*f173c2b7SSean Bruno 
140*f173c2b7SSean Bruno enum lio_card_type {
141*f173c2b7SSean Bruno 	LIO_23XX	/* 23xx */
142*f173c2b7SSean Bruno };
143*f173c2b7SSean Bruno 
144*f173c2b7SSean Bruno #define LIO_23XX_NAME  "23xx"
145*f173c2b7SSean Bruno 
146*f173c2b7SSean Bruno /*
147*f173c2b7SSean Bruno  *  Structure to define the configuration attributes for each Input queue.
148*f173c2b7SSean Bruno  *  Applicable to all Octeon processors
149*f173c2b7SSean Bruno  */
150*f173c2b7SSean Bruno struct lio_iq_config {
151*f173c2b7SSean Bruno #if BYTE_ORDER == BIG_ENDIAN
152*f173c2b7SSean Bruno 	uint64_t	reserved:16;
153*f173c2b7SSean Bruno 
154*f173c2b7SSean Bruno 	/* Tx interrupt packets. Applicable to 23xx only */
155*f173c2b7SSean Bruno 	uint64_t	iq_intr_pkt:16;
156*f173c2b7SSean Bruno 
157*f173c2b7SSean Bruno 	/* Minimum ticks to wait before checking for pending instructions. */
158*f173c2b7SSean Bruno 	uint64_t	db_timeout:16;
159*f173c2b7SSean Bruno 
160*f173c2b7SSean Bruno 	/*
161*f173c2b7SSean Bruno 	 *  Minimum number of commands pending to be posted to Octeon
162*f173c2b7SSean Bruno 	 *  before driver hits the Input queue doorbell.
163*f173c2b7SSean Bruno 	 */
164*f173c2b7SSean Bruno 	uint64_t	db_min:8;
165*f173c2b7SSean Bruno 
166*f173c2b7SSean Bruno 	/* Command size - 32 or 64 bytes */
167*f173c2b7SSean Bruno 	uint64_t	instr_type:32;
168*f173c2b7SSean Bruno 
169*f173c2b7SSean Bruno 	/*
170*f173c2b7SSean Bruno 	 *  Pending list size (usually set to the sum of the size of all Input
171*f173c2b7SSean Bruno 	 *  queues)
172*f173c2b7SSean Bruno 	 */
173*f173c2b7SSean Bruno 	uint64_t	pending_list_size:32;
174*f173c2b7SSean Bruno 
175*f173c2b7SSean Bruno 	/* Max number of IQs available */
176*f173c2b7SSean Bruno 	uint64_t	max_iqs:8;
177*f173c2b7SSean Bruno 
178*f173c2b7SSean Bruno #else	/* BYTE_ORDER != BIG_ENDIAN */
179*f173c2b7SSean Bruno 
180*f173c2b7SSean Bruno 	/* Max number of IQs available */
181*f173c2b7SSean Bruno 	uint64_t	max_iqs:8;
182*f173c2b7SSean Bruno 
183*f173c2b7SSean Bruno 	/*
184*f173c2b7SSean Bruno 	 *  Pending list size (usually set to the sum of the size of all Input
185*f173c2b7SSean Bruno 	 *  queues)
186*f173c2b7SSean Bruno 	 */
187*f173c2b7SSean Bruno 	uint64_t	pending_list_size:32;
188*f173c2b7SSean Bruno 
189*f173c2b7SSean Bruno 	/* Command size - 32 or 64 bytes */
190*f173c2b7SSean Bruno 	uint64_t	instr_type:32;
191*f173c2b7SSean Bruno 
192*f173c2b7SSean Bruno 	/*
193*f173c2b7SSean Bruno 	 *  Minimum number of commands pending to be posted to Octeon
194*f173c2b7SSean Bruno 	 *  before driver hits the Input queue doorbell.
195*f173c2b7SSean Bruno 	 */
196*f173c2b7SSean Bruno 	uint64_t	db_min:8;
197*f173c2b7SSean Bruno 
198*f173c2b7SSean Bruno 	/* Minimum ticks to wait before checking for pending instructions. */
199*f173c2b7SSean Bruno 	uint64_t	db_timeout:16;
200*f173c2b7SSean Bruno 
201*f173c2b7SSean Bruno 	/* Tx interrupt packets. Applicable to 23xx only */
202*f173c2b7SSean Bruno 	uint64_t	iq_intr_pkt:16;
203*f173c2b7SSean Bruno 
204*f173c2b7SSean Bruno 	uint64_t	reserved:16;
205*f173c2b7SSean Bruno 
206*f173c2b7SSean Bruno #endif	/* BYTE_ORDER == BIG_ENDIAN */
207*f173c2b7SSean Bruno };
208*f173c2b7SSean Bruno 
209*f173c2b7SSean Bruno /*
210*f173c2b7SSean Bruno  *  Structure to define the configuration attributes for each Output queue.
211*f173c2b7SSean Bruno  *  Applicable to all Octeon processors
212*f173c2b7SSean Bruno  */
213*f173c2b7SSean Bruno struct lio_oq_config {
214*f173c2b7SSean Bruno #if BYTE_ORDER == BIG_ENDIAN
215*f173c2b7SSean Bruno 	uint64_t	reserved:16;
216*f173c2b7SSean Bruno 
217*f173c2b7SSean Bruno 	uint64_t	pkts_per_intr:16;
218*f173c2b7SSean Bruno 
219*f173c2b7SSean Bruno 	/*
220*f173c2b7SSean Bruno 	 *  Interrupt Coalescing (Time Interval). Octeon will interrupt the
221*f173c2b7SSean Bruno 	 *  host if atleast one packet was sent in the time interval specified
222*f173c2b7SSean Bruno 	 *  by this field. The driver uses time interval interrupt coalescing
223*f173c2b7SSean Bruno 	 *  by default. The time is specified in microseconds.
224*f173c2b7SSean Bruno 	 */
225*f173c2b7SSean Bruno 	uint64_t	oq_intr_time:16;
226*f173c2b7SSean Bruno 
227*f173c2b7SSean Bruno 	/*
228*f173c2b7SSean Bruno 	 *  Interrupt Coalescing (Packet Count). Octeon will interrupt the host
229*f173c2b7SSean Bruno 	 *  only if it sent as many packets as specified by this field.
230*f173c2b7SSean Bruno 	 *  The driver
231*f173c2b7SSean Bruno 	 *  usually does not use packet count interrupt coalescing.
232*f173c2b7SSean Bruno 	 */
233*f173c2b7SSean Bruno 	uint64_t	oq_intr_pkt:16;
234*f173c2b7SSean Bruno 
235*f173c2b7SSean Bruno 	/*
236*f173c2b7SSean Bruno 	 *   The number of buffers that were consumed during packet processing by
237*f173c2b7SSean Bruno 	 *   the driver on this Output queue before the driver attempts to
238*f173c2b7SSean Bruno 	 *   replenish
239*f173c2b7SSean Bruno 	 *   the descriptor ring with new buffers.
240*f173c2b7SSean Bruno 	 */
241*f173c2b7SSean Bruno 	uint64_t	refill_threshold:16;
242*f173c2b7SSean Bruno 
243*f173c2b7SSean Bruno 	/* Max number of OQs available */
244*f173c2b7SSean Bruno 	uint64_t	max_oqs:8;
245*f173c2b7SSean Bruno 
246*f173c2b7SSean Bruno #else	/* BYTE_ORDER != BIG_ENDIAN */
247*f173c2b7SSean Bruno 
248*f173c2b7SSean Bruno 	/* Max number of OQs available */
249*f173c2b7SSean Bruno 	uint64_t	max_oqs:8;
250*f173c2b7SSean Bruno 
251*f173c2b7SSean Bruno 	/*
252*f173c2b7SSean Bruno 	 *   The number of buffers that were consumed during packet processing by
253*f173c2b7SSean Bruno 	 *   the driver on this Output queue before the driver attempts to
254*f173c2b7SSean Bruno 	 *   replenish
255*f173c2b7SSean Bruno 	 *   the descriptor ring with new buffers.
256*f173c2b7SSean Bruno 	 */
257*f173c2b7SSean Bruno 	uint64_t	refill_threshold:16;
258*f173c2b7SSean Bruno 
259*f173c2b7SSean Bruno 	/*
260*f173c2b7SSean Bruno 	 *  Interrupt Coalescing (Packet Count). Octeon will interrupt the host
261*f173c2b7SSean Bruno 	 *  only if it sent as many packets as specified by this field.
262*f173c2b7SSean Bruno 	 *  The driver
263*f173c2b7SSean Bruno 	 *  usually does not use packet count interrupt coalescing.
264*f173c2b7SSean Bruno 	 */
265*f173c2b7SSean Bruno 	uint64_t	oq_intr_pkt:16;
266*f173c2b7SSean Bruno 
267*f173c2b7SSean Bruno 	/*
268*f173c2b7SSean Bruno 	 *  Interrupt Coalescing (Time Interval). Octeon will interrupt the
269*f173c2b7SSean Bruno 	 *  host if atleast one packet was sent in the time interval specified
270*f173c2b7SSean Bruno 	 *  by this field. The driver uses time interval interrupt coalescing
271*f173c2b7SSean Bruno 	 *  by default.  The time is specified in microseconds.
272*f173c2b7SSean Bruno 	 */
273*f173c2b7SSean Bruno 	uint64_t	oq_intr_time:16;
274*f173c2b7SSean Bruno 
275*f173c2b7SSean Bruno 	uint64_t	pkts_per_intr:16;
276*f173c2b7SSean Bruno 
277*f173c2b7SSean Bruno 	uint64_t	reserved:16;
278*f173c2b7SSean Bruno #endif	/* BYTE_ORDER == BIG_ENDIAN */
279*f173c2b7SSean Bruno 
280*f173c2b7SSean Bruno };
281*f173c2b7SSean Bruno 
282*f173c2b7SSean Bruno /*
283*f173c2b7SSean Bruno  *  This structure conatins the NIC link configuration attributes,
284*f173c2b7SSean Bruno  *  common for all the OCTEON Modles.
285*f173c2b7SSean Bruno  */
286*f173c2b7SSean Bruno struct lio_nic_if_config {
287*f173c2b7SSean Bruno #if BYTE_ORDER == BIG_ENDIAN
288*f173c2b7SSean Bruno 	uint64_t	reserved:56;
289*f173c2b7SSean Bruno 
290*f173c2b7SSean Bruno 	uint64_t	base_queue:16;
291*f173c2b7SSean Bruno 
292*f173c2b7SSean Bruno 	uint64_t	gmx_port_id:8;
293*f173c2b7SSean Bruno 
294*f173c2b7SSean Bruno 	/*
295*f173c2b7SSean Bruno 	 * mbuf size, We need not change buf size even for Jumbo frames.
296*f173c2b7SSean Bruno 	 * Octeon can send jumbo frames in 4 consecutive descriptors,
297*f173c2b7SSean Bruno 	 */
298*f173c2b7SSean Bruno 	uint64_t	rx_buf_size:16;
299*f173c2b7SSean Bruno 
300*f173c2b7SSean Bruno 	/* Num of desc for tx rings */
301*f173c2b7SSean Bruno 	uint64_t	num_tx_descs:16;
302*f173c2b7SSean Bruno 
303*f173c2b7SSean Bruno 	/* Num of desc for rx rings */
304*f173c2b7SSean Bruno 	uint64_t	num_rx_descs:16;
305*f173c2b7SSean Bruno 
306*f173c2b7SSean Bruno 	/* Actual configured value. Range could be: 1...max_rxqs */
307*f173c2b7SSean Bruno 	uint64_t	num_rxqs:16;
308*f173c2b7SSean Bruno 
309*f173c2b7SSean Bruno 	/* Max Rxqs: Half for each of the two ports :max_oq/2  */
310*f173c2b7SSean Bruno 	uint64_t	max_rxqs:16;
311*f173c2b7SSean Bruno 
312*f173c2b7SSean Bruno 	/* Actual configured value. Range could be: 1...max_txqs */
313*f173c2b7SSean Bruno 	uint64_t	num_txqs:16;
314*f173c2b7SSean Bruno 
315*f173c2b7SSean Bruno 	/* Max Txqs: Half for each of the two ports :max_iq/2 */
316*f173c2b7SSean Bruno 	uint64_t	max_txqs:16;
317*f173c2b7SSean Bruno 
318*f173c2b7SSean Bruno #else	/* BYTE_ORDER != BIG_ENDIAN */
319*f173c2b7SSean Bruno 
320*f173c2b7SSean Bruno 	/* Max Txqs: Half for each of the two ports :max_iq/2 */
321*f173c2b7SSean Bruno 	uint64_t	max_txqs:16;
322*f173c2b7SSean Bruno 
323*f173c2b7SSean Bruno 	/* Actual configured value. Range could be: 1...max_txqs */
324*f173c2b7SSean Bruno 	uint64_t	num_txqs:16;
325*f173c2b7SSean Bruno 
326*f173c2b7SSean Bruno 	/* Max Rxqs: Half for each of the two ports :max_oq/2  */
327*f173c2b7SSean Bruno 	uint64_t	max_rxqs:16;
328*f173c2b7SSean Bruno 
329*f173c2b7SSean Bruno 	/* Actual configured value. Range could be: 1...max_rxqs */
330*f173c2b7SSean Bruno 	uint64_t	num_rxqs:16;
331*f173c2b7SSean Bruno 
332*f173c2b7SSean Bruno 	/* Num of desc for rx rings */
333*f173c2b7SSean Bruno 	uint64_t	num_rx_descs:16;
334*f173c2b7SSean Bruno 
335*f173c2b7SSean Bruno 	/* Num of desc for tx rings */
336*f173c2b7SSean Bruno 	uint64_t	num_tx_descs:16;
337*f173c2b7SSean Bruno 
338*f173c2b7SSean Bruno 	/*
339*f173c2b7SSean Bruno 	 * mbuf size, We need not change buf size even for Jumbo frames.
340*f173c2b7SSean Bruno 	 * Octeon can send jumbo frames in 4 consecutive descriptors,
341*f173c2b7SSean Bruno 	 */
342*f173c2b7SSean Bruno 	uint64_t	rx_buf_size:16;
343*f173c2b7SSean Bruno 
344*f173c2b7SSean Bruno 	uint64_t	gmx_port_id:8;
345*f173c2b7SSean Bruno 
346*f173c2b7SSean Bruno 	uint64_t	base_queue:16;
347*f173c2b7SSean Bruno 
348*f173c2b7SSean Bruno 	uint64_t	reserved:56;
349*f173c2b7SSean Bruno #endif	/* BYTE_ORDER == BIG_ENDIAN */
350*f173c2b7SSean Bruno 
351*f173c2b7SSean Bruno };
352*f173c2b7SSean Bruno 
353*f173c2b7SSean Bruno /*
354*f173c2b7SSean Bruno  *  Structure to define the configuration attributes for meta data.
355*f173c2b7SSean Bruno  *  Applicable to all Octeon processors.
356*f173c2b7SSean Bruno  */
357*f173c2b7SSean Bruno 
358*f173c2b7SSean Bruno struct lio_misc_config {
359*f173c2b7SSean Bruno #if BYTE_ORDER == BIG_ENDIAN
360*f173c2b7SSean Bruno 	/* Host link status polling period */
361*f173c2b7SSean Bruno 	uint64_t	host_link_query_interval:32;
362*f173c2b7SSean Bruno 	/* Oct link status polling period */
363*f173c2b7SSean Bruno 	uint64_t	oct_link_query_interval:32;
364*f173c2b7SSean Bruno 
365*f173c2b7SSean Bruno 	uint64_t	enable_sli_oq_bp:1;
366*f173c2b7SSean Bruno 	/* Control IQ Group */
367*f173c2b7SSean Bruno 	uint64_t	ctrlq_grp:4;
368*f173c2b7SSean Bruno 
369*f173c2b7SSean Bruno #else	/* BYTE_ORDER != BIG_ENDIAN */
370*f173c2b7SSean Bruno 
371*f173c2b7SSean Bruno 	/* Control IQ Group */
372*f173c2b7SSean Bruno 	uint64_t	ctrlq_grp:4;
373*f173c2b7SSean Bruno 	/* BP for SLI OQ */
374*f173c2b7SSean Bruno 	uint64_t	enable_sli_oq_bp:1;
375*f173c2b7SSean Bruno 	/* Host link status polling period */
376*f173c2b7SSean Bruno 	uint64_t	oct_link_query_interval:32;
377*f173c2b7SSean Bruno 	/* Oct link status polling period */
378*f173c2b7SSean Bruno 	uint64_t	host_link_query_interval:32;
379*f173c2b7SSean Bruno 
380*f173c2b7SSean Bruno #endif	/* BYTE_ORDER == BIG_ENDIAN */
381*f173c2b7SSean Bruno };
382*f173c2b7SSean Bruno 
383*f173c2b7SSean Bruno /* Structure to define the configuration for all OCTEON processors. */
384*f173c2b7SSean Bruno struct lio_config {
385*f173c2b7SSean Bruno 	uint16_t	card_type;
386*f173c2b7SSean Bruno 	char		*card_name;
387*f173c2b7SSean Bruno 
388*f173c2b7SSean Bruno 	/* Input Queue attributes. */
389*f173c2b7SSean Bruno 	struct lio_iq_config iq;
390*f173c2b7SSean Bruno 
391*f173c2b7SSean Bruno 	/* Output Queue attributes. */
392*f173c2b7SSean Bruno 	struct lio_oq_config oq;
393*f173c2b7SSean Bruno 
394*f173c2b7SSean Bruno 	/* NIC Port Configuration */
395*f173c2b7SSean Bruno 	struct lio_nic_if_config nic_if_cfg[LIO_MAX_IF];
396*f173c2b7SSean Bruno 
397*f173c2b7SSean Bruno 	/* Miscellaneous attributes */
398*f173c2b7SSean Bruno 	struct lio_misc_config	misc;
399*f173c2b7SSean Bruno 
400*f173c2b7SSean Bruno 	int		num_nic_ports;
401*f173c2b7SSean Bruno 
402*f173c2b7SSean Bruno 	int		num_def_tx_descs;
403*f173c2b7SSean Bruno 
404*f173c2b7SSean Bruno 	/* Num of desc for rx rings */
405*f173c2b7SSean Bruno 	int		num_def_rx_descs;
406*f173c2b7SSean Bruno 
407*f173c2b7SSean Bruno 	int		def_rx_buf_size;
408*f173c2b7SSean Bruno 
409*f173c2b7SSean Bruno };
410*f173c2b7SSean Bruno 
411*f173c2b7SSean Bruno /* The following config values are fixed and should not be modified. */
412*f173c2b7SSean Bruno /* Maximum address space to be mapped for Octeon's BAR1 index-based access. */
413*f173c2b7SSean Bruno #define LIO_MAX_BAR1_MAP_INDEX		2
414*f173c2b7SSean Bruno 
415*f173c2b7SSean Bruno /*
416*f173c2b7SSean Bruno  * Response lists - 1 ordered, 1 unordered-blocking, 1 unordered-nonblocking
417*f173c2b7SSean Bruno  * NoResponse Lists are now maintained with each IQ. (Dec' 2007).
418*f173c2b7SSean Bruno  */
419*f173c2b7SSean Bruno #define LIO_MAX_RESPONSE_LISTS		4
420*f173c2b7SSean Bruno 
421*f173c2b7SSean Bruno /*
422*f173c2b7SSean Bruno  * Opcode hash bits. The opcode is hashed on the lower 6-bits to lookup the
423*f173c2b7SSean Bruno  * dispatch table.
424*f173c2b7SSean Bruno  */
425*f173c2b7SSean Bruno #define LIO_OPCODE_MASK_BITS		6
426*f173c2b7SSean Bruno 
427*f173c2b7SSean Bruno /* Mask for the 6-bit lookup hash */
428*f173c2b7SSean Bruno #define LIO_OPCODE_MASK			0x3f
429*f173c2b7SSean Bruno 
430*f173c2b7SSean Bruno /* Size of the dispatch table. The 6-bit hash can index into 2^6 entries */
431*f173c2b7SSean Bruno #define LIO_DISPATCH_LIST_SIZE		BIT(LIO_OPCODE_MASK_BITS)
432*f173c2b7SSean Bruno 
433*f173c2b7SSean Bruno #define LIO_MAX_INSTR_QUEUES(oct)	LIO_CN23XX_PF_MAX_INPUT_QUEUES
434*f173c2b7SSean Bruno #define LIO_MAX_OUTPUT_QUEUES(oct)	LIO_CN23XX_PF_MAX_OUTPUT_QUEUES
435*f173c2b7SSean Bruno 
436*f173c2b7SSean Bruno #define LIO_MAX_POSSIBLE_INSTR_QUEUES	LIO_CN23XX_PF_MAX_INPUT_QUEUES
437*f173c2b7SSean Bruno #define LIO_MAX_POSSIBLE_OUTPUT_QUEUES	LIO_CN23XX_PF_MAX_OUTPUT_QUEUES
438*f173c2b7SSean Bruno #endif	/* __LIO_CONFIG_H__  */
439