1112098Ssam/*- 2112098Ssam * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting 3112098Ssam * All rights reserved. 4112098Ssam * 5112098Ssam * Redistribution and use in source and binary forms, with or without 6112098Ssam * modification, are permitted provided that the following conditions 7112098Ssam * are met: 8112098Ssam * 1. Redistributions of source code must retain the above copyright 9112098Ssam * notice, this list of conditions and the following disclaimer. 10112098Ssam * 2. Redistributions in binary form must reproduce the above copyright 11112098Ssam * notice, this list of conditions and the following disclaimer in the 12112098Ssam * documentation and/or other materials provided with the distribution. 13112098Ssam * 14112098Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15112098Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16112098Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17112098Ssam * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18112098Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19112098Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20112098Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21112098Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22112098Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23112098Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24112098Ssam * SUCH DAMAGE. 25112098Ssam * 26112098Ssam * $FreeBSD$ 27112098Ssam */ 28112098Ssam#include <stdio.h> 29112098Ssam#include <sys/types.h> 30112100Ssam#include "../../../sys/dev/ubsec/ubsecvar.h" 31112098Ssam 32112098Ssam/* 33112098Ssam * Little program to dump the statistics block for the ubsec driver. 34112098Ssam */ 35112098Ssamint 36112098Ssammain(int argc, char *argv[]) 37112098Ssam{ 38112098Ssam struct ubsec_stats stats; 39112098Ssam size_t slen; 40112098Ssam 41112098Ssam slen = sizeof (stats); 42112098Ssam if (sysctlbyname("hw.ubsec.stats", &stats, &slen, NULL, NULL) < 0) 43112098Ssam err(1, "kern.ubsec_stats"); 44112098Ssam 45112098Ssam printf("input %llu bytes %u packets\n", 46112098Ssam stats.hst_ibytes, stats.hst_ipackets); 47112098Ssam printf("output %llu bytes %u packets\n", 48112098Ssam stats.hst_obytes, stats.hst_opackets); 49112098Ssam printf("invalid %u badsession %u badflags %u\n", 50112098Ssam stats.hst_invalid, stats.hst_badsession, stats.hst_badflags); 51112098Ssam printf("nodesc %u badalg %u nomem %u queuefull %u\n", 52158719Spjd stats.hst_nodesc, stats.hst_badalg, stats.hst_nomem, 53158719Spjd stats.hst_queuefull); 54112098Ssam printf("dmaerr %u mcrerr %u nodmafree %u\n", 55112098Ssam stats.hst_dmaerr, stats.hst_mcrerr, stats.hst_nodmafree); 56112098Ssam printf("lenmismatch %u skipmisatch %u iovmisalined %u\n", 57158719Spjd stats.hst_lenmismatch, stats.hst_skipmismatch, 58158719Spjd stats.hst_iovmisaligned); 59112098Ssam printf("noirq %u unaligned %u nomap %u noload %u nomcl %u\n", 60112098Ssam stats.hst_noirq, stats.hst_unaligned, stats.hst_nomap, 61112098Ssam stats.hst_noload, stats.hst_nomcl); 62112098Ssam printf("totbatch %u maxbatch %u\n", 63112098Ssam stats.hst_totbatch, stats.hst_maxbatch); 64112545Ssam printf("maxqueue %u maxqchip %u mcr1full %u\n", 65112098Ssam stats.hst_maxqueue, stats.hst_maxqchip, stats.hst_mcr1full); 66112098Ssam printf("rng %u modexp %u moexpcrt %u\n", 67112098Ssam stats.hst_rng, stats.hst_modexp, stats.hst_modexpcrt); 68112098Ssam return 0; 69112098Ssam} 70