1da14cebeSEric Cheng /* 2da14cebeSEric Cheng * CDDL HEADER START 3da14cebeSEric Cheng * 4da14cebeSEric Cheng * The contents of this file are subject to the terms of the 5da14cebeSEric Cheng * Common Development and Distribution License (the "License"). 6da14cebeSEric Cheng * You may not use this file except in compliance with the License. 7da14cebeSEric Cheng * 8da14cebeSEric Cheng * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9da14cebeSEric Cheng * or http://www.opensolaris.org/os/licensing. 10da14cebeSEric Cheng * See the License for the specific language governing permissions 11da14cebeSEric Cheng * and limitations under the License. 12da14cebeSEric Cheng * 13da14cebeSEric Cheng * When distributing Covered Code, include this CDDL HEADER in each 14da14cebeSEric Cheng * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15da14cebeSEric Cheng * If applicable, add the following below this CDDL HEADER, with the 16da14cebeSEric Cheng * fields enclosed by brackets "[]" replaced with your own identifying 17da14cebeSEric Cheng * information: Portions Copyright [yyyy] [name of copyright owner] 18da14cebeSEric Cheng * 19da14cebeSEric Cheng * CDDL HEADER END 20da14cebeSEric Cheng */ 21da14cebeSEric Cheng /* 220dc2366fSVenugopal Iyer * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 23da14cebeSEric Cheng * Use is subject to license terms. 24098d2c75SRobert Mustacchi * Copyright (c) 2012, Joyent, Inc. All rights reserved. 25da14cebeSEric Cheng */ 263bb0cb70SBryan Cantrill /* 273bb0cb70SBryan Cantrill * Copyright (c) 2013, Joyent, Inc. All rights reserved. 283bb0cb70SBryan Cantrill */ 29da14cebeSEric Cheng 30da14cebeSEric Cheng #ifndef _SYS_MAC_CLIENT_IMPL_H 31da14cebeSEric Cheng #define _SYS_MAC_CLIENT_IMPL_H 32da14cebeSEric Cheng 33da14cebeSEric Cheng #include <sys/modhash.h> 34da14cebeSEric Cheng #include <sys/mac_client.h> 35da14cebeSEric Cheng #include <sys/mac_provider.h> 36da14cebeSEric Cheng #include <sys/mac.h> 37da14cebeSEric Cheng #include <sys/mac_impl.h> 380dc2366fSVenugopal Iyer #include <sys/mac_stat.h> 39da14cebeSEric Cheng #include <net/if.h> 40da14cebeSEric Cheng #include <sys/mac_flow_impl.h> 41da14cebeSEric Cheng 42da14cebeSEric Cheng #ifdef __cplusplus 43da14cebeSEric Cheng extern "C" { 44da14cebeSEric Cheng #endif 45da14cebeSEric Cheng 46da14cebeSEric Cheng extern kmem_cache_t *mac_client_impl_cache; 47da14cebeSEric Cheng extern kmem_cache_t *mac_unicast_impl_cache; 48da14cebeSEric Cheng extern kmem_cache_t *mac_promisc_impl_cache; 49da14cebeSEric Cheng 50da14cebeSEric Cheng /* 51da14cebeSEric Cheng * Need a list to chain all VIDs assigned to a client. Normally, one 52da14cebeSEric Cheng * MAC client only has one VID. But vsw might need multiple VIDs. 53da14cebeSEric Cheng */ 54da14cebeSEric Cheng typedef struct mac_unicast_impl_s { /* Protected by */ 55da14cebeSEric Cheng struct mac_unicast_impl_s *mui_next; /* SL */ 56da14cebeSEric Cheng mac_address_t *mui_map; /* SL */ 57da14cebeSEric Cheng uint16_t mui_vid; /* SL */ 58da14cebeSEric Cheng } mac_unicast_impl_t; 59da14cebeSEric Cheng 60da14cebeSEric Cheng #define MAC_CLIENT_FLAGS_PRIMARY 0X0001 61da14cebeSEric Cheng #define MAC_CLIENT_FLAGS_VNIC_PRIMARY 0x0002 62fc4e975dSVenugopal Iyer #define MAC_CLIENT_FLAGS_MULTI_PRIMARY 0x0004 63fc4e975dSVenugopal Iyer #define MAC_CLIENT_FLAGS_PASSIVE_PRIMARY 0x0008 64da14cebeSEric Cheng 65da14cebeSEric Cheng /* 66da14cebeSEric Cheng * One of these is instantiated per MAC client promiscuous callback. 67da14cebeSEric Cheng * 68da14cebeSEric Cheng * Each element of this structure belongs to two linked list. One 69da14cebeSEric Cheng * for the mac_client_impl_t (mci_promisc_list) which created allocated 70da14cebeSEric Cheng * the callback, the other for the mac_impl_t (mi_promisc_list) corresponding 71da14cebeSEric Cheng * to the MAC client. 72da14cebeSEric Cheng * The former allows us to do bookkeeping, the latter allows us 73da14cebeSEric Cheng * to more efficiently dispatch packets to the promiscuous callbacks. 74da14cebeSEric Cheng */ 75da14cebeSEric Cheng typedef struct mac_promisc_impl_s { /* Protected by */ 76da14cebeSEric Cheng mac_cb_t mpi_mci_link; /* mi_promisc_lock */ 77da14cebeSEric Cheng mac_cb_t mpi_mi_link; /* mi_promisc_lock */ 78da14cebeSEric Cheng mac_client_promisc_type_t mpi_type; /* WO */ 79da14cebeSEric Cheng mac_rx_t mpi_fn; /* WO */ 80da14cebeSEric Cheng void *mpi_arg; /* WO */ 81da14cebeSEric Cheng struct mac_client_impl_s *mpi_mcip; /* WO */ 82da14cebeSEric Cheng boolean_t mpi_no_tx_loop; /* WO */ 83da14cebeSEric Cheng boolean_t mpi_no_phys; /* WO */ 84ae6aa22aSVenugopal Iyer boolean_t mpi_strip_vlan_tag; /* WO */ 850a0e9771SDarren Reed boolean_t mpi_no_copy; /* WO */ 86da14cebeSEric Cheng } mac_promisc_impl_t; 87da14cebeSEric Cheng 88da14cebeSEric Cheng typedef union mac_tx_percpu_s { 89da14cebeSEric Cheng struct { 90da14cebeSEric Cheng kmutex_t _pcpu_tx_lock; 91da14cebeSEric Cheng uint_t _pcpu_tx_refcnt; 92da14cebeSEric Cheng } pcpu_lr; 93da14cebeSEric Cheng uchar_t pcpu_pad[64]; 94da14cebeSEric Cheng } mac_tx_percpu_t; 95da14cebeSEric Cheng 96da14cebeSEric Cheng #define pcpu_tx_lock pcpu_lr._pcpu_tx_lock 97da14cebeSEric Cheng #define pcpu_tx_refcnt pcpu_lr._pcpu_tx_refcnt 98da14cebeSEric Cheng 99da14cebeSEric Cheng /* 100*4e6f6c83SCody Peter Mello * One of these is instantiated for each MAC client. 101da14cebeSEric Cheng */ 102da14cebeSEric Cheng struct mac_client_impl_s { /* Protected by */ 103da14cebeSEric Cheng struct mac_client_impl_s *mci_client_next; /* mi_rw_lock */ 104da14cebeSEric Cheng char mci_name[MAXNAMELEN]; /* mi_rw_lock */ 105da14cebeSEric Cheng /* 106da14cebeSEric Cheng * This flow entry will contain all the internal constructs 107da14cebeSEric Cheng * such as SRS etc. for this MAC client. The MAC client may 108da14cebeSEric Cheng * have more than one flow corresponding to each upper client 109da14cebeSEric Cheng * sharing this mac_client_impl_t. 110da14cebeSEric Cheng */ 111da14cebeSEric Cheng flow_entry_t *mci_flent; /* mi_rw_lock */ 112da14cebeSEric Cheng struct mac_impl_s *mci_mip; /* WO */ 113da14cebeSEric Cheng /* 114da14cebeSEric Cheng * If this is a client that has a pass thru MAC (e.g. a VNIC), 115da14cebeSEric Cheng * then we also keep the handle for the client's upper MAC. 116da14cebeSEric Cheng */ 117da14cebeSEric Cheng struct mac_impl_s *mci_upper_mip; /* WO */ 118da14cebeSEric Cheng 119da14cebeSEric Cheng uint32_t mci_state_flags; /* WO */ 120da14cebeSEric Cheng mac_rx_t mci_rx_fn; /* Rx Quiescence */ 121da14cebeSEric Cheng void *mci_rx_arg; /* Rx Quiescence */ 122da14cebeSEric Cheng mac_direct_rx_t mci_direct_rx_fn; /* SL */ 123da14cebeSEric Cheng void *mci_direct_rx_arg; /* SL */ 124fc4e975dSVenugopal Iyer mac_rx_t mci_rx_p_fn; /* Rx Quiescence */ 125fc4e975dSVenugopal Iyer void *mci_rx_p_arg; /* Rx Quiescence */ 126fc4e975dSVenugopal Iyer void *mci_p_unicast_list; 127da14cebeSEric Cheng 128da14cebeSEric Cheng mac_cb_t *mci_promisc_list; /* mi_promisc_lock */ 129da14cebeSEric Cheng 130da14cebeSEric Cheng mac_address_t *mci_unicast; 131da14cebeSEric Cheng uint32_t mci_flags; /* SL */ 132da14cebeSEric Cheng krwlock_t mci_rw_lock; 133da14cebeSEric Cheng mac_unicast_impl_t *mci_unicast_list; /* mci_rw_lock */ 134da14cebeSEric Cheng /* 135da14cebeSEric Cheng * The mac_client_impl_t may be shared by multiple clients, i.e 136da14cebeSEric Cheng * multiple VLANs sharing the same MAC client. In this case the 137da14cebeSEric Cheng * address/vid tubles differ and are each associated with their 138da14cebeSEric Cheng * own flow entry, but the rest underlying components SRS, etc, 139da14cebeSEric Cheng * are common. 140da14cebeSEric Cheng */ 141da14cebeSEric Cheng flow_entry_t *mci_flent_list; /* mci_rw_lock */ 142da14cebeSEric Cheng uint_t mci_nflents; /* mci_rw_lock */ 143da14cebeSEric Cheng uint_t mci_nvids; /* mci_rw_lock */ 1443bb0cb70SBryan Cantrill volatile uint32_t mci_vidcache; /* VID cache */ 145da14cebeSEric Cheng 146da14cebeSEric Cheng /* Resource Management Functions */ 147da14cebeSEric Cheng mac_resource_add_t mci_resource_add; /* SL */ 148da14cebeSEric Cheng mac_resource_remove_t mci_resource_remove; /* SL */ 149da14cebeSEric Cheng mac_resource_quiesce_t mci_resource_quiesce; /* SL */ 150da14cebeSEric Cheng mac_resource_restart_t mci_resource_restart; /* SL */ 151da14cebeSEric Cheng mac_resource_bind_t mci_resource_bind; /* SL */ 152da14cebeSEric Cheng void *mci_resource_arg; /* SL */ 153da14cebeSEric Cheng 154da14cebeSEric Cheng 155da14cebeSEric Cheng /* Tx notify callback */ 156da14cebeSEric Cheng kmutex_t mci_tx_cb_lock; 157da14cebeSEric Cheng mac_cb_info_t mci_tx_notify_cb_info; /* cb list info */ 158da14cebeSEric Cheng mac_cb_t *mci_tx_notify_cb_list; /* The cb list */ 159da14cebeSEric Cheng uintptr_t mci_tx_notify_id; 160da14cebeSEric Cheng 161da14cebeSEric Cheng /* per MAC client stats */ /* None */ 1620dc2366fSVenugopal Iyer mac_misc_stats_t mci_misc_stat; 163da14cebeSEric Cheng 164da14cebeSEric Cheng flow_tab_t *mci_subflow_tab; /* Rx quiescence */ 165da14cebeSEric Cheng 166da14cebeSEric Cheng /* 167da14cebeSEric Cheng * Priority range for this MAC client. This the range 168da14cebeSEric Cheng * corresponding to the priority configured (nr_flow_priority). 169da14cebeSEric Cheng */ 170da14cebeSEric Cheng pri_t mci_min_pri; 171da14cebeSEric Cheng pri_t mci_max_pri; 172da14cebeSEric Cheng 173da14cebeSEric Cheng /* 174da14cebeSEric Cheng * Hybrid I/O related definitions. 175da14cebeSEric Cheng */ 176da14cebeSEric Cheng mac_share_handle_t mci_share; 177da14cebeSEric Cheng 178da14cebeSEric Cheng /* for multicast support */ 179da14cebeSEric Cheng struct mac_mcast_addrs_s *mci_mcast_addrs; /* mi_rw_lock */ 180da14cebeSEric Cheng 181da14cebeSEric Cheng /* 1820dc2366fSVenugopal Iyer * Mac protection related fields 1830dc2366fSVenugopal Iyer */ 1840dc2366fSVenugopal Iyer kmutex_t mci_protect_lock; 1850dc2366fSVenugopal Iyer uint32_t mci_protect_flags; /* SL */ 186*4e6f6c83SCody Peter Mello in6_addr_t mci_v6_mac_token; /* SL */ 1870dc2366fSVenugopal Iyer in6_addr_t mci_v6_local_addr; /* SL */ 1880dc2366fSVenugopal Iyer avl_tree_t mci_v4_pending_txn; /* mci_protect_lock */ 1890dc2366fSVenugopal Iyer avl_tree_t mci_v4_completed_txn; /* mci_protect_lock */ 1900dc2366fSVenugopal Iyer avl_tree_t mci_v4_dyn_ip; /* mci_protect_lock */ 1910dc2366fSVenugopal Iyer avl_tree_t mci_v6_pending_txn; /* mci_protect_lock */ 1920dc2366fSVenugopal Iyer avl_tree_t mci_v6_cid; /* mci_protect_lock */ 1930dc2366fSVenugopal Iyer avl_tree_t mci_v6_dyn_ip; /* mci_protect_lock */ 194*4e6f6c83SCody Peter Mello avl_tree_t mci_v6_slaac_ip; /* mci_protect_lock */ 1950dc2366fSVenugopal Iyer timeout_id_t mci_txn_cleanup_tid; /* mci_protect_lock */ 1960dc2366fSVenugopal Iyer 1970dc2366fSVenugopal Iyer /* 198da14cebeSEric Cheng * Protected by mci_tx_pcpu[0].pcpu_tx_lock 199da14cebeSEric Cheng */ 200da14cebeSEric Cheng uint_t mci_tx_flag; 201da14cebeSEric Cheng kcondvar_t mci_tx_cv; 202da14cebeSEric Cheng 203da14cebeSEric Cheng /* Must be last in the structure for dynamic sizing */ 204da14cebeSEric Cheng mac_tx_percpu_t mci_tx_pcpu[1]; /* SL */ 205da14cebeSEric Cheng }; 206da14cebeSEric Cheng 207da14cebeSEric Cheng #define MAC_CLIENT_IMPL_SIZE \ 208da14cebeSEric Cheng (sizeof (mac_client_impl_t) + \ 209da14cebeSEric Cheng (mac_tx_percpu_cnt * sizeof (mac_tx_percpu_t))) 210da14cebeSEric Cheng 211da14cebeSEric Cheng extern int mac_tx_percpu_cnt; 212da14cebeSEric Cheng 213da14cebeSEric Cheng #define MCIP_TX_SRS(mcip) \ 214da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? NULL : (mcip)->mci_flent->fe_tx_srs) 215da14cebeSEric Cheng 216da14cebeSEric Cheng /* Defensive coding, non-null mcip_flent could be an assert */ 217da14cebeSEric Cheng 218da14cebeSEric Cheng #define MCIP_DATAPATH_SETUP(mcip) \ 219da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? B_FALSE : \ 220da14cebeSEric Cheng !((mcip)->mci_flent->fe_flags & FE_MC_NO_DATAPATH)) 221da14cebeSEric Cheng 222da14cebeSEric Cheng #define MCIP_RESOURCE_PROPS(mcip) \ 223da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? NULL : \ 224da14cebeSEric Cheng &(mcip)->mci_flent->fe_resource_props) 225da14cebeSEric Cheng 226da14cebeSEric Cheng #define MCIP_EFFECTIVE_PROPS(mcip) \ 227da14cebeSEric Cheng (mcip->mci_flent == NULL ? NULL : \ 228da14cebeSEric Cheng &(mcip)->mci_flent->fe_effective_props) 229da14cebeSEric Cheng 230da14cebeSEric Cheng #define MCIP_RESOURCE_PROPS_MASK(mcip) \ 231da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? 0 : \ 232da14cebeSEric Cheng (mcip)->mci_flent->fe_resource_props.mrp_mask) 233da14cebeSEric Cheng 234da14cebeSEric Cheng #define MCIP_RESOURCE_PROPS_MAXBW(mcip) \ 235da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? 0 : \ 236da14cebeSEric Cheng (mcip)->mci_flent->fe_resource_props.mrp_maxbw) 237da14cebeSEric Cheng 238da14cebeSEric Cheng #define MCIP_RESOURCE_PROPS_PRIORITY(mcip) \ 239da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? 0 : \ 240da14cebeSEric Cheng (mcip)->mci_flent->fe_resource_props.mrp_priority) 241da14cebeSEric Cheng 242da14cebeSEric Cheng #define MCIP_RESOURCE_PROPS_CPUS(mcip) \ 243da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? 0 : \ 244da14cebeSEric Cheng &(mcip)->mci_flent->fe_resource_props.mrp_cpus) 245da14cebeSEric Cheng 246da14cebeSEric Cheng #define MCIP_RESOURCE_PROPS_NCPUS(mcip) \ 247da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? 0 : \ 248da14cebeSEric Cheng (mcip)->mci_flent->fe_resource_props.mrp_ncpus) 249da14cebeSEric Cheng 250da14cebeSEric Cheng #define MCIP_RESOURCE_PROPS_CPU(mcip) \ 251da14cebeSEric Cheng ((mcip)->mci_flent == NULL ? 0 : \ 252da14cebeSEric Cheng (mcip)->mci_flent->fe_resource_props.mrp_ncpu) 253da14cebeSEric Cheng 254da14cebeSEric Cheng /* 255da14cebeSEric Cheng * We validate the VLAN id of the packet w.r.t the client's vid, 256da14cebeSEric Cheng * if required (i.e. !MCIS_DISABLE_TX_VID_CHECK). DLS clients 257da14cebeSEric Cheng * will have MCIS_DISABLE_TX_VID_CHECK set. 258da14cebeSEric Cheng * (In the case of aggr when we get back packets, due to 259da14cebeSEric Cheng * the underlying driver being flow controlled, we won't 260da14cebeSEric Cheng * drop the packet even if it is VLAN tagged as we 261da14cebeSEric Cheng * don't set MCIS_DISABLE_TX_VID_CHECK for an aggr.) 262da14cebeSEric Cheng */ 263da14cebeSEric Cheng #define MAC_VID_CHECK_NEEDED(mcip) \ 264da14cebeSEric Cheng (((mcip)->mci_state_flags & MCIS_DISABLE_TX_VID_CHECK) == 0 && \ 265da14cebeSEric Cheng (mcip)->mci_mip->mi_info.mi_nativemedia == DL_ETHER) 266da14cebeSEric Cheng 267da14cebeSEric Cheng #define MAC_VID_CHECK(mcip, mp, err) { \ 268da14cebeSEric Cheng if (ntohs(((struct ether_header *)(mp)->b_rptr)->ether_type) == \ 269da14cebeSEric Cheng ETHERTYPE_VLAN) { \ 270da14cebeSEric Cheng /* \ 271da14cebeSEric Cheng * err is set to EINVAL (so the caller can take the \ 272da14cebeSEric Cheng * appropriate action. e.g. freemsg()) for two cases: \ 273da14cebeSEric Cheng * -client is not responsible for filling in the vid. \ 274da14cebeSEric Cheng * -client is responsible for filling in the vid, but \ 275da14cebeSEric Cheng * the vid doesn't match the vid of the MAC client. \ 276da14cebeSEric Cheng */ \ 277da14cebeSEric Cheng (err) = EINVAL; \ 278da14cebeSEric Cheng if (((mcip)->mci_state_flags & MCIS_TAG_DISABLE) != 0) {\ 279da14cebeSEric Cheng struct ether_vlan_header *evhp; \ 280da14cebeSEric Cheng uint16_t vlanid; \ 281da14cebeSEric Cheng \ 282da14cebeSEric Cheng evhp = (struct ether_vlan_header *)(mp)->b_rptr;\ 283da14cebeSEric Cheng vlanid = VLAN_ID(ntohs(evhp->ether_tci)); \ 284da14cebeSEric Cheng if (mac_client_check_flow_vid((mcip), vlanid)) \ 285da14cebeSEric Cheng (err) = 0; \ 286da14cebeSEric Cheng } \ 287da14cebeSEric Cheng } \ 288da14cebeSEric Cheng } 289da14cebeSEric Cheng 2903bb0cb70SBryan Cantrill /* 2913bb0cb70SBryan Cantrill * To allow the hot path to not grab any additional locks, we keep a single 2923bb0cb70SBryan Cantrill * entry VLAN ID cache that caches whether or not a given VID belongs to a 2933bb0cb70SBryan Cantrill * MAC client. 2943bb0cb70SBryan Cantrill */ 2953bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_VALIDSHIFT 31 2963bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_VIDSHIFT 1 2973bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_VIDMASK (UINT16_MAX << MCIP_VIDCACHE_VIDSHIFT) 2983bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_BOOLSHIFT 0 2993bb0cb70SBryan Cantrill 3003bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_INVALID 0 3013bb0cb70SBryan Cantrill 3023bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_CACHE(vid, bool) \ 3033bb0cb70SBryan Cantrill ((1U << MCIP_VIDCACHE_VALIDSHIFT) | \ 3043bb0cb70SBryan Cantrill ((vid) << MCIP_VIDCACHE_VIDSHIFT) | \ 3053bb0cb70SBryan Cantrill ((bool) ? (1U << MCIP_VIDCACHE_BOOLSHIFT) : 0)) 3063bb0cb70SBryan Cantrill 3073bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_ISVALID(v) ((v) & (1U << MCIP_VIDCACHE_VALIDSHIFT)) 3083bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_VID(v) \ 3093bb0cb70SBryan Cantrill (((v) & MCIP_VIDCACHE_VIDMASK) >> MCIP_VIDCACHE_VIDSHIFT) 3103bb0cb70SBryan Cantrill #define MCIP_VIDCACHE_BOOL(v) ((v) & (1U << MCIP_VIDCACHE_BOOLSHIFT)) 3113bb0cb70SBryan Cantrill 312da14cebeSEric Cheng #define MAC_TAG_NEEDED(mcip) \ 313da14cebeSEric Cheng (((mcip)->mci_state_flags & MCIS_TAG_DISABLE) == 0 && \ 314da14cebeSEric Cheng (mcip)->mci_nvids == 1) \ 315da14cebeSEric Cheng 316da14cebeSEric Cheng /* MCI state flags */ 317da14cebeSEric Cheng #define MCIS_IS_VNIC 0x0001 318da14cebeSEric Cheng #define MCIS_EXCLUSIVE 0x0002 319da14cebeSEric Cheng #define MCIS_TAG_DISABLE 0x0004 320da14cebeSEric Cheng #define MCIS_STRIP_DISABLE 0x0008 321da14cebeSEric Cheng #define MCIS_IS_AGGR_PORT 0x0010 322da14cebeSEric Cheng #define MCIS_CLIENT_POLL_CAPABLE 0x0020 323da14cebeSEric Cheng #define MCIS_DESC_LOGGED 0x0040 324da14cebeSEric Cheng #define MCIS_SHARE_BOUND 0x0080 3250dc2366fSVenugopal Iyer #define MCIS_DISABLE_TX_VID_CHECK 0x0100 3260dc2366fSVenugopal Iyer #define MCIS_USE_DATALINK_NAME 0x0200 3270dc2366fSVenugopal Iyer #define MCIS_UNICAST_HW 0x0400 3280dc2366fSVenugopal Iyer #define MCIS_IS_AGGR 0x0800 3290dc2366fSVenugopal Iyer #define MCIS_RX_BYPASS_DISABLE 0x1000 3300dc2366fSVenugopal Iyer #define MCIS_NO_UNICAST_ADDR 0x2000 3310dc2366fSVenugopal Iyer 3320dc2366fSVenugopal Iyer /* Mac protection flags */ 3330dc2366fSVenugopal Iyer #define MPT_FLAG_V6_LOCAL_ADDR_SET 0x0001 334098d2c75SRobert Mustacchi #define MPT_FLAG_PROMISC_FILTERED 0x0002 335da14cebeSEric Cheng 336da14cebeSEric Cheng /* in mac_client.c */ 337da14cebeSEric Cheng extern void mac_promisc_client_dispatch(mac_client_impl_t *, mblk_t *); 338da14cebeSEric Cheng extern void mac_client_init(void); 339da14cebeSEric Cheng extern void mac_client_fini(void); 340da14cebeSEric Cheng extern void mac_promisc_dispatch(mac_impl_t *, mblk_t *, 341da14cebeSEric Cheng mac_client_impl_t *); 342da14cebeSEric Cheng 3430dc2366fSVenugopal Iyer extern int mac_validate_props(mac_impl_t *, mac_resource_props_t *); 344da14cebeSEric Cheng 345da14cebeSEric Cheng extern mac_client_impl_t *mac_vnic_lower(mac_impl_t *); 346da14cebeSEric Cheng extern mac_client_impl_t *mac_primary_client_handle(mac_impl_t *); 347da14cebeSEric Cheng extern uint16_t i_mac_flow_vid(flow_entry_t *); 348da14cebeSEric Cheng extern boolean_t i_mac_capab_get(mac_handle_t, mac_capab_t, void *); 349da14cebeSEric Cheng 350da14cebeSEric Cheng extern void mac_unicast_update_clients(mac_impl_t *, mac_address_t *); 351da14cebeSEric Cheng extern void mac_update_resources(mac_resource_props_t *, 352da14cebeSEric Cheng mac_resource_props_t *, boolean_t); 353da14cebeSEric Cheng 354da14cebeSEric Cheng boolean_t mac_client_check_flow_vid(mac_client_impl_t *, uint16_t); 355da14cebeSEric Cheng 356da14cebeSEric Cheng extern boolean_t mac_is_primary_client(mac_client_impl_t *); 357da14cebeSEric Cheng 3580dc2366fSVenugopal Iyer extern int mac_client_set_rings_prop(mac_client_impl_t *, 3590dc2366fSVenugopal Iyer mac_resource_props_t *, mac_resource_props_t *); 3600dc2366fSVenugopal Iyer extern void mac_set_prim_vlan_rings(mac_impl_t *, mac_resource_props_t *); 3610dc2366fSVenugopal Iyer 362da14cebeSEric Cheng #ifdef __cplusplus 363da14cebeSEric Cheng } 364da14cebeSEric Cheng #endif 365da14cebeSEric Cheng 366da14cebeSEric Cheng #endif /* _SYS_MAC_CLIENT_IMPL_H */ 367