18275SEric Cheng /* 28275SEric Cheng * CDDL HEADER START 38275SEric Cheng * 48275SEric Cheng * The contents of this file are subject to the terms of the 58275SEric Cheng * Common Development and Distribution License (the "License"). 68275SEric Cheng * You may not use this file except in compliance with the License. 78275SEric Cheng * 88275SEric Cheng * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 98275SEric Cheng * or http://www.opensolaris.org/os/licensing. 108275SEric Cheng * See the License for the specific language governing permissions 118275SEric Cheng * and limitations under the License. 128275SEric Cheng * 138275SEric Cheng * When distributing Covered Code, include this CDDL HEADER in each 148275SEric Cheng * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 158275SEric Cheng * If applicable, add the following below this CDDL HEADER, with the 168275SEric Cheng * fields enclosed by brackets "[]" replaced with your own identifying 178275SEric Cheng * information: Portions Copyright [yyyy] [name of copyright owner] 188275SEric Cheng * 198275SEric Cheng * CDDL HEADER END 208275SEric Cheng */ 218275SEric Cheng 228275SEric Cheng /* 238558SGirish.Moodalbail@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 248275SEric Cheng * Use is subject to license terms. 258275SEric Cheng */ 268275SEric Cheng 278275SEric Cheng /* 288275SEric Cheng * This file contains *private* MAC API definitions. This header file 298275SEric Cheng * should only be included by kernel components which are part of the 308275SEric Cheng * GLDv3 stack (dld, dls, aggr, softmac). 318275SEric Cheng */ 328275SEric Cheng 338275SEric Cheng #ifndef _SYS_MAC_CLIENT_PRIV_H 348275SEric Cheng #define _SYS_MAC_CLIENT_PRIV_H 358275SEric Cheng 368275SEric Cheng #include <sys/mac.h> 378275SEric Cheng #include <sys/mac_flow.h> 388275SEric Cheng 398275SEric Cheng #ifdef __cplusplus 408275SEric Cheng extern "C" { 418275SEric Cheng #endif 428275SEric Cheng 438275SEric Cheng #ifdef _KERNEL 448275SEric Cheng 458275SEric Cheng #ifdef DEBUG 468275SEric Cheng #define MAC_PERIM_HELD(mph) mac_perim_held(mph) 478275SEric Cheng #else 488275SEric Cheng #define MAC_PERIM_HELD(mph) 498275SEric Cheng #endif 508275SEric Cheng 518275SEric Cheng extern boolean_t mac_rx_bypass_set(mac_client_handle_t, mac_direct_rx_t, 528275SEric Cheng void *); 538275SEric Cheng 548275SEric Cheng extern const mac_info_t *mac_info(mac_handle_t); 558275SEric Cheng extern boolean_t mac_info_get(const char *, mac_info_t *); 56*9641SGirish.Moodalbail@Sun.COM extern boolean_t mac_promisc_get(mac_handle_t); 578275SEric Cheng 588893SMichael.Lim@Sun.COM extern int mac_start(mac_handle_t); 598893SMichael.Lim@Sun.COM extern void mac_stop(mac_handle_t); 608893SMichael.Lim@Sun.COM 618275SEric Cheng extern void mac_ioctl(mac_handle_t, queue_t *, mblk_t *); 628275SEric Cheng extern link_state_t mac_link_get(mac_handle_t); 638275SEric Cheng extern void mac_resource_set(mac_client_handle_t, mac_resource_add_t, void *); 648275SEric Cheng extern dev_info_t *mac_devinfo_get(mac_handle_t); 659073SCathy.Zhou@Sun.COM extern void *mac_driver(mac_handle_t); 668275SEric Cheng extern boolean_t mac_capab_get(mac_handle_t, mac_capab_t, void *); 678275SEric Cheng extern boolean_t mac_sap_verify(mac_handle_t, uint32_t, uint32_t *); 688275SEric Cheng extern mblk_t *mac_header(mac_handle_t, const uint8_t *, uint32_t, mblk_t *, 698275SEric Cheng size_t); 708275SEric Cheng extern int mac_header_info(mac_handle_t, mblk_t *, mac_header_info_t *); 718275SEric Cheng extern mblk_t *mac_header_cook(mac_handle_t, mblk_t *); 728275SEric Cheng extern mblk_t *mac_header_uncook(mac_handle_t, mblk_t *); 738275SEric Cheng 748275SEric Cheng extern void mac_resource_set_common(mac_client_handle_t, 758275SEric Cheng mac_resource_add_t, mac_resource_remove_t, mac_resource_quiesce_t, 768275SEric Cheng mac_resource_restart_t, mac_resource_bind_t, void *); 778275SEric Cheng 788275SEric Cheng extern void mac_perim_enter_by_mh(mac_handle_t, mac_perim_handle_t *); 798275SEric Cheng extern int mac_perim_enter_by_macname(const char *, mac_perim_handle_t *); 808275SEric Cheng extern int mac_perim_enter_by_linkid(datalink_id_t, mac_perim_handle_t *); 818275SEric Cheng extern void mac_perim_exit(mac_perim_handle_t); 828275SEric Cheng extern boolean_t mac_perim_held(mac_handle_t); 838275SEric Cheng 848275SEric Cheng extern uint16_t mac_client_vid(mac_client_handle_t); 858275SEric Cheng extern int mac_vnic_unicast_set(mac_client_handle_t, const uint8_t *); 868275SEric Cheng 878275SEric Cheng extern void mac_client_poll_enable(mac_client_handle_t); 888275SEric Cheng extern void mac_client_poll_disable(mac_client_handle_t); 898275SEric Cheng 908275SEric Cheng extern int mac_resource_ctl_set(mac_client_handle_t, mac_resource_props_t *); 918275SEric Cheng extern void mac_resource_ctl_get(mac_client_handle_t, mac_resource_props_t *); 928275SEric Cheng 938275SEric Cheng /* 948275SEric Cheng * Flow-related APIs for MAC clients. 958275SEric Cheng */ 968275SEric Cheng 978275SEric Cheng extern void mac_link_init_flows(mac_client_handle_t); 988275SEric Cheng extern void mac_link_release_flows(mac_client_handle_t); 998275SEric Cheng extern int mac_link_flow_add(datalink_id_t, char *, flow_desc_t *, 1008275SEric Cheng mac_resource_props_t *); 1018275SEric Cheng extern int mac_link_flow_remove(char *); 1028275SEric Cheng extern int mac_link_flow_modify(char *, mac_resource_props_t *); 1038275SEric Cheng extern boolean_t mac_link_has_flows(mac_client_handle_t); 1048275SEric Cheng 1058275SEric Cheng typedef struct { 1068558SGirish.Moodalbail@Sun.COM char fi_flow_name[MAXFLOWNAMELEN]; 1078275SEric Cheng datalink_id_t fi_link_id; 1088275SEric Cheng flow_desc_t fi_flow_desc; 1098275SEric Cheng mac_resource_props_t fi_resource_props; 1108275SEric Cheng } mac_flowinfo_t; 1118275SEric Cheng 1128275SEric Cheng extern int mac_link_flow_walk(datalink_id_t, 1138275SEric Cheng int (*)(mac_flowinfo_t *, void *), void *); 1148275SEric Cheng extern int mac_link_flow_info(char *, mac_flowinfo_t *); 1158275SEric Cheng 1168275SEric Cheng extern void *mac_tx_hold(mac_client_handle_t); 1178275SEric Cheng extern void mac_tx_rele(mac_client_handle_t, void *); 1188275SEric Cheng extern void mac_rx_client_quiesce(mac_client_handle_t); 1198275SEric Cheng extern void mac_rx_client_restart(mac_client_handle_t); 1208275SEric Cheng extern void mac_srs_perm_quiesce(mac_client_handle_t, boolean_t); 1218275SEric Cheng extern int mac_hwrings_get(mac_client_handle_t, mac_group_handle_t *, 1228275SEric Cheng mac_ring_handle_t *); 1238275SEric Cheng extern void mac_hwring_setup(mac_ring_handle_t, mac_resource_handle_t); 1248275SEric Cheng extern void mac_hwring_teardown(mac_ring_handle_t); 1258275SEric Cheng extern int mac_hwring_disable_intr(mac_ring_handle_t); 1268275SEric Cheng extern int mac_hwring_enable_intr(mac_ring_handle_t); 1278275SEric Cheng extern int mac_hwring_start(mac_ring_handle_t); 1288275SEric Cheng extern void mac_hwring_stop(mac_ring_handle_t); 1298275SEric Cheng extern mblk_t *mac_hwring_poll(mac_ring_handle_t, int); 1308275SEric Cheng #define MAC_HWRING_POLL(ring, bytes) \ 1318275SEric Cheng (((ring)->mr_info.mri_poll) \ 1328275SEric Cheng ((ring)->mr_info.mri_driver, (bytes))) 1338275SEric Cheng 1348275SEric Cheng extern int mac_hwgroup_addmac(mac_group_handle_t, const uint8_t *); 1358275SEric Cheng extern int mac_hwgroup_remmac(mac_group_handle_t, const uint8_t *); 1368275SEric Cheng 1378275SEric Cheng extern void mac_set_upper_mac(mac_client_handle_t, mac_handle_t); 1388275SEric Cheng 1398275SEric Cheng extern int mac_mark_exclusive(mac_handle_t); 1408275SEric Cheng extern void mac_unmark_exclusive(mac_handle_t); 1418275SEric Cheng 1428275SEric Cheng extern int32_t mac_client_intr_cpu(mac_client_handle_t); 1438275SEric Cheng extern void mac_client_set_intr_cpu(void *, mac_client_handle_t, int32_t); 1448275SEric Cheng extern void *mac_get_devinfo(mac_handle_t); 1458275SEric Cheng 1468275SEric Cheng #endif /* _KERNEL */ 1478275SEric Cheng 1488275SEric Cheng #ifdef __cplusplus 1498275SEric Cheng } 1508275SEric Cheng #endif 1518275SEric Cheng 1528275SEric Cheng #endif /* _SYS_MAC_CLIENT_PRIV_H */ 153