diff options
author | Ido Schimmel <idosch@mellanox.com> | 2018-07-25 09:23:50 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-25 16:46:01 -0700 |
commit | 91329e27f36d7008402fb4d5e853e731a200f19b (patch) | |
tree | a0c6ae4e855fbbdd1296590a3881e740995511c5 /drivers/net/ethernet/mellanox/mlxsw/reg.h | |
parent | 41147bb18a38a9c9e805dac3d82cef7f1cb24eef (diff) | |
download | linux-91329e27f36d7008402fb4d5e853e731a200f19b.tar.bz2 |
mlxsw: reg: Prepare PERERP register for A-TCAM usage
Before introducing A-TCAM support we need to make sure all the necessary
fields are configurable and not hard coded to values that worked for the
C-TCAM only use case.
This includes - for example - the ability to configure the eRP table
used by the TCAM region.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/reg.h')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/reg.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 596fddfb3850..f4e16ac20fea 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h @@ -2663,12 +2663,28 @@ MLXSW_ITEM_BIT_ARRAY(reg, pererp, erpt_vector, 0x14, 4, 1); */ MLXSW_ITEM32(reg, pererp, master_rp_id, 0x18, 0, 4); -static inline void mlxsw_reg_pererp_pack(char *payload, u16 region_id) +static inline void mlxsw_reg_pererp_erp_vector_pack(char *payload, + unsigned long *erp_vector, + unsigned long size) +{ + unsigned long bit; + + for_each_set_bit(bit, erp_vector, size) + mlxsw_reg_pererp_erpt_vector_set(payload, bit, true); +} + +static inline void mlxsw_reg_pererp_pack(char *payload, u16 region_id, + bool ctcam_le, bool erpt_pointer_valid, + u8 erpt_bank_pointer, u8 erpt_pointer, + u8 master_rp_id) { MLXSW_REG_ZERO(pererp, payload); mlxsw_reg_pererp_region_id_set(payload, region_id); - mlxsw_reg_pererp_ctcam_le_set(payload, true); - mlxsw_reg_pererp_erpt_pointer_valid_set(payload, true); + mlxsw_reg_pererp_ctcam_le_set(payload, ctcam_le); + mlxsw_reg_pererp_erpt_pointer_valid_set(payload, erpt_pointer_valid); + mlxsw_reg_pererp_erpt_bank_pointer_set(payload, erpt_bank_pointer); + mlxsw_reg_pererp_erpt_pointer_set(payload, erpt_pointer); + mlxsw_reg_pererp_master_rp_id_set(payload, master_rp_id); } /* IEDR - Infrastructure Entry Delete Register |