vgen_stats.h revision 06db247c678f0e3956535e8a6dec31d6c2108827
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai/*
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * CDDL HEADER START
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai *
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * The contents of this file are subject to the terms of the
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * Common Development and Distribution License (the "License").
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * You may not use this file except in compliance with the License.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai *
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * or http://www.opensolaris.org/os/licensing.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * See the License for the specific language governing permissions
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * and limitations under the License.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai *
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * When distributing Covered Code, include this CDDL HEADER in each
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * If applicable, add the following below this CDDL HEADER, with the
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * fields enclosed by brackets "[]" replaced with your own identifying
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * information: Portions Copyright [yyyy] [name of copyright owner]
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai *
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * CDDL HEADER END
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai/*
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * Use is subject to license terms.
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#ifndef _VGEN_STATS_H
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#define _VGEN_STATS_H
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#pragma ident "%Z%%M% %I% %E% SMI"
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#ifdef __cplusplus
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaiextern "C" {
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai#endif
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaitypedef struct vgen_stats {
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai /* Link Input/Output stats */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint64_t ipackets; /* # rx packets */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint64_t ierrors; /* # rx error */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint64_t opackets; /* # tx packets */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint64_t oerrors; /* # tx error */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai /* MIB II variables */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint64_t rbytes; /* # bytes received */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint64_t obytes; /* # bytes transmitted */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t multircv; /* # multicast packets received */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t multixmt; /* # multicast packets for xmit */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t brdcstrcv; /* # broadcast packets received */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t brdcstxmt; /* # broadcast packets for xmit */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t norcvbuf; /* # rcv packets discarded */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t noxmtbuf; /* # xmit packets discarded */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai /* Tx Statistics */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t tx_no_desc; /* # out of transmit descriptors */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai /* Rx Statistics */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t rx_allocb_fail; /* # rx buf allocb() failures */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t rx_vio_allocb_fail; /* # vio_allocb() failures */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t rx_lost_pkts; /* # rx lost packets */
bb25c06cca41ca78e5fb87fbb8e81d55beb18c95jg
d62bc4badc1c1f1549c961cfb8b420e650e1272byz /* Callback statistics */
681d9761e8516a7dc5ab6589e2dfe717777e1123Eric Taylor uint32_t callbacks; /* # callbacks */
0a0e9771ca0211c15f3ac4466b661c145feeb9e4Darren Reed uint32_t dring_data_acks; /* # dring data acks recvd */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai uint32_t dring_stopped_acks; /* # dring stopped acks recvd */
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe uint32_t dring_data_msgs; /* # dring data msgs sent */
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe} vgen_stats_t;
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllaitypedef struct vgen_kstats {
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai /*
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * Link Input/Output stats
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t ipackets;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t ipackets64;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t ierrors;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t opackets;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t opackets64;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t oerrors;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai /*
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai * required by kstat for MIB II objects(RFC 1213)
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t rbytes; /* MIB - ifInOctets */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t rbytes64;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t obytes; /* MIB - ifOutOctets */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t obytes64;
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t multircv; /* MIB - ifInNUcastPkts */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t multixmt; /* MIB - ifOutNUcastPkts */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t brdcstrcv; /* MIB - ifInNUcastPkts */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t brdcstxmt; /* MIB - ifOutNUcastPkts */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t norcvbuf; /* MIB - ifInDiscards */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai kstat_named_t noxmtbuf; /* MIB - ifOutDiscards */
facf4a8d7b59fde89a8662b4f4c73a758e6c402cllai
/* Tx Statistics */
kstat_named_t tx_no_desc; /* # out of transmit descriptors */
/* 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 */
/* Callback statistics */
kstat_named_t callbacks; /* # callbacks */
kstat_named_t dring_data_acks; /* # dring data acks recvd */
kstat_named_t dring_stopped_acks; /* # dring stopped acks recvd */
kstat_named_t dring_data_msgs; /* # dring data msgs sent */
} 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 */