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
34 A pointer to it is passed as the
40 The following types define the function pointers in use in the
42 .Bd -literal -offset indent
43 typedef int (*mac_getstat_t)(void *, uint_t, uint64_t *);
44 typedef int (*mac_start_t)(void *);
45 typedef void (*mac_stop_t)(void *);
46 typedef int (*mac_setpromisc_t)(void *, boolean_t);
47 typedef int (*mac_multicst_t)(void *, boolean_t, const uint8_t *);
48 typedef int (*mac_unicst_t)(void *, const uint8_t *);
49 typedef void (*mac_ioctl_t)(void *, queue_t *, mblk_t *);
50 typedef void (*mac_resources_t)(void *);
51 typedef mblk_t *(*mac_tx_t)(void *, mblk_t *);
52 typedef boolean_t (*mac_getcapab_t)(void *, mac_capab_t, void *);
53 typedef int (*mac_open_t)(void *);
54 typedef void (*mac_close_t)(void *);
55 typedef int (*mac_set_prop_t)(void *, const char *, mac_prop_id_t,
56 uint_t, const void *);
57 typedef int (*mac_get_prop_t)(void *, const char *, mac_prop_id_t,
59 typedef void (*mac_prop_info_t)(void *, const char *, mac_prop_id_t,
60 mac_prop_info_handle_t);
63 .Bd -literal -offset indent
64 uint_t mc_callbacks; /* Denotes which callbacks are set */
65 mac_getstat_t mc_getstat; /* Get the value of a statistic */
66 mac_start_t mc_start; /* Start the device */
67 mac_stop_t mc_stop; /* Stop the device */
68 mac_setpromisc_t mc_setpromisc; /* Enable or disable promiscuous mode */
69 mac_multicst_t mc_multicst; /* Enable or disable a multicast addr */
70 mac_unicst_t mc_unicst; /* Set the unicast MAC address */
71 mac_tx_t mc_tx; /* Transmit a packet */
72 void *mc_reserved; /* Reserved, do not use */
73 mac_ioctl_t mc_ioctl; /* Process an unknown ioctl */
74 mac_getcapab_t mc_getcapab; /* Get capability information */
75 mac_open_t mc_open; /* Open the device */
76 mac_close_t mc_close; /* Close the device */
77 mac_set_prop_t mc_setprop; /* Set a device property */
78 mac_get_prop_t mc_getprop; /* Get a device property */
79 mac_prop_info_t mc_propinfo; /* Get property information */
84 member is used to denote which of a series of optional callbacks are
86 This method allows additional members to be added to the
88 structure while maintaining ABI compatibility with existing modules.
89 If a member is not mentioned below, then it is a part of the base version
90 of the structure and device drivers do not need to set anything to
91 indicate that it is present.
94 member should be set to the bitwise inclusive OR of the following
96 .Bl -tag -width Dv -offset indent
100 structure member has been set.
104 structure member has been set.
108 structure member has been set.
112 structure member has been set.
116 structure member has been set.
120 structure member has been set.
124 structure member has been set.
131 structure members have been set.
136 function defines an entry point used to receive statistics about the
138 A list of statistics that it is required to support is available in
140 For more information on the requirements of the function, see
145 member defines an entry point that is used to start the device.
146 For more information on the requirements of the function, see
151 member defines an entry point that is used to stop the device.
152 It is the opposite of the
155 For more information on the requirements of the function, see
160 member is used to enable and disable promiscuous mode on the device.
161 For more information on the requirements of the function, see
162 .Xr mc_setpromisc 9E .
166 member is used to enable or disable multicast addresses in the device's
168 For more information on the requirements of the function, see
173 member is used to set the primary unicast MAC address of the device.
174 For more information on the requirements of the function, see
179 member is used to transmit a single message on the wire.
180 For more information on the requirements of the function, see
185 member is used to process device specific ioctls.
186 The GLDv3 does not define any ioctls that devices should handle; however, there
187 may be private ioctls for this device.
188 This entry point is optional.
189 For it to be considered, the
191 value must be present in the
194 For more information on the requirements of the function, see
199 member is used to determine device capabilities.
200 Each capability has its own data and semantics associated with it.
201 A list of capabilities is provided in
203 This entry point is optional.
204 For it to be used, the
206 value must be present in the
209 For more information on the requirements of the function, see
214 member is used to provide specific actions to take when the device is
216 Note that most device drivers will not have a need to implement this.
217 It is not required for this function to be implemented for this device to be
220 This entry point is optional.
221 For it to be used, the
223 value must be present in the
226 For more information on the requirements of the function, see
231 member is used to provide specific actions to take when the device is
233 Note that most device drivers will not have a need to implement this.
234 It is not required for this function to be implemented for this device to be
237 This entry point is optional.
238 For it to be used, the
240 value must be present in the
243 For more information on the requirements of the function, see
248 member is used to get the current value of a property from the device.
249 A list of properties, their sizes, and their interpretation is available in
251 This entry point is optional.
252 For it to be used, the
254 value must be present in the
257 For more information on the requirements of the function, see
262 member is used to set the value of a device property.
263 A list of properties, their sizes, and their interpretation is available in
265 This entry point is optional.
266 For it to be used, the
268 value must be present in the
271 For more information on the requirements of the function, see
276 member is used to obtain metadata about a property such as its default
277 value, whether or not it is writable, and more.
278 A list of properties, their sizes, and their interpretation is available in
280 This entry point is optional.
281 For it to be used, the
283 value must be present in the
286 For more information on the requirements of the function, see
290 Many members in the structure are optional; however, the following
291 members must be set or a call to
294 .Bl -bullet -offset indent
311 Note, that devices which implement the GLDv3 ring capabilities must not
317 However, the ring capabilities are still private and evolving at this time.
319 Generally, a device that implements one of
324 will want to implement all three endpoints to ensure that the property
325 is fully integrated into user land utilities such as
339 .Xr mc_setpromisc 9E ,