MAC_CAPAB_LED(9E) | Driver Entry Points | MAC_CAPAB_LED(9E) |
mac_capab_led
,
mcl_set
— MAC LED
capability
#include
<sys/mac_provider.h>
typedef struct mac_capab_led
mac_capab_led_t;
typedef enum mac_led_mode mac_led_mode_t;
int
mcl_set
(void *driver,
mac_led_mode_t mode, uint_t
flags);
Evolving - This interface is still evolving. API and ABI stability is not guaranteed.
The MAC_CAPAB_LED capability allows GLDv3 device drivers to expose an interface for controlling the LEDs on the device. This allows the system to control the LEDs to assist system administrators in finding and identifying specific physical devices in the system.
Implementing this capability is optional. For more information on how to handle capabilities and how to indicate that a capability is not supported, see mc_getcapab(9E).
This capability should be implemented if the device in question provides a way to manipulate its LEDs. Generally the LEDs on a device default to indicating link status and activity. However, they can often be turned off or set to a specific pattern for identification purposes.
The system has a notion of different LED modes. Each LED mode suggests a different way that a device driver should drive the indicator LEDs on the device. While we generally want all such LED modes to be as uniform as possible, there is a limit to such similarities due to the capabilities of NICs. Each mode is a member of the mac_led_mode_t enumeration. The currently defined modes are:
MAC_LED_DEFAULT
MAC_LED_OFF
MAC_LED_ON
MAC_LED_IDENT
When the device driver's
mc_getcapab(9E) function entry
point is called with the capability set to
MAC_CAPAB_LED
, then the value of the capability
structure is the following structure:
typedef struct mac_capab_led { uint_t mcl_flags; mac_led_mode_t mcl_modes; int (*mcl_set)(void *driver, mac_led_mode_t mode, uint_t flags); } mac_capab_led_t;
If the driver supports the MAC_CAPAB_LED
capability, it should fill in this structure, based on the following
rules:
If the driver does not support anything other than the default
behavior of MAC_LED_DEFAULT
, then the device
driver should not indicate that it supports this capability.
The driver should first validate that
mode is a mode that it supports. While the device
reports the set of supported modes as a bitwise-inclusive-OR, the driver
should only receive a single value in mode. The
value of the flags argument is reserved for future
use. Drivers must check that the value of flags is zero and if not,
return EINVAL
.
When this entry point is first called on a driver, it should snapshot its device registers such that it knows how to restore the default behavior. Because each method of programming the LEDs is different, it is up to the driver itself to take care of this, the broader framework cannot take care of it.
If for some reason the driver is asked to program the same mode that it is already driving, then it need not do anything and should simply return success.
Once the driver successfully changes the LED driving mode, it should return 0. Otherwise, it should return the appropriate error number. For a full list of error numbers, see Intro(2). Common values are:
EINVAL
ENOTSUP
EIO
The broader framework will guarantee that only a single call to the mcl_set function is ongoing at any time. If other parts of the driver refer to the data used by the mcl_set function, then the driver must ensure that it is performing sufficient locking of its data.
The mcl_set entry point will only be called from user or kernel context. It will never be called from interrupt context.
February 21, 2017 | OmniOS |