Skip to content

Commit 43a4685

Browse files
yotamgidavem330
authored andcommitted
mlxsw: reg: Add Monitoring Port Analyzer Table register
The MPAT register is used to query and configure the Switch Port Analyzer (SPAN) table. This register is used to configure a port as a mirror output port, while after that a mirrored input port can be bound using MPAR register. Signed-off-by: Yotam Gigi <yotamg@mellanox.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 51ae8cc commit 43a4685

File tree

1 file changed

+54
-0
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+54
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4633,6 +4633,58 @@ static inline void mlxsw_reg_mtmp_unpack(char *payload, unsigned int *p_temp,
46334633
mlxsw_reg_mtmp_sensor_name_memcpy_from(payload, sensor_name);
46344634
}
46354635

4636+
/* MPAT - Monitoring Port Analyzer Table
4637+
* -------------------------------------
4638+
* MPAT Register is used to query and configure the Switch PortAnalyzer Table.
4639+
* For an enabled analyzer, all fields except e (enable) cannot be modified.
4640+
*/
4641+
#define MLXSW_REG_MPAT_ID 0x901A
4642+
#define MLXSW_REG_MPAT_LEN 0x78
4643+
4644+
static const struct mlxsw_reg_info mlxsw_reg_mpat = {
4645+
.id = MLXSW_REG_MPAT_ID,
4646+
.len = MLXSW_REG_MPAT_LEN,
4647+
};
4648+
4649+
/* reg_mpat_pa_id
4650+
* Port Analyzer ID.
4651+
* Access: Index
4652+
*/
4653+
MLXSW_ITEM32(reg, mpat, pa_id, 0x00, 28, 4);
4654+
4655+
/* reg_mpat_system_port
4656+
* A unique port identifier for the final destination of the packet.
4657+
* Access: RW
4658+
*/
4659+
MLXSW_ITEM32(reg, mpat, system_port, 0x00, 0, 16);
4660+
4661+
/* reg_mpat_e
4662+
* Enable. Indicating the Port Analyzer is enabled.
4663+
* Access: RW
4664+
*/
4665+
MLXSW_ITEM32(reg, mpat, e, 0x04, 31, 1);
4666+
4667+
/* reg_mpat_qos
4668+
* Quality Of Service Mode.
4669+
* 0: CONFIGURED - QoS parameters (Switch Priority, and encapsulation
4670+
* PCP, DEI, DSCP or VL) are configured.
4671+
* 1: MAINTAIN - QoS parameters (Switch Priority, Color) are the
4672+
* same as in the original packet that has triggered the mirroring. For
4673+
* SPAN also the pcp,dei are maintained.
4674+
* Access: RW
4675+
*/
4676+
MLXSW_ITEM32(reg, mpat, qos, 0x04, 26, 1);
4677+
4678+
static inline void mlxsw_reg_mpat_pack(char *payload, u8 pa_id,
4679+
u16 system_port, bool e)
4680+
{
4681+
MLXSW_REG_ZERO(mpat, payload);
4682+
mlxsw_reg_mpat_pa_id_set(payload, pa_id);
4683+
mlxsw_reg_mpat_system_port_set(payload, system_port);
4684+
mlxsw_reg_mpat_e_set(payload, e);
4685+
mlxsw_reg_mpat_qos_set(payload, 1);
4686+
}
4687+
46364688
/* MLCR - Management LED Control Register
46374689
* --------------------------------------
46384690
* Controls the system LEDs.
@@ -5204,6 +5256,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
52045256
return "MFSM";
52055257
case MLXSW_REG_MTCAP_ID:
52065258
return "MTCAP";
5259+
case MLXSW_REG_MPAT_ID:
5260+
return "MPAT";
52075261
case MLXSW_REG_MTMP_ID:
52085262
return "MTMP";
52095263
case MLXSW_REG_MLCR_ID:

0 commit comments

Comments
 (0)