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> 38*1184Skrgopi #include <sys/dlpi.h> 39*1184Skrgopi #include <sys/dls_soft_ring.h> 400Sstevel@tonic-gate 410Sstevel@tonic-gate #ifdef __cplusplus 420Sstevel@tonic-gate extern "C" { 430Sstevel@tonic-gate #endif 440Sstevel@tonic-gate 450Sstevel@tonic-gate typedef struct dls_multicst_addr_s dls_multicst_addr_t; 460Sstevel@tonic-gate 470Sstevel@tonic-gate struct dls_multicst_addr_s { 480Sstevel@tonic-gate dls_multicst_addr_t *dma_nextp; 490Sstevel@tonic-gate uint8_t dma_addr[MAXADDRLEN]; 500Sstevel@tonic-gate }; 510Sstevel@tonic-gate 520Sstevel@tonic-gate typedef struct dls_link_s dls_link_t; 530Sstevel@tonic-gate 540Sstevel@tonic-gate struct dls_link_s { 550Sstevel@tonic-gate char dl_name[MAXNAMELEN]; 560Sstevel@tonic-gate char dl_dev[MAXNAMELEN]; 570Sstevel@tonic-gate uint_t dl_port; 580Sstevel@tonic-gate mac_handle_t dl_mh; 590Sstevel@tonic-gate const mac_info_t *dl_mip; 600Sstevel@tonic-gate mac_rx_handle_t dl_mrh; 610Sstevel@tonic-gate mac_txloop_handle_t dl_mth; 620Sstevel@tonic-gate uint_t dl_ref; 630Sstevel@tonic-gate uint_t dl_macref; 64269Sericheng mod_hash_t *dl_impl_hash; 65269Sericheng krwlock_t dl_impl_lock; 66269Sericheng uint_t dl_impl_count; 670Sstevel@tonic-gate mac_txloop_t dl_loopback; 6856Smeem kmutex_t dl_promisc_lock; 690Sstevel@tonic-gate uint_t dl_npromisc; 700Sstevel@tonic-gate uint_t dl_nactive; 710Sstevel@tonic-gate uint32_t dl_unknowns; 720Sstevel@tonic-gate kmutex_t dl_lock; 730Sstevel@tonic-gate }; 740Sstevel@tonic-gate 750Sstevel@tonic-gate typedef struct dls_vlan_s { 760Sstevel@tonic-gate char dv_name[IFNAMSIZ]; 770Sstevel@tonic-gate uint_t dv_ref; 780Sstevel@tonic-gate dls_link_t *dv_dlp; 790Sstevel@tonic-gate uint16_t dv_id; 800Sstevel@tonic-gate kstat_t *dv_ksp; 810Sstevel@tonic-gate } dls_vlan_t; 820Sstevel@tonic-gate 830Sstevel@tonic-gate typedef struct dls_impl_s dls_impl_t; 84269Sericheng typedef struct dls_head_s dls_head_t; 850Sstevel@tonic-gate 860Sstevel@tonic-gate typedef mblk_t *(*dls_priv_header_t)(dls_impl_t *, 870Sstevel@tonic-gate const uint8_t *, uint16_t, uint_t); 880Sstevel@tonic-gate typedef void (*dls_priv_header_info_t)(dls_impl_t *, 890Sstevel@tonic-gate mblk_t *, dls_header_info_t *); 900Sstevel@tonic-gate 910Sstevel@tonic-gate struct dls_impl_s { 920Sstevel@tonic-gate dls_impl_t *di_nextp; 93269Sericheng dls_head_t *di_headp; 940Sstevel@tonic-gate dls_vlan_t *di_dvp; 950Sstevel@tonic-gate mac_handle_t di_mh; 960Sstevel@tonic-gate mac_notify_handle_t di_mnh; 970Sstevel@tonic-gate const mac_info_t *di_mip; 980Sstevel@tonic-gate krwlock_t di_lock; 990Sstevel@tonic-gate uint16_t di_sap; 1000Sstevel@tonic-gate uint_t di_promisc; 1010Sstevel@tonic-gate dls_multicst_addr_t *di_dmap; 1020Sstevel@tonic-gate dls_rx_t di_rx; 1030Sstevel@tonic-gate void *di_rx_arg; 104*1184Skrgopi mac_resource_add_t di_ring_add; 10556Smeem const mac_txinfo_t *di_txinfo; 1060Sstevel@tonic-gate boolean_t di_bound; 1070Sstevel@tonic-gate boolean_t di_removing; 1080Sstevel@tonic-gate boolean_t di_active; 1090Sstevel@tonic-gate uint8_t di_unicst_addr[MAXADDRLEN]; 1100Sstevel@tonic-gate dls_priv_header_t di_header; 1110Sstevel@tonic-gate dls_priv_header_info_t di_header_info; 112*1184Skrgopi soft_ring_t **di_soft_ring_list; 113*1184Skrgopi uint_t di_soft_ring_size; 114*1184Skrgopi int di_soft_ring_fanout_type; 1150Sstevel@tonic-gate }; 1160Sstevel@tonic-gate 117269Sericheng struct dls_head_s { 118269Sericheng dls_impl_t *dh_list; 119269Sericheng uint_t dh_ref; 120269Sericheng mod_hash_key_t dh_key; 121269Sericheng }; 122269Sericheng 1230Sstevel@tonic-gate extern void dls_link_init(void); 1240Sstevel@tonic-gate extern int dls_link_fini(void); 1250Sstevel@tonic-gate extern int dls_link_hold(const char *, uint_t, dls_link_t **); 1260Sstevel@tonic-gate extern void dls_link_rele(dls_link_t *); 1270Sstevel@tonic-gate extern void dls_link_add(dls_link_t *, uint32_t, dls_impl_t *); 1280Sstevel@tonic-gate extern void dls_link_remove(dls_link_t *, dls_impl_t *); 1290Sstevel@tonic-gate extern int dls_mac_hold(dls_link_t *); 1300Sstevel@tonic-gate extern void dls_mac_rele(dls_link_t *); 1310Sstevel@tonic-gate 132*1184Skrgopi extern void dls_mac_stat_create(dls_vlan_t *); 133*1184Skrgopi extern void dls_mac_stat_destroy(dls_vlan_t *); 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate extern void dls_vlan_init(void); 1360Sstevel@tonic-gate extern int dls_vlan_fini(void); 1370Sstevel@tonic-gate extern int dls_vlan_create(const char *, const char *, uint_t, 1380Sstevel@tonic-gate uint16_t); 1390Sstevel@tonic-gate extern int dls_vlan_destroy(const char *); 140269Sericheng extern int dls_vlan_hold(const char *, dls_vlan_t **, boolean_t); 1410Sstevel@tonic-gate extern void dls_vlan_rele(dls_vlan_t *); 142269Sericheng extern int dls_vlan_walk(int (*)(dls_vlan_t *, void *), void *); 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate extern void dls_init(void); 1450Sstevel@tonic-gate extern int dls_fini(void); 146449Sericheng extern boolean_t dls_accept(dls_impl_t *, const uint8_t *, 147449Sericheng dls_rx_t *, void **); 148449Sericheng extern boolean_t dls_accept_loopback(dls_impl_t *, const uint8_t *, 149449Sericheng dls_rx_t *, void **); 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate #ifdef __cplusplus 1520Sstevel@tonic-gate } 1530Sstevel@tonic-gate #endif 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate #endif /* _SYS_DLS_IMPL_H */ 156