1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_DKTP_FLOWCTRL_H 28 #define _SYS_DKTP_FLOWCTRL_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 struct flc_obj { 37 opaque_t flc_data; 38 struct flc_objops *flc_ops; 39 }; 40 41 struct flc_objops { 42 int (*flc_init)(opaque_t, opaque_t, opaque_t, void *); 43 int (*flc_free)(struct flc_obj *); 44 int (*flc_enque)(opaque_t, struct buf *); 45 int (*flc_deque)(opaque_t, struct buf *); 46 int (*flc_start_kstat)(opaque_t, char *, int); 47 int (*flc_stop_kstat)(opaque_t); 48 void *flc_resv[2]; 49 }; 50 51 #define FLC_INIT(X, tgcomobjp, queobjp, lkarg) \ 52 (*((struct flc_obj *)(X))->flc_ops->flc_init) \ 53 (((struct flc_obj *)(X))->flc_data, (tgcomobjp), (queobjp), (lkarg)) 54 #define FLC_FREE(X) (*((struct flc_obj *)(X))->flc_ops->flc_free) ((X)) 55 #define FLC_ENQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_enque) \ 56 (((struct flc_obj *)(X))->flc_data, (bp)) 57 #define FLC_DEQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_deque) \ 58 (((struct flc_obj *)(X))->flc_data, (bp)) 59 #define FLC_START_KSTAT(X, devtype, instance) \ 60 (*((struct flc_obj *)(X))->flc_ops->flc_start_kstat)\ 61 (((struct flc_obj *)(X))->flc_data, (devtype), (instance)) 62 #define FLC_STOP_KSTAT(X) (*((struct flc_obj *)(X))->flc_ops->flc_stop_kstat) \ 63 (((struct flc_obj *)(X))->flc_data) 64 65 #ifdef __cplusplus 66 } 67 #endif 68 69 #endif /* _SYS_DKTP_FLOWCTRL_H */ 70