1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_DLS_IMPL_H 28 #define _SYS_DLS_IMPL_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/stream.h> 33 #include <sys/dls.h> 34 #include <sys/mac.h> 35 #include <sys/ght.h> 36 #include <sys/kstat.h> 37 #include <net/if.h> 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 typedef struct dls_multicst_addr_s dls_multicst_addr_t; 44 45 struct dls_multicst_addr_s { 46 dls_multicst_addr_t *dma_nextp; 47 uint8_t dma_addr[MAXADDRLEN]; 48 }; 49 50 typedef struct dls_link_s dls_link_t; 51 52 struct dls_link_s { 53 char dl_name[MAXNAMELEN]; 54 char dl_dev[MAXNAMELEN]; 55 uint_t dl_port; 56 mac_handle_t dl_mh; 57 const mac_info_t *dl_mip; 58 mac_rx_handle_t dl_mrh; 59 mac_txloop_handle_t dl_mth; 60 ghte_t dl_hte; 61 uint_t dl_ref; 62 uint_t dl_macref; 63 ght_t dl_impl_hash; 64 mac_txloop_t dl_loopback; 65 uint_t dl_npromisc; 66 uint_t dl_nactive; 67 uint32_t dl_unknowns; 68 kmutex_t dl_lock; 69 }; 70 71 typedef struct dls_vlan_s { 72 char dv_name[IFNAMSIZ]; 73 ghte_t dv_hte; 74 uint_t dv_ref; 75 dls_link_t *dv_dlp; 76 uint16_t dv_id; 77 kstat_t *dv_ksp; 78 } dls_vlan_t; 79 80 typedef struct dls_impl_s dls_impl_t; 81 82 typedef mblk_t *(*dls_priv_header_t)(dls_impl_t *, 83 const uint8_t *, uint16_t, uint_t); 84 typedef void (*dls_priv_header_info_t)(dls_impl_t *, 85 mblk_t *, dls_header_info_t *); 86 87 struct dls_impl_s { 88 dls_impl_t *di_nextp; 89 dls_vlan_t *di_dvp; 90 mac_handle_t di_mh; 91 mac_notify_handle_t di_mnh; 92 const mac_info_t *di_mip; 93 krwlock_t di_lock; 94 uint16_t di_sap; 95 ghte_t di_hte; 96 uint_t di_promisc; 97 dls_multicst_addr_t *di_dmap; 98 dls_rx_t di_rx; 99 void *di_rx_arg; 100 dls_tx_t di_tx; 101 void *di_tx_arg; 102 boolean_t di_bound; 103 boolean_t di_removing; 104 boolean_t di_active; 105 uint8_t di_unicst_addr[MAXADDRLEN]; 106 dls_priv_header_t di_header; 107 dls_priv_header_info_t di_header_info; 108 }; 109 110 extern void dls_link_init(void); 111 extern int dls_link_fini(void); 112 extern int dls_link_hold(const char *, uint_t, dls_link_t **); 113 extern void dls_link_rele(dls_link_t *); 114 extern void dls_link_add(dls_link_t *, uint32_t, dls_impl_t *); 115 extern void dls_link_remove(dls_link_t *, dls_impl_t *); 116 extern int dls_mac_hold(dls_link_t *); 117 extern void dls_mac_rele(dls_link_t *); 118 119 extern void dls_stat_create(dls_vlan_t *); 120 extern void dls_stat_destroy(dls_vlan_t *); 121 122 extern void dls_vlan_init(void); 123 extern int dls_vlan_fini(void); 124 extern int dls_vlan_create(const char *, const char *, uint_t, 125 uint16_t); 126 extern int dls_vlan_destroy(const char *); 127 extern int dls_vlan_hold(const char *, dls_vlan_t **); 128 extern void dls_vlan_rele(dls_vlan_t *); 129 130 extern void dls_init(void); 131 extern int dls_fini(void); 132 extern boolean_t dls_accept(dls_impl_t *, const uint8_t *); 133 extern boolean_t dls_accept_loopback(dls_impl_t *, const uint8_t *); 134 135 #ifdef __cplusplus 136 } 137 #endif 138 139 #endif /* _SYS_DLS_IMPL_H */ 140