diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/reg.h')
| -rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/reg.h | 490 |
1 files changed, 490 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 9280d96bb291..0cc148566677 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | * Copyright (c) 2015-2016 Ido Schimmel <idosch@mellanox.com> | 4 | * Copyright (c) 2015-2016 Ido Schimmel <idosch@mellanox.com> |
| 5 | * Copyright (c) 2015 Elad Raz <eladr@mellanox.com> | 5 | * Copyright (c) 2015 Elad Raz <eladr@mellanox.com> |
| 6 | * Copyright (c) 2015-2016 Jiri Pirko <jiri@mellanox.com> | 6 | * Copyright (c) 2015-2016 Jiri Pirko <jiri@mellanox.com> |
| 7 | * Copyright (c) 2016 Yotam Gigi <yotamg@mellanox.com> | ||
| 7 | * | 8 | * |
| 8 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions are met: | 10 | * modification, are permitted provided that the following conditions are met: |
| @@ -3454,6 +3455,137 @@ static inline void mlxsw_reg_ritr_pack(char *payload, bool enable, | |||
| 3454 | mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac); | 3455 | mlxsw_reg_ritr_if_mac_memcpy_to(payload, mac); |
| 3455 | } | 3456 | } |
| 3456 | 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 | |||
| 3457 | /* RALTA - Router Algorithmic LPM Tree Allocation Register | 3589 | /* RALTA - Router Algorithmic LPM Tree Allocation Register |
| 3458 | * ------------------------------------------------------- | 3590 | * ------------------------------------------------------- |
| 3459 | * 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. |
| @@ -3884,6 +4016,356 @@ mlxsw_reg_ralue_act_ip2me_pack(char *payload) | |||
| 3884 | MLXSW_REG_RALUE_ACTION_TYPE_IP2ME); | 4016 | MLXSW_REG_RALUE_ACTION_TYPE_IP2ME); |
| 3885 | } | 4017 | } |
| 3886 | 4018 | ||
| 4019 | /* RAUHT - Router Algorithmic LPM Unicast Host Table Register | ||
| 4020 | * ---------------------------------------------------------- | ||
| 4021 | * The RAUHT register is used to configure and query the Unicast Host table in | ||
| 4022 | * devices that implement the Algorithmic LPM. | ||
| 4023 | */ | ||
| 4024 | #define MLXSW_REG_RAUHT_ID 0x8014 | ||
| 4025 | #define MLXSW_REG_RAUHT_LEN 0x74 | ||
| 4026 | |||
| 4027 | static const struct mlxsw_reg_info mlxsw_reg_rauht = { | ||
| 4028 | .id = MLXSW_REG_RAUHT_ID, | ||
| 4029 | .len = MLXSW_REG_RAUHT_LEN, | ||
| 4030 | }; | ||
| 4031 | |||
| 4032 | enum mlxsw_reg_rauht_type { | ||
| 4033 | MLXSW_REG_RAUHT_TYPE_IPV4, | ||
| 4034 | MLXSW_REG_RAUHT_TYPE_IPV6, | ||
| 4035 | }; | ||
| 4036 | |||
| 4037 | /* reg_rauht_type | ||
| 4038 | * Access: Index | ||
| 4039 | */ | ||
| 4040 | MLXSW_ITEM32(reg, rauht, type, 0x00, 24, 2); | ||
| 4041 | |||
| 4042 | enum mlxsw_reg_rauht_op { | ||
| 4043 | MLXSW_REG_RAUHT_OP_QUERY_READ = 0, | ||
| 4044 | /* Read operation */ | ||
| 4045 | MLXSW_REG_RAUHT_OP_QUERY_CLEAR_ON_READ = 1, | ||
| 4046 | /* Clear on read operation. Used to read entry and clear | ||
| 4047 | * activity bit. | ||
| 4048 | */ | ||
| 4049 | MLXSW_REG_RAUHT_OP_WRITE_ADD = 0, | ||
| 4050 | /* Add. Used to write a new entry to the table. All R/W fields are | ||
| 4051 | * relevant for new entry. Activity bit is set for new entries. | ||
| 4052 | */ | ||
| 4053 | MLXSW_REG_RAUHT_OP_WRITE_UPDATE = 1, | ||
| 4054 | /* Update action. Used to update an existing route entry and | ||
| 4055 | * only update the following fields: | ||
| 4056 | * trap_action, trap_id, mac, counter_set_type, counter_index | ||
| 4057 | */ | ||
| 4058 | MLXSW_REG_RAUHT_OP_WRITE_CLEAR_ACTIVITY = 2, | ||
| 4059 | /* Clear activity. A bit is cleared for the entry. */ | ||
| 4060 | MLXSW_REG_RAUHT_OP_WRITE_DELETE = 3, | ||
| 4061 | /* Delete entry */ | ||
| 4062 | MLXSW_REG_RAUHT_OP_WRITE_DELETE_ALL = 4, | ||
| 4063 | /* Delete all host entries on a RIF. In this command, dip | ||
| 4064 | * field is reserved. | ||
| 4065 | */ | ||
| 4066 | }; | ||
| 4067 | |||
| 4068 | /* reg_rauht_op | ||
| 4069 | * Access: OP | ||
| 4070 | */ | ||
| 4071 | MLXSW_ITEM32(reg, rauht, op, 0x00, 20, 3); | ||
| 4072 | |||
| 4073 | /* reg_rauht_a | ||
| 4074 | * Activity. Set for new entries. Set if a packet lookup has hit on | ||
| 4075 | * the specific entry. | ||
| 4076 | * To clear the a bit, use "clear activity" op. | ||
| 4077 | * Enabled by activity_dis in RGCR | ||
| 4078 | * Access: RO | ||
| 4079 | */ | ||
| 4080 | MLXSW_ITEM32(reg, rauht, a, 0x00, 16, 1); | ||
| 4081 | |||
| 4082 | /* reg_rauht_rif | ||
| 4083 | * Router Interface | ||
| 4084 | * Access: Index | ||
| 4085 | */ | ||
| 4086 | MLXSW_ITEM32(reg, rauht, rif, 0x00, 0, 16); | ||
| 4087 | |||
| 4088 | /* reg_rauht_dip* | ||
| 4089 | * Destination address. | ||
| 4090 | * Access: Index | ||
| 4091 | */ | ||
| 4092 | MLXSW_ITEM32(reg, rauht, dip4, 0x1C, 0x0, 32); | ||
| 4093 | |||
| 4094 | enum mlxsw_reg_rauht_trap_action { | ||
| 4095 | MLXSW_REG_RAUHT_TRAP_ACTION_NOP, | ||
| 4096 | MLXSW_REG_RAUHT_TRAP_ACTION_TRAP, | ||
| 4097 | MLXSW_REG_RAUHT_TRAP_ACTION_MIRROR_TO_CPU, | ||
| 4098 | MLXSW_REG_RAUHT_TRAP_ACTION_MIRROR, | ||
| 4099 | MLXSW_REG_RAUHT_TRAP_ACTION_DISCARD_ERRORS, | ||
| 4100 | }; | ||
| 4101 | |||
| 4102 | /* reg_rauht_trap_action | ||
| 4103 | * Access: RW | ||
| 4104 | */ | ||
| 4105 | MLXSW_ITEM32(reg, rauht, trap_action, 0x60, 28, 4); | ||
| 4106 | |||
| 4107 | enum mlxsw_reg_rauht_trap_id { | ||
| 4108 | MLXSW_REG_RAUHT_TRAP_ID_RTR_EGRESS0, | ||
| 4109 | MLXSW_REG_RAUHT_TRAP_ID_RTR_EGRESS1, | ||
| 4110 | }; | ||
| 4111 | |||
| 4112 | /* reg_rauht_trap_id | ||
| 4113 | * Trap ID to be reported to CPU. | ||
| 4114 | * Trap-ID is RTR_EGRESS0 or RTR_EGRESS1. | ||
| 4115 | * For trap_action of NOP, MIRROR and DISCARD_ERROR, | ||
| 4116 | * trap_id is reserved. | ||
| 4117 | * Access: RW | ||
| 4118 | */ | ||
| 4119 | MLXSW_ITEM32(reg, rauht, trap_id, 0x60, 0, 9); | ||
| 4120 | |||
| 4121 | /* reg_rauht_counter_set_type | ||
| 4122 | * Counter set type for flow counters | ||
| 4123 | * Access: RW | ||
| 4124 | */ | ||
| 4125 | MLXSW_ITEM32(reg, rauht, counter_set_type, 0x68, 24, 8); | ||
| 4126 | |||
| 4127 | /* reg_rauht_counter_index | ||
| 4128 | * Counter index for flow counters | ||
| 4129 | * Access: RW | ||
| 4130 | */ | ||
| 4131 | MLXSW_ITEM32(reg, rauht, counter_index, 0x68, 0, 24); | ||
| 4132 | |||
| 4133 | /* reg_rauht_mac | ||
| 4134 | * MAC address. | ||
| 4135 | * Access: RW | ||
| 4136 | */ | ||
| 4137 | MLXSW_ITEM_BUF(reg, rauht, mac, 0x6E, 6); | ||
| 4138 | |||
| 4139 | static inline void mlxsw_reg_rauht_pack(char *payload, | ||
| 4140 | enum mlxsw_reg_rauht_op op, u16 rif, | ||
| 4141 | const char *mac) | ||
| 4142 | { | ||
| 4143 | MLXSW_REG_ZERO(rauht, payload); | ||
| 4144 | mlxsw_reg_rauht_op_set(payload, op); | ||
| 4145 | mlxsw_reg_rauht_rif_set(payload, rif); | ||
| 4146 | mlxsw_reg_rauht_mac_memcpy_to(payload, mac); | ||
| 4147 | } | ||
| 4148 | |||
| 4149 | static inline void mlxsw_reg_rauht_pack4(char *payload, | ||
| 4150 | enum mlxsw_reg_rauht_op op, u16 rif, | ||
| 4151 | const char *mac, u32 dip) | ||
| 4152 | { | ||
| 4153 | mlxsw_reg_rauht_pack(payload, op, rif, mac); | ||
| 4154 | mlxsw_reg_rauht_dip4_set(payload, dip); | ||
| 4155 | } | ||
| 4156 | |||
| 4157 | /* RALEU - Router Algorithmic LPM ECMP Update Register | ||
| 4158 | * --------------------------------------------------- | ||
| 4159 | * The register enables updating the ECMP section in the action for multiple | ||
| 4160 | * LPM Unicast entries in a single operation. The update is executed to | ||
| 4161 | * all entries of a {virtual router, protocol} tuple using the same ECMP group. | ||
| 4162 | */ | ||
| 4163 | #define MLXSW_REG_RALEU_ID 0x8015 | ||
| 4164 | #define MLXSW_REG_RALEU_LEN 0x28 | ||
| 4165 | |||
| 4166 | static const struct mlxsw_reg_info mlxsw_reg_raleu = { | ||
| 4167 | .id = MLXSW_REG_RALEU_ID, | ||
| 4168 | .len = MLXSW_REG_RALEU_LEN, | ||
| 4169 | }; | ||
| 4170 | |||
| 4171 | /* reg_raleu_protocol | ||
| 4172 | * Protocol. | ||
| 4173 | * Access: Index | ||
| 4174 | */ | ||
| 4175 | MLXSW_ITEM32(reg, raleu, protocol, 0x00, 24, 4); | ||
| 4176 | |||
| 4177 | /* reg_raleu_virtual_router | ||
| 4178 | * Virtual Router ID | ||
| 4179 | * Range is 0..cap_max_virtual_routers-1 | ||
| 4180 | * Access: Index | ||
| 4181 | */ | ||
| 4182 | MLXSW_ITEM32(reg, raleu, virtual_router, 0x00, 0, 16); | ||
| 4183 | |||
| 4184 | /* reg_raleu_adjacency_index | ||
| 4185 | * Adjacency Index used for matching on the existing entries. | ||
| 4186 | * Access: Index | ||
| 4187 | */ | ||
| 4188 | MLXSW_ITEM32(reg, raleu, adjacency_index, 0x10, 0, 24); | ||
| 4189 | |||
| 4190 | /* reg_raleu_ecmp_size | ||
| 4191 | * ECMP Size used for matching on the existing entries. | ||
| 4192 | * Access: Index | ||
| 4193 | */ | ||
| 4194 | MLXSW_ITEM32(reg, raleu, ecmp_size, 0x14, 0, 13); | ||
| 4195 | |||
| 4196 | /* reg_raleu_new_adjacency_index | ||
| 4197 | * New Adjacency Index. | ||
| 4198 | * Access: WO | ||
| 4199 | */ | ||
| 4200 | MLXSW_ITEM32(reg, raleu, new_adjacency_index, 0x20, 0, 24); | ||
| 4201 | |||
| 4202 | /* reg_raleu_new_ecmp_size | ||
| 4203 | * New ECMP Size. | ||
| 4204 | * Access: WO | ||
| 4205 | */ | ||
| 4206 | MLXSW_ITEM32(reg, raleu, new_ecmp_size, 0x24, 0, 13); | ||
| 4207 | |||
| 4208 | static inline void mlxsw_reg_raleu_pack(char *payload, | ||
| 4209 | enum mlxsw_reg_ralxx_protocol protocol, | ||
| 4210 | u16 virtual_router, | ||
| 4211 | u32 adjacency_index, u16 ecmp_size, | ||
| 4212 | u32 new_adjacency_index, | ||
| 4213 | u16 new_ecmp_size) | ||
| 4214 | { | ||
| 4215 | MLXSW_REG_ZERO(raleu, payload); | ||
| 4216 | mlxsw_reg_raleu_protocol_set(payload, protocol); | ||
| 4217 | mlxsw_reg_raleu_virtual_router_set(payload, virtual_router); | ||
| 4218 | mlxsw_reg_raleu_adjacency_index_set(payload, adjacency_index); | ||
| 4219 | mlxsw_reg_raleu_ecmp_size_set(payload, ecmp_size); | ||
| 4220 | mlxsw_reg_raleu_new_adjacency_index_set(payload, new_adjacency_index); | ||
| 4221 | mlxsw_reg_raleu_new_ecmp_size_set(payload, new_ecmp_size); | ||
| 4222 | } | ||
| 4223 | |||
| 4224 | /* RAUHTD - Router Algorithmic LPM Unicast Host Table Dump Register | ||
| 4225 | * ---------------------------------------------------------------- | ||
| 4226 | * The RAUHTD register allows dumping entries from the Router Unicast Host | ||
| 4227 | * Table. For a given session an entry is dumped no more than one time. The | ||
| 4228 | * first RAUHTD access after reset is a new session. A session ends when the | ||
| 4229 | * num_rec response is smaller than num_rec request or for IPv4 when the | ||
| 4230 | * num_entries is smaller than 4. The clear activity affect the current session | ||
| 4231 | * or the last session if a new session has not started. | ||
| 4232 | */ | ||
| 4233 | #define MLXSW_REG_RAUHTD_ID 0x8018 | ||
| 4234 | #define MLXSW_REG_RAUHTD_BASE_LEN 0x20 | ||
| 4235 | #define MLXSW_REG_RAUHTD_REC_LEN 0x20 | ||
| 4236 | #define MLXSW_REG_RAUHTD_REC_MAX_NUM 32 | ||
| 4237 | #define MLXSW_REG_RAUHTD_LEN (MLXSW_REG_RAUHTD_BASE_LEN + \ | ||
| 4238 | MLXSW_REG_RAUHTD_REC_MAX_NUM * MLXSW_REG_RAUHTD_REC_LEN) | ||
| 4239 | #define MLXSW_REG_RAUHTD_IPV4_ENT_PER_REC 4 | ||
| 4240 | |||
| 4241 | static const struct mlxsw_reg_info mlxsw_reg_rauhtd = { | ||
| 4242 | .id = MLXSW_REG_RAUHTD_ID, | ||
| 4243 | .len = MLXSW_REG_RAUHTD_LEN, | ||
| 4244 | }; | ||
| 4245 | |||
| 4246 | #define MLXSW_REG_RAUHTD_FILTER_A BIT(0) | ||
| 4247 | #define MLXSW_REG_RAUHTD_FILTER_RIF BIT(3) | ||
| 4248 | |||
| 4249 | /* reg_rauhtd_filter_fields | ||
| 4250 | * if a bit is '0' then the relevant field is ignored and dump is done | ||
| 4251 | * regardless of the field value | ||
| 4252 | * Bit0 - filter by activity: entry_a | ||
| 4253 | * Bit3 - filter by entry rip: entry_rif | ||
| 4254 | * Access: Index | ||
| 4255 | */ | ||
| 4256 | MLXSW_ITEM32(reg, rauhtd, filter_fields, 0x00, 0, 8); | ||
| 4257 | |||
| 4258 | enum mlxsw_reg_rauhtd_op { | ||
| 4259 | MLXSW_REG_RAUHTD_OP_DUMP, | ||
| 4260 | MLXSW_REG_RAUHTD_OP_DUMP_AND_CLEAR, | ||
| 4261 | }; | ||
| 4262 | |||
| 4263 | /* reg_rauhtd_op | ||
| 4264 | * Access: OP | ||
| 4265 | */ | ||
| 4266 | MLXSW_ITEM32(reg, rauhtd, op, 0x04, 24, 2); | ||
| 4267 | |||
| 4268 | /* reg_rauhtd_num_rec | ||
| 4269 | * At request: number of records requested | ||
| 4270 | * At response: number of records dumped | ||
| 4271 | * For IPv4, each record has 4 entries at request and up to 4 entries | ||
| 4272 | * at response | ||
| 4273 | * Range is 0..MLXSW_REG_RAUHTD_REC_MAX_NUM | ||
| 4274 | * Access: Index | ||
| 4275 | */ | ||
| 4276 | MLXSW_ITEM32(reg, rauhtd, num_rec, 0x04, 0, 8); | ||
| 4277 | |||
| 4278 | /* reg_rauhtd_entry_a | ||
| 4279 | * Dump only if activity has value of entry_a | ||
| 4280 | * Reserved if filter_fields bit0 is '0' | ||
| 4281 | * Access: Index | ||
| 4282 | */ | ||
| 4283 | MLXSW_ITEM32(reg, rauhtd, entry_a, 0x08, 16, 1); | ||
| 4284 | |||
| 4285 | enum mlxsw_reg_rauhtd_type { | ||
| 4286 | MLXSW_REG_RAUHTD_TYPE_IPV4, | ||
| 4287 | MLXSW_REG_RAUHTD_TYPE_IPV6, | ||
| 4288 | }; | ||
| 4289 | |||
| 4290 | /* reg_rauhtd_type | ||
| 4291 | * Dump only if record type is: | ||
| 4292 | * 0 - IPv4 | ||
| 4293 | * 1 - IPv6 | ||
| 4294 | * Access: Index | ||
| 4295 | */ | ||
| 4296 | MLXSW_ITEM32(reg, rauhtd, type, 0x08, 0, 4); | ||
| 4297 | |||
| 4298 | /* reg_rauhtd_entry_rif | ||
| 4299 | * Dump only if RIF has value of entry_rif | ||
| 4300 | * Reserved if filter_fields bit3 is '0' | ||
| 4301 | * Access: Index | ||
| 4302 | */ | ||
| 4303 | MLXSW_ITEM32(reg, rauhtd, entry_rif, 0x0C, 0, 16); | ||
| 4304 | |||
| 4305 | static inline void mlxsw_reg_rauhtd_pack(char *payload, | ||
| 4306 | enum mlxsw_reg_rauhtd_type type) | ||
| 4307 | { | ||
| 4308 | MLXSW_REG_ZERO(rauhtd, payload); | ||
| 4309 | mlxsw_reg_rauhtd_filter_fields_set(payload, MLXSW_REG_RAUHTD_FILTER_A); | ||
| 4310 | mlxsw_reg_rauhtd_op_set(payload, MLXSW_REG_RAUHTD_OP_DUMP_AND_CLEAR); | ||
| 4311 | mlxsw_reg_rauhtd_num_rec_set(payload, MLXSW_REG_RAUHTD_REC_MAX_NUM); | ||
| 4312 | mlxsw_reg_rauhtd_entry_a_set(payload, 1); | ||
| 4313 | mlxsw_reg_rauhtd_type_set(payload, type); | ||
| 4314 | } | ||
| 4315 | |||
| 4316 | /* reg_rauhtd_ipv4_rec_num_entries | ||
| 4317 | * Number of valid entries in this record: | ||
| 4318 | * 0 - 1 valid entry | ||
| 4319 | * 1 - 2 valid entries | ||
| 4320 | * 2 - 3 valid entries | ||
| 4321 | * 3 - 4 valid entries | ||
| 4322 | * Access: RO | ||
| 4323 | */ | ||
| 4324 | MLXSW_ITEM32_INDEXED(reg, rauhtd, ipv4_rec_num_entries, | ||
| 4325 | MLXSW_REG_RAUHTD_BASE_LEN, 28, 2, | ||
| 4326 | MLXSW_REG_RAUHTD_REC_LEN, 0x00, false); | ||
| 4327 | |||
| 4328 | /* reg_rauhtd_rec_type | ||
| 4329 | * Record type. | ||
| 4330 | * 0 - IPv4 | ||
| 4331 | * 1 - IPv6 | ||
| 4332 | * Access: RO | ||
| 4333 | */ | ||
| 4334 | MLXSW_ITEM32_INDEXED(reg, rauhtd, rec_type, MLXSW_REG_RAUHTD_BASE_LEN, 24, 2, | ||
| 4335 | MLXSW_REG_RAUHTD_REC_LEN, 0x00, false); | ||
| 4336 | |||
| 4337 | #define MLXSW_REG_RAUHTD_IPV4_ENT_LEN 0x8 | ||
| 4338 | |||
| 4339 | /* reg_rauhtd_ipv4_ent_a | ||
| 4340 | * Activity. Set for new entries. Set if a packet lookup has hit on the | ||
| 4341 | * specific entry. | ||
| 4342 | * Access: RO | ||
| 4343 | */ | ||
| 4344 | MLXSW_ITEM32_INDEXED(reg, rauhtd, ipv4_ent_a, MLXSW_REG_RAUHTD_BASE_LEN, 16, 1, | ||
| 4345 | MLXSW_REG_RAUHTD_IPV4_ENT_LEN, 0x00, false); | ||
| 4346 | |||
| 4347 | /* reg_rauhtd_ipv4_ent_rif | ||
| 4348 | * Router interface. | ||
| 4349 | * Access: RO | ||
| 4350 | */ | ||
| 4351 | MLXSW_ITEM32_INDEXED(reg, rauhtd, ipv4_ent_rif, MLXSW_REG_RAUHTD_BASE_LEN, 0, | ||
| 4352 | 16, MLXSW_REG_RAUHTD_IPV4_ENT_LEN, 0x00, false); | ||
| 4353 | |||
| 4354 | /* reg_rauhtd_ipv4_ent_dip | ||
| 4355 | * Destination IPv4 address. | ||
| 4356 | * Access: RO | ||
| 4357 | */ | ||
| 4358 | MLXSW_ITEM32_INDEXED(reg, rauhtd, ipv4_ent_dip, MLXSW_REG_RAUHTD_BASE_LEN, 0, | ||
| 4359 | 32, MLXSW_REG_RAUHTD_IPV4_ENT_LEN, 0x04, false); | ||
| 4360 | |||
| 4361 | static inline void mlxsw_reg_rauhtd_ent_ipv4_unpack(char *payload, | ||
| 4362 | int ent_index, u16 *p_rif, | ||
| 4363 | u32 *p_dip) | ||
| 4364 | { | ||
| 4365 | *p_rif = mlxsw_reg_rauhtd_ipv4_ent_rif_get(payload, ent_index); | ||
| 4366 | *p_dip = mlxsw_reg_rauhtd_ipv4_ent_dip_get(payload, ent_index); | ||
| 4367 | } | ||
| 4368 | |||
| 3887 | /* MFCR - Management Fan Control Register | 4369 | /* MFCR - Management Fan Control Register |
| 3888 | * -------------------------------------- | 4370 | * -------------------------------------- |
| 3889 | * This register controls the settings of the Fan Speed PWM mechanism. | 4371 | * This register controls the settings of the Fan Speed PWM mechanism. |
| @@ -4626,6 +5108,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id) | |||
| 4626 | return "RGCR"; | 5108 | return "RGCR"; |
| 4627 | case MLXSW_REG_RITR_ID: | 5109 | case MLXSW_REG_RITR_ID: |
| 4628 | return "RITR"; | 5110 | return "RITR"; |
| 5111 | case MLXSW_REG_RATR_ID: | ||
| 5112 | return "RATR"; | ||
| 4629 | case MLXSW_REG_RALTA_ID: | 5113 | case MLXSW_REG_RALTA_ID: |
| 4630 | return "RALTA"; | 5114 | return "RALTA"; |
| 4631 | case MLXSW_REG_RALST_ID: | 5115 | case MLXSW_REG_RALST_ID: |
| @@ -4634,6 +5118,12 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id) | |||
| 4634 | return "RALTB"; | 5118 | return "RALTB"; |
| 4635 | case MLXSW_REG_RALUE_ID: | 5119 | case MLXSW_REG_RALUE_ID: |
| 4636 | return "RALUE"; | 5120 | return "RALUE"; |
| 5121 | case MLXSW_REG_RAUHT_ID: | ||
| 5122 | return "RAUHT"; | ||
| 5123 | case MLXSW_REG_RALEU_ID: | ||
| 5124 | return "RALEU"; | ||
| 5125 | case MLXSW_REG_RAUHTD_ID: | ||
| 5126 | return "RAUHTD"; | ||
| 4637 | case MLXSW_REG_MFCR_ID: | 5127 | case MLXSW_REG_MFCR_ID: |
| 4638 | return "MFCR"; | 5128 | return "MFCR"; |
| 4639 | case MLXSW_REG_MFSC_ID: | 5129 | case MLXSW_REG_MFSC_ID: |
