0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #ifndef __OCTEON_CONFIG_H__
0023 #define __OCTEON_CONFIG_H__
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #define MAX_OCTEON_NICIF 128
0036 #define MAX_OCTEON_DEVICES MAX_OCTEON_NICIF
0037 #define MAX_OCTEON_LINKS MAX_OCTEON_NICIF
0038 #define MAX_OCTEON_MULTICAST_ADDR 32
0039
0040 #define MAX_OCTEON_FILL_COUNT 8
0041
0042
0043 #define CN6XXX_MAX_INPUT_QUEUES 32
0044 #define CN6XXX_MAX_IQ_DESCRIPTORS 2048
0045 #define CN6XXX_DB_MIN 1
0046 #define CN6XXX_DB_MAX 8
0047 #define CN6XXX_DB_TIMEOUT 1
0048
0049
0050 #define CN6XXX_MAX_OUTPUT_QUEUES 32
0051 #define CN6XXX_MAX_OQ_DESCRIPTORS 2048
0052 #define CN6XXX_OQ_BUF_SIZE 1664
0053 #define CN6XXX_OQ_PKTSPER_INTR ((CN6XXX_MAX_OQ_DESCRIPTORS < 512) ? \
0054 (CN6XXX_MAX_OQ_DESCRIPTORS / 4) : 128)
0055 #define CN6XXX_OQ_REFIL_THRESHOLD ((CN6XXX_MAX_OQ_DESCRIPTORS < 512) ? \
0056 (CN6XXX_MAX_OQ_DESCRIPTORS / 4) : 128)
0057
0058 #define CN6XXX_OQ_INTR_PKT 64
0059 #define CN6XXX_OQ_INTR_TIME 100
0060 #define DEFAULT_NUM_NIC_PORTS_66XX 2
0061 #define DEFAULT_NUM_NIC_PORTS_68XX 4
0062 #define DEFAULT_NUM_NIC_PORTS_68XX_210NV 2
0063
0064
0065 #define CN23XX_MAX_VFS_PER_PF_PASS_1_0 8
0066 #define CN23XX_MAX_VFS_PER_PF_PASS_1_1 31
0067 #define CN23XX_MAX_VFS_PER_PF 63
0068 #define CN23XX_MAX_RINGS_PER_VF 8
0069
0070 #define CN23XX_MAX_RINGS_PER_PF_PASS_1_0 12
0071 #define CN23XX_MAX_RINGS_PER_PF_PASS_1_1 32
0072 #define CN23XX_MAX_RINGS_PER_PF 64
0073 #define CN23XX_MAX_RINGS_PER_VF 8
0074
0075 #define CN23XX_MAX_INPUT_QUEUES CN23XX_MAX_RINGS_PER_PF
0076 #define CN23XX_MAX_IQ_DESCRIPTORS 2048
0077 #define CN23XX_DEFAULT_IQ_DESCRIPTORS 512
0078 #define CN23XX_MIN_IQ_DESCRIPTORS 128
0079 #define CN23XX_DB_MIN 1
0080 #define CN23XX_DB_MAX 8
0081 #define CN23XX_DB_TIMEOUT 1
0082
0083 #define CN23XX_MAX_OUTPUT_QUEUES CN23XX_MAX_RINGS_PER_PF
0084 #define CN23XX_MAX_OQ_DESCRIPTORS 2048
0085 #define CN23XX_DEFAULT_OQ_DESCRIPTORS 512
0086 #define CN23XX_MIN_OQ_DESCRIPTORS 128
0087 #define CN23XX_OQ_BUF_SIZE 1664
0088 #define CN23XX_OQ_PKTSPER_INTR 128
0089
0090 #define CN23XX_OQ_REFIL_THRESHOLD 16
0091
0092 #define CN23XX_OQ_INTR_PKT 64
0093 #define CN23XX_OQ_INTR_TIME 100
0094 #define DEFAULT_NUM_NIC_PORTS_23XX 1
0095
0096 #define CN23XX_CFG_IO_QUEUES CN23XX_MAX_RINGS_PER_PF
0097
0098 #define CN23XX_MAX_MACS 4
0099
0100 #define CN23XX_DEF_IQ_INTR_THRESHOLD 32
0101 #define CN23XX_DEF_IQ_INTR_BYTE_THRESHOLD (64 * 1024)
0102
0103 #define CN6XXX_CFG_IO_QUEUES 32
0104 #define OCTEON_32BYTE_INSTR 32
0105 #define OCTEON_64BYTE_INSTR 64
0106 #define OCTEON_MAX_BASE_IOQ 4
0107
0108 #define OCTEON_DMA_INTR_PKT 64
0109 #define OCTEON_DMA_INTR_TIME 1000
0110
0111 #define MAX_TXQS_PER_INTF 8
0112 #define MAX_RXQS_PER_INTF 8
0113 #define DEF_TXQS_PER_INTF 4
0114 #define DEF_RXQS_PER_INTF 4
0115
0116 #define INVALID_IOQ_NO 0xff
0117
0118 #define DEFAULT_POW_GRP 0
0119
0120
0121 #define CFG_GET_IQ_CFG(cfg) ((cfg)->iq)
0122 #define CFG_GET_IQ_MAX_Q(cfg) ((cfg)->iq.max_iqs)
0123 #define CFG_GET_IQ_PENDING_LIST_SIZE(cfg) ((cfg)->iq.pending_list_size)
0124 #define CFG_GET_IQ_INSTR_TYPE(cfg) ((cfg)->iq.instr_type)
0125 #define CFG_GET_IQ_DB_MIN(cfg) ((cfg)->iq.db_min)
0126 #define CFG_GET_IQ_DB_TIMEOUT(cfg) ((cfg)->iq.db_timeout)
0127
0128 #define CFG_GET_IQ_INTR_PKT(cfg) ((cfg)->iq.iq_intr_pkt)
0129 #define CFG_SET_IQ_INTR_PKT(cfg, val) (cfg)->iq.iq_intr_pkt = val
0130
0131 #define CFG_GET_OQ_MAX_Q(cfg) ((cfg)->oq.max_oqs)
0132 #define CFG_GET_OQ_PKTS_PER_INTR(cfg) ((cfg)->oq.pkts_per_intr)
0133 #define CFG_GET_OQ_REFILL_THRESHOLD(cfg) ((cfg)->oq.refill_threshold)
0134 #define CFG_GET_OQ_INTR_PKT(cfg) ((cfg)->oq.oq_intr_pkt)
0135 #define CFG_GET_OQ_INTR_TIME(cfg) ((cfg)->oq.oq_intr_time)
0136 #define CFG_SET_OQ_INTR_PKT(cfg, val) (cfg)->oq.oq_intr_pkt = val
0137 #define CFG_SET_OQ_INTR_TIME(cfg, val) (cfg)->oq.oq_intr_time = val
0138
0139 #define CFG_GET_DMA_INTR_PKT(cfg) ((cfg)->dma.dma_intr_pkt)
0140 #define CFG_GET_DMA_INTR_TIME(cfg) ((cfg)->dma.dma_intr_time)
0141 #define CFG_GET_NUM_NIC_PORTS(cfg) ((cfg)->num_nic_ports)
0142 #define CFG_GET_NUM_DEF_TX_DESCS(cfg) ((cfg)->num_def_tx_descs)
0143 #define CFG_GET_NUM_DEF_RX_DESCS(cfg) ((cfg)->num_def_rx_descs)
0144 #define CFG_GET_DEF_RX_BUF_SIZE(cfg) ((cfg)->def_rx_buf_size)
0145
0146 #define CFG_GET_MAX_TXQS_NIC_IF(cfg, idx) \
0147 ((cfg)->nic_if_cfg[idx].max_txqs)
0148 #define CFG_GET_NUM_TXQS_NIC_IF(cfg, idx) \
0149 ((cfg)->nic_if_cfg[idx].num_txqs)
0150 #define CFG_GET_MAX_RXQS_NIC_IF(cfg, idx) \
0151 ((cfg)->nic_if_cfg[idx].max_rxqs)
0152 #define CFG_GET_NUM_RXQS_NIC_IF(cfg, idx) \
0153 ((cfg)->nic_if_cfg[idx].num_rxqs)
0154 #define CFG_GET_NUM_RX_DESCS_NIC_IF(cfg, idx) \
0155 ((cfg)->nic_if_cfg[idx].num_rx_descs)
0156 #define CFG_GET_NUM_TX_DESCS_NIC_IF(cfg, idx) \
0157 ((cfg)->nic_if_cfg[idx].num_tx_descs)
0158 #define CFG_GET_NUM_RX_BUF_SIZE_NIC_IF(cfg, idx) \
0159 ((cfg)->nic_if_cfg[idx].rx_buf_size)
0160 #define CFG_GET_BASE_QUE_NIC_IF(cfg, idx) \
0161 ((cfg)->nic_if_cfg[idx].base_queue)
0162 #define CFG_GET_GMXID_NIC_IF(cfg, idx) \
0163 ((cfg)->nic_if_cfg[idx].gmx_port_id)
0164
0165 #define CFG_GET_CTRL_Q_GRP(cfg) ((cfg)->misc.ctrlq_grp)
0166 #define CFG_GET_HOST_LINK_QUERY_INTERVAL(cfg) \
0167 ((cfg)->misc.host_link_query_interval)
0168 #define CFG_GET_OCT_LINK_QUERY_INTERVAL(cfg) \
0169 ((cfg)->misc.oct_link_query_interval)
0170 #define CFG_GET_IS_SLI_BP_ON(cfg) ((cfg)->misc.enable_sli_oq_bp)
0171
0172 #define CFG_SET_NUM_RX_DESCS_NIC_IF(cfg, idx, value) \
0173 ((cfg)->nic_if_cfg[idx].num_rx_descs = value)
0174 #define CFG_SET_NUM_TX_DESCS_NIC_IF(cfg, idx, value) \
0175 ((cfg)->nic_if_cfg[idx].num_tx_descs = value)
0176
0177
0178 #define MAX_IOQS_PER_NICIF 64
0179
0180 enum lio_card_type {
0181 LIO_210SV = 0,
0182 LIO_210NV,
0183 LIO_410NV,
0184 LIO_23XX
0185 };
0186
0187 #define LIO_210SV_NAME "210sv"
0188 #define LIO_210NV_NAME "210nv"
0189 #define LIO_410NV_NAME "410nv"
0190 #define LIO_23XX_NAME "23xx"
0191
0192
0193
0194
0195 struct octeon_iq_config {
0196 #ifdef __BIG_ENDIAN_BITFIELD
0197 u64 reserved:16;
0198
0199
0200 u64 iq_intr_pkt:16;
0201
0202
0203 u64 db_timeout:16;
0204
0205
0206
0207
0208 u64 db_min:8;
0209
0210
0211 u64 instr_type:32;
0212
0213
0214
0215
0216 u64 pending_list_size:32;
0217
0218
0219 u64 max_iqs:8;
0220 #else
0221
0222 u64 max_iqs:8;
0223
0224
0225
0226
0227 u64 pending_list_size:32;
0228
0229
0230 u64 instr_type:32;
0231
0232
0233
0234
0235 u64 db_min:8;
0236
0237
0238 u64 db_timeout:16;
0239
0240
0241 u64 iq_intr_pkt:16;
0242
0243 u64 reserved:16;
0244 #endif
0245 };
0246
0247
0248
0249
0250 struct octeon_oq_config {
0251 #ifdef __BIG_ENDIAN_BITFIELD
0252 u64 reserved:16;
0253
0254 u64 pkts_per_intr:16;
0255
0256
0257
0258
0259
0260
0261 u64 oq_intr_time:16;
0262
0263
0264
0265
0266
0267
0268 u64 oq_intr_pkt:16;
0269
0270
0271
0272
0273
0274
0275 u64 refill_threshold:16;
0276
0277
0278 u64 max_oqs:8;
0279
0280 #else
0281
0282 u64 max_oqs:8;
0283
0284
0285
0286
0287
0288
0289 u64 refill_threshold:16;
0290
0291
0292
0293
0294
0295
0296 u64 oq_intr_pkt:16;
0297
0298
0299
0300
0301
0302
0303 u64 oq_intr_time:16;
0304
0305 u64 pkts_per_intr:16;
0306
0307 u64 reserved:16;
0308 #endif
0309
0310 };
0311
0312
0313
0314
0315 struct octeon_nic_if_config {
0316 #ifdef __BIG_ENDIAN_BITFIELD
0317 u64 reserved:56;
0318
0319 u64 base_queue:16;
0320
0321 u64 gmx_port_id:8;
0322
0323
0324
0325
0326 u64 rx_buf_size:16;
0327
0328
0329 u64 num_tx_descs:16;
0330
0331
0332 u64 num_rx_descs:16;
0333
0334
0335 u64 num_rxqs:16;
0336
0337
0338 u64 max_rxqs:16;
0339
0340
0341 u64 num_txqs:16;
0342
0343
0344 u64 max_txqs:16;
0345 #else
0346
0347 u64 max_txqs:16;
0348
0349
0350 u64 num_txqs:16;
0351
0352
0353 u64 max_rxqs:16;
0354
0355
0356 u64 num_rxqs:16;
0357
0358
0359 u64 num_rx_descs:16;
0360
0361
0362 u64 num_tx_descs:16;
0363
0364
0365
0366
0367 u64 rx_buf_size:16;
0368
0369 u64 gmx_port_id:8;
0370
0371 u64 base_queue:16;
0372
0373 u64 reserved:56;
0374 #endif
0375
0376 };
0377
0378
0379
0380
0381
0382 struct octeon_misc_config {
0383 #ifdef __BIG_ENDIAN_BITFIELD
0384
0385 u64 host_link_query_interval:32;
0386
0387 u64 oct_link_query_interval:32;
0388
0389 u64 enable_sli_oq_bp:1;
0390
0391 u64 ctrlq_grp:4;
0392 #else
0393
0394 u64 ctrlq_grp:4;
0395
0396 u64 enable_sli_oq_bp:1;
0397
0398 u64 oct_link_query_interval:32;
0399
0400 u64 host_link_query_interval:32;
0401 #endif
0402 };
0403
0404
0405 struct octeon_config {
0406 u16 card_type;
0407 char *card_name;
0408
0409
0410 struct octeon_iq_config iq;
0411
0412
0413 struct octeon_oq_config oq;
0414
0415
0416 struct octeon_nic_if_config nic_if_cfg[MAX_OCTEON_NICIF];
0417
0418
0419 struct octeon_misc_config misc;
0420
0421 int num_nic_ports;
0422
0423 int num_def_tx_descs;
0424
0425
0426 int num_def_rx_descs;
0427
0428 int def_rx_buf_size;
0429
0430 };
0431
0432
0433
0434 #define BAR1_INDEX_DYNAMIC_MAP 2
0435 #define BAR1_INDEX_STATIC_MAP 15
0436 #define OCTEON_BAR1_ENTRY_SIZE (4 * 1024 * 1024)
0437
0438 #define MAX_BAR1_IOREMAP_SIZE (16 * OCTEON_BAR1_ENTRY_SIZE)
0439
0440
0441
0442
0443
0444 #define MAX_RESPONSE_LISTS 6
0445
0446
0447
0448
0449 #define OPCODE_MASK_BITS 6
0450
0451
0452 #define OCTEON_OPCODE_MASK 0x3f
0453
0454
0455 #define DISPATCH_LIST_SIZE BIT(OPCODE_MASK_BITS)
0456
0457
0458 #define MAX_OCTEON_INSTR_QUEUES(oct) \
0459 (OCTEON_CN23XX_PF(oct) ? CN23XX_MAX_INPUT_QUEUES : \
0460 CN6XXX_MAX_INPUT_QUEUES)
0461
0462
0463 #define MAX_OCTEON_OUTPUT_QUEUES(oct) \
0464 (OCTEON_CN23XX_PF(oct) ? CN23XX_MAX_OUTPUT_QUEUES : \
0465 CN6XXX_MAX_OUTPUT_QUEUES)
0466
0467 #define MAX_POSSIBLE_OCTEON_INSTR_QUEUES CN23XX_MAX_INPUT_QUEUES
0468 #define MAX_POSSIBLE_OCTEON_OUTPUT_QUEUES CN23XX_MAX_OUTPUT_QUEUES
0469
0470 #define MAX_POSSIBLE_VFS 64
0471
0472 #endif