xref: /titanic_52/usr/src/lib/libdladm/common/libdlstat.h (revision b424305435881ac456a9343be2898f1f86440f31)
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(datalink_id_t, const char *, int, int);
55 
56 extern kstat_t		*dladm_kstat_lookup(kstat_ctl_t *, const char *, int,
57 			    const char *, const char *);
58 extern void		dladm_get_stats(kstat_ctl_t *, kstat_t *, pktsum_t *);
59 extern int		dladm_kstat_value(kstat_t *, const char *, uint8_t,
60 			    void *);
61 extern dladm_status_t	dladm_get_single_mac_stat(datalink_id_t, const char *,
62 			    uint8_t, void *);
63 
64 extern void		dladm_stats_total(pktsum_t *, pktsum_t *, pktsum_t *);
65 extern void		dladm_stats_diff(pktsum_t *, pktsum_t *, pktsum_t *);
66 
67 #ifdef	__cplusplus
68 }
69 #endif
70 
71 #endif	/* _LIBDLSTAT_H */
72