MC_UNICST(9E) | Driver Entry Points | MC_UNICST(9E) |
mc_unicst
— set
device unicast address
#include
<sys/mac_provider.h>
int
prefix_m_unicst
(void *driver,
const uint8_t *mac);
illumos DDI specific
ETHERADDRL
.The
mc_unicst
()
entry point is used by the MAC framework to indicate that the device driver
should update the primary MAC address of the device. In the basic mode of
operation, this entry point is required and the device has a single primary
MAC address. If multiple MAC addresses are required, the device will be
placed into promiscuous mode. This call should overwrite the existing MAC
address that is programmed into the device.
Device drivers that implement the
MAC_CAPAB_RINGS
capability
must not implement
this interface.
As noted in the PARAMETERS section, the mac array is guaranteed to be at least as many bytes as is required to specify an address; however, it should be assumed to be no longer than that value.
The device driver can optionally assert that the address is in the valid form for a unicast address and then program the device. The device driver can access its device soft state by casting the device pointer to the appropriate structure. As this may be called while other operations are ongoing, the device driver should employ the appropriate locking while updating the data.
It is recommended that device drivers always maintain a copy of the current unicast address in its soft state so that way it can recover from various device reset and errors or handle requests to suspend and resume the device that may result in device registers being cleared.
Some devices support multiple MAC address
filters. The
mc_unicst
()
entry point only supports a single MAC address. In this case, devices should
only use a single MAC address and replace that MAC address. To enable the
operating system to take advantage of multiple unicast MAC address filters,
the driver should implement the MAC_CAPAB_RINGS
capability. See
mac_capab_rings(9E) for more
information.
Upon successful completion, the device driver should have updated its unicast filter and return 0. Otherwise, the MAC address should remain unchanged and the driver should return an appropriate error number.
The device driver may return one of the following errors. While this list is not intended to be exhaustive, it is recommended to use one of these if possible.
mac(9E), mac_capab_rings(9E), mac_register(9F), mac_register(9S)
July 2, 2022 | OmniOS |