diff options
author | Ido Schimmel <idosch@nvidia.com> | 2022-11-08 11:47:13 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-09 19:06:14 -0800 |
commit | dc0d1a8b7f84ca09b53af356eb401df9e3d976a0 (patch) | |
tree | 5289c53267d3e5eb50d85c78f8a193b7a7f88d8c /drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |
parent | 0b31fb9ba2b54896b0fe4b1ec0102031c40bdf4f (diff) | |
download | lwn-dc0d1a8b7f84ca09b53af356eb401df9e3d976a0.tar.gz lwn-dc0d1a8b7f84ca09b53af356eb401df9e3d976a0.zip |
mlxsw: spectrum: Add an API to configure security checks
Add an API to enable or disable security checks on a local port. It will
be used by subsequent patches when the 'BR_PORT_LOCKED' flag is toggled.
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw/spectrum.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 04dc79da6024..b34366521914 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c @@ -466,6 +466,24 @@ int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, return err; } +int mlxsw_sp_port_security_set(struct mlxsw_sp_port *mlxsw_sp_port, bool enable) +{ + struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; + char spfsr_pl[MLXSW_REG_SPFSR_LEN]; + int err; + + if (mlxsw_sp_port->security == enable) + return 0; + + mlxsw_reg_spfsr_pack(spfsr_pl, mlxsw_sp_port->local_port, enable); + err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spfsr), spfsr_pl); + if (err) + return err; + + mlxsw_sp_port->security = enable; + return 0; +} + int mlxsw_sp_ethtype_to_sver_type(u16 ethtype, u8 *p_sver_type) { switch (ethtype) { |