3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2017, Joyent, Inc.
24 */
25
26 #ifndef _SYS_MAC_IMPL_H
27 #define _SYS_MAC_IMPL_H
28
29 #include <sys/cpupart.h>
30 #include <sys/modhash.h>
31 #include <sys/mac_client.h>
32 #include <sys/mac_provider.h>
33 #include <sys/note.h>
34 #include <sys/avl.h>
35 #include <net/if.h>
36 #include <sys/mac_flow_impl.h>
37 #include <netinet/ip6.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
238
239 /*
240 * Reference hold and release on mac_ring_t 'mr'
241 */
242 #define MR_REFHOLD_LOCKED(mr) { \
243 ASSERT(MUTEX_HELD(&mr->mr_lock)); \
244 (mr)->mr_refcnt++; \
245 }
246
247 #define MR_REFRELE(mr) { \
248 mutex_enter(&(mr)->mr_lock); \
249 ASSERT((mr)->mr_refcnt != 0); \
250 (mr)->mr_refcnt--; \
251 if ((mr)->mr_refcnt == 0 && \
252 ((mr)->mr_flag & (MR_CONDEMNED | MR_QUIESCE))) \
253 cv_signal(&(mr)->mr_cv); \
254 mutex_exit(&(mr)->mr_lock); \
255 }
256
257 /*
258 * Per mac client flow information associated with a RX group.
259 * The entire structure is SL protected.
260 */
261 typedef struct mac_grp_client {
262 struct mac_grp_client *mgc_next;
263 struct mac_client_impl_s *mgc_client;
264 } mac_grp_client_t;
265
266 #define MAC_GROUP_NO_CLIENT(g) ((g)->mrg_clients == NULL)
267
268 #define MAC_GROUP_ONLY_CLIENT(g) \
269 ((((g)->mrg_clients != NULL) && \
270 ((g)->mrg_clients->mgc_next == NULL)) ? \
271 (g)->mrg_clients->mgc_client : NULL)
272
273 /*
274 * Common ring group data structure for ring control and management.
275 * The entire structure is SL protected
276 */
277 struct mac_group_s {
278 int mrg_index; /* index in the list */
279 mac_ring_type_t mrg_type; /* ring type */
280 mac_group_state_t mrg_state; /* state of the group */
281 mac_group_t *mrg_next; /* next ring in the chain */
282 mac_handle_t mrg_mh; /* reference to MAC */
283 mac_ring_t *mrg_rings; /* grouped rings */
284 uint_t mrg_cur_count; /* actual size of group */
285
286 mac_grp_client_t *mrg_clients; /* clients list */
287
288 mac_group_info_t mrg_info; /* driver supplied info */
289 };
290
291 #define mrg_driver mrg_info.mgi_driver
292 #define mrg_start mrg_info.mgi_start
293 #define mrg_stop mrg_info.mgi_stop
294
295 #define GROUP_INTR_HANDLE(g) (g)->mrg_info.mgi_intr.mi_handle
296 #define GROUP_INTR_ENABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_enable
297 #define GROUP_INTR_DISABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_disable
298
299 #define MAC_RING_TX(mhp, rh, mp, rest) { \
300 mac_ring_handle_t mrh = rh; \
301 mac_impl_t *mimpl = (mac_impl_t *)mhp; \
343 mp = mac_bridge_tx(mip, rhandle, mp); \
344 } \
345 }
346
347 /* mci_tx_flag */
348 #define MCI_TX_QUIESCE 0x1
349
350 typedef struct mac_factory_addr_s {
351 boolean_t mfa_in_use;
352 uint8_t mfa_addr[MAXMACADDRLEN];
353 struct mac_client_impl_s *mfa_client;
354 } mac_factory_addr_t;
355
356 typedef struct mac_mcast_addrs_s {
357 struct mac_mcast_addrs_s *mma_next;
358 uint8_t mma_addr[MAXMACADDRLEN];
359 int mma_ref;
360 } mac_mcast_addrs_t;
361
362 typedef enum {
363 MAC_ADDRESS_TYPE_UNICAST_CLASSIFIED = 1, /* hardware steering */
364 MAC_ADDRESS_TYPE_UNICAST_PROMISC /* promiscuous mode */
365 } mac_address_type_t;
366
367 typedef struct mac_address_s {
368 mac_address_type_t ma_type; /* address type */
369 int ma_nusers; /* number of users */
370 /* of that address */
371 struct mac_address_s *ma_next; /* next address */
372 uint8_t ma_addr[MAXMACADDRLEN]; /* address value */
373 size_t ma_len; /* address length */
374 mac_group_t *ma_group; /* asscociated group */
375 mac_impl_t *ma_mip; /* MAC handle */
376 } mac_address_t;
377
378 extern krwlock_t i_mac_impl_lock;
379 extern mod_hash_t *i_mac_impl_hash;
380 extern kmem_cache_t *i_mac_impl_cachep;
381 extern uint_t i_mac_impl_count;
382
383 /*
384 * Each registered MAC is associated with a mac_impl_t structure. The
385 * structure represents the undelying hardware, in terms of definition,
386 * resources (transmit, receive rings etc.), callback functions etc. It
387 * also holds the table of MAC clients that are configured on the device.
388 * The table is used for classifying incoming packets in software.
389 *
390 * The protection scheme uses 2 elements, a coarse serialization mechanism
391 * called perimeter and a finer traditional lock based scheme. More details
392 * can be found in the big block comment in mac.c.
393 *
470 mac_capab_rings_t mi_tx_rings_cap;
471 uint_t mi_txrings_rsvd;
472 uint_t mi_txrings_avail;
473 uint_t mi_txhwclnt_avail;
474 uint_t mi_txhwclnt_used;
475
476 mac_ring_handle_t mi_default_tx_ring;
477
478 /*
479 * Transceiver capabilities. SL protected.
480 */
481 mac_capab_transceiver_t mi_transceiver;
482
483 /*
484 * LED Capability information. SL protected.
485 */
486 mac_led_mode_t mi_led_modes;
487 mac_capab_led_t mi_led;
488
489 /*
490 * MAC address list. SL protected.
491 */
492 mac_address_t *mi_addresses;
493
494 /*
495 * This MAC's table of sub-flows
496 */
497 flow_tab_t *mi_flow_tab; /* WO */
498
499 kstat_t *mi_ksp; /* WO */
500 uint_t mi_kstat_count; /* WO */
501 uint_t mi_nactiveclients; /* SL */
502
503 /* for broadcast and multicast support */
504 struct mac_mcast_addrs_s *mi_mcast_addrs; /* mi_rw_lock */
505 struct mac_bcast_grp_s *mi_bcast_grp; /* mi_rw_lock */
506 uint_t mi_bcast_ngrps; /* mi_rw_lock */
507
508 /* list of MAC clients which opened this MAC */
509 struct mac_client_impl_s *mi_clients_list; /* mi_rw_lock */
510 uint_t mi_nclients; /* mi_rw_lock */
742
743 /* in mac_bcast.c */
744 extern void mac_bcast_init(void);
745 extern void mac_bcast_fini(void);
746 extern mac_impl_t *mac_bcast_grp_mip(void *);
747 extern int mac_bcast_add(mac_client_impl_t *, const uint8_t *, uint16_t,
748 mac_addrtype_t);
749 extern void mac_bcast_delete(mac_client_impl_t *, const uint8_t *, uint16_t);
750 extern void mac_bcast_send(void *, void *, mblk_t *, boolean_t);
751 extern void mac_bcast_grp_free(void *);
752 extern void mac_bcast_refresh(mac_impl_t *, mac_multicst_t, void *,
753 boolean_t);
754 extern void mac_client_bcast_refresh(mac_client_impl_t *, mac_multicst_t,
755 void *, boolean_t);
756
757 /*
758 * Grouping functions are used internally by MAC layer.
759 */
760 extern int mac_group_addmac(mac_group_t *, const uint8_t *);
761 extern int mac_group_remmac(mac_group_t *, const uint8_t *);
762 extern int mac_rx_group_add_flow(mac_client_impl_t *, flow_entry_t *,
763 mac_group_t *);
764 extern mblk_t *mac_hwring_tx(mac_ring_handle_t, mblk_t *);
765 extern mblk_t *mac_bridge_tx(mac_impl_t *, mac_ring_handle_t, mblk_t *);
766 extern mac_group_t *mac_reserve_rx_group(mac_client_impl_t *, uint8_t *,
767 boolean_t);
768 extern void mac_release_rx_group(mac_client_impl_t *, mac_group_t *);
769 extern int mac_rx_switch_group(mac_client_impl_t *, mac_group_t *,
770 mac_group_t *);
771 extern mac_ring_t *mac_reserve_tx_ring(mac_impl_t *, mac_ring_t *);
772 extern mac_group_t *mac_reserve_tx_group(mac_client_impl_t *, boolean_t);
773 extern void mac_release_tx_group(mac_client_impl_t *, mac_group_t *);
774 extern void mac_tx_switch_group(mac_client_impl_t *, mac_group_t *,
775 mac_group_t *);
776 extern void mac_rx_switch_grp_to_sw(mac_group_t *);
777
778 /*
779 * MAC address functions are used internally by MAC layer.
780 */
781 extern mac_address_t *mac_find_macaddr(mac_impl_t *, uint8_t *);
782 extern boolean_t mac_check_macaddr_shared(mac_address_t *);
783 extern int mac_update_macaddr(mac_address_t *, uint8_t *);
784 extern void mac_freshen_macaddr(mac_address_t *, uint8_t *);
785 extern void mac_retrieve_macaddr(mac_address_t *, uint8_t *);
786 extern void mac_init_macaddr(mac_impl_t *);
787 extern void mac_fini_macaddr(mac_impl_t *);
788
789 /*
790 * Flow construction/destruction routines.
791 * Not meant to be used by mac clients.
792 */
793 extern int mac_link_flow_init(mac_client_handle_t, flow_entry_t *);
794 extern void mac_link_flow_clean(mac_client_handle_t, flow_entry_t *);
795
796 /*
797 * Fanout update routines called when the link speed of the NIC changes
798 * or when a MAC client's share is unbound.
799 */
800 extern void mac_fanout_recompute_client(mac_client_impl_t *, cpupart_t *);
801 extern void mac_fanout_recompute(mac_impl_t *);
846 extern void mac_rx_group_unmark(mac_group_t *, uint_t);
847 extern void mac_tx_client_flush(mac_client_impl_t *);
848 extern void mac_tx_client_block(mac_client_impl_t *);
849 extern void mac_tx_client_unblock(mac_client_impl_t *);
850 extern void mac_tx_invoke_callbacks(mac_client_impl_t *, mac_tx_cookie_t);
851 extern int i_mac_promisc_set(mac_impl_t *, boolean_t);
852 extern void i_mac_promisc_walker_cleanup(mac_impl_t *);
853 extern mactype_t *mactype_getplugin(const char *);
854 extern void mac_addr_factory_init(mac_impl_t *);
855 extern void mac_addr_factory_fini(mac_impl_t *);
856 extern void mac_register_priv_prop(mac_impl_t *, char **);
857 extern void mac_unregister_priv_prop(mac_impl_t *);
858 extern int mac_init_rings(mac_impl_t *, mac_ring_type_t);
859 extern void mac_free_rings(mac_impl_t *, mac_ring_type_t);
860 extern void mac_compare_ddi_handle(mac_group_t *, uint_t, mac_ring_t *);
861
862 extern int mac_start_group(mac_group_t *);
863 extern void mac_stop_group(mac_group_t *);
864 extern int mac_start_ring(mac_ring_t *);
865 extern void mac_stop_ring(mac_ring_t *);
866 extern int mac_add_macaddr(mac_impl_t *, mac_group_t *, uint8_t *, boolean_t);
867 extern int mac_remove_macaddr(mac_address_t *);
868
869 extern void mac_set_group_state(mac_group_t *, mac_group_state_t);
870 extern void mac_group_add_client(mac_group_t *, mac_client_impl_t *);
871 extern void mac_group_remove_client(mac_group_t *, mac_client_impl_t *);
872
873 extern int i_mac_group_add_ring(mac_group_t *, mac_ring_t *, int);
874 extern void i_mac_group_rem_ring(mac_group_t *, mac_ring_t *, boolean_t);
875 extern int mac_group_ring_modify(mac_client_impl_t *, mac_group_t *,
876 mac_group_t *);
877 extern void mac_poll_state_change(mac_handle_t, boolean_t);
878
879 extern mac_group_state_t mac_group_next_state(mac_group_t *,
880 mac_client_impl_t **, mac_group_t *, boolean_t);
881
882 extern mblk_t *mac_protect_check(mac_client_handle_t, mblk_t *);
883 extern int mac_protect_set(mac_client_handle_t, mac_resource_props_t *);
884 extern boolean_t mac_protect_enabled(mac_client_handle_t, uint32_t);
885 extern int mac_protect_validate(mac_resource_props_t *);
886 extern void mac_protect_update(mac_resource_props_t *, mac_resource_props_t *);
887 extern void mac_protect_update_mac_token(mac_client_impl_t *);
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2018, Joyent, Inc.
24 */
25
26 #ifndef _SYS_MAC_IMPL_H
27 #define _SYS_MAC_IMPL_H
28
29 #include <sys/cpupart.h>
30 #include <sys/modhash.h>
31 #include <sys/mac_client.h>
32 #include <sys/mac_provider.h>
33 #include <sys/note.h>
34 #include <sys/avl.h>
35 #include <net/if.h>
36 #include <sys/mac_flow_impl.h>
37 #include <netinet/ip6.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
238
239 /*
240 * Reference hold and release on mac_ring_t 'mr'
241 */
242 #define MR_REFHOLD_LOCKED(mr) { \
243 ASSERT(MUTEX_HELD(&mr->mr_lock)); \
244 (mr)->mr_refcnt++; \
245 }
246
247 #define MR_REFRELE(mr) { \
248 mutex_enter(&(mr)->mr_lock); \
249 ASSERT((mr)->mr_refcnt != 0); \
250 (mr)->mr_refcnt--; \
251 if ((mr)->mr_refcnt == 0 && \
252 ((mr)->mr_flag & (MR_CONDEMNED | MR_QUIESCE))) \
253 cv_signal(&(mr)->mr_cv); \
254 mutex_exit(&(mr)->mr_lock); \
255 }
256
257 /*
258 * Used to attach MAC clients to an Rx group. The members are SL
259 * protected.
260 */
261 typedef struct mac_grp_client {
262 struct mac_grp_client *mgc_next;
263 struct mac_client_impl_s *mgc_client;
264 } mac_grp_client_t;
265
266 #define MAC_GROUP_NO_CLIENT(g) ((g)->mrg_clients == NULL)
267
268 #define MAC_GROUP_ONLY_CLIENT(g) \
269 ((((g)->mrg_clients != NULL) && \
270 ((g)->mrg_clients->mgc_next == NULL)) ? \
271 (g)->mrg_clients->mgc_client : NULL)
272
273 #define MAC_GROUP_HW_VLAN(g) \
274 (((g) != NULL) && \
275 ((g)->mrg_info.mgi_addvlan != NULL) && \
276 ((g)->mrg_info.mgi_remvlan != NULL))
277
278 /*
279 * Common ring group data structure for ring control and management.
280 * The entire structure is SL protected.
281 */
282 struct mac_group_s {
283 int mrg_index; /* index in the list */
284 mac_ring_type_t mrg_type; /* ring type */
285 mac_group_state_t mrg_state; /* state of the group */
286 mac_group_t *mrg_next; /* next group in the chain */
287 mac_handle_t mrg_mh; /* reference to MAC */
288 mac_ring_t *mrg_rings; /* grouped rings */
289 uint_t mrg_cur_count; /* actual size of group */
290
291 mac_grp_client_t *mrg_clients; /* clients list */
292
293 mac_group_info_t mrg_info; /* driver supplied info */
294 };
295
296 #define mrg_driver mrg_info.mgi_driver
297 #define mrg_start mrg_info.mgi_start
298 #define mrg_stop mrg_info.mgi_stop
299
300 #define GROUP_INTR_HANDLE(g) (g)->mrg_info.mgi_intr.mi_handle
301 #define GROUP_INTR_ENABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_enable
302 #define GROUP_INTR_DISABLE_FUNC(g) (g)->mrg_info.mgi_intr.mi_disable
303
304 #define MAC_RING_TX(mhp, rh, mp, rest) { \
305 mac_ring_handle_t mrh = rh; \
306 mac_impl_t *mimpl = (mac_impl_t *)mhp; \
348 mp = mac_bridge_tx(mip, rhandle, mp); \
349 } \
350 }
351
352 /* mci_tx_flag */
353 #define MCI_TX_QUIESCE 0x1
354
355 typedef struct mac_factory_addr_s {
356 boolean_t mfa_in_use;
357 uint8_t mfa_addr[MAXMACADDRLEN];
358 struct mac_client_impl_s *mfa_client;
359 } mac_factory_addr_t;
360
361 typedef struct mac_mcast_addrs_s {
362 struct mac_mcast_addrs_s *mma_next;
363 uint8_t mma_addr[MAXMACADDRLEN];
364 int mma_ref;
365 } mac_mcast_addrs_t;
366
367 typedef enum {
368 MAC_ADDRESS_TYPE_UNICAST_CLASSIFIED = 1, /* HW classification */
369 MAC_ADDRESS_TYPE_UNICAST_PROMISC /* promiscuous mode */
370 } mac_address_type_t;
371
372 typedef struct mac_vlan_s {
373 struct mac_vlan_s *mv_next;
374 uint16_t mv_vid;
375 } mac_vlan_t;
376
377 typedef struct mac_address_s {
378 mac_address_type_t ma_type; /* address type */
379 int ma_nusers; /* num users of addr */
380 struct mac_address_s *ma_next; /* next address */
381 uint8_t ma_addr[MAXMACADDRLEN]; /* address value */
382 size_t ma_len; /* address length */
383 mac_vlan_t *ma_vlans; /* VLANs on this addr */
384 boolean_t ma_untagged; /* accept untagged? */
385 mac_group_t *ma_group; /* asscociated group */
386 mac_impl_t *ma_mip; /* MAC handle */
387 } mac_address_t;
388
389 extern krwlock_t i_mac_impl_lock;
390 extern mod_hash_t *i_mac_impl_hash;
391 extern kmem_cache_t *i_mac_impl_cachep;
392 extern uint_t i_mac_impl_count;
393
394 /*
395 * Each registered MAC is associated with a mac_impl_t structure. The
396 * structure represents the undelying hardware, in terms of definition,
397 * resources (transmit, receive rings etc.), callback functions etc. It
398 * also holds the table of MAC clients that are configured on the device.
399 * The table is used for classifying incoming packets in software.
400 *
401 * The protection scheme uses 2 elements, a coarse serialization mechanism
402 * called perimeter and a finer traditional lock based scheme. More details
403 * can be found in the big block comment in mac.c.
404 *
481 mac_capab_rings_t mi_tx_rings_cap;
482 uint_t mi_txrings_rsvd;
483 uint_t mi_txrings_avail;
484 uint_t mi_txhwclnt_avail;
485 uint_t mi_txhwclnt_used;
486
487 mac_ring_handle_t mi_default_tx_ring;
488
489 /*
490 * Transceiver capabilities. SL protected.
491 */
492 mac_capab_transceiver_t mi_transceiver;
493
494 /*
495 * LED Capability information. SL protected.
496 */
497 mac_led_mode_t mi_led_modes;
498 mac_capab_led_t mi_led;
499
500 /*
501 * MAC address and VLAN lists. SL protected.
502 */
503 mac_address_t *mi_addresses;
504
505 /*
506 * This MAC's table of sub-flows
507 */
508 flow_tab_t *mi_flow_tab; /* WO */
509
510 kstat_t *mi_ksp; /* WO */
511 uint_t mi_kstat_count; /* WO */
512 uint_t mi_nactiveclients; /* SL */
513
514 /* for broadcast and multicast support */
515 struct mac_mcast_addrs_s *mi_mcast_addrs; /* mi_rw_lock */
516 struct mac_bcast_grp_s *mi_bcast_grp; /* mi_rw_lock */
517 uint_t mi_bcast_ngrps; /* mi_rw_lock */
518
519 /* list of MAC clients which opened this MAC */
520 struct mac_client_impl_s *mi_clients_list; /* mi_rw_lock */
521 uint_t mi_nclients; /* mi_rw_lock */
753
754 /* in mac_bcast.c */
755 extern void mac_bcast_init(void);
756 extern void mac_bcast_fini(void);
757 extern mac_impl_t *mac_bcast_grp_mip(void *);
758 extern int mac_bcast_add(mac_client_impl_t *, const uint8_t *, uint16_t,
759 mac_addrtype_t);
760 extern void mac_bcast_delete(mac_client_impl_t *, const uint8_t *, uint16_t);
761 extern void mac_bcast_send(void *, void *, mblk_t *, boolean_t);
762 extern void mac_bcast_grp_free(void *);
763 extern void mac_bcast_refresh(mac_impl_t *, mac_multicst_t, void *,
764 boolean_t);
765 extern void mac_client_bcast_refresh(mac_client_impl_t *, mac_multicst_t,
766 void *, boolean_t);
767
768 /*
769 * Grouping functions are used internally by MAC layer.
770 */
771 extern int mac_group_addmac(mac_group_t *, const uint8_t *);
772 extern int mac_group_remmac(mac_group_t *, const uint8_t *);
773 extern int mac_group_addvlan(mac_group_t *, uint16_t);
774 extern int mac_group_remvlan(mac_group_t *, uint16_t);
775 extern int mac_rx_group_add_flow(mac_client_impl_t *, flow_entry_t *,
776 mac_group_t *);
777 extern mblk_t *mac_hwring_tx(mac_ring_handle_t, mblk_t *);
778 extern mblk_t *mac_bridge_tx(mac_impl_t *, mac_ring_handle_t, mblk_t *);
779 extern mac_group_t *mac_reserve_rx_group(mac_client_impl_t *, uint8_t *,
780 boolean_t);
781 extern void mac_release_rx_group(mac_client_impl_t *, mac_group_t *);
782 extern int mac_rx_switch_group(mac_client_impl_t *, mac_group_t *,
783 mac_group_t *);
784 extern mac_ring_t *mac_reserve_tx_ring(mac_impl_t *, mac_ring_t *);
785 extern mac_group_t *mac_reserve_tx_group(mac_client_impl_t *, boolean_t);
786 extern void mac_release_tx_group(mac_client_impl_t *, mac_group_t *);
787 extern void mac_tx_switch_group(mac_client_impl_t *, mac_group_t *,
788 mac_group_t *);
789 extern void mac_rx_switch_grp_to_sw(mac_group_t *);
790
791 /*
792 * MAC address functions are used internally by MAC layer.
793 */
794 extern mac_address_t *mac_find_macaddr(mac_impl_t *, uint8_t *);
795 extern mac_address_t *mac_find_macaddr_vlan(mac_impl_t *, uint8_t *, uint16_t);
796 extern boolean_t mac_check_macaddr_shared(mac_address_t *);
797 extern int mac_update_macaddr(mac_address_t *, uint8_t *);
798 extern void mac_freshen_macaddr(mac_address_t *, uint8_t *);
799 extern void mac_retrieve_macaddr(mac_address_t *, uint8_t *);
800 extern void mac_init_macaddr(mac_impl_t *);
801 extern void mac_fini_macaddr(mac_impl_t *);
802
803 /*
804 * Flow construction/destruction routines.
805 * Not meant to be used by mac clients.
806 */
807 extern int mac_link_flow_init(mac_client_handle_t, flow_entry_t *);
808 extern void mac_link_flow_clean(mac_client_handle_t, flow_entry_t *);
809
810 /*
811 * Fanout update routines called when the link speed of the NIC changes
812 * or when a MAC client's share is unbound.
813 */
814 extern void mac_fanout_recompute_client(mac_client_impl_t *, cpupart_t *);
815 extern void mac_fanout_recompute(mac_impl_t *);
860 extern void mac_rx_group_unmark(mac_group_t *, uint_t);
861 extern void mac_tx_client_flush(mac_client_impl_t *);
862 extern void mac_tx_client_block(mac_client_impl_t *);
863 extern void mac_tx_client_unblock(mac_client_impl_t *);
864 extern void mac_tx_invoke_callbacks(mac_client_impl_t *, mac_tx_cookie_t);
865 extern int i_mac_promisc_set(mac_impl_t *, boolean_t);
866 extern void i_mac_promisc_walker_cleanup(mac_impl_t *);
867 extern mactype_t *mactype_getplugin(const char *);
868 extern void mac_addr_factory_init(mac_impl_t *);
869 extern void mac_addr_factory_fini(mac_impl_t *);
870 extern void mac_register_priv_prop(mac_impl_t *, char **);
871 extern void mac_unregister_priv_prop(mac_impl_t *);
872 extern int mac_init_rings(mac_impl_t *, mac_ring_type_t);
873 extern void mac_free_rings(mac_impl_t *, mac_ring_type_t);
874 extern void mac_compare_ddi_handle(mac_group_t *, uint_t, mac_ring_t *);
875
876 extern int mac_start_group(mac_group_t *);
877 extern void mac_stop_group(mac_group_t *);
878 extern int mac_start_ring(mac_ring_t *);
879 extern void mac_stop_ring(mac_ring_t *);
880 extern int mac_add_macaddr_vlan(mac_impl_t *, mac_group_t *, uint8_t *,
881 uint16_t, boolean_t);
882 extern int mac_remove_macaddr_vlan(mac_address_t *, uint16_t);
883
884 extern void mac_set_group_state(mac_group_t *, mac_group_state_t);
885 extern void mac_group_add_client(mac_group_t *, mac_client_impl_t *);
886 extern void mac_group_remove_client(mac_group_t *, mac_client_impl_t *);
887
888 extern int i_mac_group_add_ring(mac_group_t *, mac_ring_t *, int);
889 extern void i_mac_group_rem_ring(mac_group_t *, mac_ring_t *, boolean_t);
890 extern int mac_group_ring_modify(mac_client_impl_t *, mac_group_t *,
891 mac_group_t *);
892 extern void mac_poll_state_change(mac_handle_t, boolean_t);
893
894 extern mac_group_state_t mac_group_next_state(mac_group_t *,
895 mac_client_impl_t **, mac_group_t *, boolean_t);
896
897 extern mblk_t *mac_protect_check(mac_client_handle_t, mblk_t *);
898 extern int mac_protect_set(mac_client_handle_t, mac_resource_props_t *);
899 extern boolean_t mac_protect_enabled(mac_client_handle_t, uint32_t);
900 extern int mac_protect_validate(mac_resource_props_t *);
901 extern void mac_protect_update(mac_resource_props_t *, mac_resource_props_t *);
902 extern void mac_protect_update_mac_token(mac_client_impl_t *);
|