1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef __OCTEON_CONFIG_H__
28#define __OCTEON_CONFIG_H__
29
30
31
32
33
34
35
36
37
38
39
40#define MAX_OCTEON_NICIF 32
41#define MAX_OCTEON_DEVICES MAX_OCTEON_NICIF
42#define MAX_OCTEON_LINKS MAX_OCTEON_NICIF
43#define MAX_OCTEON_MULTICAST_ADDR 32
44
45
46#define CN6XXX_MAX_INPUT_QUEUES 32
47#define CN6XXX_MAX_IQ_DESCRIPTORS 2048
48#define CN6XXX_DB_MIN 1
49#define CN6XXX_DB_MAX 8
50#define CN6XXX_DB_TIMEOUT 1
51
52
53#define CN6XXX_MAX_OUTPUT_QUEUES 32
54#define CN6XXX_MAX_OQ_DESCRIPTORS 2048
55#define CN6XXX_OQ_BUF_SIZE 1536
56#define CN6XXX_OQ_PKTSPER_INTR ((CN6XXX_MAX_OQ_DESCRIPTORS < 512) ? \
57 (CN6XXX_MAX_OQ_DESCRIPTORS / 4) : 128)
58#define CN6XXX_OQ_REFIL_THRESHOLD ((CN6XXX_MAX_OQ_DESCRIPTORS < 512) ? \
59 (CN6XXX_MAX_OQ_DESCRIPTORS / 4) : 128)
60
61#define CN6XXX_OQ_INTR_PKT 64
62#define CN6XXX_OQ_INTR_TIME 100
63#define DEFAULT_NUM_NIC_PORTS_66XX 2
64#define DEFAULT_NUM_NIC_PORTS_68XX 4
65#define DEFAULT_NUM_NIC_PORTS_68XX_210NV 2
66
67
68#define CN6XXX_CFG_IO_QUEUES 32
69#define OCTEON_32BYTE_INSTR 32
70#define OCTEON_64BYTE_INSTR 64
71#define OCTEON_MAX_BASE_IOQ 4
72#define OCTEON_OQ_BUFPTR_MODE 0
73#define OCTEON_OQ_INFOPTR_MODE 1
74
75#define OCTEON_DMA_INTR_PKT 64
76#define OCTEON_DMA_INTR_TIME 1000
77
78#define MAX_TXQS_PER_INTF 8
79#define MAX_RXQS_PER_INTF 8
80#define DEF_TXQS_PER_INTF 4
81#define DEF_RXQS_PER_INTF 4
82
83#define INVALID_IOQ_NO 0xff
84
85#define DEFAULT_POW_GRP 0
86
87
88#define CFG_GET_IQ_CFG(cfg) ((cfg)->iq)
89#define CFG_GET_IQ_MAX_Q(cfg) ((cfg)->iq.max_iqs)
90#define CFG_GET_IQ_PENDING_LIST_SIZE(cfg) ((cfg)->iq.pending_list_size)
91#define CFG_GET_IQ_INSTR_TYPE(cfg) ((cfg)->iq.instr_type)
92#define CFG_GET_IQ_DB_MIN(cfg) ((cfg)->iq.db_min)
93#define CFG_GET_IQ_DB_TIMEOUT(cfg) ((cfg)->iq.db_timeout)
94
95#define CFG_GET_OQ_MAX_Q(cfg) ((cfg)->oq.max_oqs)
96#define CFG_GET_OQ_INFO_PTR(cfg) ((cfg)->oq.info_ptr)
97#define CFG_GET_OQ_PKTS_PER_INTR(cfg) ((cfg)->oq.pkts_per_intr)
98#define CFG_GET_OQ_REFILL_THRESHOLD(cfg) ((cfg)->oq.refill_threshold)
99#define CFG_GET_OQ_INTR_PKT(cfg) ((cfg)->oq.oq_intr_pkt)
100#define CFG_GET_OQ_INTR_TIME(cfg) ((cfg)->oq.oq_intr_time)
101#define CFG_SET_OQ_INTR_PKT(cfg, val) (cfg)->oq.oq_intr_pkt = val
102#define CFG_SET_OQ_INTR_TIME(cfg, val) (cfg)->oq.oq_intr_time = val
103
104#define CFG_GET_DMA_INTR_PKT(cfg) ((cfg)->dma.dma_intr_pkt)
105#define CFG_GET_DMA_INTR_TIME(cfg) ((cfg)->dma.dma_intr_time)
106#define CFG_GET_NUM_NIC_PORTS(cfg) ((cfg)->num_nic_ports)
107#define CFG_GET_NUM_DEF_TX_DESCS(cfg) ((cfg)->num_def_tx_descs)
108#define CFG_GET_NUM_DEF_RX_DESCS(cfg) ((cfg)->num_def_rx_descs)
109#define CFG_GET_DEF_RX_BUF_SIZE(cfg) ((cfg)->def_rx_buf_size)
110
111#define CFG_GET_MAX_TXQS_NIC_IF(cfg, idx) \
112 ((cfg)->nic_if_cfg[idx].max_txqs)
113#define CFG_GET_NUM_TXQS_NIC_IF(cfg, idx) \
114 ((cfg)->nic_if_cfg[idx].num_txqs)
115#define CFG_GET_MAX_RXQS_NIC_IF(cfg, idx) \
116 ((cfg)->nic_if_cfg[idx].max_rxqs)
117#define CFG_GET_NUM_RXQS_NIC_IF(cfg, idx) \
118 ((cfg)->nic_if_cfg[idx].num_rxqs)
119#define CFG_GET_NUM_RX_DESCS_NIC_IF(cfg, idx) \
120 ((cfg)->nic_if_cfg[idx].num_rx_descs)
121#define CFG_GET_NUM_TX_DESCS_NIC_IF(cfg, idx) \
122 ((cfg)->nic_if_cfg[idx].num_tx_descs)
123#define CFG_GET_NUM_RX_BUF_SIZE_NIC_IF(cfg, idx) \
124 ((cfg)->nic_if_cfg[idx].rx_buf_size)
125#define CFG_GET_BASE_QUE_NIC_IF(cfg, idx) \
126 ((cfg)->nic_if_cfg[idx].base_queue)
127#define CFG_GET_GMXID_NIC_IF(cfg, idx) \
128 ((cfg)->nic_if_cfg[idx].gmx_port_id)
129
130#define CFG_GET_CTRL_Q_GRP(cfg) ((cfg)->misc.ctrlq_grp)
131#define CFG_GET_HOST_LINK_QUERY_INTERVAL(cfg) \
132 ((cfg)->misc.host_link_query_interval)
133#define CFG_GET_OCT_LINK_QUERY_INTERVAL(cfg) \
134 ((cfg)->misc.oct_link_query_interval)
135#define CFG_GET_IS_SLI_BP_ON(cfg) ((cfg)->misc.enable_sli_oq_bp)
136
137
138#define MAX_IOQS_PER_NICIF 32
139
140enum lio_card_type {
141 LIO_210SV = 0,
142 LIO_210NV,
143 LIO_410NV
144};
145
146#define LIO_210SV_NAME "210sv"
147#define LIO_210NV_NAME "210nv"
148#define LIO_410NV_NAME "410nv"
149
150
151
152
153struct octeon_iq_config {
154#ifdef __BIG_ENDIAN_BITFIELD
155 u64 reserved:32;
156
157
158 u64 db_timeout:16;
159
160
161
162
163 u64 db_min:8;
164
165
166 u64 instr_type:32;
167
168
169
170
171 u64 pending_list_size:32;
172
173
174 u64 max_iqs:8;
175#else
176
177 u64 max_iqs:8;
178
179
180
181
182 u64 pending_list_size:32;
183
184
185 u64 instr_type:32;
186
187
188
189
190 u64 db_min:8;
191
192
193 u64 db_timeout:16;
194
195 u64 reserved:32;
196#endif
197};
198
199
200
201
202struct octeon_oq_config {
203#ifdef __BIG_ENDIAN_BITFIELD
204 u64 reserved:16;
205
206 u64 pkts_per_intr:16;
207
208
209
210
211
212
213 u64 oq_intr_time:16;
214
215
216
217
218
219
220 u64 oq_intr_pkt:16;
221
222
223
224
225
226
227 u64 refill_threshold:16;
228
229
230 u64 info_ptr:32;
231
232
233 u64 max_oqs:8;
234
235#else
236
237 u64 max_oqs:8;
238
239
240 u64 info_ptr:32;
241
242
243
244
245
246
247 u64 refill_threshold:16;
248
249
250
251
252
253
254 u64 oq_intr_pkt:16;
255
256
257
258
259
260
261 u64 oq_intr_time:16;
262
263 u64 pkts_per_intr:16;
264
265 u64 reserved:16;
266#endif
267
268};
269
270
271
272
273struct octeon_nic_if_config {
274#ifdef __BIG_ENDIAN_BITFIELD
275 u64 reserved:56;
276
277 u64 base_queue:16;
278
279 u64 gmx_port_id:8;
280
281
282
283
284 u64 rx_buf_size:16;
285
286
287 u64 num_tx_descs:16;
288
289
290 u64 num_rx_descs:16;
291
292
293 u64 num_rxqs:16;
294
295
296 u64 max_rxqs:16;
297
298
299 u64 num_txqs:16;
300
301
302 u64 max_txqs:16;
303#else
304
305 u64 max_txqs:16;
306
307
308 u64 num_txqs:16;
309
310
311 u64 max_rxqs:16;
312
313
314 u64 num_rxqs:16;
315
316
317 u64 num_rx_descs:16;
318
319
320 u64 num_tx_descs:16;
321
322
323
324
325 u64 rx_buf_size:16;
326
327 u64 gmx_port_id:8;
328
329 u64 base_queue:16;
330
331 u64 reserved:56;
332#endif
333
334};
335
336
337
338
339
340struct octeon_misc_config {
341#ifdef __BIG_ENDIAN_BITFIELD
342
343 u64 host_link_query_interval:32;
344
345 u64 oct_link_query_interval:32;
346
347 u64 enable_sli_oq_bp:1;
348
349 u64 ctrlq_grp:4;
350#else
351
352 u64 ctrlq_grp:4;
353
354 u64 enable_sli_oq_bp:1;
355
356 u64 oct_link_query_interval:32;
357
358 u64 host_link_query_interval:32;
359#endif
360};
361
362
363struct octeon_config {
364 u16 card_type;
365 char *card_name;
366
367
368 struct octeon_iq_config iq;
369
370
371 struct octeon_oq_config oq;
372
373
374 struct octeon_nic_if_config nic_if_cfg[MAX_OCTEON_NICIF];
375
376
377 struct octeon_misc_config misc;
378
379 int num_nic_ports;
380
381 int num_def_tx_descs;
382
383
384 int num_def_rx_descs;
385
386 int def_rx_buf_size;
387
388};
389
390
391
392
393#define MAX_BAR1_MAP_INDEX 2
394#define OCTEON_BAR1_ENTRY_SIZE (4 * 1024 * 1024)
395
396
397
398
399#define MAX_BAR1_IOREMAP_SIZE ((MAX_BAR1_MAP_INDEX + 1) * \
400 OCTEON_BAR1_ENTRY_SIZE)
401
402
403
404
405#define MAX_RESPONSE_LISTS 4
406
407
408
409
410#define OPCODE_MASK_BITS 6
411
412
413#define OCTEON_OPCODE_MASK 0x3f
414
415
416#define DISPATCH_LIST_SIZE BIT(OPCODE_MASK_BITS)
417
418
419#define MAX_OCTEON_INSTR_QUEUES CN6XXX_MAX_INPUT_QUEUES
420
421
422#define MAX_OCTEON_OUTPUT_QUEUES CN6XXX_MAX_OUTPUT_QUEUES
423
424#endif
425