1*11878SVenu.Iyer@Sun.COM /* 2*11878SVenu.Iyer@Sun.COM * CDDL HEADER START 3*11878SVenu.Iyer@Sun.COM * 4*11878SVenu.Iyer@Sun.COM * The contents of this file are subject to the terms of the 5*11878SVenu.Iyer@Sun.COM * Common Development and Distribution License (the "License"). 6*11878SVenu.Iyer@Sun.COM * You may not use this file except in compliance with the License. 7*11878SVenu.Iyer@Sun.COM * 8*11878SVenu.Iyer@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*11878SVenu.Iyer@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*11878SVenu.Iyer@Sun.COM * See the License for the specific language governing permissions 11*11878SVenu.Iyer@Sun.COM * and limitations under the License. 12*11878SVenu.Iyer@Sun.COM * 13*11878SVenu.Iyer@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*11878SVenu.Iyer@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*11878SVenu.Iyer@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*11878SVenu.Iyer@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*11878SVenu.Iyer@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*11878SVenu.Iyer@Sun.COM * 19*11878SVenu.Iyer@Sun.COM * CDDL HEADER END 20*11878SVenu.Iyer@Sun.COM */ 21*11878SVenu.Iyer@Sun.COM 22*11878SVenu.Iyer@Sun.COM /* 23*11878SVenu.Iyer@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24*11878SVenu.Iyer@Sun.COM * Use is subject to license terms. 25*11878SVenu.Iyer@Sun.COM */ 26*11878SVenu.Iyer@Sun.COM 27*11878SVenu.Iyer@Sun.COM #ifndef _MAC_STAT_H 28*11878SVenu.Iyer@Sun.COM #define _MAC_STAT_H 29*11878SVenu.Iyer@Sun.COM 30*11878SVenu.Iyer@Sun.COM #include <sys/mac_flow_impl.h> 31*11878SVenu.Iyer@Sun.COM 32*11878SVenu.Iyer@Sun.COM #ifdef __cplusplus 33*11878SVenu.Iyer@Sun.COM extern "C" { 34*11878SVenu.Iyer@Sun.COM #endif 35*11878SVenu.Iyer@Sun.COM #ifdef __cplusplus 36*11878SVenu.Iyer@Sun.COM } 37*11878SVenu.Iyer@Sun.COM #endif 38*11878SVenu.Iyer@Sun.COM 39*11878SVenu.Iyer@Sun.COM struct mac_soft_ring_set_s; 40*11878SVenu.Iyer@Sun.COM struct mac_soft_ring_s; 41*11878SVenu.Iyer@Sun.COM 42*11878SVenu.Iyer@Sun.COM typedef struct mac_rx_stats_s { 43*11878SVenu.Iyer@Sun.COM uint64_t mrs_lclbytes; 44*11878SVenu.Iyer@Sun.COM uint64_t mrs_lclcnt; 45*11878SVenu.Iyer@Sun.COM uint64_t mrs_pollcnt; 46*11878SVenu.Iyer@Sun.COM uint64_t mrs_pollbytes; 47*11878SVenu.Iyer@Sun.COM uint64_t mrs_intrcnt; 48*11878SVenu.Iyer@Sun.COM uint64_t mrs_intrbytes; 49*11878SVenu.Iyer@Sun.COM uint64_t mrs_sdrops; 50*11878SVenu.Iyer@Sun.COM uint64_t mrs_chaincntundr10; 51*11878SVenu.Iyer@Sun.COM uint64_t mrs_chaincnt10to50; 52*11878SVenu.Iyer@Sun.COM uint64_t mrs_chaincntover50; 53*11878SVenu.Iyer@Sun.COM uint64_t mrs_ierrors; 54*11878SVenu.Iyer@Sun.COM } mac_rx_stats_t; 55*11878SVenu.Iyer@Sun.COM 56*11878SVenu.Iyer@Sun.COM typedef struct mac_tx_stats_s { 57*11878SVenu.Iyer@Sun.COM uint64_t mts_obytes; 58*11878SVenu.Iyer@Sun.COM uint64_t mts_opackets; 59*11878SVenu.Iyer@Sun.COM uint64_t mts_oerrors; 60*11878SVenu.Iyer@Sun.COM /* 61*11878SVenu.Iyer@Sun.COM * Number of times the srs gets blocked due to lack of Tx 62*11878SVenu.Iyer@Sun.COM * desc is noted down. Corresponding wakeup from driver 63*11878SVenu.Iyer@Sun.COM * to unblock is also noted down. They should match in a 64*11878SVenu.Iyer@Sun.COM * correctly working setup. If there is less unblocks 65*11878SVenu.Iyer@Sun.COM * than blocks, then Tx side waits forever for a wakeup 66*11878SVenu.Iyer@Sun.COM * from below. The following protected by srs_lock. 67*11878SVenu.Iyer@Sun.COM */ 68*11878SVenu.Iyer@Sun.COM uint64_t mts_blockcnt; /* times blocked for Tx descs */ 69*11878SVenu.Iyer@Sun.COM uint64_t mts_unblockcnt; /* unblock calls from driver */ 70*11878SVenu.Iyer@Sun.COM uint64_t mts_sdrops; 71*11878SVenu.Iyer@Sun.COM } mac_tx_stats_t; 72*11878SVenu.Iyer@Sun.COM 73*11878SVenu.Iyer@Sun.COM typedef struct mac_misc_stats_s { 74*11878SVenu.Iyer@Sun.COM uint64_t mms_multircv; 75*11878SVenu.Iyer@Sun.COM uint64_t mms_brdcstrcv; 76*11878SVenu.Iyer@Sun.COM uint64_t mms_multixmt; 77*11878SVenu.Iyer@Sun.COM uint64_t mms_brdcstxmt; 78*11878SVenu.Iyer@Sun.COM uint64_t mms_multircvbytes; 79*11878SVenu.Iyer@Sun.COM uint64_t mms_brdcstrcvbytes; 80*11878SVenu.Iyer@Sun.COM uint64_t mms_multixmtbytes; 81*11878SVenu.Iyer@Sun.COM uint64_t mms_brdcstxmtbytes; 82*11878SVenu.Iyer@Sun.COM uint64_t mms_txerrors; /* vid_check, tag needed errors */ 83*11878SVenu.Iyer@Sun.COM 84*11878SVenu.Iyer@Sun.COM /* 85*11878SVenu.Iyer@Sun.COM * When a ring is taken away from a mac client, before destroying 86*11878SVenu.Iyer@Sun.COM * corresponding SRS (for rx ring) or soft ring (for tx ring), add stats 87*11878SVenu.Iyer@Sun.COM * recorded by that SRS or soft ring to defunct lane stats. 88*11878SVenu.Iyer@Sun.COM */ 89*11878SVenu.Iyer@Sun.COM mac_rx_stats_t mms_defunctrxlanestats; 90*11878SVenu.Iyer@Sun.COM mac_tx_stats_t mms_defuncttxlanestats; 91*11878SVenu.Iyer@Sun.COM 92*11878SVenu.Iyer@Sun.COM /* link protection stats */ 93*11878SVenu.Iyer@Sun.COM uint64_t mms_macspoofed; 94*11878SVenu.Iyer@Sun.COM uint64_t mms_ipspoofed; 95*11878SVenu.Iyer@Sun.COM uint64_t mms_dhcpspoofed; 96*11878SVenu.Iyer@Sun.COM uint64_t mms_restricted; 97*11878SVenu.Iyer@Sun.COM uint64_t mms_dhcpdropped; 98*11878SVenu.Iyer@Sun.COM } mac_misc_stats_t; 99*11878SVenu.Iyer@Sun.COM 100*11878SVenu.Iyer@Sun.COM extern void mac_misc_stat_create(flow_entry_t *); 101*11878SVenu.Iyer@Sun.COM extern void mac_misc_stat_delete(flow_entry_t *); 102*11878SVenu.Iyer@Sun.COM 103*11878SVenu.Iyer@Sun.COM extern void mac_ring_stat_create(mac_ring_t *); 104*11878SVenu.Iyer@Sun.COM extern void mac_ring_stat_delete(mac_ring_t *); 105*11878SVenu.Iyer@Sun.COM 106*11878SVenu.Iyer@Sun.COM extern void mac_srs_stat_create(struct mac_soft_ring_set_s *); 107*11878SVenu.Iyer@Sun.COM extern void mac_srs_stat_delete(struct mac_soft_ring_set_s *); 108*11878SVenu.Iyer@Sun.COM extern void mac_tx_srs_stat_recreate(struct mac_soft_ring_set_s *, 109*11878SVenu.Iyer@Sun.COM boolean_t); 110*11878SVenu.Iyer@Sun.COM 111*11878SVenu.Iyer@Sun.COM extern void mac_soft_ring_stat_create(struct mac_soft_ring_s *); 112*11878SVenu.Iyer@Sun.COM extern void mac_soft_ring_stat_delete(struct mac_soft_ring_s *); 113*11878SVenu.Iyer@Sun.COM 114*11878SVenu.Iyer@Sun.COM extern void mac_stat_rename(mac_client_impl_t *); 115*11878SVenu.Iyer@Sun.COM extern void mac_pseudo_ring_stat_rename(mac_impl_t *); 116*11878SVenu.Iyer@Sun.COM 117*11878SVenu.Iyer@Sun.COM extern void mac_driver_stat_create(mac_impl_t *); 118*11878SVenu.Iyer@Sun.COM extern void mac_driver_stat_delete(mac_impl_t *); 119*11878SVenu.Iyer@Sun.COM extern uint64_t mac_driver_stat_default(mac_impl_t *, uint_t); 120*11878SVenu.Iyer@Sun.COM 121*11878SVenu.Iyer@Sun.COM extern uint64_t mac_rx_ring_stat_get(void *, uint_t); 122*11878SVenu.Iyer@Sun.COM extern uint64_t mac_tx_ring_stat_get(void *, uint_t); 123*11878SVenu.Iyer@Sun.COM 124*11878SVenu.Iyer@Sun.COM #endif /* _MAC_STAT_H */ 125