summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4v/sys/vgen_stats.h
blob: 999a9171630fcbadf6a01c5b76aefa08884484b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _VGEN_STATS_H
#define	_VGEN_STATS_H

#ifdef __cplusplus
extern "C" {
#endif

typedef struct vgen_stats {

	/* Link Input/Output stats */
	uint64_t	ipackets;	/* # rx packets */
	uint64_t	ierrors;	/* # rx error */
	uint64_t	opackets;	/* # tx packets */
	uint64_t	oerrors;	/* # tx error */

	/* MIB II variables */
	uint64_t	rbytes;		/* # bytes received */
	uint64_t	obytes;		/* # bytes transmitted */
	uint32_t	multircv;	/* # multicast packets received */
	uint32_t	multixmt;	/* # multicast packets for xmit */
	uint32_t	brdcstrcv;	/* # broadcast packets received */
	uint32_t	brdcstxmt;	/* # broadcast packets for xmit */
	uint32_t	norcvbuf;	/* # rcv packets discarded */
	uint32_t	noxmtbuf;	/* # xmit packets discarded */

	/* Tx Statistics */
	uint32_t	tx_no_desc;	/* # out of transmit descriptors */
	uint32_t	tx_qfull;	/* pkts dropped due to qfull in vsw */
	uint32_t	tx_pri_fail;	/* # tx priority packet failures */
	uint64_t	tx_pri_packets;	/* # priority packets transmitted */
	uint64_t	tx_pri_bytes;	/* # priority bytes transmitted */

	/* Rx Statistics */
	uint32_t	rx_allocb_fail;	/* # rx buf allocb() failures */
	uint32_t	rx_vio_allocb_fail; /* # vio_allocb() failures */
	uint32_t	rx_lost_pkts;	/* # rx lost packets */
	uint32_t	rx_pri_fail;	/* # rx priority packet failures */
	uint64_t	rx_pri_packets;	/* # priority packets received */
	uint64_t	rx_pri_bytes;	/* # priority bytes received */

	/* Callback statistics */
	uint32_t	callbacks;		/* # callbacks */
	uint32_t	dring_data_msgs_sent;	/* # dring data msgs sent */
	uint32_t	dring_data_acks_rcvd;	/* # dring data acks recvd  */
	uint32_t	dring_stopped_acks_rcvd; /* # dring stopped acks rcvd */
	uint32_t	dring_data_msgs_rcvd;	/* # dring data msgs rcvd */
	uint32_t	dring_data_acks_sent;	/* # dring data acks sent  */
	uint32_t	dring_stopped_acks_sent; /* # dring stopped acks sent */
	uint32_t	dring_mode;		/* dring mode */

} vgen_stats_t;

typedef struct vgen_kstats {
	/*
	 * Link Input/Output stats
	 */
	kstat_named_t	ipackets;
	kstat_named_t	ipackets64;
	kstat_named_t	ierrors;
	kstat_named_t	opackets;
	kstat_named_t	opackets64;
	kstat_named_t	oerrors;

	/*
	 * required by kstat for MIB II objects(RFC 1213)
	 */
	kstat_named_t	rbytes; 	/* MIB - ifInOctets */
	kstat_named_t	rbytes64;
	kstat_named_t	obytes; 	/* MIB - ifOutOctets */
	kstat_named_t	obytes64;
	kstat_named_t	multircv; 	/* MIB - ifInNUcastPkts */
	kstat_named_t	multixmt; 	/* MIB - ifOutNUcastPkts */
	kstat_named_t	brdcstrcv;	/* MIB - ifInNUcastPkts */
	kstat_named_t	brdcstxmt;	/* MIB - ifOutNUcastPkts */
	kstat_named_t	norcvbuf; 	/* MIB - ifInDiscards */
	kstat_named_t	noxmtbuf; 	/* MIB - ifOutDiscards */

	/* Tx Statistics */
	kstat_named_t	tx_no_desc;	/* # out of transmit descriptors */
	kstat_named_t	tx_qfull;	/* pkts dropped due to qfull in vsw */
	kstat_named_t	tx_pri_fail;	/* # tx priority packet failures */
	kstat_named_t	tx_pri_packets;	/* # priority packets transmitted */
	kstat_named_t	tx_pri_bytes;	/* # priority bytes transmitted */

	/* Rx Statistics */
	kstat_named_t	rx_allocb_fail;	/* # rx buf allocb failures */
	kstat_named_t	rx_vio_allocb_fail; /* # vio_allocb() failures */
	kstat_named_t	rx_lost_pkts;	/* # rx lost packets */
	kstat_named_t	rx_pri_fail;	/* # rx priority packet failures */
	kstat_named_t	rx_pri_packets;	/* # priority packets received */
	kstat_named_t	rx_pri_bytes;	/* # priority bytes received */

	/* Callback statistics */
	kstat_named_t	callbacks;		/* # callbacks */
	kstat_named_t	dring_data_msgs_sent;	/* # dring data msgs sent */
	kstat_named_t	dring_data_acks_rcvd;	/* # dring data acks recvd  */
	kstat_named_t	dring_stopped_acks_rcvd; /* # dring stopped acks rcvd */
	kstat_named_t	dring_data_msgs_rcvd;	/* # dring data msgs rcvd */
	kstat_named_t	dring_data_acks_sent;	/* # dring data acks sent  */
	kstat_named_t	dring_stopped_acks_sent; /* # dring stopped acks sent */
	kstat_named_t	dring_mode;		/* dring mode */

} vgen_kstats_t;

kstat_t *vgen_setup_kstats(char *ks_mod, int instance,
    char *ks_name, vgen_stats_t *statsp);
void vgen_destroy_kstats(kstat_t *ksp);
int vgen_kstat_update(kstat_t *ksp, int rw);

#ifdef __cplusplus
}
#endif

#endif	/* _VGEN_STATS_H */