4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
33 #include <sys/types.h>
34 #include <sys/processor.h>
35 #include <sys/stream.h>
38 typedef struct squeue_s squeue_t
;
40 #define SET_SQUEUE(mp, proc, arg) { \
41 ASSERT((mp)->b_prev == NULL); \
42 ASSERT((mp)->b_next == NULL); \
43 (mp)->b_queue = (queue_t *)(proc); \
44 (mp)->b_prev = (mblk_t *)(arg); \
47 #define GET_SQUEUE(mp) ((conn_t *)((mp)->b_prev))->conn_sqp
49 #define SQ_FILL 0x0001
50 #define SQ_NODRAIN 0x0002
51 #define SQ_PROCESS 0x0004
53 #define SQUEUE_ENTER(sqp, head, tail, cnt, flag, tag) { \
54 sqp->sq_enter(sqp, head, tail, cnt, flag, tag); \
57 #define SQUEUE_ENTER_ONE(sqp, mp, proc, arg, flag, tag) { \
58 ASSERT(mp->b_next == NULL); \
59 ASSERT(mp->b_prev == NULL); \
60 SET_SQUEUE(mp, proc, arg); \
61 SQUEUE_ENTER(sqp, mp, mp, 1, flag, tag); \
65 * May be called only by a thread executing in the squeue. The thread must
66 * not continue to execute any code needing squeue protection after calling
67 * this macro. Please see the comments in squeue.c for more details.
69 #define SQUEUE_SWITCH(connp, new_sqp) \
70 (connp)->conn_sqp = new_sqp;
73 * Facility-special private data in squeues.
80 extern void squeue_init(void);
81 extern squeue_t
*squeue_create(clock_t, pri_t
);
82 extern void squeue_bind(squeue_t
*, processorid_t
);
83 extern void squeue_unbind(squeue_t
*);
84 extern void squeue_enter(squeue_t
*, mblk_t
*, mblk_t
*,
85 uint32_t, int, uint8_t);
86 extern uintptr_t *squeue_getprivate(squeue_t
*, sqprivate_t
);
88 extern int squeue_synch_enter(squeue_t
*, void *, uint8_t);
89 extern void squeue_synch_exit(squeue_t
*, void *);
95 #endif /* _SYS_SQUEUE_H */