Skip to content

Commit 3a66ee3

Browse files
idoschdavem330
authored andcommitted
mlxsw: spectrum: Add support for port identification
Allow a user to flash the port's LED in order to identify it. This is achieved by setting the Management LED Control Register (MLCR). Signed-off-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 3161c15 commit 3a66ee3

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,29 @@ static void mlxsw_sp_port_get_strings(struct net_device *dev,
859859
}
860860
}
861861

862+
static int mlxsw_sp_port_set_phys_id(struct net_device *dev,
863+
enum ethtool_phys_id_state state)
864+
{
865+
struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
866+
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
867+
char mlcr_pl[MLXSW_REG_MLCR_LEN];
868+
bool active;
869+
870+
switch (state) {
871+
case ETHTOOL_ID_ACTIVE:
872+
active = true;
873+
break;
874+
case ETHTOOL_ID_INACTIVE:
875+
active = false;
876+
break;
877+
default:
878+
return -EOPNOTSUPP;
879+
}
880+
881+
mlxsw_reg_mlcr_pack(mlcr_pl, mlxsw_sp_port->local_port, active);
882+
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mlcr), mlcr_pl);
883+
}
884+
862885
static void mlxsw_sp_port_get_stats(struct net_device *dev,
863886
struct ethtool_stats *stats, u64 *data)
864887
{
@@ -1205,6 +1228,7 @@ static const struct ethtool_ops mlxsw_sp_port_ethtool_ops = {
12051228
.get_drvinfo = mlxsw_sp_port_get_drvinfo,
12061229
.get_link = ethtool_op_get_link,
12071230
.get_strings = mlxsw_sp_port_get_strings,
1231+
.set_phys_id = mlxsw_sp_port_set_phys_id,
12081232
.get_ethtool_stats = mlxsw_sp_port_get_stats,
12091233
.get_sset_count = mlxsw_sp_port_get_sset_count,
12101234
.get_settings = mlxsw_sp_port_get_settings,

0 commit comments

Comments
 (0)