Print this page
11493 aggr needs support for multiple pseudo rx groups
Portions contributed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/mac_provider.h
+++ new/usr/src/uts/common/sys/mac_provider.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 * Copyright (c) 2018, Joyent, Inc.
25 25 */
26 26
27 27 #ifndef _SYS_MAC_PROVIDER_H
28 28 #define _SYS_MAC_PROVIDER_H
29 29
30 30 #include <sys/types.h>
31 31 #include <sys/ddi.h>
32 32 #include <sys/sunddi.h>
33 33 #include <sys/stream.h>
34 34 #include <sys/mkdev.h>
35 35 #include <sys/mac.h>
36 36 #include <sys/mac_flow.h>
37 37
38 38 /*
39 39 * MAC Provider Interface
40 40 */
41 41
42 42 #ifdef __cplusplus
43 43 extern "C" {
44 44 #endif
45 45
46 46 /*
47 47 * MAC version identifiers. Drivers compiled against the stable V1 version
48 48 * of the API should register with MAC_VERSION_V1. ON drivers should use
49 49 * MAC_VERSION. This is used by mac_alloc() mac_register() to
50 50 * verify that incompatible drivers don't register.
51 51 */
52 52 #define MAC_VERSION_V1 0x1
53 53 #define MAC_VERSION MAC_VERSION_V1
54 54
55 55 /*
56 56 * Possible values for ETHER_STAT_XCVR_INUSE statistic.
57 57 */
58 58
59 59 #define XCVR_UNDEFINED 0
60 60 #define XCVR_NONE 1
61 61 #define XCVR_10 2
62 62 #define XCVR_100T4 3
63 63 #define XCVR_100X 4
64 64 #define XCVR_100T2 5
65 65 #define XCVR_1000X 6
66 66 #define XCVR_1000T 7
67 67
68 68 #ifdef _KERNEL
69 69
70 70 /*
71 71 * Definitions for MAC Drivers Capabilities
72 72 */
73 73 /*
74 74 * MAC layer capabilities. These capabilities are handled by the drivers'
75 75 * mc_capab_get() callbacks. Some capabilities require the driver to fill
76 76 * in a given data structure, and others are simply boolean capabilities.
77 77 * Note that capability values must be powers of 2 so that consumers and
78 78 * providers of this interface can keep track of which capabilities they
79 79 * care about by keeping a bitfield of these things around somewhere.
80 80 */
81 81 typedef enum {
82 82 /*
83 83 * Public Capabilities (MAC_VERSION_V1)
84 84 */
85 85 MAC_CAPAB_HCKSUM = 0x00000001, /* data is a uint32_t */
86 86 MAC_CAPAB_LSO = 0x00000008, /* data is mac_capab_lso_t */
87 87
88 88 /*
89 89 * Reserved capabilities, do not use
90 90 */
91 91 MAC_CAPAB_RESERVED1 = 0x00000002,
92 92 MAC_CAPAB_RESERVED2 = 0x00000004,
93 93
94 94 /*
95 95 * Private driver capabilities
96 96 */
97 97 MAC_CAPAB_RINGS = 0x00000010, /* data is mac_capab_rings_t */
98 98 MAC_CAPAB_SHARES = 0x00000020, /* data is mac_capab_share_t */
99 99 MAC_CAPAB_MULTIFACTADDR = 0x00000040, /* mac_data_multifactaddr_t */
100 100
101 101 /*
102 102 * Private driver capabilities for use by the GLDv3 framework only
103 103 */
104 104 MAC_CAPAB_VNIC = 0x00010000, /* data is mac_capab_vnic_t */
105 105 MAC_CAPAB_ANCHOR_VNIC = 0x00020000, /* boolean only, no data */
106 106 MAC_CAPAB_AGGR = 0x00040000, /* data is mac_capab_aggr_t */
107 107 MAC_CAPAB_NO_NATIVEVLAN = 0x00080000, /* boolean only, no data */
108 108 MAC_CAPAB_NO_ZCOPY = 0x00100000, /* boolean only, no data */
109 109 MAC_CAPAB_LEGACY = 0x00200000, /* data is mac_capab_legacy_t */
110 110 MAC_CAPAB_VRRP = 0x00400000, /* data is mac_capab_vrrp_t */
111 111 MAC_CAPAB_TRANSCEIVER = 0x01000000, /* mac_capab_transciever_t */
112 112 MAC_CAPAB_LED = 0x02000000 /* data is mac_capab_led_t */
113 113 } mac_capab_t;
114 114
115 115 /*
116 116 * LSO capability
117 117 */
118 118 typedef struct lso_basic_tcp_ipv4_s {
119 119 t_uscalar_t lso_max; /* maximum payload */
120 120 } lso_basic_tcp_ipv4_t;
121 121
122 122 /*
123 123 * Currently supported flags for LSO.
124 124 */
125 125 #define LSO_TX_BASIC_TCP_IPV4 0x01 /* TCP LSO capability */
126 126
127 127 /*
128 128 * Future LSO capabilities can be added at the end of the mac_capab_lso_t.
129 129 * When such capability is added to the GLDv3 framework, the size of the
130 130 * mac_capab_lso_t it allocates and passes to the drivers increases. Older
131 131 * drivers wil access only the (upper) sections of that structure, that is the
132 132 * sections carrying the capabilities they understand. This ensures the
133 133 * interface can be safely extended in a binary compatible way.
134 134 */
135 135 typedef struct mac_capab_lso_s {
136 136 t_uscalar_t lso_flags;
137 137 lso_basic_tcp_ipv4_t lso_basic_tcp_ipv4;
138 138 /* Add future lso capabilities here */
139 139 } mac_capab_lso_t;
140 140
141 141 /*
142 142 * Multiple Factory MAC Addresses Capability
143 143 */
144 144 typedef struct mac_capab_multifactaddr_s {
145 145 /*
146 146 * Number of factory addresses
147 147 */
148 148 uint_t mcm_naddr;
149 149
150 150 /*
151 151 * Callbacks to query all the factory addresses.
152 152 */
153 153 void (*mcm_getaddr)(void *, uint_t, uint8_t *);
154 154 } mac_capab_multifactaddr_t;
155 155
156 156 /*
157 157 * Info and callbacks of legacy devices.
158 158 */
159 159 typedef struct mac_capab_legacy_s {
160 160 /*
161 161 * Notifications that the legacy device does not support.
162 162 */
163 163 uint32_t ml_unsup_note;
164 164 /*
165 165 * dev_t of the legacy device; can be held to force attach.
166 166 */
167 167 dev_t ml_dev;
168 168 boolean_t (*ml_active_set)(void *);
169 169 void (*ml_active_clear)(void *);
170 170 int (*ml_fastpath_disable)(void *);
171 171 void (*ml_fastpath_enable)(void *);
172 172 } mac_capab_legacy_t;
173 173
174 174 typedef struct __mac_prop_info_handle *mac_prop_info_handle_t;
175 175
176 176 /*
177 177 * MAC driver entry point types.
178 178 */
179 179 typedef int (*mac_getstat_t)(void *, uint_t, uint64_t *);
180 180 typedef int (*mac_start_t)(void *);
181 181 typedef void (*mac_stop_t)(void *);
182 182 typedef int (*mac_setpromisc_t)(void *, boolean_t);
183 183 typedef int (*mac_multicst_t)(void *, boolean_t, const uint8_t *);
184 184 typedef int (*mac_unicst_t)(void *, const uint8_t *);
185 185 typedef void (*mac_ioctl_t)(void *, queue_t *, mblk_t *);
186 186 typedef void (*mac_resources_t)(void *);
187 187 typedef mblk_t *(*mac_tx_t)(void *, mblk_t *);
188 188 typedef boolean_t (*mac_getcapab_t)(void *, mac_capab_t, void *);
189 189 typedef int (*mac_open_t)(void *);
190 190 typedef void (*mac_close_t)(void *);
191 191 typedef int (*mac_set_prop_t)(void *, const char *, mac_prop_id_t,
192 192 uint_t, const void *);
193 193 typedef int (*mac_get_prop_t)(void *, const char *, mac_prop_id_t,
194 194 uint_t, void *);
195 195 typedef void (*mac_prop_info_t)(void *, const char *, mac_prop_id_t,
196 196 mac_prop_info_handle_t);
197 197
198 198 /*
199 199 * Driver callbacks. The following capabilities are optional, and if
200 200 * implemented by the driver, must have a corresponding MC_ flag set
201 201 * in the mc_callbacks field.
202 202 *
203 203 * Any future additions to this list must also be accompanied by an
204 204 * associated mc_callbacks flag so that the framework can grow without
205 205 * affecting the binary compatibility of the interface.
206 206 */
207 207 typedef struct mac_callbacks_s {
208 208 uint_t mc_callbacks; /* Denotes which callbacks are set */
209 209 mac_getstat_t mc_getstat; /* Get the value of a statistic */
210 210 mac_start_t mc_start; /* Start the device */
211 211 mac_stop_t mc_stop; /* Stop the device */
212 212 mac_setpromisc_t mc_setpromisc; /* Enable or disable promiscuous mode */
213 213 mac_multicst_t mc_multicst; /* Enable or disable a multicast addr */
214 214 mac_unicst_t mc_unicst; /* Set the unicast MAC address */
215 215 mac_tx_t mc_tx; /* Transmit a packet */
216 216 void *mc_reserved; /* Reserved, do not use */
217 217 mac_ioctl_t mc_ioctl; /* Process an unknown ioctl */
218 218 mac_getcapab_t mc_getcapab; /* Get capability information */
219 219 mac_open_t mc_open; /* Open the device */
220 220 mac_close_t mc_close; /* Close the device */
221 221 mac_set_prop_t mc_setprop;
222 222 mac_get_prop_t mc_getprop;
223 223 mac_prop_info_t mc_propinfo;
224 224 } mac_callbacks_t;
225 225
226 226 /*
227 227 * Flags for mc_callbacks. Requiring drivers to set the flags associated
228 228 * with optional callbacks initialized in the structure allows the mac
229 229 * module to add optional callbacks in the future without requiring drivers
230 230 * to recompile.
231 231 */
232 232 #define MC_RESERVED 0x0001
233 233 #define MC_IOCTL 0x0002
234 234 #define MC_GETCAPAB 0x0004
↓ open down ↓ |
234 lines elided |
↑ open up ↑ |
235 235 #define MC_OPEN 0x0008
236 236 #define MC_CLOSE 0x0010
237 237 #define MC_SETPROP 0x0020
238 238 #define MC_GETPROP 0x0040
239 239 #define MC_PROPINFO 0x0080
240 240 #define MC_PROPERTIES (MC_SETPROP | MC_GETPROP | MC_PROPINFO)
241 241
242 242 /*
243 243 * Virtualization Capabilities
244 244 */
245 +
245 246 /*
246 - * The ordering of entries below is important. MAC_HW_CLASSIFIER
247 - * is the cutoff below which are entries which don't depend on
248 - * H/W. MAC_HW_CLASSIFIER and entries after that are cases where
249 - * H/W has been updated through add/modify/delete APIs.
247 + * The type of ring classification. This is used by MAC to determine
248 + * what, if any, processing it has to do upon receiving traffic on a
249 + * particular Rx ring.
250 + *
251 + * MAC_NO_CLASSIFIER
252 + *
253 + * No classification has been set. No traffic should cross an Rx
254 + * ring in this state.
255 + *
256 + * MAC_SW_CLASSIFIER
257 + *
258 + * The driver delivers traffic for multiple clients to this ring.
259 + * All traffic must be software classified by MAC to guarantee
260 + * delivery to the correct client. This classification type may
261 + * be chosen for several reasons.
262 + *
263 + * o The driver provides only one group and there are multiple
264 + * clients using the MAC.
265 + *
266 + * o The driver provides some hardware filtering but not enough
267 + * to fully classify the traffic. E.g., a VLAN VNIC requires L2
268 + * unicast address filtering as well as VLAN filtering, but
269 + * some drivers may only support the former.
270 + *
271 + * o The ring belongs to the default group. The default group
272 + * acts as a spillover for all clients that can't reserve an
273 + * exclusive group. It also handles multicast traffic for all
274 + * clients. For these reasons, the default group's rings are
275 + * always software classified.
276 + *
277 + * MAC_HW_CLASSIFIER
278 + *
279 + * The driver delivers traffic for a single MAC client across
280 + * this ring. With this guarantee, MAC can simply pass the
281 + * traffic up the stack or even allow polling of the ring.
282 + *
283 + * MAC_PASSTHRU_CLASSIFIER
284 + *
285 + * The ring is in "passthru" mode. In this mode we bypass all of
286 + * the typical MAC processing and pass the traffic directly to
287 + * the mr_pt_fn callback, see mac_rx_common(). This is used in
288 + * cases where there is another module acting as MAC provider on
289 + * behalf of the driver. E.g., link aggregations use this mode to
290 + * take full control of the port's rings; allowing it to enforce
291 + * LACP protocols and aggregate rings across discrete drivers.
250 292 */
251 293 typedef enum {
252 294 MAC_NO_CLASSIFIER = 0,
253 295 MAC_SW_CLASSIFIER,
254 - MAC_HW_CLASSIFIER
296 + MAC_HW_CLASSIFIER,
297 + MAC_PASSTHRU_CLASSIFIER
255 298 } mac_classify_type_t;
256 299
257 300 typedef void (*mac_rx_func_t)(void *, mac_resource_handle_t, mblk_t *,
258 301 boolean_t);
259 302
260 303 /*
261 304 * The virtualization level conveys the extent of the NIC hardware assistance
262 305 * for traffic steering employed for virtualization:
263 306 *
264 307 * MAC_VIRT_NONE: No assist for v12n.
265 308 *
266 309 * MAC_VIRT_LEVEL1: Multiple Rx rings with MAC address level
267 310 * classification between groups of rings.
268 311 * Requires the support of the MAC_CAPAB_RINGS
269 312 * capability.
270 313 *
271 314 * MAC_VIRT_HIO: Hybrid I/O capable MAC. Require the support
272 315 * of the MAC_CAPAB_SHARES capability.
273 316 */
274 317 #define MAC_VIRT_NONE 0x0
275 318 #define MAC_VIRT_LEVEL1 0x1
276 319 #define MAC_VIRT_HIO 0x2
277 320
278 321 typedef enum {
279 322 MAC_RING_TYPE_RX = 1, /* Receive ring */
280 323 MAC_RING_TYPE_TX /* Transmit ring */
281 324 } mac_ring_type_t;
282 325
283 326 /*
284 327 * The value VLAN_ID_NONE (VID 0) means a client does not have
285 328 * membership to any VLAN. However, this statement is true for both
286 329 * untagged packets and priority tagged packets leading to confusion
287 330 * over what semantic is intended. To the provider, VID 0 is a valid
288 331 * VID when priority tagging is in play. To MAC and everything above
289 332 * VLAN_ID_NONE almost universally implies untagged traffic. Thus, we
290 333 * convert VLAN_ID_NONE to a sentinel value (MAC_VLAN_UNTAGGED) at the
291 334 * border between MAC and MAC provider. This informs the provider that
292 335 * the client is interested in untagged traffic and the provider
293 336 * should set any relevant bits to receive such traffic.
294 337 *
295 338 * Currently, the API between MAC and the provider passes the VID as a
296 339 * unit16_t. In the future this could actually be the entire TCI mask
297 340 * (PCP, DEI, and VID). This current scheme is safe in that potential
298 341 * future world as well; as 0xFFFF is not a valid TCI (the 0xFFF VID
299 342 * is reserved and never transmitted across networks).
300 343 */
301 344 #define MAC_VLAN_UNTAGGED UINT16_MAX
302 345 #define MAC_VLAN_UNTAGGED_VID(vid) \
303 346 (((vid) == VLAN_ID_NONE) ? MAC_VLAN_UNTAGGED : (vid))
304 347
305 348 /*
306 349 * Grouping type of a ring group
307 350 *
308 351 * MAC_GROUP_TYPE_STATIC: The ring group can not be re-grouped.
309 352 * MAC_GROUP_TYPE_DYNAMIC: The ring group support dynamic re-grouping
310 353 */
311 354 typedef enum {
312 355 MAC_GROUP_TYPE_STATIC = 1, /* Static ring group */
313 356 MAC_GROUP_TYPE_DYNAMIC /* Dynamic ring group */
314 357 } mac_group_type_t;
315 358
316 359 typedef struct __mac_ring_driver *mac_ring_driver_t;
317 360 typedef struct __mac_group_driver *mac_group_driver_t;
318 361
319 362 typedef struct mac_ring_info_s mac_ring_info_t;
320 363 typedef struct mac_group_info_s mac_group_info_t;
321 364
322 365 typedef void (*mac_get_ring_t)(void *, mac_ring_type_t, const int, const int,
323 366 mac_ring_info_t *, mac_ring_handle_t);
324 367 typedef void (*mac_get_group_t)(void *, mac_ring_type_t, const int,
325 368 mac_group_info_t *, mac_group_handle_t);
326 369
327 370 typedef void (*mac_group_add_ring_t)(mac_group_driver_t,
328 371 mac_ring_driver_t, mac_ring_type_t);
329 372 typedef void (*mac_group_rem_ring_t)(mac_group_driver_t,
330 373 mac_ring_driver_t, mac_ring_type_t);
331 374
332 375 /*
333 376 * Multiple Rings Capability
334 377 */
335 378 typedef struct mac_capab_rings_s {
336 379 mac_ring_type_t mr_type; /* Ring type: Rx vs Tx */
337 380 mac_group_type_t mr_group_type; /* Dynamic vs static grouping */
338 381 uint_t mr_rnum; /* Number of rings */
339 382 uint_t mr_gnum; /* Number of ring groups */
340 383 mac_get_ring_t mr_rget; /* Get ring from driver */
341 384 mac_get_group_t mr_gget; /* Get ring group from driver */
342 385 mac_group_add_ring_t mr_gaddring; /* Add ring into a group */
343 386 mac_group_rem_ring_t mr_gremring; /* Remove ring from a group */
344 387 } mac_capab_rings_t;
345 388
346 389 /*
347 390 * Common ring functions and driver interfaces
348 391 */
349 392 typedef int (*mac_ring_start_t)(mac_ring_driver_t, uint64_t);
350 393 typedef void (*mac_ring_stop_t)(mac_ring_driver_t);
351 394
352 395 typedef mblk_t *(*mac_ring_send_t)(void *, mblk_t *);
353 396 typedef mblk_t *(*mac_ring_poll_t)(void *, int);
354 397
355 398 typedef int (*mac_ring_stat_t)(mac_ring_driver_t, uint_t, uint64_t *);
356 399
↓ open down ↓ |
92 lines elided |
↑ open up ↑ |
357 400 typedef struct mac_ring_info_s {
358 401 mac_ring_driver_t mri_driver;
359 402 mac_ring_start_t mri_start;
360 403 mac_ring_stop_t mri_stop;
361 404 mac_intr_t mri_intr;
362 405 union {
363 406 mac_ring_send_t send;
364 407 mac_ring_poll_t poll;
365 408 } mrfunion;
366 409 mac_ring_stat_t mri_stat;
410 +
367 411 /*
368 412 * mri_flags will have some bits set to indicate some special
369 413 * property/feature of a ring like serialization needed for a
370 414 * Tx ring or packets should always need enqueuing on Rx side,
371 415 * etc.
372 416 */
373 417 uint_t mri_flags;
374 418 } mac_ring_info_s;
375 419
376 420 #define mri_tx mrfunion.send
377 421 #define mri_poll mrfunion.poll
378 422
379 423 /*
380 424 * #defines for mri_flags. The flags are temporary flags that are provided
381 425 * only to workaround issues in specific drivers, and they will be
382 426 * removed in the future.
383 427 *
384 428 * These are consumed only by sun4v and neptune (nxge).
385 429 */
386 430 #define MAC_RING_TX_SERIALIZE 0x1
387 431 #define MAC_RING_RX_ENQUEUE 0x2
388 432
389 433 typedef int (*mac_group_start_t)(mac_group_driver_t);
390 434 typedef void (*mac_group_stop_t)(mac_group_driver_t);
391 435 typedef int (*mac_add_mac_addr_t)(void *, const uint8_t *);
392 436 typedef int (*mac_rem_mac_addr_t)(void *, const uint8_t *);
393 437 typedef int (*mac_add_vlan_filter_t)(mac_group_driver_t, uint16_t);
394 438 typedef int (*mac_rem_vlan_filter_t)(mac_group_driver_t, uint16_t);
395 439
396 440 struct mac_group_info_s {
397 441 mac_group_driver_t mgi_driver; /* Driver reference */
398 442 mac_group_start_t mgi_start; /* Start the group */
399 443 mac_group_stop_t mgi_stop; /* Stop the group */
400 444 uint_t mgi_count; /* Count of rings */
401 445 mac_intr_t mgi_intr; /* Optional per-group intr */
402 446
403 447 /* Only used for Rx groups */
404 448 mac_add_mac_addr_t mgi_addmac; /* Add a MAC address */
405 449 mac_rem_mac_addr_t mgi_remmac; /* Remove a MAC address */
406 450 mac_add_vlan_filter_t mgi_addvlan; /* Add a VLAN filter */
407 451 mac_rem_vlan_filter_t mgi_remvlan; /* Remove a VLAN filter */
408 452 };
409 453
410 454 /*
411 455 * Share management functions.
412 456 */
413 457 typedef uint64_t mac_share_handle_t;
414 458
415 459 /*
416 460 * Allocate and free a share. Returns ENOSPC if all shares have been
417 461 * previously allocated.
418 462 */
419 463 typedef int (*mac_alloc_share_t)(void *, mac_share_handle_t *);
420 464 typedef void (*mac_free_share_t)(mac_share_handle_t);
421 465
422 466 /*
423 467 * Bind and unbind a share. Binding a share allows a domain
424 468 * to have direct access to the groups and rings associated with
425 469 * that share.
426 470 */
427 471 typedef int (*mac_bind_share_t)(mac_share_handle_t, uint64_t, uint64_t *);
428 472 typedef void (*mac_unbind_share_t)(mac_share_handle_t);
429 473
430 474 /*
431 475 * Return information on about a share.
432 476 */
433 477 typedef void (*mac_share_query_t)(mac_share_handle_t, mac_ring_type_t,
434 478 mac_ring_handle_t *, uint_t *);
435 479
436 480 /*
437 481 * Basic idea, bind previously created ring groups to shares
438 482 * for them to be exported (or shared) by another domain.
439 483 * These interfaces bind/unbind the ring group to a share.
440 484 * The groups and their rings will be shared with the guest
441 485 * as soon as the share is bound.
442 486 */
443 487 typedef int (*mac_share_add_group_t)(mac_share_handle_t,
444 488 mac_group_driver_t);
445 489 typedef int (*mac_share_rem_group_t)(mac_share_handle_t,
446 490 mac_group_driver_t);
447 491
448 492 typedef struct mac_capab_share_s {
449 493 uint_t ms_snum; /* Number of shares (vr's) */
450 494 void *ms_handle; /* Handle to driver. */
451 495 mac_alloc_share_t ms_salloc; /* Get a share from driver. */
452 496 mac_free_share_t ms_sfree; /* Return a share to driver. */
453 497 mac_share_add_group_t ms_sadd; /* Add a group to the share. */
454 498 mac_share_rem_group_t ms_sremove; /* Remove group from share. */
455 499 mac_share_query_t ms_squery; /* Query share constraints */
456 500 mac_bind_share_t ms_sbind; /* Bind a share */
457 501 mac_unbind_share_t ms_sunbind; /* Unbind a share */
458 502 } mac_capab_share_t;
459 503
460 504 typedef struct mac_capab_vrrp_s {
461 505 /* IPv6 or IPv4? */
462 506 int mcv_af;
463 507 } mac_capab_vrrp_t;
464 508
465 509 /*
466 510 * Transceiver capability
467 511 */
468 512 typedef struct mac_transceiver_info mac_transceiver_info_t;
469 513
470 514 typedef struct mac_capab_transceiver {
471 515 uint_t mct_flags;
472 516 uint_t mct_ntransceivers;
473 517 int (*mct_info)(void *, uint_t, mac_transceiver_info_t *);
474 518 int (*mct_read)(void *, uint_t, uint_t, void *, size_t, off_t,
475 519 size_t *);
476 520 } mac_capab_transceiver_t;
477 521
478 522 /*
479 523 * LED capability
480 524 */
481 525 typedef struct mac_capab_led {
482 526 uint_t mcl_flags;
483 527 mac_led_mode_t mcl_modes;
484 528 int (*mcl_set)(void *, mac_led_mode_t, uint_t);
485 529 } mac_capab_led_t;
486 530
487 531 /*
488 532 * MAC registration interface
489 533 */
490 534 typedef struct mac_register_s {
491 535 uint_t m_version; /* set by mac_alloc() */
492 536 const char *m_type_ident;
493 537 void *m_driver; /* Driver private data */
494 538 dev_info_t *m_dip;
495 539 uint_t m_instance;
496 540 uint8_t *m_src_addr;
497 541 uint8_t *m_dst_addr;
498 542 mac_callbacks_t *m_callbacks;
499 543 uint_t m_min_sdu;
500 544 uint_t m_max_sdu;
501 545 void *m_pdata;
502 546 size_t m_pdata_size;
503 547 char **m_priv_props;
504 548 uint32_t m_margin;
505 549 uint32_t m_v12n; /* Virtualization level */
506 550 uint_t m_multicast_sdu;
507 551 } mac_register_t;
508 552
509 553 /*
510 554 * Driver interface functions.
511 555 */
512 556 extern mac_protect_t *mac_protect_get(mac_handle_t);
513 557 extern void mac_sdu_get(mac_handle_t, uint_t *, uint_t *);
514 558 extern void mac_sdu_get2(mac_handle_t, uint_t *, uint_t *,
515 559 uint_t *);
516 560 extern int mac_maxsdu_update(mac_handle_t, uint_t);
517 561 extern int mac_maxsdu_update2(mac_handle_t, uint_t,
518 562 uint_t);
519 563
520 564 extern mac_register_t *mac_alloc(uint_t);
521 565 extern void mac_free(mac_register_t *);
522 566 extern int mac_register(mac_register_t *, mac_handle_t *);
523 567 extern int mac_disable_nowait(mac_handle_t);
524 568 extern int mac_disable(mac_handle_t);
525 569 extern int mac_unregister(mac_handle_t);
526 570 extern void mac_rx(mac_handle_t, mac_resource_handle_t,
527 571 mblk_t *);
528 572 extern void mac_rx_ring(mac_handle_t, mac_ring_handle_t,
529 573 mblk_t *, uint64_t);
530 574 extern void mac_link_update(mac_handle_t, link_state_t);
531 575 extern void mac_link_redo(mac_handle_t, link_state_t);
532 576 extern void mac_unicst_update(mac_handle_t,
533 577 const uint8_t *);
534 578 extern void mac_dst_update(mac_handle_t, const uint8_t *);
535 579 extern void mac_tx_update(mac_handle_t);
536 580 extern void mac_tx_ring_update(mac_handle_t,
537 581 mac_ring_handle_t);
538 582 extern void mac_capab_update(mac_handle_t);
539 583 extern int mac_pdata_update(mac_handle_t, void *,
540 584 size_t);
541 585 extern void mac_multicast_refresh(mac_handle_t,
542 586 mac_multicst_t, void *, boolean_t);
543 587 extern void mac_unicst_refresh(mac_handle_t, mac_unicst_t,
544 588 void *);
545 589 extern void mac_promisc_refresh(mac_handle_t,
546 590 mac_setpromisc_t, void *);
547 591 extern boolean_t mac_margin_update(mac_handle_t, uint32_t);
548 592 extern void mac_margin_get(mac_handle_t, uint32_t *);
549 593 extern int mac_margin_remove(mac_handle_t, uint32_t);
550 594 extern int mac_margin_add(mac_handle_t, uint32_t *,
551 595 boolean_t);
552 596 extern void mac_init_ops(struct dev_ops *, const char *);
553 597 extern void mac_fini_ops(struct dev_ops *);
554 598 extern int mac_devt_to_instance(dev_t);
555 599 extern minor_t mac_private_minor(void);
556 600 extern void mac_ring_intr_set(mac_ring_handle_t,
557 601 ddi_intr_handle_t);
558 602
559 603
560 604 extern mactype_register_t *mactype_alloc(uint_t);
561 605 extern void mactype_free(mactype_register_t *);
562 606 extern int mactype_register(mactype_register_t *);
563 607 extern int mactype_unregister(const char *);
564 608
565 609 extern boolean_t mac_unicst_verify(mac_handle_t,
566 610 const uint8_t *, uint_t);
567 611
568 612 extern int mac_group_add_ring(mac_group_handle_t, int);
569 613 extern void mac_group_rem_ring(mac_group_handle_t,
570 614 mac_ring_handle_t);
571 615 extern mac_ring_handle_t mac_find_ring(mac_group_handle_t, int);
572 616
573 617 extern void mac_prop_info_set_default_uint8(
574 618 mac_prop_info_handle_t, uint8_t);
575 619 extern void mac_prop_info_set_default_str(
576 620 mac_prop_info_handle_t, const char *);
577 621 extern void mac_prop_info_set_default_uint64(
578 622 mac_prop_info_handle_t, uint64_t);
579 623 extern void mac_prop_info_set_default_uint32(
580 624 mac_prop_info_handle_t, uint32_t);
581 625 extern void mac_prop_info_set_default_link_flowctrl(
582 626 mac_prop_info_handle_t, link_flowctrl_t);
583 627 extern void mac_prop_info_set_range_uint32(
584 628 mac_prop_info_handle_t,
585 629 uint32_t, uint32_t);
586 630 extern void mac_prop_info_set_perm(mac_prop_info_handle_t,
587 631 uint8_t);
588 632
589 633 extern void mac_hcksum_get(mblk_t *, uint32_t *,
590 634 uint32_t *, uint32_t *, uint32_t *,
591 635 uint32_t *);
592 636 extern void mac_hcksum_set(mblk_t *, uint32_t, uint32_t,
593 637 uint32_t, uint32_t, uint32_t);
594 638
595 639 extern void mac_lso_get(mblk_t *, uint32_t *, uint32_t *);
596 640
597 641 extern void mac_transceiver_info_set_present(
598 642 mac_transceiver_info_t *,
599 643 boolean_t);
600 644 extern void mac_transceiver_info_set_usable(
601 645 mac_transceiver_info_t *,
602 646 boolean_t);
603 647
604 648 #endif /* _KERNEL */
605 649
606 650 #ifdef __cplusplus
607 651 }
608 652 #endif
609 653
610 654 #endif /* _SYS_MAC_PROVIDER_H */
↓ open down ↓ |
234 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX