Driver Entry Points mac(9E)
NAME
mac, mc_getstat, mc_start, mc_stop, mc_setpromisc,
mc_multicst, mc_unicst, mc_tx, mc_ioctl, mc_getcapab,
mc_setprop, mc_getprop, mc_propinfo - MAC driver entry
pointsSYNOPSIS
#include
#include
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);
SunOS 5.11 Last change: 26 Mar 2010 1
Driver Entry Points mac(9E)PARAMETERS
driver_handle pointer to the driver-private handle that
was specified by the device driver throughthe m_driver field of the mac_register(9S)
structure during registration. stat statistic being queriedstat_val value of statistic being queried
promisc_mode promiscuous mode to be set
add whether to add or delete the multicast addressmcast_addr value of the multicast address to add or
removeucast_addr value of the unicast address to set
q STREAMS queue for ioctl operation mp message block for ioctl operationmp_chain chain of message blocks to be sent
cap capability type, MAC_CAPAB_HCKSUM or
MAC_CAPAB_LSO
cap_data pointer to capability data. The type of
data depends on the capability type speci-
fied by cap.prop_name name of a driver-private property
prop_id property identifier
SunOS 5.11 Last change: 26 Mar 2010 2
Driver Entry Points mac(9E)prop_val_size property value size, in bytes
prop_val pointer to a property value
prop_flags property query flags
prop_perm property permissions
INTERFACE LEVEL
Solaris architecture specific (Solaris DDI)DESCRIPTION
The entry points described below are implemented by a MAC device driver and passed to the MAC layer through themac_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 statis-
tics are listed in the Statistics section below. The devicedriver 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 prom-
iscuous mode of the device driver instance specified bydriver_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.
SunOS 5.11 Last change: 26 Mar 2010 3
Driver Entry Points mac(9E)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 message blocks,
chained using the b_next pointer, on the device driver
instance specified by driver_instance. If all the message
blocks could be submitted to the hardware for processing, the entry point returns NULL. If the hardware resources were exhausted, the entry point returns a chain containing the message blocks which could not be sent. In that case, thedriver is responsible to invoke the mac_tx_update(9F) entry
point once more hardware transmit resources are available to resume transmission. The driver is responsible to free the message blocks once the packets have 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 fordebugging 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 ofcapability 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 theframework, it must return B_FALSE, otherwise the driver must
return B_TRUE. The following capabilities are supported:
MAC_CAPAB_HCKSUM
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:HCKSUM_INET_PARTIAL
Partial 1's complement checksum ability.HCKSUM_INET_FULL_V4
Full 1's complement checksum ability for IPv4 pack-
ets.SunOS 5.11 Last change: 26 Mar 2010 4
Driver Entry Points mac(9E)HCKSUM_INET_FULL_V6
Full 1's complement checksum ability for IPv6 pack-
ets.HCKSUM_IPHDRCKSUM
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 mustuse the mac_hcksum_get(9F) function to retrieve the
per-packet hardware checksumming metadata.
MAC_CAPAB_LSO
The cap_data argument points to a mac_capab_lso_t struc-
ture which describes the LSO capabilities of the driver,and is described in details in mac_capab_lso(9S).
The mc_setprop() and mc_getprop() entry points set and get,
respectively, the value of a property for the device driverinstance specified by driver_handle. The property is speci-
fied by the prop_id argument, and is one of the properties
identifier listed in section Properties below. The value ofthe 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 pro-
perty 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 bydriver_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 themac_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 pro-
perty handle passed to the mc_propinfo() entry point must be
passed as-is to these routines.
SunOS 5.11 Last change: 26 Mar 2010 5
Driver Entry Points mac(9E)In addition to the properties listed in the Properties sec-
tion below, drivers can also expose driver-private proper-
ties. These properties are identified by property namesstrings. Private property names always start with an under-
score (_) character and must be no longer than 256 charac-
ters, including a null-terminating character. Driver-private
properties supported by a device driver are specified by them_priv_props field of the mac_register data structure. Dur-
ing a call to mc_setprop(), mc_getprop(), or mc_propinfo(),
a private property is specified by a property id ofMAC_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.RETURN VALUES
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 capabil-
ity 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.CONTEXT
The mc_tx() entry point can be called from interrupt con-
text. The other entry points can be called from user or ker-
nel context. STATISTICSThe 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:SunOS 5.11 Last change: 26 Mar 2010 6
Driver Entry Points mac(9E)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
MII/GMII stats:
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
SunOS 5.11 Last change: 26 Mar 2010 7
Driver Entry Points mac(9E)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
PROPERTIES Property Property TypeMAC_PROP_DUPLEX link_duplex_t
MAC_PROP_SPEED uint64_t
MAC_PROP_STATUS link_state_t
MAC_PROP_AUTONEG uint8_t
MAC_PROP_MTU uint32_t
MAC_PROP_FLOWCTRL link_flowctrl_t
MAC_PROP_ADV_10GFDX_CAP uint8_t
MAC_PROP_EN_10GFDX_CAP uint8_t
MAC_PROP_ADV_1000FDX_CAP uint8_t
MAC_PROP_EN_1000FDX_CAP uint8_t
MAC_PROP_ADV_1000HDX_CAP uint8_t
MAC_PROP_EN_1000HDX_CAP uint8_t
MAC_PROP_ADV_100FDX_CAP uint8_t
MAC_PROP_EN_100FDX_CAP uint8_t
MAC_PROP_ADV_100HDX_CAP uint8_t
MAC_PROP_EN_100HDX_CAP uint8_t
MAC_PROP_ADV_10FDX_CAP uint8_t
MAC_PROP_EN_10FDX_CAP uint8_t
MAC_PROP_ADV_10HDX_CAP uint8_t
MAC_PROP_EN_10HDX_CAP uint8_t
MAC_PROP_PRIVATE char[]
SunOS 5.11 Last change: 26 Mar 2010 8
Driver Entry Points mac(9E)ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Availability | SUNWhea ||_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
SEE ALSO
libdlpi(3LIB), attributes(5), mac_hcksum_get(9F),
mac_prop_info_set_perm(9F), mac_register(9F),
mac_tx_update(9F), mac_capab_lso(9S), mac_register(9S)
SunOS 5.11 Last change: 26 Mar 2010 9