10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*9105SStephen.Hanson@Sun.COM * Common Development and Distribution License (the "License"). 6*9105SStephen.Hanson@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*9105SStephen.Hanson@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _ERRORQ_IMPL_H 270Sstevel@tonic-gate #define _ERRORQ_IMPL_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <sys/errorq.h> 300Sstevel@tonic-gate #include <sys/dditypes.h> 310Sstevel@tonic-gate #include <sys/kstat.h> 320Sstevel@tonic-gate 330Sstevel@tonic-gate #ifdef __cplusplus 340Sstevel@tonic-gate extern "C" { 350Sstevel@tonic-gate #endif 360Sstevel@tonic-gate 370Sstevel@tonic-gate typedef struct errorq_nvelem { 380Sstevel@tonic-gate void *eqn_buf; /* data buf for this nv element */ 390Sstevel@tonic-gate nvlist_t *eqn_nvl; /* nvlist */ 400Sstevel@tonic-gate nv_alloc_t *eqn_nva; /* fixed nv allocator */ 410Sstevel@tonic-gate } errorq_nvelem_t; 420Sstevel@tonic-gate 430Sstevel@tonic-gate struct errorq_elem { 440Sstevel@tonic-gate struct errorq_elem *eqe_next; /* next on processing list */ 450Sstevel@tonic-gate struct errorq_elem *eqe_prev; /* prev on free or pend list */ 460Sstevel@tonic-gate struct errorq_elem *eqe_dump; /* next on crash dump list */ 470Sstevel@tonic-gate void *eqe_data; /* data for this element */ 480Sstevel@tonic-gate }; 490Sstevel@tonic-gate 500Sstevel@tonic-gate typedef struct errorq_kstat { 510Sstevel@tonic-gate kstat_named_t eqk_dispatched; /* total errors dispatched */ 520Sstevel@tonic-gate kstat_named_t eqk_dropped; /* total errors dropped */ 530Sstevel@tonic-gate kstat_named_t eqk_logged; /* total errors logged */ 540Sstevel@tonic-gate kstat_named_t eqk_reserved; /* total errors reserved */ 550Sstevel@tonic-gate kstat_named_t eqk_reserve_fail; /* total reservation failures */ 560Sstevel@tonic-gate kstat_named_t eqk_committed; /* total errors committed */ 570Sstevel@tonic-gate kstat_named_t eqk_commit_fail; /* total commit failures */ 580Sstevel@tonic-gate kstat_named_t eqk_cancelled; /* total reserves cancelled */ 590Sstevel@tonic-gate } errorq_kstat_t; 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * errorq implementation flags: bit range 16-31 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate #define ERRORQ_ACTIVE 0x00010000 /* queue is enabled */ 650Sstevel@tonic-gate #define ERRORQ_NVLIST 0x00020000 /* nvlist queue */ 660Sstevel@tonic-gate 670Sstevel@tonic-gate #define ERRORQ_NAMELEN 31 /* length of queue name */ 680Sstevel@tonic-gate 690Sstevel@tonic-gate struct errorq { 700Sstevel@tonic-gate char eq_name[ERRORQ_NAMELEN + 1]; /* string name for debugging */ 710Sstevel@tonic-gate errorq_kstat_t eq_kstat; /* kstat data (see above) */ 720Sstevel@tonic-gate kstat_t *eq_ksp; /* pointer to installed kstat */ 730Sstevel@tonic-gate errorq_func_t eq_func; /* drain callback */ 740Sstevel@tonic-gate void *eq_private; /* drain callback data */ 750Sstevel@tonic-gate void *eq_data; /* buffer of queue data */ 760Sstevel@tonic-gate ulong_t eq_qlen; /* maximum queue length */ 770Sstevel@tonic-gate size_t eq_size; /* size of element data */ 780Sstevel@tonic-gate uint_t eq_ipl; /* soft interrupt priority */ 790Sstevel@tonic-gate uint_t eq_flags; /* flags (see above) */ 800Sstevel@tonic-gate ddi_softintr_t eq_id; /* soft interrupt identifier */ 810Sstevel@tonic-gate kmutex_t eq_lock; /* consumer lock */ 820Sstevel@tonic-gate errorq_elem_t *eq_elems; /* array of all elements */ 830Sstevel@tonic-gate errorq_elem_t *eq_phead; /* head of processing list */ 840Sstevel@tonic-gate errorq_elem_t *eq_ptail; /* tail of processing list */ 850Sstevel@tonic-gate errorq_elem_t *eq_pend; /* list of pending errors */ 86*9105SStephen.Hanson@Sun.COM ulong_t *eq_bitmap; /* bitmap of free elements */ 870Sstevel@tonic-gate errorq_elem_t *eq_dump; /* list of crash dump elem's */ 880Sstevel@tonic-gate struct errorq *eq_next; /* next errorq on global list */ 89*9105SStephen.Hanson@Sun.COM index_t eq_rotor; /* best efforts bitmap rotor */ 900Sstevel@tonic-gate }; 910Sstevel@tonic-gate 920Sstevel@tonic-gate #ifdef __cplusplus 930Sstevel@tonic-gate } 940Sstevel@tonic-gate #endif 950Sstevel@tonic-gate 960Sstevel@tonic-gate #endif /* _ERRORQ_IMPL_H */ 97