blob: 54870c067c26682bd89e109ff2828d4431cac208 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SQUEUE_IMPL_H
#define _SYS_SQUEUE_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/squeue.h>
#define SQ_NAMELEN 31
/*
* SQUEUE_DEBUG: If defined as 1, special code is compiled in which records
* additional information aiding debugging is recorded in squeue.
*
* SQUEUE_PROFILE: If defined as 1, special code is compiled in which collects
* various squeue statistics and exports them as kstats.
*
* Ideally we would like both SQUEUE_DEBUG and SQUEUE_PROFILE to be always set,
* but it affects performance, so they are enabled on DEBUG kernels and disabled
* on non-DEBUG by default.
*/
#ifdef DEBUG
#define SQUEUE_DEBUG 1
#define SQUEUE_PROFILE 1
#else
#define SQUEUE_DEBUG 0
#define SQUEUE_PROFILE 0
#endif
typedef struct sqstat_s {
uint_t sq_max_qlen;
uint_t sq_npackets_worker;
uint_t sq_npackets_intr;
uint_t sq_npackets_other;
uint_t sq_nqueued_intr;
uint_t sq_nqueued_other;
uint_t sq_ndrains_worker;
uint_t sq_ndrains_intr;
uint_t sq_ndrains_other;
hrtime_t sq_time_worker;
hrtime_t sq_time_intr;
hrtime_t sq_time_other;
} sqstat_t;
struct squeue_s {
/* Keep the most used members 64bytes cache aligned */
kmutex_t sq_lock; /* lock before using any member */
uint32_t sq_state; /* state flags and message count */
int sq_count; /* # of mblocks in squeue */
mblk_t *sq_first; /* first mblk chain or NULL */
mblk_t *sq_last; /* last mblk chain or NULL */
clock_t sq_awaken; /* time async thread was awakened */
kthread_t *sq_run; /* Current thread processing sq */
void *sq_rx_ring;
clock_t sq_avg_drain_time; /* Avg time to drain a pkt */
processorid_t sq_bind; /* processor to bind to */
kcondvar_t sq_async; /* async thread blocks on */
clock_t sq_wait; /* lbolts to wait after a fill() */
uintptr_t sq_private[SQPRIVATE_MAX];
timeout_id_t sq_tid; /* timer id of pending timeout() */
kthread_t *sq_worker; /* kernel thread id */
char sq_name[SQ_NAMELEN + 1];
#if SQUEUE_DEBUG
/* Debug-only fields */
int sq_isintr; /* serviced by interrupt */
mblk_t *sq_curmp;
void (*sq_curproc)();
conn_t *sq_connp;
uchar_t sq_tag;
#endif
#if SQUEUE_PROFILE
/* Profiling fields */
kstat_t *sq_kstat; /* exported statistics */
sqstat_t sq_stats;
#endif
};
/*
* State flags.
* Note: The MDB IP module depends on the values of these flags.
*/
#define SQS_PROC 0x0001 /* being processed */
#define SQS_WORKER 0x0002 /* worker thread */
#define SQS_ENTER 0x0004 /* enter thread */
#define SQS_FAST 0x0008 /* enter-fast thread */
#define SQS_USER 0x0010 /* A non interrupt user */
#define SQS_BOUND 0x0020 /* Worker thread is bound */
#define SQS_PROFILE 0x0040 /* Enable profiling */
#define SQS_REENTER 0x0080 /* Re entered thread */
#define SQS_TMO_PROG 0x0100 /* Timeout is being set */
#define SQS_POLL_CAPAB 0x0200 /* Squeue can control interrupts */
#define SQS_NO_INTR 0x0400 /* Interrupts currently disabled */
#define SQS_ILL_BOUND 0x0800 /* Squeue bound to an ill */
#define SQS_GET_PKTS 0x1000 /* Moving pkts from NIC in progress */
#define SQS_DEFAULT 0x2000 /* The default squeue for the CPU */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SQUEUE_IMPL_H */
|