diff options
Diffstat (limited to 'usr/src/uts/common/sys/dls_impl.h')
-rw-r--r-- | usr/src/uts/common/sys/dls_impl.h | 101 |
1 files changed, 74 insertions, 27 deletions
diff --git a/usr/src/uts/common/sys/dls_impl.h b/usr/src/uts/common/sys/dls_impl.h index c2a2dcf24c..83bccd20bb 100644 --- a/usr/src/uts/common/sys/dls_impl.h +++ b/usr/src/uts/common/sys/dls_impl.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -71,16 +71,56 @@ struct dls_link_s { typedef struct dls_impl_s dls_impl_t; typedef struct dls_head_s dls_head_t; +/* + * The maximum length of an SPA (subnetwork point of attachment). It is of + * the form <macname/vid>. + */ +#define MAXSPALEN (MAXNAMELEN + 5) + typedef struct dls_vlan_s { - char dv_name[IFNAMSIZ]; - uint_t dv_ref; + /* + * The following fields will not change after dls_vlan_t creation. + */ dls_link_t *dv_dlp; uint16_t dv_id; + + /* + * Unique SPA (of the form <macname/vid>) identifying a data-link; + * is needed to avoid name collisions between an explicitly and + * implicitly created VLANs. + */ + char dv_spa[MAXSPALEN]; + + /* + * The ppa value of the associated device. Used to derive this link's + * devfs node name. + */ + uint_t dv_ppa; + + /* + * The dev_t used to access this dls_vlan_t. + */ + dev_t dv_dev; + + dev_info_t *dv_dip; kstat_t *dv_ksp; - minor_t dv_minor; - t_uscalar_t dv_ppa; + uint32_t dv_force : 1; + + /* + * The following fields are protected by dv_lock. + */ + kmutex_t dv_lock; + + /* + * Reference count of dls_impl_t plus explicit creation of the link + */ + uint_t dv_ref; + + /* + * The reference count of this vlan is opened in its own zone. + */ + uint_t dv_zone_ref; zoneid_t dv_zid; - dls_impl_t *dv_impl_list; } dls_vlan_t; struct dls_impl_s { @@ -98,14 +138,15 @@ struct dls_impl_s { void *di_rx_arg; mac_resource_add_t di_ring_add; const mac_txinfo_t *di_txinfo; - boolean_t di_bound; - boolean_t di_removing; - boolean_t di_active; + uint_t di_bound : 1, + di_removing : 1, + di_active : 1, + di_local : 1; + uint8_t di_unicst_addr[MAXMACADDRLEN]; soft_ring_t **di_soft_ring_list; uint_t di_soft_ring_size; - zoneid_t di_zid; - dls_impl_t *di_next_impl; + dls_dl_handle_t di_ddh; }; struct dls_head_s { @@ -121,37 +162,43 @@ extern void dls_link_rele(dls_link_t *); extern void dls_link_add(dls_link_t *, uint32_t, dls_impl_t *); extern void dls_link_remove(dls_link_t *, dls_impl_t *); extern int dls_link_header_info(dls_link_t *, mblk_t *, - mac_header_info_t *); + mac_header_info_t *); extern int dls_mac_hold(dls_link_t *); extern void dls_mac_rele(dls_link_t *); +extern boolean_t dls_mac_active_set(dls_link_t *); +extern void dls_mac_active_clear(dls_link_t *); extern void dls_mac_stat_create(dls_vlan_t *); extern void dls_mac_stat_destroy(dls_vlan_t *); extern void dls_vlan_init(void); extern int dls_vlan_fini(void); -extern int dls_vlan_create(const char *, const char *, uint16_t); -extern int dls_vlan_destroy(const char *); -extern int dls_vlan_hold(const char *, dls_vlan_t **, boolean_t); +extern int dls_vlan_hold(const char *, uint16_t, dls_vlan_t **, + boolean_t, boolean_t); +extern int dls_vlan_hold_by_dev(dev_t, dls_vlan_t **); extern void dls_vlan_rele(dls_vlan_t *); -extern int dls_vlan_walk(int (*)(dls_vlan_t *, void *), void *); -extern dev_info_t *dls_vlan_finddevinfo(dev_t); -extern int dls_vlan_ppa_from_minor(minor_t, t_uscalar_t *); -extern int dls_vlan_rele_by_name(const char *); -extern minor_t dls_minor_hold(boolean_t); -extern void dls_minor_rele(minor_t); -extern int dls_vlan_setzoneid(char *, zoneid_t, boolean_t); -extern int dls_vlan_getzoneid(char *, zoneid_t *); -extern void dls_vlan_add_impl(dls_vlan_t *, dls_impl_t *); -extern void dls_vlan_remove_impl(dls_vlan_t *, dls_impl_t *); +extern int dls_vlan_destroy(const char *, uint16_t); +extern int dls_vlan_create(const char *, uint16_t, boolean_t); +extern int dls_vlan_setzid(const char *, uint16_t, zoneid_t); +extern int dls_stat_update(kstat_t *, dls_vlan_t *, int); +extern int dls_stat_create(const char *, int, const char *, + int (*)(struct kstat *, int), void *, kstat_t **); + +extern int dls_devnet_open_by_dev(dev_t, dls_vlan_t **, + dls_dl_handle_t *); extern void dls_init(void); extern int dls_fini(void); extern void dls_link_txloop(void *, mblk_t *); extern boolean_t dls_accept(dls_impl_t *, mac_header_info_t *, - dls_rx_t *, void **); + dls_rx_t *, void **); extern boolean_t dls_accept_loopback(dls_impl_t *, mac_header_info_t *, - dls_rx_t *, void **); + dls_rx_t *, void **); + +extern void dls_mgmt_init(void); +extern void dls_mgmt_fini(void); + +extern int dls_mgmt_get_phydev(datalink_id_t, dev_t *); #ifdef __cplusplus } |