2 .\" This file and its contents are supplied under the terms of the
3 .\" Common Development and Distribution License ("CDDL"), version 1.0.
4 .\" You may only use this file in accordance with the terms of version
7 .\" A full copy of the text of the CDDL should have accompanied this
8 .\" source. A copy of the CDDL is also available via the Internet at
9 .\" http://www.illumos.org/license/CDDL.
12 .\" Copyright 2016 Joyent, Inc.
20 .Nd networking device driver entry points structure
22 .In sys/mac_provider.h
28 structure is used by GLDv3 networking device drivers implementing the
32 The structure is normally allocated statically by drivers as a single
33 global entry. A pointer to it is passed as the
39 The following types define the function pointers in use in the
41 .Bd -literal -offset indent
42 typedef int (*mac_getstat_t)(void *, uint_t, uint64_t *);
43 typedef int (*mac_start_t)(void *);
44 typedef void (*mac_stop_t)(void *);
45 typedef int (*mac_setpromisc_t)(void *, boolean_t);
46 typedef int (*mac_multicst_t)(void *, boolean_t, const uint8_t *);
47 typedef int (*mac_unicst_t)(void *, const uint8_t *);
48 typedef void (*mac_ioctl_t)(void *, queue_t *, mblk_t *);
49 typedef void (*mac_resources_t)(void *);
50 typedef mblk_t *(*mac_tx_t)(void *, mblk_t *);
51 typedef boolean_t (*mac_getcapab_t)(void *, mac_capab_t, void *);
52 typedef int (*mac_open_t)(void *);
53 typedef void (*mac_close_t)(void *);
54 typedef int (*mac_set_prop_t)(void *, const char *, mac_prop_id_t,
55 uint_t, const void *);
56 typedef int (*mac_get_prop_t)(void *, const char *, mac_prop_id_t,
58 typedef void (*mac_prop_info_t)(void *, const char *, mac_prop_id_t,
59 mac_prop_info_handle_t);
62 .Bd -literal -offset indent
63 uint_t mc_callbacks; /* Denotes which callbacks are set */
64 mac_getstat_t mc_getstat; /* Get the value of a statistic */
65 mac_start_t mc_start; /* Start the device */
66 mac_stop_t mc_stop; /* Stop the device */
67 mac_setpromisc_t mc_setpromisc; /* Enable or disable promiscuous mode */
68 mac_multicst_t mc_multicst; /* Enable or disable a multicast addr */
69 mac_unicst_t mc_unicst; /* Set the unicast MAC address */
70 mac_tx_t mc_tx; /* Transmit a packet */
71 void *mc_reserved; /* Reserved, do not use */
72 mac_ioctl_t mc_ioctl; /* Process an unknown ioctl */
73 mac_getcapab_t mc_getcapab; /* Get capability information */
74 mac_open_t mc_open; /* Open the device */
75 mac_close_t mc_close; /* Close the device */
76 mac_set_prop_t mc_setprop; /* Set a device property */
77 mac_get_prop_t mc_getprop; /* Get a device property */
78 mac_prop_info_t mc_propinfo; /* Get property information */
83 member is used to denote which of a series of optional callbacks are
84 present. This method allows additional members to be added to the
86 structure while maintaining ABI compatibility with existing modules. If
87 a member is not mentioned below, then it is a part of the base version
88 of the structure and device drivers do not need to set anything to
89 indicate that it is present.
92 member should be set to the bitwise inclusive OR of the following
94 .Bl -tag -width Dv -offset indent
98 structure member has been set.
102 structure member has been set.
106 structure member has been set.
110 structure member has been set.
114 structure member has been set.
118 structure member has been set.
122 structure member has been set.
129 structure members have been set.
134 function defines an entry point used to receive statistics about the
135 device. A list of statistics that it is required to support is available
138 For more information on the requirements of the function, see
143 member defines an entry point that is used to start the device. For more
144 information on the requirements of the function, see
149 member defines an entry point that is used to stop the device. It is the
152 member. For more information on the requirements of the function, see
157 member is used to enable and disable promiscuous mode on the device. For
158 more information on the requirements of the function, see
159 .Xr mc_setpromisc 9E .
163 member is used to enable or disable multicast addresses in the device's
164 filters. For more information on the requirements of the function, see
169 member is used to set the primary unicast MAC address of the device.
170 For more information on the requirements of the function, see
175 member is used to transmit a single message on the wire. For more
176 information on the requirements of the function, see
181 member is used to process device specific ioctls. The GLDv3 does not
182 define any ioctls that devices should handle; however, there may be
183 private ioctls for this device. This entry point is optional. For it to
186 value must be present in the
188 member. For more information on the requirements of the function, see
193 member is used to determine device capabilities. Each capability has its
194 own data and semantics associated with it. A list of capabilities is
197 This entry point is optional. For it to be used, the
199 value must be present in the
201 member. For more information on the requirements of the function, see
206 member is used to provide specific actions to take when the device is
207 opened. Note that most device drivers will not have a need to implement
208 this. It is not required for this function to be implemented for this
209 device to be used with
211 This entry point is optional. For it to be used, the
213 value must be present in the
215 member. For more information on the requirements of the function, see
220 member is used to provide specific actions to take when the device is
221 closed. Note that most device drivers will not have a need to implement
222 this. It is not required for this function to be implemented for this
223 device to be used with
225 This entry point is optional. For it to be used, the
227 value must be present in the
229 member. For more information on the requirements of the function, see
234 member is used to get the current value of a property from the device. A
235 list of properties, their sizes, and their interpretation is available
238 This entry point is optional. For it to be used, the
240 value must be present in the
242 member. For more information on the requirements of the function, see
247 member is used to set the value of a device property. A list of
248 properties, their sizes, and their interpretation is available in
250 This entry point is optional. For it to be used, the
252 value must be present in the
254 member. For more information on the requirements of the function, see
259 member is used to obtain metadata about a property such as its default
260 value, whether or not it is writable, and more. A list of properties,
261 their sizes, and their interpretation is available in
263 This entry point is optional. For it to be used, the
265 value must be present in the
267 member. For more information on the requirements of the function, see
271 Many members in the structure are optional; however, the following
272 members must be set or a call to
275 .Bl -bullet -offset indent
292 Note, that devices which implement the GLDv3 ring capabilities must not
297 functions. However, the ring capabilities are still private and evolving
300 Generally, a device that implements one of
305 will want to implement all three endpoints to ensure that the property
306 is fully integrated into user land utilities such as
320 .Xr mc_setpromisc 9E ,