xref: /titanic_44/usr/src/uts/common/sys/squeue.h (revision 9dd0f810214fdc8e1af881a9a5c4b6927629ff9e)
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_SQUEUE_H
28 #define	_SYS_SQUEUE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <sys/processor.h>
38 #include <sys/stream.h>
39 
40 struct squeue_s;
41 typedef struct squeue_s squeue_t;
42 
43 #define	SET_SQUEUE(mp, proc, arg) {				\
44 	ASSERT((mp)->b_prev == NULL);				\
45 	ASSERT((mp)->b_next == NULL);				\
46 	(mp)->b_queue = (queue_t *)(proc);			\
47 	(mp)->b_prev = (mblk_t *)(arg);				\
48 }
49 
50 #define	GET_SQUEUE(mp)		((conn_t *)((mp)->b_prev))->conn_sqp
51 
52 /*
53  * Facility-special private data in squeues.
54  */
55 typedef enum {
56 	SQPRIVATE_TCP,
57 	SQPRIVATE_MAX
58 } sqprivate_t;
59 
60 typedef void (*sqproc_t)(void *, mblk_t *, void *);
61 
62 extern void squeue_init(void);
63 extern squeue_t *squeue_create(char *, processorid_t, clock_t, pri_t);
64 extern void squeue_bind(squeue_t *, processorid_t);
65 extern void squeue_unbind(squeue_t *);
66 extern void squeue_enter_chain(squeue_t *, mblk_t *, mblk_t *,
67     uint32_t, uint8_t);
68 extern void squeue_enter(squeue_t *, mblk_t *, sqproc_t, void *, uint8_t);
69 extern void squeue_enter_nodrain(squeue_t *, mblk_t *, sqproc_t, void *,
70     uint8_t);
71 extern void squeue_fill(squeue_t *, mblk_t *, sqproc_t, void *, uint8_t);
72 extern uintptr_t *squeue_getprivate(squeue_t *, sqprivate_t);
73 extern processorid_t squeue_binding(squeue_t *);
74 
75 extern void squeue_profile_reset(squeue_t *);
76 extern void squeue_profile_enable(squeue_t *);
77 extern void squeue_profile_disable(squeue_t *);
78 extern void squeue_profile_stop(void);
79 extern void squeue_profile_start(void);
80 
81 #ifdef	__cplusplus
82 }
83 #endif
84 
85 #endif	/* _SYS_SQUEUE_H */
86