|Skip Navigation Links|
|Exit Print View|
|man pages section 9: DDI and DKI Driver Entry Points Oracle Solaris 11.1 Information Library|
- MAC driver entry points
#include <sys/mac_provider.h> #include <sys/mac_ether.h> int prefix_getstat(void *driver_handle, uint_t stat, uint64_t *stat_value);
int prefix_start(void *driver_handle);
void prefix_stop(void *driver_handle);
int prefix_setpromisc(void *driver_handle, boolean_t promisc_mode);
int prefix_multicst(void *driver_handle, boolean_t add, const uint8_t *mcast_addr);
int prefix_unicst(void *driver_handle, const uint8_t *ucast_addr);
mblk_t *prefix_tx(void *driver_handle, mblk_t *mp_chain);
void prefix_ioctl(void *driver_handle, queue_t *q, mblk_t *mp);
boolean_t prefix_getcapab(void *driver_handle, mac_capab_t cap, void *cap_data);
int prefix_setprop(void *driver_handle, const char *prop_name, mac_prop_id_t prop_id, uint_t prop_val_size, const void *prop_val);
int prefix_getprop(void *driver_handle, const char *prop_name, mac_prop_id_t prop_id, uint_t prop_val_size, void *prop_val);
void prefix_propinfo(void *driver_handle, const char *prop_name, mac_prop_id_t prop_id, mac_prop_info_handle_t prop_handle);
pointer to the driver-private handle that was specified by the device driver through the m_driver field of the mac_register(9S) structure during registration.
statistic being queried
value of statistic being queried
promiscuous mode to be set
whether to add or delete the multicast address
value of the multicast address to add or remove
value of the unicast address to set
STREAMS queue for ioctl operation
message block for ioctl operation
chain of message blocks to be sent
capability type, MAC_CAPAB_HCKSUM or MAC_CAPAB_LSO
pointer to capability data. The type of data depends on the capability type specified by cap.
name of a driver-private property
property value size, in bytes
pointer to a property value
property query flags
Solaris architecture specific (Solaris DDI)
The entry points described below are implemented by a MAC device driver and passed to the MAC layer through the mac_register structure as part of the registration process using mac_register(9F).
The mc_getstat() entry point returns through the 64 bit unsigned integer pointed to by stat_value the value of the statistic specified by the stat argument. Supported statistics are listed in the Statistics section below. The device driver mc_getstat() entry point should return 0 if the statistics is successfully passed back to the caller, or ENOTSUP if the statistic is not supported by the device driver.
The mc_start() entry point starts the device driver instance specified by driver_handle.
The mc_stop() entry point stops the device driver instance specified by driver_handle. The MAC layer will invoke the stop entry point before the device is detached.
The mc_setpromisc() entry point is used to change the promiscuous mode of the device driver instance specified by driver_handle. Promiscuous mode should be turned on if the promisc_mode is set to B_TRUE and off if the promisc_mode is set to B_FALSE.
The mc_multicst() entry point adds or remove the multicast address pointed to by mcast_addr to or from the device instance specified by driver_handle.
The mc_unicst() entry point sets the primary unicast address of the device instance specified by driver_handle to the value specified by ucast_addr. The device must start passing back through mac_rx() the packets with a destination MAC address which matches the new unicast address.
The mc_tx() entry point is used to transmit the message block on the device driver instance specified by driver_instance. If the message block could not be submitted to the hardware for processing, the entry point returns NULL. If the hardware resources were exhausted, the entry point returns the message block that could not be sent. In that case, the driver is responsible for invoking the mac_tx_update(9F) entry point when more hardware transmit resources are available to resume transmission. The driver is responsible for freeing the message block once the packet has been consumed by the hardware.
The mc_ioctl() entry point is a generic facility which can be used to pass arbitrary ioctl to a driver from STREAMs clients. This facility is intended to be used only for debugging purpose only. The STREAMs M_IOCTL messages can be generated by a user-space application and passed done to the device libdlpi(3LIB).
The mc_getcapab() entry point queries a specific capability from the driver. The cap argument specifies the type of capability being queried, and cap_data is used by the driver to return the capability data to the framework, if any. It the driver does not support the capability specified by the framework, it must return B_FALSE, otherwise the driver must return B_TRUE. The following capabilities are supported:
The cap_data argument points to a uint32_t location. The driver must return in cap_data a combination of one of the following flags:
Partial 1's complement checksum ability.
Full 1's complement checksum ability for IPv4 packets.
Full 1's complement checksum ability for IPv6 packets.
IPv4 Header checksum offload capability.
These flags indicate the level of hardware checksum offload that the driver is capable of performing for outbound packets.
When hardware checksumming is enabled, the driver must use the mac_hcksum_get(9F) function to retrieve the per-packet hardware checksumming metadata.
The cap_data argument points to a mac_capab_lso_t structure which describes the LSO capabilities of the driver, and is described in detail in mac_capab_lso(9S).
The cap_data argument points to a mac_capab_rings_t structure that describes the hardware transmit and receive rings (DMA channels) capabilities of the driver. This information allows the framework to schedule the traffic arriving from receive rings, associate MAC addresses with receive rings, group receive rings, and fan out outbound traffic to multiple transmit rings. See mac_capab_rings(9S) for more information.
The mc_setprop() and mc_getprop() entry points set and get, respectively, the value of a property for the device driver instance specified by driver_handle. The property is specified by the prop_id argument, and is one of the properties identifier listed in section Properties below. The value of the property is stored in a buffer at prop_val, and the size of that buffer is specified by prop_val_size. The MAC layer ensures that the buffer is large enough to store the property specified by prop_id. The type of each property is listed in the Properties section below.
The mc_propinfo() entry point returns immutable attributes of a property for the device driver instance specified by driver_handle. The property is specified by the prop_id argument, and is one of the properties identifier listed in section Properties below. The entry point invokes the mac_prop_info_set_perm(), mac_prop_info_set_default(), or mac_prop_info_set_range() functions to associate specific attributes of the property being queried. The opaque property handle passed to the mc_propinfo() entry point must be passed as-is to these routines.
In addition to the properties listed in the Properties section below, drivers can also expose driver-private properties. These properties are identified by property names strings. Private property names always start with an underscore (_) character and must be no longer than 256 characters, including a null-terminating character. Driver-private properties supported by a device driver are specified by the m_priv_props field of the mac_register data structure. During a call to mc_setprop(), mc_getprop(), or mc_propinfo(), a private property is specified by a property id of MAC_PROP_PRIVATE, and the driver property name is passed through the prop_name argument. Private property values are always specified by a string. The driver is responsible to encode and parse private properties value strings.
The mc_getstat() entry point returns 0 on success, or ENOTSUP if the specific statistic is not supported by the device driver.
The mc_start(), mc_setpromisc(), mc_multicst(), and mc_unicst() entry points return 0 on success and one of the error values specified by Intro(2) on failure.
The mc_getcapab() entry point returns B_TRUE if the capability is supported by the device driver, B_FALSE otherwise.
The mc_tx() entry point returns NULL if all packets could be posted on the hardware to be sent. The entry point returns a chain of unsent message blocks if the transmit resources were exhausted.
The mc_setprop() and mc_getprop() entry points return 0 on success, ENOTSUP if the property is not supported by the device driver, or an error value specified by Intro(2) for other failures.
The mc_tx() entry point can be called from interrupt context. The other entry points can be called from user or kernel context.
The stat argument value of the mc_getstat() entry point is used by the framework to specify the specific statistic being queried. The following statistics are supported by all media types:
MIB-II stats (RFC 1213 and RFC 1573):
MAC_STAT_IFSPEED MAC_STAT_MULTIRCV MAC_STAT_BRDCSTRCV MAC_STAT_MULTIXMT MAC_STAT_BRDCSTXMT MAC_STAT_NORCVBUF MAC_STAT_IERRORS MAC_STAT_UNKNOWNS MAC_STAT_NOXMTBUF MAC_STAT_OERRORS MAC_STAT_COLLISIONS MAC_STAT_RBYTES MAC_STAT_IPACKETS MAC_STAT_OBYTES MAC_STAT_OPACKETS MAC_STAT_UNDERFLOWS MAC_STAT_OVERFLOWS
The following statistics are specific to Ethernet device drivers:
RFC 1643 stats:
ETHER_STAT_ALIGN_ERRORS ETHER_STAT_FCS_ERRORS ETHER_STAT_FIRST_COLLISIONS ETHER_STAT_MULTI_COLLISIONS ETHER_STAT_SQE_ERRORS ETHER_STAT_DEFER_XMTS ETHER_STAT_TX_LATE_COLLISIONS ETHER_STAT_EX_COLLISIONS ETHER_STAT_MACXMT_ERRORS ETHER_STAT_CARRIER_ERRORS ETHER_STAT_TOOLONG_ERRORS ETHER_STAT_MACRCV_ERRORS
ETHER_STAT_XCVR_ADDR ETHER_STAT_XCVR_ID ETHER_STAT_XCVR_INUSE ETHER_STAT_CAP_1000FDX ETHER_STAT_CAP_1000HDX ETHER_STAT_CAP_100FDX ETHER_STAT_CAP_100HDX ETHER_STAT_CAP_10FDX ETHER_STAT_CAP_10HDX ETHER_STAT_CAP_ASMPAUSE ETHER_STAT_CAP_PAUSE ETHER_STAT_CAP_AUTONEG ETHER_STAT_ADV_CAP_1000FDX ETHER_STAT_ADV_CAP_1000HDX ETHER_STAT_ADV_CAP_100FDX ETHER_STAT_ADV_CAP_100HDX ETHER_STAT_ADV_CAP_10FDX ETHER_STAT_ADV_CAP_10HDX ETHER_STAT_ADV_CAP_ASMPAUSE ETHER_STAT_ADV_CAP_PAUSE ETHER_STAT_ADV_CAP_AUTONEG ETHER_STAT_LP_CAP_1000FDX ETHER_STAT_LP_CAP_1000HDX ETHER_STAT_LP_CAP_100FDX ETHER_STAT_LP_CAP_100HDX ETHER_STAT_LP_CAP_10FDX ETHER_STAT_LP_CAP_10HDX ETHER_STAT_LP_CAP_ASMPAUSE ETHER_STAT_LP_CAP_PAUSE ETHER_STAT_LP_CAP_AUTONEG ETHER_STAT_LINK_ASMPAUSE ETHER_STAT_LINK_PAUSE ETHER_STAT_LINK_AUTONEG ETHER_STAT_LINK_DUPLEX
See attributes(5) for descriptions of the following attributes: