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 /* 23*11878SVenu.Iyer@Sun.COM * Copyright 2010 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 *); 5311021SEric.Cheng@Sun.COM extern void mac_rx_bypass_enable(mac_client_handle_t); 5411021SEric.Cheng@Sun.COM extern void mac_rx_bypass_disable(mac_client_handle_t); 558275SEric Cheng 568275SEric Cheng extern const mac_info_t *mac_info(mac_handle_t); 578275SEric Cheng extern boolean_t mac_info_get(const char *, mac_info_t *); 589641SGirish.Moodalbail@Sun.COM extern boolean_t mac_promisc_get(mac_handle_t); 598275SEric Cheng 608893SMichael.Lim@Sun.COM extern int mac_start(mac_handle_t); 618893SMichael.Lim@Sun.COM extern void mac_stop(mac_handle_t); 628893SMichael.Lim@Sun.COM 638275SEric Cheng extern void mac_ioctl(mac_handle_t, queue_t *, mblk_t *); 648275SEric Cheng extern link_state_t mac_link_get(mac_handle_t); 658275SEric Cheng extern void mac_resource_set(mac_client_handle_t, mac_resource_add_t, void *); 668275SEric Cheng extern dev_info_t *mac_devinfo_get(mac_handle_t); 679073SCathy.Zhou@Sun.COM extern void *mac_driver(mac_handle_t); 688275SEric Cheng extern boolean_t mac_capab_get(mac_handle_t, mac_capab_t, void *); 698275SEric Cheng extern boolean_t mac_sap_verify(mac_handle_t, uint32_t, uint32_t *); 708275SEric Cheng extern mblk_t *mac_header(mac_handle_t, const uint8_t *, uint32_t, mblk_t *, 718275SEric Cheng size_t); 728275SEric Cheng extern int mac_header_info(mac_handle_t, mblk_t *, mac_header_info_t *); 7310734SEric Cheng extern int mac_vlan_header_info(mac_handle_t, mblk_t *, mac_header_info_t *); 748275SEric Cheng extern mblk_t *mac_header_cook(mac_handle_t, mblk_t *); 758275SEric Cheng extern mblk_t *mac_header_uncook(mac_handle_t, mblk_t *); 768275SEric Cheng 778275SEric Cheng extern void mac_resource_set_common(mac_client_handle_t, 788275SEric Cheng mac_resource_add_t, mac_resource_remove_t, mac_resource_quiesce_t, 798275SEric Cheng mac_resource_restart_t, mac_resource_bind_t, void *); 808275SEric Cheng 818275SEric Cheng extern void mac_perim_enter_by_mh(mac_handle_t, mac_perim_handle_t *); 828275SEric Cheng extern int mac_perim_enter_by_macname(const char *, mac_perim_handle_t *); 838275SEric Cheng extern int mac_perim_enter_by_linkid(datalink_id_t, mac_perim_handle_t *); 848275SEric Cheng extern void mac_perim_exit(mac_perim_handle_t); 858275SEric Cheng extern boolean_t mac_perim_held(mac_handle_t); 868275SEric Cheng 878275SEric Cheng extern uint16_t mac_client_vid(mac_client_handle_t); 888275SEric Cheng extern int mac_vnic_unicast_set(mac_client_handle_t, const uint8_t *); 899726SNicolas.Droux@Sun.COM extern boolean_t mac_client_is_vlan_vnic(mac_client_handle_t); 908275SEric Cheng 918275SEric Cheng extern void mac_client_poll_enable(mac_client_handle_t); 928275SEric Cheng extern void mac_client_poll_disable(mac_client_handle_t); 938275SEric Cheng 948275SEric Cheng extern int mac_resource_ctl_set(mac_client_handle_t, mac_resource_props_t *); 958275SEric Cheng extern void mac_resource_ctl_get(mac_client_handle_t, mac_resource_props_t *); 968275SEric Cheng 978275SEric Cheng /* 988275SEric Cheng * Flow-related APIs for MAC clients. 998275SEric Cheng */ 1008275SEric Cheng 1018275SEric Cheng extern void mac_link_init_flows(mac_client_handle_t); 1028275SEric Cheng extern void mac_link_release_flows(mac_client_handle_t); 1038275SEric Cheng extern int mac_link_flow_add(datalink_id_t, char *, flow_desc_t *, 1048275SEric Cheng mac_resource_props_t *); 1058275SEric Cheng extern int mac_link_flow_remove(char *); 1068275SEric Cheng extern int mac_link_flow_modify(char *, mac_resource_props_t *); 1078275SEric Cheng extern boolean_t mac_link_has_flows(mac_client_handle_t); 1088275SEric Cheng 1098275SEric Cheng typedef struct { 1108558SGirish.Moodalbail@Sun.COM char fi_flow_name[MAXFLOWNAMELEN]; 1118275SEric Cheng datalink_id_t fi_link_id; 1128275SEric Cheng flow_desc_t fi_flow_desc; 1138275SEric Cheng mac_resource_props_t fi_resource_props; 1148275SEric Cheng } mac_flowinfo_t; 1158275SEric Cheng 1168275SEric Cheng extern int mac_link_flow_walk(datalink_id_t, 1178275SEric Cheng int (*)(mac_flowinfo_t *, void *), void *); 1188275SEric Cheng extern int mac_link_flow_info(char *, mac_flowinfo_t *); 1198275SEric Cheng 120*11878SVenu.Iyer@Sun.COM extern void mac_rx_client_quiesce(mac_client_handle_t); 121*11878SVenu.Iyer@Sun.COM extern void mac_rx_client_restart(mac_client_handle_t); 122*11878SVenu.Iyer@Sun.COM extern void mac_tx_client_quiesce(mac_client_handle_t); 123*11878SVenu.Iyer@Sun.COM extern void mac_tx_client_condemn(mac_client_handle_t); 124*11878SVenu.Iyer@Sun.COM extern void mac_tx_client_restart(mac_client_handle_t); 125*11878SVenu.Iyer@Sun.COM extern void mac_srs_perm_quiesce(mac_client_handle_t, boolean_t); 126*11878SVenu.Iyer@Sun.COM extern int mac_hwrings_get(mac_client_handle_t, mac_group_handle_t *, 127*11878SVenu.Iyer@Sun.COM mac_ring_handle_t *, mac_ring_type_t); 128*11878SVenu.Iyer@Sun.COM extern uint_t mac_hwring_getinfo(mac_ring_handle_t); 129*11878SVenu.Iyer@Sun.COM extern void mac_hwring_setup(mac_ring_handle_t, mac_resource_handle_t, 130*11878SVenu.Iyer@Sun.COM mac_ring_handle_t); 131*11878SVenu.Iyer@Sun.COM extern void mac_hwring_teardown(mac_ring_handle_t); 132*11878SVenu.Iyer@Sun.COM extern int mac_hwring_disable_intr(mac_ring_handle_t); 133*11878SVenu.Iyer@Sun.COM extern int mac_hwring_enable_intr(mac_ring_handle_t); 134*11878SVenu.Iyer@Sun.COM extern int mac_hwring_start(mac_ring_handle_t); 135*11878SVenu.Iyer@Sun.COM extern void mac_hwring_stop(mac_ring_handle_t); 136*11878SVenu.Iyer@Sun.COM extern mblk_t *mac_hwring_poll(mac_ring_handle_t, int); 137*11878SVenu.Iyer@Sun.COM extern mblk_t *mac_hwring_tx(mac_ring_handle_t, mblk_t *); 138*11878SVenu.Iyer@Sun.COM extern int mac_hwring_getstat(mac_ring_handle_t, uint_t, uint64_t *); 139*11878SVenu.Iyer@Sun.COM extern mblk_t *mac_hwring_send_priv(mac_client_handle_t, 140*11878SVenu.Iyer@Sun.COM mac_ring_handle_t, mblk_t *); 1418275SEric Cheng 142*11878SVenu.Iyer@Sun.COM #define MAC_HWRING_POLL(ring, bytes) \ 143*11878SVenu.Iyer@Sun.COM (((ring)->mr_info.mri_poll) \ 144*11878SVenu.Iyer@Sun.COM ((ring)->mr_info.mri_driver, (bytes))) 1458275SEric Cheng 146*11878SVenu.Iyer@Sun.COM extern int mac_hwgroup_addmac(mac_group_handle_t, const uint8_t *); 147*11878SVenu.Iyer@Sun.COM extern int mac_hwgroup_remmac(mac_group_handle_t, const uint8_t *); 148*11878SVenu.Iyer@Sun.COM 149*11878SVenu.Iyer@Sun.COM extern void mac_set_upper_mac(mac_client_handle_t, mac_handle_t, 150*11878SVenu.Iyer@Sun.COM mac_resource_props_t *); 1518275SEric Cheng 1528275SEric Cheng extern int mac_mark_exclusive(mac_handle_t); 1538275SEric Cheng extern void mac_unmark_exclusive(mac_handle_t); 1548275SEric Cheng 155*11878SVenu.Iyer@Sun.COM extern uint_t mac_hwgrp_num(mac_handle_t, int); 156*11878SVenu.Iyer@Sun.COM extern void mac_get_hwrxgrp_info(mac_handle_t, int, uint_t *, uint_t *, 157*11878SVenu.Iyer@Sun.COM uint_t *, uint_t *, uint_t *, char *); 158*11878SVenu.Iyer@Sun.COM extern void mac_get_hwtxgrp_info(mac_handle_t, int, uint_t *, uint_t *, 159*11878SVenu.Iyer@Sun.COM uint_t *, uint_t *, uint_t *, char *); 160*11878SVenu.Iyer@Sun.COM 161*11878SVenu.Iyer@Sun.COM extern uint_t mac_txavail_get(mac_handle_t); 162*11878SVenu.Iyer@Sun.COM extern uint_t mac_rxavail_get(mac_handle_t); 163*11878SVenu.Iyer@Sun.COM extern uint_t mac_txrsvd_get(mac_handle_t); 164*11878SVenu.Iyer@Sun.COM extern uint_t mac_rxrsvd_get(mac_handle_t); 165*11878SVenu.Iyer@Sun.COM extern uint_t mac_rxhwlnksavail_get(mac_handle_t); 166*11878SVenu.Iyer@Sun.COM extern uint_t mac_rxhwlnksrsvd_get(mac_handle_t); 167*11878SVenu.Iyer@Sun.COM extern uint_t mac_txhwlnksavail_get(mac_handle_t); 168*11878SVenu.Iyer@Sun.COM extern uint_t mac_txhwlnksrsvd_get(mac_handle_t); 169*11878SVenu.Iyer@Sun.COM 170*11878SVenu.Iyer@Sun.COM extern int32_t mac_client_intr_cpu(mac_client_handle_t); 171*11878SVenu.Iyer@Sun.COM extern void mac_client_set_intr_cpu(void *, mac_client_handle_t, int32_t); 172*11878SVenu.Iyer@Sun.COM extern void *mac_get_devinfo(mac_handle_t); 173*11878SVenu.Iyer@Sun.COM 174*11878SVenu.Iyer@Sun.COM extern boolean_t mac_is_vnic(mac_handle_t); 175*11878SVenu.Iyer@Sun.COM extern uint32_t mac_no_notification(mac_handle_t); 176*11878SVenu.Iyer@Sun.COM 177*11878SVenu.Iyer@Sun.COM extern int mac_set_prop(mac_handle_t, mac_prop_id_t, char *, void *, uint_t); 178*11878SVenu.Iyer@Sun.COM extern int mac_get_prop(mac_handle_t, mac_prop_id_t, char *, void *, uint_t); 179*11878SVenu.Iyer@Sun.COM extern int mac_prop_info(mac_handle_t, mac_prop_id_t, char *, void *, 180*11878SVenu.Iyer@Sun.COM uint_t, mac_propval_range_t *, uint_t *); 181*11878SVenu.Iyer@Sun.COM extern boolean_t mac_prop_check_size(mac_prop_id_t, uint_t, boolean_t); 182*11878SVenu.Iyer@Sun.COM 183*11878SVenu.Iyer@Sun.COM extern uint64_t mac_pseudo_rx_ring_stat_get(mac_ring_handle_t, uint_t); 184*11878SVenu.Iyer@Sun.COM extern uint64_t mac_pseudo_tx_ring_stat_get(mac_ring_handle_t, uint_t); 1858275SEric Cheng 1868275SEric Cheng #endif /* _KERNEL */ 1878275SEric Cheng 1888275SEric Cheng #ifdef __cplusplus 1898275SEric Cheng } 1908275SEric Cheng #endif 1918275SEric Cheng 1928275SEric Cheng #endif /* _SYS_MAC_CLIENT_PRIV_H */ 193