06db247c678f0e3956535e8a6dec31d6c2108827raghuram/*
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * CDDL HEADER START
06db247c678f0e3956535e8a6dec31d6c2108827raghuram *
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * The contents of this file are subject to the terms of the
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * Common Development and Distribution License (the "License").
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * You may not use this file except in compliance with the License.
06db247c678f0e3956535e8a6dec31d6c2108827raghuram *
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * or http://www.opensolaris.org/os/licensing.
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * See the License for the specific language governing permissions
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * and limitations under the License.
06db247c678f0e3956535e8a6dec31d6c2108827raghuram *
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * When distributing Covered Code, include this CDDL HEADER in each
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * If applicable, add the following below this CDDL HEADER, with the
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * fields enclosed by brackets "[]" replaced with your own identifying
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * information: Portions Copyright [yyyy] [name of copyright owner]
06db247c678f0e3956535e8a6dec31d6c2108827raghuram *
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * CDDL HEADER END
06db247c678f0e3956535e8a6dec31d6c2108827raghuram */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram/*
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * Use is subject to license terms.
06db247c678f0e3956535e8a6dec31d6c2108827raghuram */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram#ifndef _VGEN_STATS_H
06db247c678f0e3956535e8a6dec31d6c2108827raghuram#define _VGEN_STATS_H
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram#ifdef __cplusplus
06db247c678f0e3956535e8a6dec31d6c2108827raghuramextern "C" {
06db247c678f0e3956535e8a6dec31d6c2108827raghuram#endif
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuramtypedef struct vgen_stats {
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* Link Input/Output stats */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint64_t ipackets; /* # rx packets */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint64_t ierrors; /* # rx error */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint64_t opackets; /* # tx packets */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint64_t oerrors; /* # tx error */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* MIB II variables */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint64_t rbytes; /* # bytes received */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint64_t obytes; /* # bytes transmitted */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t multircv; /* # multicast packets received */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t multixmt; /* # multicast packets for xmit */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t brdcstrcv; /* # broadcast packets received */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t brdcstxmt; /* # broadcast packets for xmit */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t norcvbuf; /* # rcv packets discarded */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t noxmtbuf; /* # xmit packets discarded */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* Tx Statistics */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t tx_no_desc; /* # out of transmit descriptors */
f0ca1d9a12d54d304791bc74525e2010ca924726sb uint32_t tx_qfull; /* pkts dropped due to qfull in vsw */
f0ca1d9a12d54d304791bc74525e2010ca924726sb uint32_t tx_pri_fail; /* # tx priority packet failures */
f0ca1d9a12d54d304791bc74525e2010ca924726sb uint64_t tx_pri_packets; /* # priority packets transmitted */
f0ca1d9a12d54d304791bc74525e2010ca924726sb uint64_t tx_pri_bytes; /* # priority bytes transmitted */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* Rx Statistics */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t rx_allocb_fail; /* # rx buf allocb() failures */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t rx_vio_allocb_fail; /* # vio_allocb() failures */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t rx_lost_pkts; /* # rx lost packets */
f0ca1d9a12d54d304791bc74525e2010ca924726sb uint32_t rx_pri_fail; /* # rx priority packet failures */
f0ca1d9a12d54d304791bc74525e2010ca924726sb uint64_t rx_pri_packets; /* # priority packets received */
f0ca1d9a12d54d304791bc74525e2010ca924726sb uint64_t rx_pri_bytes; /* # priority bytes received */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* Callback statistics */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram uint32_t callbacks; /* # callbacks */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna uint32_t dring_data_msgs_sent; /* # dring data msgs sent */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna uint32_t dring_data_acks_rcvd; /* # dring data acks recvd */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna uint32_t dring_stopped_acks_rcvd; /* # dring stopped acks rcvd */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna uint32_t dring_data_msgs_rcvd; /* # dring data msgs rcvd */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna uint32_t dring_data_acks_sent; /* # dring data acks sent */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna uint32_t dring_stopped_acks_sent; /* # dring stopped acks sent */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna uint32_t dring_mode; /* dring mode */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram} vgen_stats_t;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuramtypedef struct vgen_kstats {
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /*
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * Link Input/Output stats
06db247c678f0e3956535e8a6dec31d6c2108827raghuram */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t ipackets;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t ipackets64;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t ierrors;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t opackets;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t opackets64;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t oerrors;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /*
06db247c678f0e3956535e8a6dec31d6c2108827raghuram * required by kstat for MIB II objects(RFC 1213)
06db247c678f0e3956535e8a6dec31d6c2108827raghuram */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t rbytes; /* MIB - ifInOctets */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t rbytes64;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t obytes; /* MIB - ifOutOctets */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t obytes64;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t multircv; /* MIB - ifInNUcastPkts */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t multixmt; /* MIB - ifOutNUcastPkts */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t brdcstrcv; /* MIB - ifInNUcastPkts */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t brdcstxmt; /* MIB - ifOutNUcastPkts */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t norcvbuf; /* MIB - ifInDiscards */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t noxmtbuf; /* MIB - ifOutDiscards */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* Tx Statistics */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t tx_no_desc; /* # out of transmit descriptors */
f0ca1d9a12d54d304791bc74525e2010ca924726sb kstat_named_t tx_qfull; /* pkts dropped due to qfull in vsw */
f0ca1d9a12d54d304791bc74525e2010ca924726sb kstat_named_t tx_pri_fail; /* # tx priority packet failures */
f0ca1d9a12d54d304791bc74525e2010ca924726sb kstat_named_t tx_pri_packets; /* # priority packets transmitted */
f0ca1d9a12d54d304791bc74525e2010ca924726sb kstat_named_t tx_pri_bytes; /* # priority bytes transmitted */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* Rx Statistics */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t rx_allocb_fail; /* # rx buf allocb failures */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t rx_vio_allocb_fail; /* # vio_allocb() failures */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t rx_lost_pkts; /* # rx lost packets */
f0ca1d9a12d54d304791bc74525e2010ca924726sb kstat_named_t rx_pri_fail; /* # rx priority packet failures */
f0ca1d9a12d54d304791bc74525e2010ca924726sb kstat_named_t rx_pri_packets; /* # priority packets received */
f0ca1d9a12d54d304791bc74525e2010ca924726sb kstat_named_t rx_pri_bytes; /* # priority bytes received */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram /* Callback statistics */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram kstat_named_t callbacks; /* # callbacks */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna kstat_named_t dring_data_msgs_sent; /* # dring data msgs sent */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna kstat_named_t dring_data_acks_rcvd; /* # dring data acks recvd */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna kstat_named_t dring_stopped_acks_rcvd; /* # dring stopped acks rcvd */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna kstat_named_t dring_data_msgs_rcvd; /* # dring data msgs rcvd */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna kstat_named_t dring_data_acks_sent; /* # dring data acks sent */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna kstat_named_t dring_stopped_acks_sent; /* # dring stopped acks sent */
7bd3a2e26cc8569257b88c1691d559138e1d32d0Sriharsha Basavapatna kstat_named_t dring_mode; /* dring mode */
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram} vgen_kstats_t;
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuramkstat_t *vgen_setup_kstats(char *ks_mod, int instance,
06db247c678f0e3956535e8a6dec31d6c2108827raghuram char *ks_name, vgen_stats_t *statsp);
06db247c678f0e3956535e8a6dec31d6c2108827raghuramvoid vgen_destroy_kstats(kstat_t *ksp);
06db247c678f0e3956535e8a6dec31d6c2108827raghuramint vgen_kstat_update(kstat_t *ksp, int rw);
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram#ifdef __cplusplus
06db247c678f0e3956535e8a6dec31d6c2108827raghuram}
06db247c678f0e3956535e8a6dec31d6c2108827raghuram#endif
06db247c678f0e3956535e8a6dec31d6c2108827raghuram
06db247c678f0e3956535e8a6dec31d6c2108827raghuram#endif /* _VGEN_STATS_H */