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 2005 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 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 struct flc_obj { 35 opaque_t flc_data; 36 struct flc_objops *flc_ops; 37 }; 38 39 struct flc_objops { 40 int (*flc_init)(opaque_t, opaque_t, opaque_t, void *); 41 int (*flc_free)(struct flc_obj *); 42 int (*flc_enque)(opaque_t, struct buf *); 43 int (*flc_deque)(opaque_t, struct buf *); 44 int (*flc_start_kstat)(opaque_t, char *, int); 45 int (*flc_stop_kstat)(opaque_t); 46 void *flc_resv[2]; 47 }; 48 49 struct flc_obj *dsngl_create(); 50 struct flc_obj *dmult_create(); 51 struct flc_obj *duplx_create(); 52 struct flc_obj *adapt_create(); 53 54 #define FLC_INIT(X, tgcomobjp, queobjp, lkarg) \ 55 (*((struct flc_obj *)(X))->flc_ops->flc_init) \ 56 (((struct flc_obj *)(X))->flc_data, (tgcomobjp), (queobjp), (lkarg)) 57 #define FLC_FREE(X) (*((struct flc_obj *)(X))->flc_ops->flc_free) ((X)) 58 #define FLC_ENQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_enque) \ 59 (((struct flc_obj *)(X))->flc_data, (bp)) 60 #define FLC_DEQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_deque) \ 61 (((struct flc_obj *)(X))->flc_data, (bp)) 62 #define FLC_START_KSTAT(X, devtype, instance) \ 63 (*((struct flc_obj *)(X))->flc_ops->flc_start_kstat)\ 64 (((struct flc_obj *)(X))->flc_data, (devtype), (instance)) 65 #define FLC_STOP_KSTAT(X) (*((struct flc_obj *)(X))->flc_ops->flc_stop_kstat) \ 66 (((struct flc_obj *)(X))->flc_data) 67 68 #ifdef __cplusplus 69 } 70 #endif 71 72 #endif /* _SYS_DKTP_FLOWCTRL_H */ 73