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