-
Notifications
You must be signed in to change notification settings - Fork 39
Controlling LEDs
The leds_mlxcpld
kernel module is in charge of providing standard sysfs access
to the LEDs on Mellanox switches. Hence, in order to control the LEDs, one must
make sure that the module is compiled and loaded.
Module compilation is controlled via the CONFIG_LEDS_MLXCPLD
config option.
To verify whether the module is loaded, the following command may be used:
$ lsmod | grep leds_mlxcpld
If the module is not loaded, it can be loaded by running:
$ modprobe leds_mlxcpld
When installing the provided .iso
file according to the
instructions, the module will be automatically loaded upon
boot via /etc/modules-load.d/mlxleds.conf
.
To control the LEDs' status from the user space, the sysfs interface can be used. For every LED and every color, there exists a directory named:
/sys/class/leds/<driver>:<LED name>:<LED color>
For example, on a Mellanox Spectrum machine, the following directories are available:
$ ls /sys/class/leds/
mlxcpld:fan1:green
mlxcpld:fan1:red
mlxcpld:fan2:green
mlxcpld:fan2:red
mlxcpld:fan3:green
mlxcpld:fan3:red
mlxcpld:fan4:green
mlxcpld:fan4:red
mlxcpld:psu:green
mlxcpld:psu:red
mlxcpld:status:green
mlxcpld:status:red
Controlling or querying the brightness of a specific LED and color can be done
via the file <LED dir>/brightness
. This file contains integer values that vary
from 0 to <LED dir>/max_brightness
.
For example, to set the status
LED to be green, run:
$ cd /sys/class/leds
$ echo 0 > mlxcpld\:status\:red/brightness
$ cat mlxcpld\:status\:green/max_brightness > mlxcpld\:status\:green/brightness
The kernel's LED infrastructure allows connecting certain LEDs to certain
triggers. To control a LED trigger, the file <LED dir>/trigger
may be used.
To list all available triggers, use the command:
$ cat <LED dir>/trigger
For example, to make a LED blink, the timer
trigger may be used:
$ echo timer > <LED dir>/trigger
The files delay_on
and delay_off
are added under <LED dir>
. With those
two files, it is possible to set the LED frequency and duty-cycle, as the
delay_on
sets the number of milliseconds for which the LED would be ON, and
the delay_off
sets the number of milliseconds for which the LED would be OFF.
Hence, the total frequency is 1.0/(delay_on + delay_off) KHz
.
Note: To use the timer trigger, make sure that the ledtrig-timer
module is loaded. In the provided .iso
file, the module is loaded on startup.
General information
System Maintenance
Network Interface Configuration
- Switch Port Configuration
- Netdevice Statistics
- Persistent Configuration
- Quality of Service
- Queues Management
- How To Configure Lossless RoCE
- Port Mirroring
- ACLs
- OVS
- Resource Management
- Precision Time Protocol (PTP)
Layer 2
Network Virtualization
Layer 3
- Static Routing
- Virtual Routing and Forwarding (VRF)
- Tunneling
- Multicast Routing
- Virtual Router Redundancy Protocol (VRRP)
Debugging