Driver Entry Points mac(9E) NAME mc_getstat, mc_start, mc_stop, mc_setpromisc, mc_getpromisc, mc_multicst, mc_unicst, mc_tx, mc_ioctl, mc_getcapab -- MAC driver entry points SYNOPSIS #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); INTERFACE LEVEL Solaris architecture specific (Solaris DDI). PARAMETERS driver_handle Pointer to the driver-private handle which was specified by the device driver through the m_driver field of the mac_register(9E) structure during registration. stat Statistic being queried stat_val Value of statistic being queried promisc_mode Promiscuous mode to be set add Whether to add or delete the multicast address mcast_addr Value of the multicast address to add or remove ucast_addr Value of the unicast address to set q STREAMS queue for ioctl operation mp Message block for ioctl operation mp_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 specified by cap. prop_name Name of a driver-private property prop_id Property identifier prop_val_size Property value size, in bytes prop_val Pointer to a property value prop_flags Property query flags prop_perm Property permissions DESCRIPTION The entry points described below are implemented by a MAC device driver and passed to the MAC layer through the mac_callbacks(9S) structure as part of the registration process using mac_register(9E). mc_getstat() 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. mc_start() starts the device driver instance specified by driver_handle. mc_stop() stops the device driver instance specified by driver_handle. The MAC layer will invoke the stop entry point before the device is detached. mc_setpromisc() is used to change the promicuous 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. mc_multicst() adds or remove the multicast address pointed to by mcast_addr to or from the device instance specified by driver_handle. mc_unicst() 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. mc_tx() 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, the driver is responsible to invoke the mac_tx_update() 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 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). mc_getcapab() 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 currently supported: MAC_CAPAB_HCKSUM cap_data 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 packets. HCKSUM_INET_FULL_V6 Full 1's complement checksum ability for IPv6 packets. 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 must use the hcksum_retrieve(9F) function to retrieve the per-packet hardware checksumming meta-data. MAC_CAPAB_LSO cap_data points to a mac_capab_lso_t structure which describes the LSO capabilities of the driver, and is described in details in mac_capab_lso(9S). mc_setprop() and mc_getprop() 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 undercore 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. 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(), mc_unicst() return zero on success, or one of the error values specified by Intro(2) on failure. mc_getcapab() returns B_TRUE if the capability is supported by the device driver, B_FALSE otherwise. mc_tx() returns NULL if all packets could be posted on the hardware to be sent. The entry point returns a chain chain of unsent message blocks if the transmit resources were exhausted. mc_setprop() and mc_getprop() return 0 on succes, 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 context. The other entry points defined by this man page can be called from user or kernel context. STATISTICS 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 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 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 TYPE _______________________________________________________ MAC_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[] ATTRIBUTES See attributes(5) for descriptions of the following attri- butes: ____________________________________________________________ | Attribute TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Availability | SUNWhea | |_____________________________|_____________________________| | Interface Stability | Committed | |_____________________________|_____________________________| SEE ALSO mac_capab_lso(9S), mac_register(9E), libdlpi(3LIB), mac_hcksum_get(9F), attributes(5), mac_register(9S), mac_prop_info_set_perm(9F)