1117852Ssam/*- 2117852Ssam * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 3117852Ssam * All rights reserved. 4117852Ssam * 5117852Ssam * Redistribution and use in source and binary forms, with or without 6117852Ssam * modification, are permitted provided that the following conditions 7117852Ssam * are met: 8117852Ssam * 1. Redistributions of source code must retain the above copyright 9117852Ssam * notice, this list of conditions and the following disclaimer. 10117852Ssam * 2. Redistributions in binary form must reproduce the above copyright 11117852Ssam * notice, this list of conditions and the following disclaimer in the 12117852Ssam * documentation and/or other materials provided with the distribution. 13117852Ssam * 14117852Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15117852Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16117852Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17117852Ssam * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18117852Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19117852Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20117852Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21117852Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22117852Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23117852Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24117852Ssam * SUCH DAMAGE. 25117852Ssam * 26117852Ssam * $FreeBSD$ 27117852Ssam */ 28117852Ssam#include <stdio.h> 29117852Ssam#include <sys/types.h> 30117852Ssam#include "../../../sys/dev/safe/safevar.h" 31117852Ssam 32117852Ssam/* 33117852Ssam * Little program to dump the statistics block for the safe driver. 34117852Ssam */ 35117852Ssamint 36117852Ssammain(int argc, char *argv[]) 37117852Ssam{ 38117852Ssam struct safe_stats stats; 39117852Ssam size_t slen; 40117852Ssam 41117852Ssam slen = sizeof (stats); 42117852Ssam if (sysctlbyname("hw.safe.stats", &stats, &slen, NULL, NULL) < 0) 43117852Ssam err(1, "hw.safe.stats"); 44117852Ssam 45117852Ssam printf("input %llu bytes %u packets\n", 46117852Ssam stats.st_ibytes, stats.st_ipackets); 47117852Ssam printf("output %llu bytes %u packets\n", 48117852Ssam stats.st_obytes, stats.st_opackets); 49117852Ssam printf("invalid %u badsession %u badflags %u\n", 50117852Ssam stats.st_invalid, stats.st_badsession, stats.st_badflags); 51117852Ssam printf("nodesc %u badalg %u ringfull %u\n", 52117852Ssam stats.st_nodesc, stats.st_badalg, stats.st_ringfull); 53117852Ssam printf("peoperr %u dmaerr %u bypasstoobig %u\n", 54117852Ssam stats.st_peoperr, stats.st_dmaerr, stats.st_bypasstoobig); 55117852Ssam printf("skipmismatch %u lenmismatch %u coffmisaligned %u cofftoobig %u\n", 56117852Ssam stats.st_skipmismatch, stats.st_lenmismatch, 57117852Ssam stats.st_coffmisaligned, stats.st_cofftoobig); 58117852Ssam printf("iovmisaligned %u iovnotuniform %u noicvcopy %u\n", 59117852Ssam stats.st_iovmisaligned, stats.st_iovnotuniform, 60117852Ssam stats.st_noicvcopy); 61117852Ssam printf("unaligned %u notuniform %u nomap %u noload %u\n", 62117852Ssam stats.st_unaligned, stats.st_notuniform, stats.st_nomap, 63117852Ssam stats.st_noload); 64117852Ssam printf("nomcl %u mbuf %u maxqchip %u\n", 65117852Ssam stats.st_nomcl, stats.st_nombuf, stats.st_maxqchip); 66117852Ssam printf("rng %u rngalarm %u\n", 67117852Ssam stats.st_rng, stats.st_rngalarm); 68117852Ssam return 0; 69117852Ssam} 70