10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_DLS_IMPL_H 280Sstevel@tonic-gate #define _SYS_DLS_IMPL_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/stream.h> 330Sstevel@tonic-gate #include <sys/dls.h> 340Sstevel@tonic-gate #include <sys/mac.h> 350Sstevel@tonic-gate #include <sys/ght.h> 360Sstevel@tonic-gate #include <sys/kstat.h> 370Sstevel@tonic-gate #include <net/if.h> 380Sstevel@tonic-gate 390Sstevel@tonic-gate #ifdef __cplusplus 400Sstevel@tonic-gate extern "C" { 410Sstevel@tonic-gate #endif 420Sstevel@tonic-gate 430Sstevel@tonic-gate typedef struct dls_multicst_addr_s dls_multicst_addr_t; 440Sstevel@tonic-gate 450Sstevel@tonic-gate struct dls_multicst_addr_s { 460Sstevel@tonic-gate dls_multicst_addr_t *dma_nextp; 470Sstevel@tonic-gate uint8_t dma_addr[MAXADDRLEN]; 480Sstevel@tonic-gate }; 490Sstevel@tonic-gate 500Sstevel@tonic-gate typedef struct dls_link_s dls_link_t; 510Sstevel@tonic-gate 520Sstevel@tonic-gate struct dls_link_s { 530Sstevel@tonic-gate char dl_name[MAXNAMELEN]; 540Sstevel@tonic-gate char dl_dev[MAXNAMELEN]; 550Sstevel@tonic-gate uint_t dl_port; 560Sstevel@tonic-gate mac_handle_t dl_mh; 570Sstevel@tonic-gate const mac_info_t *dl_mip; 580Sstevel@tonic-gate mac_rx_handle_t dl_mrh; 590Sstevel@tonic-gate mac_txloop_handle_t dl_mth; 600Sstevel@tonic-gate ghte_t dl_hte; 610Sstevel@tonic-gate uint_t dl_ref; 620Sstevel@tonic-gate uint_t dl_macref; 630Sstevel@tonic-gate ght_t dl_impl_hash; 640Sstevel@tonic-gate mac_txloop_t dl_loopback; 65*56Smeem kmutex_t dl_promisc_lock; 660Sstevel@tonic-gate uint_t dl_npromisc; 670Sstevel@tonic-gate uint_t dl_nactive; 680Sstevel@tonic-gate uint32_t dl_unknowns; 690Sstevel@tonic-gate kmutex_t dl_lock; 700Sstevel@tonic-gate }; 710Sstevel@tonic-gate 720Sstevel@tonic-gate typedef struct dls_vlan_s { 730Sstevel@tonic-gate char dv_name[IFNAMSIZ]; 740Sstevel@tonic-gate ghte_t dv_hte; 750Sstevel@tonic-gate uint_t dv_ref; 760Sstevel@tonic-gate dls_link_t *dv_dlp; 770Sstevel@tonic-gate uint16_t dv_id; 780Sstevel@tonic-gate kstat_t *dv_ksp; 790Sstevel@tonic-gate } dls_vlan_t; 800Sstevel@tonic-gate 810Sstevel@tonic-gate typedef struct dls_impl_s dls_impl_t; 820Sstevel@tonic-gate 830Sstevel@tonic-gate typedef mblk_t *(*dls_priv_header_t)(dls_impl_t *, 840Sstevel@tonic-gate const uint8_t *, uint16_t, uint_t); 850Sstevel@tonic-gate typedef void (*dls_priv_header_info_t)(dls_impl_t *, 860Sstevel@tonic-gate mblk_t *, dls_header_info_t *); 870Sstevel@tonic-gate 880Sstevel@tonic-gate struct dls_impl_s { 890Sstevel@tonic-gate dls_impl_t *di_nextp; 900Sstevel@tonic-gate dls_vlan_t *di_dvp; 910Sstevel@tonic-gate mac_handle_t di_mh; 920Sstevel@tonic-gate mac_notify_handle_t di_mnh; 930Sstevel@tonic-gate const mac_info_t *di_mip; 940Sstevel@tonic-gate krwlock_t di_lock; 950Sstevel@tonic-gate uint16_t di_sap; 960Sstevel@tonic-gate ghte_t di_hte; 970Sstevel@tonic-gate uint_t di_promisc; 980Sstevel@tonic-gate dls_multicst_addr_t *di_dmap; 990Sstevel@tonic-gate dls_rx_t di_rx; 1000Sstevel@tonic-gate void *di_rx_arg; 101*56Smeem const mac_txinfo_t *di_txinfo; 1020Sstevel@tonic-gate boolean_t di_bound; 1030Sstevel@tonic-gate boolean_t di_removing; 1040Sstevel@tonic-gate boolean_t di_active; 1050Sstevel@tonic-gate uint8_t di_unicst_addr[MAXADDRLEN]; 1060Sstevel@tonic-gate dls_priv_header_t di_header; 1070Sstevel@tonic-gate dls_priv_header_info_t di_header_info; 1080Sstevel@tonic-gate }; 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate extern void dls_link_init(void); 1110Sstevel@tonic-gate extern int dls_link_fini(void); 1120Sstevel@tonic-gate extern int dls_link_hold(const char *, uint_t, dls_link_t **); 1130Sstevel@tonic-gate extern void dls_link_rele(dls_link_t *); 1140Sstevel@tonic-gate extern void dls_link_add(dls_link_t *, uint32_t, dls_impl_t *); 1150Sstevel@tonic-gate extern void dls_link_remove(dls_link_t *, dls_impl_t *); 1160Sstevel@tonic-gate extern int dls_mac_hold(dls_link_t *); 1170Sstevel@tonic-gate extern void dls_mac_rele(dls_link_t *); 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate extern void dls_stat_create(dls_vlan_t *); 1200Sstevel@tonic-gate extern void dls_stat_destroy(dls_vlan_t *); 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate extern void dls_vlan_init(void); 1230Sstevel@tonic-gate extern int dls_vlan_fini(void); 1240Sstevel@tonic-gate extern int dls_vlan_create(const char *, const char *, uint_t, 1250Sstevel@tonic-gate uint16_t); 1260Sstevel@tonic-gate extern int dls_vlan_destroy(const char *); 1270Sstevel@tonic-gate extern int dls_vlan_hold(const char *, dls_vlan_t **); 1280Sstevel@tonic-gate extern void dls_vlan_rele(dls_vlan_t *); 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate extern void dls_init(void); 1310Sstevel@tonic-gate extern int dls_fini(void); 1320Sstevel@tonic-gate extern boolean_t dls_accept(dls_impl_t *, const uint8_t *); 1330Sstevel@tonic-gate extern boolean_t dls_accept_loopback(dls_impl_t *, const uint8_t *); 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate #ifdef __cplusplus 1360Sstevel@tonic-gate } 1370Sstevel@tonic-gate #endif 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate #endif /* _SYS_DLS_IMPL_H */ 140