xref: /titanic_44/usr/src/uts/common/sys/dktp/flowctrl.h (revision 43369e138469651f508b1edd3512f007d1545665)
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 #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 struct flc_obj *dsngl_create();
52 struct flc_obj *dmult_create();
53 struct flc_obj *duplx_create();
54 struct flc_obj *adapt_create();
55 
56 #define	FLC_INIT(X, tgcomobjp, queobjp, lkarg) \
57 	(*((struct flc_obj *)(X))->flc_ops->flc_init) \
58 	(((struct flc_obj *)(X))->flc_data, (tgcomobjp), (queobjp), (lkarg))
59 #define	FLC_FREE(X) (*((struct flc_obj *)(X))->flc_ops->flc_free) ((X))
60 #define	FLC_ENQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_enque) \
61 	(((struct flc_obj *)(X))->flc_data, (bp))
62 #define	FLC_DEQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_deque) \
63 	(((struct flc_obj *)(X))->flc_data, (bp))
64 #define	FLC_START_KSTAT(X, devtype, instance) \
65 	(*((struct flc_obj *)(X))->flc_ops->flc_start_kstat)\
66 	(((struct flc_obj *)(X))->flc_data, (devtype), (instance))
67 #define	FLC_STOP_KSTAT(X) (*((struct flc_obj *)(X))->flc_ops->flc_stop_kstat) \
68 	(((struct flc_obj *)(X))->flc_data)
69 
70 #ifdef	__cplusplus
71 }
72 #endif
73 
74 #endif	/* _SYS_DKTP_FLOWCTRL_H */
75