xref: /titanic_52/usr/src/lib/libdladm/common/libdlstat.h (revision 69112edd987c28fa551d4f8d9362a84a45365f17)
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  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _LIBDLSTAT_H
27 #define	_LIBDLSTAT_H
28 
29 /*
30  * This file includes structures, macros and common routines shared by all
31  * data-link administration, and routines which are used to retrieve and
32  * display statistics.
33  */
34 
35 #include <kstat.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define	LINK_REPORT	1
42 #define	FLOW_REPORT	2
43 
44 typedef struct pktsum_s {
45 	hrtime_t	snaptime;
46 	uint64_t	ipackets;
47 	uint64_t	opackets;
48 	uint64_t	rbytes;
49 	uint64_t	obytes;
50 	uint64_t	ierrors;
51 	uint64_t	oerrors;
52 } pktsum_t;
53 
54 extern void		dladm_continuous(dladm_handle_t, datalink_id_t,
55 			    const char *, int, int);
56 
57 extern kstat_t		*dladm_kstat_lookup(kstat_ctl_t *, const char *, int,
58 			    const char *, const char *);
59 extern void		dladm_get_stats(kstat_ctl_t *, kstat_t *, pktsum_t *);
60 extern int		dladm_kstat_value(kstat_t *, const char *, uint8_t,
61 			    void *);
62 extern dladm_status_t	dladm_get_single_mac_stat(dladm_handle_t, datalink_id_t,
63 			    const char *, uint8_t, void *);
64 
65 extern void		dladm_stats_total(pktsum_t *, pktsum_t *, pktsum_t *);
66 extern void		dladm_stats_diff(pktsum_t *, pktsum_t *, pktsum_t *);
67 
68 #ifdef	__cplusplus
69 }
70 #endif
71 
72 #endif	/* _LIBDLSTAT_H */
73