bt_sysctl.c revision 1.1 1 1.1 gdamore /* $NetBSD: bt_sysctl.c,v 1.1 2006/06/19 15:44:45 gdamore Exp $ */
2 1.1 gdamore
3 1.1 gdamore /*-
4 1.1 gdamore * Copyright (c) 2005 Iain Hibbert.
5 1.1 gdamore * Copyright (c) 2006 Itronix Inc.
6 1.1 gdamore * All rights reserved.
7 1.1 gdamore *
8 1.1 gdamore * Redistribution and use in source and binary forms, with or without
9 1.1 gdamore * modification, are permitted provided that the following conditions
10 1.1 gdamore * are met:
11 1.1 gdamore * 1. Redistributions of source code must retain the above copyright
12 1.1 gdamore * notice, this list of conditions and the following disclaimer.
13 1.1 gdamore * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 gdamore * notice, this list of conditions and the following disclaimer in the
15 1.1 gdamore * documentation and/or other materials provided with the distribution.
16 1.1 gdamore * 3. The name of Itronix Inc. may not be used to endorse
17 1.1 gdamore * or promote products derived from this software without specific
18 1.1 gdamore * prior written permission.
19 1.1 gdamore *
20 1.1 gdamore * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
21 1.1 gdamore * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 1.1 gdamore * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 1.1 gdamore * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
24 1.1 gdamore * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 1.1 gdamore * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 1.1 gdamore * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 1.1 gdamore * ON ANY THEORY OF LIABILITY, WHETHER IN
28 1.1 gdamore * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 1.1 gdamore * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 1.1 gdamore * POSSIBILITY OF SUCH DAMAGE.
31 1.1 gdamore */
32 1.1 gdamore
33 1.1 gdamore #include <sys/cdefs.h>
34 1.1 gdamore __KERNEL_RCSID(0, "$NetBSD: bt_sysctl.c,v 1.1 2006/06/19 15:44:45 gdamore Exp $");
35 1.1 gdamore
36 1.1 gdamore #include <sys/param.h>
37 1.1 gdamore #include <sys/kernel.h>
38 1.1 gdamore #include <sys/mbuf.h>
39 1.1 gdamore #include <sys/proc.h>
40 1.1 gdamore #include <sys/sysctl.h>
41 1.1 gdamore #include <sys/systm.h>
42 1.1 gdamore
43 1.1 gdamore #include <netbt/bluetooth.h>
44 1.1 gdamore #include <netbt/hci.h>
45 1.1 gdamore #include <netbt/l2cap.h>
46 1.1 gdamore #include <netbt/rfcomm.h>
47 1.1 gdamore #include <netbt/sco.h>
48 1.1 gdamore
49 1.1 gdamore SYSCTL_SETUP(sysctl_net_bluetooth_setup, "sysctl net.bluetooth subtree setup")
50 1.1 gdamore {
51 1.1 gdamore
52 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
53 1.1 gdamore CTLFLAG_PERMANENT,
54 1.1 gdamore CTLTYPE_NODE, "net", NULL,
55 1.1 gdamore NULL, 0,
56 1.1 gdamore NULL, 0,
57 1.1 gdamore CTL_NET, CTL_EOL);
58 1.1 gdamore
59 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
60 1.1 gdamore CTLFLAG_PERMANENT,
61 1.1 gdamore CTLTYPE_NODE, "bluetooth",
62 1.1 gdamore SYSCTL_DESCR("Bluetooth Protocol Family"),
63 1.1 gdamore NULL, 0,
64 1.1 gdamore NULL, 0,
65 1.1 gdamore CTL_NET, PF_BLUETOOTH, CTL_EOL);
66 1.1 gdamore
67 1.1 gdamore #ifdef BLUETOOTH_DEBUG
68 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
69 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
70 1.1 gdamore CTLTYPE_INT, "debug",
71 1.1 gdamore SYSCTL_DESCR("debug level"),
72 1.1 gdamore NULL, 0,
73 1.1 gdamore &bluetooth_debug, sizeof(bluetooth_debug),
74 1.1 gdamore CTL_NET, PF_BLUETOOTH,
75 1.1 gdamore CTL_CREATE, CTL_EOL);
76 1.1 gdamore #endif
77 1.1 gdamore
78 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
79 1.1 gdamore CTLFLAG_PERMANENT,
80 1.1 gdamore CTLTYPE_NODE, "hci",
81 1.1 gdamore SYSCTL_DESCR("Host Controller Interface"),
82 1.1 gdamore NULL, 0,
83 1.1 gdamore NULL, 0,
84 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI, CTL_EOL);
85 1.1 gdamore
86 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
87 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
88 1.1 gdamore CTLTYPE_INT, "sendspace",
89 1.1 gdamore SYSCTL_DESCR("Socket Send Buffer Size"),
90 1.1 gdamore NULL, 0,
91 1.1 gdamore &hci_sendspace, sizeof(hci_sendspace),
92 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
93 1.1 gdamore CTL_CREATE, CTL_EOL);
94 1.1 gdamore
95 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
96 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
97 1.1 gdamore CTLTYPE_INT, "recvspace",
98 1.1 gdamore SYSCTL_DESCR("Socket Receive Buffer Size"),
99 1.1 gdamore NULL, 0,
100 1.1 gdamore &hci_recvspace, sizeof(hci_recvspace),
101 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
102 1.1 gdamore CTL_CREATE, CTL_EOL);
103 1.1 gdamore
104 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
105 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
106 1.1 gdamore CTLTYPE_INT, "acl_expiry",
107 1.1 gdamore SYSCTL_DESCR("ACL Connection Expiry Time"),
108 1.1 gdamore NULL, 0,
109 1.1 gdamore &hci_acl_expiry, sizeof(hci_acl_expiry),
110 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
111 1.1 gdamore CTL_CREATE, CTL_EOL);
112 1.1 gdamore
113 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
114 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
115 1.1 gdamore CTLTYPE_INT, "memo_expiry",
116 1.1 gdamore SYSCTL_DESCR("Memo Expiry Time"),
117 1.1 gdamore NULL, 0,
118 1.1 gdamore &hci_memo_expiry, sizeof(hci_memo_expiry),
119 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
120 1.1 gdamore CTL_CREATE, CTL_EOL);
121 1.1 gdamore
122 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
123 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
124 1.1 gdamore CTLTYPE_INT, "eventq_max",
125 1.1 gdamore SYSCTL_DESCR("Max Event queue length"),
126 1.1 gdamore NULL, 0,
127 1.1 gdamore &hci_eventq_max, sizeof(hci_eventq_max),
128 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
129 1.1 gdamore CTL_CREATE, CTL_EOL);
130 1.1 gdamore
131 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
132 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
133 1.1 gdamore CTLTYPE_INT, "aclrxq_max",
134 1.1 gdamore SYSCTL_DESCR("Max ACL rx queue length"),
135 1.1 gdamore NULL, 0,
136 1.1 gdamore &hci_aclrxq_max, sizeof(hci_aclrxq_max),
137 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
138 1.1 gdamore CTL_CREATE, CTL_EOL);
139 1.1 gdamore
140 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
141 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
142 1.1 gdamore CTLTYPE_INT, "scorxq_max",
143 1.1 gdamore SYSCTL_DESCR("Max SCO rx queue length"),
144 1.1 gdamore NULL, 0,
145 1.1 gdamore &hci_scorxq_max, sizeof(hci_scorxq_max),
146 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
147 1.1 gdamore CTL_CREATE, CTL_EOL);
148 1.1 gdamore
149 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
150 1.1 gdamore CTLFLAG_PERMANENT,
151 1.1 gdamore CTLTYPE_NODE, "l2cap",
152 1.1 gdamore SYSCTL_DESCR("Logical Link Control & Adapataion Protocol"),
153 1.1 gdamore NULL, 0, NULL, 0,
154 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP, CTL_EOL);
155 1.1 gdamore
156 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
157 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
158 1.1 gdamore CTLTYPE_INT, "sendspace",
159 1.1 gdamore SYSCTL_DESCR("Socket Send Buffer Size"),
160 1.1 gdamore NULL, 0,
161 1.1 gdamore &l2cap_sendspace, sizeof(l2cap_sendspace),
162 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
163 1.1 gdamore CTL_CREATE, CTL_EOL);
164 1.1 gdamore
165 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
166 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
167 1.1 gdamore CTLTYPE_INT, "recvspace",
168 1.1 gdamore SYSCTL_DESCR("Socket Receive Buffer Size"),
169 1.1 gdamore NULL, 0,
170 1.1 gdamore &l2cap_recvspace, sizeof(l2cap_recvspace),
171 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
172 1.1 gdamore CTL_CREATE, CTL_EOL);
173 1.1 gdamore
174 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
175 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
176 1.1 gdamore CTLTYPE_INT, "rtx",
177 1.1 gdamore SYSCTL_DESCR("Response Timeout"),
178 1.1 gdamore NULL, 0,
179 1.1 gdamore &l2cap_response_timeout, sizeof(l2cap_response_timeout),
180 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
181 1.1 gdamore CTL_CREATE, CTL_EOL);
182 1.1 gdamore
183 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
184 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
185 1.1 gdamore CTLTYPE_INT, "ertx",
186 1.1 gdamore SYSCTL_DESCR("Extended Response Timeout"),
187 1.1 gdamore NULL, 0,
188 1.1 gdamore &l2cap_response_extended_timeout,
189 1.1 gdamore sizeof(l2cap_response_extended_timeout),
190 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
191 1.1 gdamore CTL_CREATE, CTL_EOL);
192 1.1 gdamore
193 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
194 1.1 gdamore CTLFLAG_PERMANENT,
195 1.1 gdamore CTLTYPE_NODE, "rfcomm",
196 1.1 gdamore SYSCTL_DESCR("Serial Cable Emulation"),
197 1.1 gdamore NULL, 0, NULL, 0,
198 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM, CTL_EOL);
199 1.1 gdamore
200 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
201 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
202 1.1 gdamore CTLTYPE_INT, "sendspace",
203 1.1 gdamore SYSCTL_DESCR("Socket Send Buffer Size"),
204 1.1 gdamore NULL, 0,
205 1.1 gdamore &rfcomm_sendspace, sizeof(rfcomm_sendspace),
206 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
207 1.1 gdamore CTL_CREATE, CTL_EOL);
208 1.1 gdamore
209 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
210 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
211 1.1 gdamore CTLTYPE_INT, "recvspace",
212 1.1 gdamore SYSCTL_DESCR("Socket Receive Buffer Size"),
213 1.1 gdamore NULL, 0,
214 1.1 gdamore &rfcomm_recvspace, sizeof(rfcomm_recvspace),
215 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
216 1.1 gdamore CTL_CREATE, CTL_EOL);
217 1.1 gdamore
218 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
219 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
220 1.1 gdamore CTLTYPE_INT, "mtu_default",
221 1.1 gdamore SYSCTL_DESCR("Default MTU"),
222 1.1 gdamore NULL, 0,
223 1.1 gdamore &rfcomm_mtu_default, sizeof(rfcomm_mtu_default),
224 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
225 1.1 gdamore CTL_CREATE, CTL_EOL);
226 1.1 gdamore
227 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
228 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
229 1.1 gdamore CTLTYPE_INT, "ack_timeout",
230 1.1 gdamore SYSCTL_DESCR("Acknowledgement Timer"),
231 1.1 gdamore NULL, 0,
232 1.1 gdamore &rfcomm_ack_timeout, sizeof(rfcomm_ack_timeout),
233 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
234 1.1 gdamore CTL_CREATE, CTL_EOL);
235 1.1 gdamore
236 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
237 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
238 1.1 gdamore CTLTYPE_INT, "mcc_timeout",
239 1.1 gdamore SYSCTL_DESCR("Response Timeout for Multiplexer Control Channel"),
240 1.1 gdamore NULL, 0,
241 1.1 gdamore &rfcomm_mcc_timeout, sizeof(rfcomm_mcc_timeout),
242 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
243 1.1 gdamore CTL_CREATE, CTL_EOL);
244 1.1 gdamore
245 1.1 gdamore #ifdef BLUETOOTH_SCO
246 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
247 1.1 gdamore CTLFLAG_PERMANENT,
248 1.1 gdamore CTLTYPE_NODE, "sco",
249 1.1 gdamore SYSCTL_DESCR("SCO data"),
250 1.1 gdamore NULL, 0, NULL, 0,
251 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_SCO, CTL_EOL);
252 1.1 gdamore
253 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
254 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
255 1.1 gdamore CTLTYPE_INT, "sendspace",
256 1.1 gdamore SYSCTL_DESCR("Socket Send Buffer Size"),
257 1.1 gdamore NULL, 0,
258 1.1 gdamore &sco_sendspace, sizeof(sco_sendspace),
259 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_SCO,
260 1.1 gdamore CTL_CREATE, CTL_EOL);
261 1.1 gdamore
262 1.1 gdamore sysctl_createv(clog, 0, NULL, NULL,
263 1.1 gdamore CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
264 1.1 gdamore CTLTYPE_INT, "recvspace",
265 1.1 gdamore SYSCTL_DESCR("Socket Receive Buffer Size"),
266 1.1 gdamore NULL, 0,
267 1.1 gdamore &sco_recvspace, sizeof(sco_recvspace),
268 1.1 gdamore CTL_NET, PF_BLUETOOTH, BTPROTO_SCO,
269 1.1 gdamore CTL_CREATE, CTL_EOL);
270 1.1 gdamore #endif
271 1.1 gdamore }
272