41 #define BLOCK_OPS_IDX(block, stage, end) \
42 (2*(((block)*NUM_OF_INIT_PHASES) + (stage)) + (end))
177 #define BNX2X_ETH_Q 0
178 #define BNX2X_TOE_Q 3
179 #define BNX2X_TOE_ACK_Q 6
180 #define BNX2X_ISCSI_Q 9
181 #define BNX2X_ISCSI_ACK_Q 11
182 #define BNX2X_FCOE_Q 10
185 #define BNX2X_PORT2_MODE_NUM_VNICS 4
186 #define BNX2X_PORT4_MODE_NUM_VNICS 2
189 #define BNX2X_E3B0_PORT1_COS_OFFSET 3
192 #define BNX2X_Q_VOQ_REG_ADDR(pf_q_num)\
193 (QM_REG_QVOQIDX_0 + 4 * (pf_q_num))
194 #define BNX2X_VOQ_Q_REG_ADDR(cos, pf_q_num)\
195 (QM_REG_VOQQMASK_0_LSB + 4 * ((cos) * 2 + ((pf_q_num) >> 5)))
196 #define BNX2X_Q_CMDQ_REG_ADDR(pf_q_num)\
197 (QM_REG_BYTECRDCMDQ_0 + 4 * ((pf_q_num) >> 4))
200 #define BNX2X_PF_Q_NUM(q_num, port, vnic)\
201 ((((port) << 1) | (vnic)) * 16 + (q_num))
205 static inline void bnx2x_map_q_cos(
struct bnx2x *bp,
u32 q_num,
u32 new_cos)
211 if (curr_cos != new_cos) {
225 for (vnic = 0; vnic < num_vnics; vnic++) {
228 u32 q_bit_map = 1 << (pf_q_num & 0x1f);
235 reg_bit_map =
REG_RD(bp, reg_addr);
236 REG_WR(bp, reg_addr, reg_bit_map & (~q_bit_map));
240 reg_bit_map =
REG_RD(bp, reg_addr);
241 REG_WR(bp, reg_addr, reg_bit_map | q_bit_map);
248 reg_bit_map =
REG_RD(bp, reg_addr);
249 q_bit_map = 1 << (2 * (pf_q_num & 0xf));
250 reg_bit_map = new_cos ?
251 (reg_bit_map | q_bit_map) :
252 (reg_bit_map & (~q_bit_map));
253 REG_WR(bp, reg_addr, reg_bit_map);
297 #define BITS_TO_BYTES(x) ((x)/8)
302 #define DEF_MIN_RATE 100
305 #define RS_PERIODIC_TIMEOUT_USEC 400
310 #define QM_ARB_BYTES 160000
318 #define MIN_ABOVE_THRESH 32768
323 #define T_FAIR_COEF ((MIN_ABOVE_THRESH + QM_ARB_BYTES) * 8 * MIN_RES)
327 #define SAFC_TIMEOUT_USEC 52
332 static inline void bnx2x_init_max(
const struct cmng_init_input *input_data,
343 pdata->
rs_vars.rs_periodic_timeout =
369 static inline void bnx2x_init_min(
const struct cmng_init_input *input_data,
372 u32 vnic, fair_periodic_timeout_usec, vnicWeightSum, tFair;
403 if (vnicWeightSum > 0) {
424 static inline void bnx2x_init_fw_wrr(
const struct cmng_init_input *input_data,
428 u32 cosWeightSum = 0;
435 if (cosWeightSum > 0) {
450 if (ccd[cos] < pdata->
fair_vars.fair_threshold
461 static inline void bnx2x_init_safc(
const struct cmng_init_input *input_data,
469 static inline void bnx2x_init_cmng(
const struct cmng_init_input *input_data,
475 ram_data->
port.flags = input_data->
flags;
481 bnx2x_init_max(input_data, r_param, ram_data);
482 bnx2x_init_min(input_data, r_param, ram_data);
483 bnx2x_init_fw_wrr(input_data, r_param, ram_data);
484 bnx2x_init_safc(input_data, ram_data);
490 #define BLOCK_OPS_IDX(block, stage, end) \
491 (2*(((block)*NUM_OF_INIT_PHASES) + (stage)) + (end))
495 #define INITOP_CLEAR 1
496 #define INITOP_INIT 2
513 #define ILT_CLIENT_SKIP_INIT 0x1
514 #define ILT_CLIENT_SKIP_MEM 0x2
521 #define ILT_CLIENT_CDU 0
522 #define ILT_CLIENT_QM 1
523 #define ILT_CLIENT_SRC 2
524 #define ILT_CLIENT_TM 3
538 #define BLOCK_PRTY_INFO(block, en_mask, m1, m1h, m2, m3) \
540 block##_REG_##block##_PRTY_MASK, \
541 block##_REG_##block##_PRTY_STS_CLR, \
542 en_mask, {m1, m1h, m2, m3}, #block \
545 #define BLOCK_PRTY_INFO_0(block, en_mask, m1, m1h, m2, m3) \
547 block##_REG_##block##_PRTY_MASK_0, \
548 block##_REG_##block##_PRTY_STS_CLR_0, \
549 en_mask, {m1, m1h, m2, m3}, #block"_0" \
552 #define BLOCK_PRTY_INFO_1(block, en_mask, m1, m1h, m2, m3) \
554 block##_REG_##block##_PRTY_MASK_1, \
555 block##_REG_##block##_PRTY_STS_CLR_1, \
556 en_mask, {m1, m1h, m2, m3}, #block"_1" \
559 static const struct {
572 } bnx2x_blocks_parity_data[] = {
602 {0xf, 0xf, 0xf, 0xf},
"UPB"},
605 {0xf, 0xf, 0xf, 0xf},
"XPB"},
643 #define MISC_AEU_ENABLE_MCP_PRTY_BITS \
644 (AEU_INPUTS_ATTN_BITS_MCP_LATCHED_ROM_PARITY | \
645 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_RX_PARITY | \
646 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY | \
647 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY)
653 static const u32 mcp_attn_ctl_regs[] = {
662 static inline void bnx2x_set_mcp_parity(
struct bnx2x *bp,
u8 enable)
667 for (i = 0; i <
ARRAY_SIZE(mcp_attn_ctl_regs); i++) {
668 reg_val =
REG_RD(bp, mcp_attn_ctl_regs[i]);
675 REG_WR(bp, mcp_attn_ctl_regs[i], reg_val);
679 static inline u32 bnx2x_parity_reg_mask(
struct bnx2x *bp,
int idx)
682 return bnx2x_blocks_parity_data[
idx].reg_mask.e1;
684 return bnx2x_blocks_parity_data[
idx].reg_mask.e1h;
686 return bnx2x_blocks_parity_data[
idx].reg_mask.e2;
688 return bnx2x_blocks_parity_data[
idx].reg_mask.e3;
691 static inline void bnx2x_disable_blocks_parity(
struct bnx2x *bp)
695 for (i = 0; i <
ARRAY_SIZE(bnx2x_blocks_parity_data); i++) {
696 u32 dis_mask = bnx2x_parity_reg_mask(bp, i);
702 "for %s to\t\t0x%x\n",
703 bnx2x_blocks_parity_data[i].
name, dis_mask);
708 bnx2x_set_mcp_parity(bp,
false);
712 static inline void bnx2x_clear_blocks_parity(
struct bnx2x *bp)
727 for (i = 0; i <
ARRAY_SIZE(bnx2x_blocks_parity_data); i++) {
731 reg_val =
REG_RD(bp, bnx2x_blocks_parity_data[i].
733 if (reg_val & reg_mask)
735 "Parity errors in %s: 0x%x\n",
736 bnx2x_blocks_parity_data[i].
name,
743 if (reg_val & mcp_aeu_bits)
745 reg_val & mcp_aeu_bits);
756 static inline void bnx2x_enable_blocks_parity(
struct bnx2x *bp)
760 for (i = 0; i <
ARRAY_SIZE(bnx2x_blocks_parity_data); i++) {
761 u32 reg_mask = bnx2x_parity_reg_mask(bp, i);
765 bnx2x_blocks_parity_data[i].
en_mask & reg_mask);
769 bnx2x_set_mcp_parity(bp,
true);