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