safestats.c revision 117852
1139825Simp/*-
266131Swpaul * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
366131Swpaul * All rights reserved.
466131Swpaul *
566131Swpaul * Redistribution and use in source and binary forms, with or without
666131Swpaul * modification, are permitted provided that the following conditions
766131Swpaul * are met:
866131Swpaul * 1. Redistributions of source code must retain the above copyright
966131Swpaul *    notice, this list of conditions and the following disclaimer.
1066131Swpaul * 2. Redistributions in binary form must reproduce the above copyright
1166131Swpaul *    notice, this list of conditions and the following disclaimer in the
1266131Swpaul *    documentation and/or other materials provided with the distribution.
1366131Swpaul *
1466131Swpaul * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1566131Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1666131Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1766131Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1866131Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1966131Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2066131Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2166131Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2266131Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2366131Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2466131Swpaul * SUCH DAMAGE.
2566131Swpaul *
2666131Swpaul * $FreeBSD: head/tools/tools/crypto/safestats.c 117852 2003-07-21 21:58:04Z sam $
2766131Swpaul */
2866131Swpaul#include <stdio.h>
2966131Swpaul#include <sys/types.h>
3066131Swpaul#include "../../../sys/dev/safe/safevar.h"
3166131Swpaul
3266131Swpaul/*
3366131Swpaul * Little program to dump the statistics block for the safe driver.
34122678Sobrien */
35122678Sobrienint
36122678Sobrienmain(int argc, char *argv[])
3766131Swpaul{
38134842Sbrueffer	struct safe_stats stats;
3966131Swpaul	size_t slen;
4066131Swpaul
4166131Swpaul	slen = sizeof (stats);
4266131Swpaul	if (sysctlbyname("hw.safe.stats", &stats, &slen, NULL, NULL) < 0)
4366131Swpaul		err(1, "hw.safe.stats");
4466131Swpaul
4566131Swpaul	printf("input %llu bytes %u packets\n",
4666131Swpaul		stats.st_ibytes, stats.st_ipackets);
4766131Swpaul	printf("output %llu bytes %u packets\n",
4866131Swpaul		stats.st_obytes, stats.st_opackets);
4966131Swpaul	printf("invalid %u badsession %u badflags %u\n",
5066131Swpaul		stats.st_invalid, stats.st_badsession, stats.st_badflags);
5166131Swpaul	printf("nodesc %u badalg %u ringfull %u\n",
5266131Swpaul		stats.st_nodesc, stats.st_badalg, stats.st_ringfull);
5366131Swpaul	printf("peoperr %u dmaerr %u bypasstoobig %u\n",
5466131Swpaul		stats.st_peoperr, stats.st_dmaerr, stats.st_bypasstoobig);
5566131Swpaul	printf("skipmismatch %u lenmismatch %u coffmisaligned %u cofftoobig %u\n",
5666131Swpaul		stats.st_skipmismatch, stats.st_lenmismatch,
5766131Swpaul		stats.st_coffmisaligned, stats.st_cofftoobig);
5866131Swpaul	printf("iovmisaligned %u iovnotuniform %u noicvcopy %u\n",
5966131Swpaul		stats.st_iovmisaligned, stats.st_iovnotuniform,
6066131Swpaul		stats.st_noicvcopy);
61129878Sphk	printf("unaligned %u notuniform %u nomap %u noload %u\n",
6266131Swpaul		stats.st_unaligned, stats.st_notuniform, stats.st_nomap,
6366131Swpaul		stats.st_noload);
6466131Swpaul	printf("nomcl %u mbuf %u maxqchip %u\n",
6566131Swpaul		stats.st_nomcl, stats.st_nombuf, stats.st_maxqchip);
6666131Swpaul	printf("rng %u rngalarm %u\n",
6766131Swpaul		stats.st_rng, stats.st_rngalarm);
6866131Swpaul	return 0;
69147256Sbrooks}
7066131Swpaul