diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/reg.h | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index fcf379b5984c..a2d7870ea60e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h | |||
| @@ -3455,6 +3455,137 @@ static inline void mlxsw_reg_ritr_pack(char *payload, bool enable, | |||
| 3455 | mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac); | 3455 | mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac); |
| 3456 | } | 3456 | } |
| 3457 | 3457 | ||
| 3458 | /* RATR - Router Adjacency Table Register | ||
| 3459 | * -------------------------------------- | ||
| 3460 | * The RATR register is used to configure the Router Adjacency (next-hop) | ||
| 3461 | * Table. | ||
| 3462 | */ | ||
| 3463 | #define MLXSW_REG_RATR_ID 0x8008 | ||
| 3464 | #define MLXSW_REG_RATR_LEN 0x2C | ||
| 3465 | |||
| 3466 | static const struct mlxsw_reg_info mlxsw_reg_ratr = { | ||
| 3467 | .id = MLXSW_REG_RATR_ID, | ||
| 3468 | .len = MLXSW_REG_RATR_LEN, | ||
| 3469 | }; | ||
| 3470 | |||
| 3471 | enum mlxsw_reg_ratr_op { | ||
| 3472 | /* Read */ | ||
| 3473 | MLXSW_REG_RATR_OP_QUERY_READ = 0, | ||
| 3474 | /* Read and clear activity */ | ||
| 3475 | MLXSW_REG_RATR_OP_QUERY_READ_CLEAR = 2, | ||
| 3476 | /* Write Adjacency entry */ | ||
| 3477 | MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY = 1, | ||
| 3478 | /* Write Adjacency entry only if the activity is cleared. | ||
| 3479 | * The write may not succeed if the activity is set. There is not | ||
| 3480 | * direct feedback if the write has succeeded or not, however | ||
| 3481 | * the get will reveal the actual entry (SW can compare the get | ||
| 3482 | * response to the set command). | ||
| 3483 | */ | ||
| 3484 | MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY_ON_ACTIVITY = 3, | ||
| 3485 | }; | ||
| 3486 | |||
| 3487 | /* reg_ratr_op | ||
| 3488 | * Note that Write operation may also be used for updating | ||
| 3489 | * counter_set_type and counter_index. In this case all other | ||
| 3490 | * fields must not be updated. | ||
| 3491 | * Access: OP | ||
| 3492 | */ | ||
| 3493 | MLXSW_ITEM32(reg, ratr, op, 0x00, 28, 4); | ||
| 3494 | |||
| 3495 | /* reg_ratr_v | ||
| 3496 | * Valid bit. Indicates if the adjacency entry is valid. | ||
| 3497 | * Note: the device may need some time before reusing an invalidated | ||
| 3498 | * entry. During this time the entry can not be reused. It is | ||
| 3499 | * recommended to use another entry before reusing an invalidated | ||
| 3500 | * entry (e.g. software can put it at the end of the list for | ||
| 3501 | * reusing). Trying to access an invalidated entry not yet cleared | ||
| 3502 | * by the device results with failure indicating "Try Again" status. | ||
| 3503 | * When valid is '0' then egress_router_interface,trap_action, | ||
| 3504 | * adjacency_parameters and counters are reserved | ||
| 3505 | * Access: RW | ||
| 3506 | */ | ||
| 3507 | MLXSW_ITEM32(reg, ratr, v, 0x00, 24, 1); | ||
| 3508 | |||
| 3509 | /* reg_ratr_a | ||
| 3510 | * Activity. Set for new entries. Set if a packet lookup has hit on | ||
| 3511 | * the specific entry. To clear the a bit, use "clear activity". | ||
| 3512 | * Access: RO | ||
| 3513 | */ | ||
| 3514 | MLXSW_ITEM32(reg, ratr, a, 0x00, 16, 1); | ||
| 3515 | |||
| 3516 | /* reg_ratr_adjacency_index_low | ||
| 3517 | * Bits 15:0 of index into the adjacency table. | ||
| 3518 | * For SwitchX and SwitchX-2, the adjacency table is linear and | ||
| 3519 | * used for adjacency entries only. | ||
| 3520 | * For Spectrum, the index is to the KVD linear. | ||
| 3521 | * Access: Index | ||
| 3522 | */ | ||
| 3523 | MLXSW_ITEM32(reg, ratr, adjacency_index_low, 0x04, 0, 16); | ||
| 3524 | |||
| 3525 | /* reg_ratr_egress_router_interface | ||
| 3526 | * Range is 0 .. cap_max_router_interfaces - 1 | ||
| 3527 | * Access: RW | ||
| 3528 | */ | ||
| 3529 | MLXSW_ITEM32(reg, ratr, egress_router_interface, 0x08, 0, 16); | ||
| 3530 | |||
| 3531 | enum mlxsw_reg_ratr_trap_action { | ||
| 3532 | MLXSW_REG_RATR_TRAP_ACTION_NOP, | ||
| 3533 | MLXSW_REG_RATR_TRAP_ACTION_TRAP, | ||
| 3534 | MLXSW_REG_RATR_TRAP_ACTION_MIRROR_TO_CPU, | ||
| 3535 | MLXSW_REG_RATR_TRAP_ACTION_MIRROR, | ||
| 3536 | MLXSW_REG_RATR_TRAP_ACTION_DISCARD_ERRORS, | ||
| 3537 | }; | ||
| 3538 | |||
| 3539 | /* reg_ratr_trap_action | ||
| 3540 | * see mlxsw_reg_ratr_trap_action | ||
| 3541 | * Access: RW | ||
| 3542 | */ | ||
| 3543 | MLXSW_ITEM32(reg, ratr, trap_action, 0x0C, 28, 4); | ||
| 3544 | |||
| 3545 | enum mlxsw_reg_ratr_trap_id { | ||
| 3546 | MLXSW_REG_RATR_TRAP_ID_RTR_EGRESS0 = 0, | ||
| 3547 | MLXSW_REG_RATR_TRAP_ID_RTR_EGRESS1 = 1, | ||
| 3548 | }; | ||
| 3549 | |||
| 3550 | /* reg_ratr_adjacency_index_high | ||
| 3551 | * Bits 23:16 of the adjacency_index. | ||
| 3552 | * Access: Index | ||
| 3553 | */ | ||
| 3554 | MLXSW_ITEM32(reg, ratr, adjacency_index_high, 0x0C, 16, 8); | ||
| 3555 | |||
| 3556 | /* reg_ratr_trap_id | ||
| 3557 | * Trap ID to be reported to CPU. | ||
| 3558 | * Trap-ID is RTR_EGRESS0 or RTR_EGRESS1. | ||
| 3559 | * For trap_action of NOP, MIRROR and DISCARD_ERROR | ||
| 3560 | * Access: RW | ||
| 3561 | */ | ||
| 3562 | MLXSW_ITEM32(reg, ratr, trap_id, 0x0C, 0, 8); | ||
| 3563 | |||
| 3564 | /* reg_ratr_eth_destination_mac | ||
| 3565 | * MAC address of the destination next-hop. | ||
| 3566 | * Access: RW | ||
| 3567 | */ | ||
| 3568 | MLXSW_ITEM_BUF(reg, ratr, eth_destination_mac, 0x12, 6); | ||
| 3569 | |||
| 3570 | static inline void | ||
| 3571 | mlxsw_reg_ratr_pack(char *payload, | ||
| 3572 | enum mlxsw_reg_ratr_op op, bool valid, | ||
| 3573 | u32 adjacency_index, u16 egress_rif) | ||
| 3574 | { | ||
| 3575 | MLXSW_REG_ZERO(ratr, payload); | ||
| 3576 | mlxsw_reg_ratr_op_set(payload, op); | ||
| 3577 | mlxsw_reg_ratr_v_set(payload, valid); | ||
| 3578 | mlxsw_reg_ratr_adjacency_index_low_set(payload, adjacency_index); | ||
| 3579 | mlxsw_reg_ratr_adjacency_index_high_set(payload, adjacency_index >> 16); | ||
| 3580 | mlxsw_reg_ratr_egress_router_interface_set(payload, egress_rif); | ||
| 3581 | } | ||
| 3582 | |||
| 3583 | static inline void mlxsw_reg_ratr_eth_entry_pack(char *payload, | ||
| 3584 | const char *dest_mac) | ||
| 3585 | { | ||
| 3586 | mlxsw_reg_ratr_eth_destination_mac_memcpy_to(payload, dest_mac); | ||
| 3587 | } | ||
| 3588 | |||
| 3458 | /* RALTA - Router Algorithmic LPM Tree Allocation Register | 3589 | /* RALTA - Router Algorithmic LPM Tree Allocation Register |
| 3459 | * ------------------------------------------------------- | 3590 | * ------------------------------------------------------- |
| 3460 | * RALTA is used to allocate the LPM trees of the SHSPM method. | 3591 | * RALTA is used to allocate the LPM trees of the SHSPM method. |
| @@ -4910,6 +5041,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id) | |||
| 4910 | return "RGCR"; | 5041 | return "RGCR"; |
| 4911 | case MLXSW_REG_RITR_ID: | 5042 | case MLXSW_REG_RITR_ID: |
| 4912 | return "RITR"; | 5043 | return "RITR"; |
| 5044 | case MLXSW_REG_RATR_ID: | ||
| 5045 | return "RATR"; | ||
| 4913 | case MLXSW_REG_RALTA_ID: | 5046 | case MLXSW_REG_RALTA_ID: |
| 4914 | return "RALTA"; | 5047 | return "RALTA"; |
| 4915 | case MLXSW_REG_RALST_ID: | 5048 | case MLXSW_REG_RALST_ID: |
