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> 35269Sericheng #include <sys/modhash.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 uint_t dl_ref; 610Sstevel@tonic-gate uint_t dl_macref; 62269Sericheng mod_hash_t *dl_impl_hash; 63269Sericheng krwlock_t dl_impl_lock; 64269Sericheng uint_t dl_impl_count; 650Sstevel@tonic-gate mac_txloop_t dl_loopback; 6656Smeem kmutex_t dl_promisc_lock; 670Sstevel@tonic-gate uint_t dl_npromisc; 680Sstevel@tonic-gate uint_t dl_nactive; 690Sstevel@tonic-gate uint32_t dl_unknowns; 700Sstevel@tonic-gate kmutex_t dl_lock; 710Sstevel@tonic-gate }; 720Sstevel@tonic-gate 730Sstevel@tonic-gate typedef struct dls_vlan_s { 740Sstevel@tonic-gate char dv_name[IFNAMSIZ]; 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; 82269Sericheng typedef struct dls_head_s dls_head_t; 830Sstevel@tonic-gate 840Sstevel@tonic-gate typedef mblk_t *(*dls_priv_header_t)(dls_impl_t *, 850Sstevel@tonic-gate const uint8_t *, uint16_t, uint_t); 860Sstevel@tonic-gate typedef void (*dls_priv_header_info_t)(dls_impl_t *, 870Sstevel@tonic-gate mblk_t *, dls_header_info_t *); 880Sstevel@tonic-gate 890Sstevel@tonic-gate struct dls_impl_s { 900Sstevel@tonic-gate dls_impl_t *di_nextp; 91269Sericheng dls_head_t *di_headp; 920Sstevel@tonic-gate dls_vlan_t *di_dvp; 930Sstevel@tonic-gate mac_handle_t di_mh; 940Sstevel@tonic-gate mac_notify_handle_t di_mnh; 950Sstevel@tonic-gate const mac_info_t *di_mip; 960Sstevel@tonic-gate krwlock_t di_lock; 970Sstevel@tonic-gate uint16_t di_sap; 980Sstevel@tonic-gate uint_t di_promisc; 990Sstevel@tonic-gate dls_multicst_addr_t *di_dmap; 1000Sstevel@tonic-gate dls_rx_t di_rx; 1010Sstevel@tonic-gate void *di_rx_arg; 10256Smeem const mac_txinfo_t *di_txinfo; 1030Sstevel@tonic-gate boolean_t di_bound; 1040Sstevel@tonic-gate boolean_t di_removing; 1050Sstevel@tonic-gate boolean_t di_active; 1060Sstevel@tonic-gate uint8_t di_unicst_addr[MAXADDRLEN]; 1070Sstevel@tonic-gate dls_priv_header_t di_header; 1080Sstevel@tonic-gate dls_priv_header_info_t di_header_info; 1090Sstevel@tonic-gate }; 1100Sstevel@tonic-gate 111269Sericheng struct dls_head_s { 112269Sericheng dls_impl_t *dh_list; 113269Sericheng uint_t dh_ref; 114269Sericheng mod_hash_key_t dh_key; 115269Sericheng }; 116269Sericheng 1170Sstevel@tonic-gate extern void dls_link_init(void); 1180Sstevel@tonic-gate extern int dls_link_fini(void); 1190Sstevel@tonic-gate extern int dls_link_hold(const char *, uint_t, dls_link_t **); 1200Sstevel@tonic-gate extern void dls_link_rele(dls_link_t *); 1210Sstevel@tonic-gate extern void dls_link_add(dls_link_t *, uint32_t, dls_impl_t *); 1220Sstevel@tonic-gate extern void dls_link_remove(dls_link_t *, dls_impl_t *); 1230Sstevel@tonic-gate extern int dls_mac_hold(dls_link_t *); 1240Sstevel@tonic-gate extern void dls_mac_rele(dls_link_t *); 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate extern void dls_stat_create(dls_vlan_t *); 1270Sstevel@tonic-gate extern void dls_stat_destroy(dls_vlan_t *); 1280Sstevel@tonic-gate 1290Sstevel@tonic-gate extern void dls_vlan_init(void); 1300Sstevel@tonic-gate extern int dls_vlan_fini(void); 1310Sstevel@tonic-gate extern int dls_vlan_create(const char *, const char *, uint_t, 1320Sstevel@tonic-gate uint16_t); 1330Sstevel@tonic-gate extern int dls_vlan_destroy(const char *); 134269Sericheng extern int dls_vlan_hold(const char *, dls_vlan_t **, boolean_t); 1350Sstevel@tonic-gate extern void dls_vlan_rele(dls_vlan_t *); 136269Sericheng extern int dls_vlan_walk(int (*)(dls_vlan_t *, void *), void *); 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate extern void dls_init(void); 1390Sstevel@tonic-gate extern int dls_fini(void); 140*449Sericheng extern boolean_t dls_accept(dls_impl_t *, const uint8_t *, 141*449Sericheng dls_rx_t *, void **); 142*449Sericheng extern boolean_t dls_accept_loopback(dls_impl_t *, const uint8_t *, 143*449Sericheng dls_rx_t *, void **); 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate #ifdef __cplusplus 1460Sstevel@tonic-gate } 1470Sstevel@tonic-gate #endif 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate #endif /* _SYS_DLS_IMPL_H */ 150