1112394Ssam/*-
2112394Ssam * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
3112394Ssam * All rights reserved.
4112394Ssam *
5112394Ssam * Redistribution and use in source and binary forms, with or without
6112394Ssam * modification, are permitted provided that the following conditions
7112394Ssam * are met:
8112394Ssam * 1. Redistributions of source code must retain the above copyright
9112394Ssam *    notice, this list of conditions and the following disclaimer.
10112394Ssam * 2. Redistributions in binary form must reproduce the above copyright
11112394Ssam *    notice, this list of conditions and the following disclaimer in the
12112394Ssam *    documentation and/or other materials provided with the distribution.
13112394Ssam *
14112394Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15112394Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16112394Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17112394Ssam * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18112394Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19112394Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20112394Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21112394Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22112394Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23112394Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24112394Ssam * SUCH DAMAGE.
25112394Ssam *
26112394Ssam * $FreeBSD$
27112394Ssam */
28112394Ssam#include <stdio.h>
29112394Ssam#include <sys/types.h>
30112394Ssam#include "../../../sys/dev/hifn/hifn7751var.h"
31112394Ssam
32112394Ssam/*
33112394Ssam * Little program to dump the statistics block for the hifn driver.
34112394Ssam */
35112394Ssamint
36112394Ssammain(int argc, char *argv[])
37112394Ssam{
38112394Ssam	struct hifn_stats stats;
39112394Ssam	size_t slen;
40112394Ssam
41112394Ssam	slen = sizeof (stats);
42112394Ssam	if (sysctlbyname("hw.hifn.stats", &stats, &slen, NULL, NULL) < 0)
43112394Ssam		err(1, "kern.hifn.stats");
44112394Ssam
45112394Ssam	printf("input %llu bytes %u packets\n",
46112394Ssam		stats.hst_ibytes, stats.hst_ipackets);
47112394Ssam	printf("output %llu bytes %u packets\n",
48112394Ssam		stats.hst_obytes, stats.hst_opackets);
49112394Ssam	printf("invalid %u nomem %u abort %u\n",
50112394Ssam		stats.hst_invalid, stats.hst_nomem, stats.hst_abort);
51112394Ssam	printf("noirq %u unaligned %u\n",
52112394Ssam		stats.hst_noirq, stats.hst_unaligned);
53112394Ssam	printf("totbatch %u maxbatch %u\n",
54112394Ssam		stats.hst_totbatch, stats.hst_maxbatch);
55112394Ssam	printf("nomem: map %u load %u mbuf %u mcl %u cr %u sd %u\n",
56112394Ssam		stats.hst_nomem_map, stats.hst_nomem_load,
57112394Ssam		stats.hst_nomem_mbuf, stats.hst_nomem_mcl,
58112394Ssam		stats.hst_nomem_cr, stats.hst_nomem_sd);
59112394Ssam	return 0;
60112394Ssam}
61