JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 9: DDI and DKI Driver Entry Points
search filter icon
search icon

Document Information

Preface

Introduction

Driver Entry Points

aread(9E)

attach(9E)

awrite(9E)

chpoll(9E)

close(9E)

csx_event_handler(9E)

detach(9E)

devmap(9E)

devmap_access(9E)

devmap_contextmgt(9E)

devmap_dup(9E)

devmap_map(9E)

devmap_unmap(9E)

dump(9E)

_fini(9E)

getinfo(9E)

gld(9E)

gldm_get_stats(9E)

gldm_intr(9E)

gldm_ioctl(9E)

gldm_reset(9E)

gldm_send(9E)

gldm_set_mac_addr(9E)

gldm_set_multicast(9E)

gldm_set_promiscuous(9E)

gldm_start(9E)

gldm_stop(9E)

identify(9E)

_info(9E)

_init(9E)

ioctl(9E)

ks_snapshot(9E)

ks_update(9E)

mac(9E)

mc_getcapab(9E)

mc_getprop(9E)

mc_getstat(9E)

mc_ioctl(9E)

mc_multicst(9E)

mc_propinfo(9E)

mc_setpromisc(9E)

mc_setprop(9E)

mc_start(9E)

mc_stop(9E)

mc_tx(9E)

mc_unicst(9E)

mmap(9E)

open(9E)

power(9E)

print(9E)

probe(9E)

prop_op(9E)

put(9E)

read(9E)

segmap(9E)

srv(9E)

strategy(9E)

tran_abort(9E)

tran_bus_reset(9E)

tran_destroy_pkt(9E)

tran_dmafree(9E)

tran_getcap(9E)

tran_init_pkt(9E)

tran_quiesce(9E)

tran_reset(9E)

tran_reset_notify(9E)

tran_setcap(9E)

tran_start(9E)

tran_sync_pkt(9E)

tran_tgt_free(9E)

tran_tgt_init(9E)

tran_tgt_probe(9E)

tran_unquiesce(9E)

write(9E)

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 points

Synopsis

#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);

Parameters

driver_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.

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

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 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 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(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 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:

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 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 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 structure 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 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.

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 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.

Context

The mc_tx() entry point can be called from interrupt context. The other entry points 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 attributes:

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)