xref: /illumos-gate/usr/src/uts/sun4v/sys/vgen_stats.h (revision 89a7715a55deca73d03076f5c24463717f0aaa91)
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 2007 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 
57 	/* Rx Statistics */
58 	uint32_t	rx_allocb_fail;	/* # rx buf allocb() failures */
59 	uint32_t	rx_vio_allocb_fail; /* # vio_allocb() failures */
60 	uint32_t	rx_lost_pkts;	/* # rx lost packets */
61 
62 	/* Callback statistics */
63 	uint32_t	callbacks;		/* # callbacks */
64 	uint32_t	dring_data_acks;	/* # dring data acks recvd  */
65 	uint32_t	dring_stopped_acks;	/* # dring stopped acks recvd */
66 	uint32_t	dring_data_msgs;	/* # dring data msgs sent */
67 
68 } vgen_stats_t;
69 
70 typedef struct vgen_kstats {
71 	/*
72 	 * Link Input/Output stats
73 	 */
74 	kstat_named_t	ipackets;
75 	kstat_named_t	ipackets64;
76 	kstat_named_t	ierrors;
77 	kstat_named_t	opackets;
78 	kstat_named_t	opackets64;
79 	kstat_named_t	oerrors;
80 
81 	/*
82 	 * required by kstat for MIB II objects(RFC 1213)
83 	 */
84 	kstat_named_t	rbytes; 	/* MIB - ifInOctets */
85 	kstat_named_t	rbytes64;
86 	kstat_named_t	obytes; 	/* MIB - ifOutOctets */
87 	kstat_named_t	obytes64;
88 	kstat_named_t	multircv; 	/* MIB - ifInNUcastPkts */
89 	kstat_named_t	multixmt; 	/* MIB - ifOutNUcastPkts */
90 	kstat_named_t	brdcstrcv;	/* MIB - ifInNUcastPkts */
91 	kstat_named_t	brdcstxmt;	/* MIB - ifOutNUcastPkts */
92 	kstat_named_t	norcvbuf; 	/* MIB - ifInDiscards */
93 	kstat_named_t	noxmtbuf; 	/* MIB - ifOutDiscards */
94 
95 	/* Tx Statistics */
96 	kstat_named_t	tx_no_desc;	/* # out of transmit descriptors */
97 
98 	/* Rx Statistics */
99 	kstat_named_t	rx_allocb_fail;	/* # rx buf allocb failures */
100 	kstat_named_t	rx_vio_allocb_fail; /* # vio_allocb() failures */
101 	kstat_named_t	rx_lost_pkts;	/* # rx lost packets */
102 
103 	/* Callback statistics */
104 	kstat_named_t	callbacks;		/* # callbacks */
105 	kstat_named_t	dring_data_acks;	/* # dring data acks recvd  */
106 	kstat_named_t	dring_stopped_acks;	/* # dring stopped acks recvd */
107 	kstat_named_t	dring_data_msgs;	/* # dring data msgs sent */
108 
109 } vgen_kstats_t;
110 
111 kstat_t *vgen_setup_kstats(char *ks_mod, int instance,
112     char *ks_name, vgen_stats_t *statsp);
113 void vgen_destroy_kstats(kstat_t *ksp);
114 int vgen_kstat_update(kstat_t *ksp, int rw);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif	/* _VGEN_STATS_H */
121