xref: /illumos-gate/usr/src/uts/sun4v/sys/vgen_stats.h (revision e11c3f44)
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 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _VGEN_STATS_H
28 #define	_VGEN_STATS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef struct vgen_stats {
37 
38 	/* Link Input/Output stats */
39 	uint64_t	ipackets;	/* # rx packets */
40 	uint64_t	ierrors;	/* # rx error */
41 	uint64_t	opackets;	/* # tx packets */
42 	uint64_t	oerrors;	/* # tx error */
43 
44 	/* MIB II variables */
45 	uint64_t	rbytes;		/* # bytes received */
46 	uint64_t	obytes;		/* # bytes transmitted */
47 	uint32_t	multircv;	/* # multicast packets received */
48 	uint32_t	multixmt;	/* # multicast packets for xmit */
49 	uint32_t	brdcstrcv;	/* # broadcast packets received */
50 	uint32_t	brdcstxmt;	/* # broadcast packets for xmit */
51 	uint32_t	norcvbuf;	/* # rcv packets discarded */
52 	uint32_t	noxmtbuf;	/* # xmit packets discarded */
53 
54 	/* Tx Statistics */
55 	uint32_t	tx_no_desc;	/* # out of transmit descriptors */
56 	uint32_t	tx_qfull;	/* pkts dropped due to qfull in vsw */
57 	uint32_t	tx_pri_fail;	/* # tx priority packet failures */
58 	uint64_t	tx_pri_packets;	/* # priority packets transmitted */
59 	uint64_t	tx_pri_bytes;	/* # priority bytes transmitted */
60 
61 	/* Rx Statistics */
62 	uint32_t	rx_allocb_fail;	/* # rx buf allocb() failures */
63 	uint32_t	rx_vio_allocb_fail; /* # vio_allocb() failures */
64 	uint32_t	rx_lost_pkts;	/* # rx lost packets */
65 	uint32_t	rx_pri_fail;	/* # rx priority packet failures */
66 	uint64_t	rx_pri_packets;	/* # priority packets received */
67 	uint64_t	rx_pri_bytes;	/* # priority bytes received */
68 
69 	/* Callback statistics */
70 	uint32_t	callbacks;		/* # callbacks */
71 	uint32_t	dring_data_acks;	/* # dring data acks recvd  */
72 	uint32_t	dring_stopped_acks;	/* # dring stopped acks recvd */
73 	uint32_t	dring_data_msgs;	/* # dring data msgs sent */
74 
75 } vgen_stats_t;
76 
77 typedef struct vgen_kstats {
78 	/*
79 	 * Link Input/Output stats
80 	 */
81 	kstat_named_t	ipackets;
82 	kstat_named_t	ipackets64;
83 	kstat_named_t	ierrors;
84 	kstat_named_t	opackets;
85 	kstat_named_t	opackets64;
86 	kstat_named_t	oerrors;
87 
88 	/*
89 	 * required by kstat for MIB II objects(RFC 1213)
90 	 */
91 	kstat_named_t	rbytes; 	/* MIB - ifInOctets */
92 	kstat_named_t	rbytes64;
93 	kstat_named_t	obytes; 	/* MIB - ifOutOctets */
94 	kstat_named_t	obytes64;
95 	kstat_named_t	multircv; 	/* MIB - ifInNUcastPkts */
96 	kstat_named_t	multixmt; 	/* MIB - ifOutNUcastPkts */
97 	kstat_named_t	brdcstrcv;	/* MIB - ifInNUcastPkts */
98 	kstat_named_t	brdcstxmt;	/* MIB - ifOutNUcastPkts */
99 	kstat_named_t	norcvbuf; 	/* MIB - ifInDiscards */
100 	kstat_named_t	noxmtbuf; 	/* MIB - ifOutDiscards */
101 
102 	/* Tx Statistics */
103 	kstat_named_t	tx_no_desc;	/* # out of transmit descriptors */
104 	kstat_named_t	tx_qfull;	/* pkts dropped due to qfull in vsw */
105 	kstat_named_t	tx_pri_fail;	/* # tx priority packet failures */
106 	kstat_named_t	tx_pri_packets;	/* # priority packets transmitted */
107 	kstat_named_t	tx_pri_bytes;	/* # priority bytes transmitted */
108 
109 	/* Rx Statistics */
110 	kstat_named_t	rx_allocb_fail;	/* # rx buf allocb failures */
111 	kstat_named_t	rx_vio_allocb_fail; /* # vio_allocb() failures */
112 	kstat_named_t	rx_lost_pkts;	/* # rx lost packets */
113 	kstat_named_t	rx_pri_fail;	/* # rx priority packet failures */
114 	kstat_named_t	rx_pri_packets;	/* # priority packets received */
115 	kstat_named_t	rx_pri_bytes;	/* # priority bytes received */
116 
117 	/* Callback statistics */
118 	kstat_named_t	callbacks;		/* # callbacks */
119 	kstat_named_t	dring_data_acks;	/* # dring data acks recvd  */
120 	kstat_named_t	dring_stopped_acks;	/* # dring stopped acks recvd */
121 	kstat_named_t	dring_data_msgs;	/* # dring data msgs sent */
122 
123 } vgen_kstats_t;
124 
125 kstat_t *vgen_setup_kstats(char *ks_mod, int instance,
126     char *ks_name, vgen_stats_t *statsp);
127 void vgen_destroy_kstats(kstat_t *ksp);
128 int vgen_kstat_update(kstat_t *ksp, int rw);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif	/* _VGEN_STATS_H */
135