Commit fa3faeb7 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: reg: Extend mirroring registers with probability rate field

The MPAR and MPAGR registers are used to configure the binding between
the mirroring trigger (e.g., received packet) and the SPAN agent. Add
probability rate field, which will allow us to support sampling by
mirroring to the CPU.
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c7659eb
...@@ -9925,15 +9925,28 @@ MLXSW_ITEM32(reg, mpar, enable, 0x04, 31, 1); ...@@ -9925,15 +9925,28 @@ MLXSW_ITEM32(reg, mpar, enable, 0x04, 31, 1);
*/ */
MLXSW_ITEM32(reg, mpar, pa_id, 0x04, 0, 4); MLXSW_ITEM32(reg, mpar, pa_id, 0x04, 0, 4);
#define MLXSW_REG_MPAR_RATE_MAX 3500000000UL
/* reg_mpar_probability_rate
* Sampling rate.
* Valid values are: 1 to 3.5*10^9
* Value of 1 means "sample all". Default is 1.
* Reserved when Spectrum-1.
* Access: RW
*/
MLXSW_ITEM32(reg, mpar, probability_rate, 0x08, 0, 32);
static inline void mlxsw_reg_mpar_pack(char *payload, u8 local_port, static inline void mlxsw_reg_mpar_pack(char *payload, u8 local_port,
enum mlxsw_reg_mpar_i_e i_e, enum mlxsw_reg_mpar_i_e i_e,
bool enable, u8 pa_id) bool enable, u8 pa_id,
u32 probability_rate)
{ {
MLXSW_REG_ZERO(mpar, payload); MLXSW_REG_ZERO(mpar, payload);
mlxsw_reg_mpar_local_port_set(payload, local_port); mlxsw_reg_mpar_local_port_set(payload, local_port);
mlxsw_reg_mpar_enable_set(payload, enable); mlxsw_reg_mpar_enable_set(payload, enable);
mlxsw_reg_mpar_i_e_set(payload, i_e); mlxsw_reg_mpar_i_e_set(payload, i_e);
mlxsw_reg_mpar_pa_id_set(payload, pa_id); mlxsw_reg_mpar_pa_id_set(payload, pa_id);
mlxsw_reg_mpar_probability_rate_set(payload, probability_rate);
} }
/* MGIR - Management General Information Register /* MGIR - Management General Information Register
...@@ -10577,6 +10590,8 @@ MLXSW_ITEM32(reg, mpagr, trigger, 0x00, 0, 4); ...@@ -10577,6 +10590,8 @@ MLXSW_ITEM32(reg, mpagr, trigger, 0x00, 0, 4);
*/ */
MLXSW_ITEM32(reg, mpagr, pa_id, 0x04, 0, 4); MLXSW_ITEM32(reg, mpagr, pa_id, 0x04, 0, 4);
#define MLXSW_REG_MPAGR_RATE_MAX 3500000000UL
/* reg_mpagr_probability_rate /* reg_mpagr_probability_rate
* Sampling rate. * Sampling rate.
* Valid values are: 1 to 3.5*10^9 * Valid values are: 1 to 3.5*10^9
......
...@@ -1232,7 +1232,7 @@ __mlxsw_sp_span_trigger_port_bind(struct mlxsw_sp_span *span, ...@@ -1232,7 +1232,7 @@ __mlxsw_sp_span_trigger_port_bind(struct mlxsw_sp_span *span,
} }
mlxsw_reg_mpar_pack(mpar_pl, trigger_entry->local_port, i_e, enable, mlxsw_reg_mpar_pack(mpar_pl, trigger_entry->local_port, i_e, enable,
trigger_entry->parms.span_id); trigger_entry->parms.span_id, 1);
return mlxsw_reg_write(span->mlxsw_sp->core, MLXSW_REG(mpar), mpar_pl); return mlxsw_reg_write(span->mlxsw_sp->core, MLXSW_REG(mpar), mpar_pl);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment