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