Home | History | Annotate | Line # | Download | only in netbt
bt_sysctl.c revision 1.2.94.1
      1  1.2.94.1     yamt /*	$NetBSD: bt_sysctl.c,v 1.2.94.1 2014/05/22 11:41:09 yamt 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.2.94.1     yamt __KERNEL_RCSID(0, "$NetBSD: bt_sysctl.c,v 1.2.94.1 2014/05/22 11:41:09 yamt 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, "bluetooth",
     55       1.1  gdamore 		SYSCTL_DESCR("Bluetooth Protocol Family"),
     56       1.1  gdamore 		NULL, 0,
     57       1.1  gdamore 		NULL, 0,
     58       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, CTL_EOL);
     59       1.1  gdamore 
     60       1.1  gdamore #ifdef BLUETOOTH_DEBUG
     61       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
     62       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
     63       1.1  gdamore 		CTLTYPE_INT, "debug",
     64       1.1  gdamore 		SYSCTL_DESCR("debug level"),
     65       1.1  gdamore 		NULL, 0,
     66       1.1  gdamore 		&bluetooth_debug, sizeof(bluetooth_debug),
     67       1.1  gdamore 		CTL_NET, PF_BLUETOOTH,
     68       1.1  gdamore 		CTL_CREATE, CTL_EOL);
     69       1.1  gdamore #endif
     70       1.1  gdamore 
     71       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
     72       1.1  gdamore 		CTLFLAG_PERMANENT,
     73       1.1  gdamore 		CTLTYPE_NODE, "hci",
     74       1.1  gdamore 		SYSCTL_DESCR("Host Controller Interface"),
     75       1.1  gdamore 		NULL, 0,
     76       1.1  gdamore 		NULL, 0,
     77       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI, CTL_EOL);
     78       1.1  gdamore 
     79       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
     80       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
     81       1.1  gdamore 		CTLTYPE_INT, "sendspace",
     82       1.1  gdamore 		SYSCTL_DESCR("Socket Send Buffer Size"),
     83       1.1  gdamore 		NULL, 0,
     84       1.1  gdamore 		&hci_sendspace, sizeof(hci_sendspace),
     85       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
     86       1.1  gdamore 		CTL_CREATE, CTL_EOL);
     87       1.1  gdamore 
     88       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
     89       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
     90       1.1  gdamore 		CTLTYPE_INT, "recvspace",
     91       1.1  gdamore 		SYSCTL_DESCR("Socket Receive Buffer Size"),
     92       1.1  gdamore 		NULL, 0,
     93       1.1  gdamore 		&hci_recvspace, sizeof(hci_recvspace),
     94       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
     95       1.1  gdamore 		CTL_CREATE, CTL_EOL);
     96       1.1  gdamore 
     97       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
     98       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
     99       1.1  gdamore 		CTLTYPE_INT, "acl_expiry",
    100       1.1  gdamore 		SYSCTL_DESCR("ACL Connection Expiry Time"),
    101       1.1  gdamore 		NULL, 0,
    102       1.1  gdamore 		&hci_acl_expiry, sizeof(hci_acl_expiry),
    103       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
    104       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    105       1.1  gdamore 
    106       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    107       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    108       1.1  gdamore 		CTLTYPE_INT, "memo_expiry",
    109       1.1  gdamore 		SYSCTL_DESCR("Memo Expiry Time"),
    110       1.1  gdamore 		NULL, 0,
    111       1.1  gdamore 		&hci_memo_expiry, sizeof(hci_memo_expiry),
    112       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
    113       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    114       1.1  gdamore 
    115       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    116       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    117       1.1  gdamore 		CTLTYPE_INT, "eventq_max",
    118       1.1  gdamore 		SYSCTL_DESCR("Max Event queue length"),
    119       1.1  gdamore 		NULL, 0,
    120       1.1  gdamore 		&hci_eventq_max, sizeof(hci_eventq_max),
    121       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
    122       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    123       1.1  gdamore 
    124       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    125       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    126       1.1  gdamore 		CTLTYPE_INT, "aclrxq_max",
    127       1.1  gdamore 		SYSCTL_DESCR("Max ACL rx queue length"),
    128       1.1  gdamore 		NULL, 0,
    129       1.1  gdamore 		&hci_aclrxq_max, sizeof(hci_aclrxq_max),
    130       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
    131       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    132       1.1  gdamore 
    133       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    134       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    135       1.1  gdamore 		CTLTYPE_INT, "scorxq_max",
    136       1.1  gdamore 		SYSCTL_DESCR("Max SCO rx queue length"),
    137       1.1  gdamore 		NULL, 0,
    138       1.1  gdamore 		&hci_scorxq_max, sizeof(hci_scorxq_max),
    139       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_HCI,
    140       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    141       1.1  gdamore 
    142       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    143       1.1  gdamore 		CTLFLAG_PERMANENT,
    144       1.1  gdamore 		CTLTYPE_NODE, "l2cap",
    145       1.1  gdamore 		SYSCTL_DESCR("Logical Link Control & Adapataion Protocol"),
    146       1.1  gdamore 		NULL, 0, NULL, 0,
    147       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP, CTL_EOL);
    148       1.1  gdamore 
    149       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    150       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    151       1.1  gdamore 		CTLTYPE_INT, "sendspace",
    152       1.1  gdamore 		SYSCTL_DESCR("Socket Send Buffer Size"),
    153       1.1  gdamore 		NULL, 0,
    154       1.1  gdamore 		&l2cap_sendspace, sizeof(l2cap_sendspace),
    155       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
    156       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    157       1.1  gdamore 
    158       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    159       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    160       1.1  gdamore 		CTLTYPE_INT, "recvspace",
    161       1.1  gdamore 		SYSCTL_DESCR("Socket Receive Buffer Size"),
    162       1.1  gdamore 		NULL, 0,
    163       1.1  gdamore 		&l2cap_recvspace, sizeof(l2cap_recvspace),
    164       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
    165       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    166       1.1  gdamore 
    167       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    168       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    169       1.1  gdamore 		CTLTYPE_INT, "rtx",
    170       1.1  gdamore 		SYSCTL_DESCR("Response Timeout"),
    171       1.1  gdamore 		NULL, 0,
    172       1.1  gdamore 		&l2cap_response_timeout, sizeof(l2cap_response_timeout),
    173       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
    174       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    175       1.1  gdamore 
    176       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    177       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    178       1.1  gdamore 		CTLTYPE_INT, "ertx",
    179       1.1  gdamore 		SYSCTL_DESCR("Extended Response Timeout"),
    180       1.1  gdamore 		NULL, 0,
    181       1.1  gdamore 		&l2cap_response_extended_timeout,
    182       1.1  gdamore 		sizeof(l2cap_response_extended_timeout),
    183       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_L2CAP,
    184       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    185       1.1  gdamore 
    186       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    187       1.1  gdamore 		CTLFLAG_PERMANENT,
    188       1.1  gdamore 		CTLTYPE_NODE, "rfcomm",
    189       1.1  gdamore 		SYSCTL_DESCR("Serial Cable Emulation"),
    190       1.1  gdamore 		NULL, 0, NULL, 0,
    191       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM, CTL_EOL);
    192       1.1  gdamore 
    193       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    194       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    195       1.1  gdamore 		CTLTYPE_INT, "sendspace",
    196       1.1  gdamore 		SYSCTL_DESCR("Socket Send Buffer Size"),
    197       1.1  gdamore 		NULL, 0,
    198       1.1  gdamore 		&rfcomm_sendspace, sizeof(rfcomm_sendspace),
    199       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
    200       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    201       1.1  gdamore 
    202       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    203       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    204       1.1  gdamore 		CTLTYPE_INT, "recvspace",
    205       1.1  gdamore 		SYSCTL_DESCR("Socket Receive Buffer Size"),
    206       1.1  gdamore 		NULL, 0,
    207       1.1  gdamore 		&rfcomm_recvspace, sizeof(rfcomm_recvspace),
    208       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
    209       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    210       1.1  gdamore 
    211       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    212       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    213       1.1  gdamore 		CTLTYPE_INT, "mtu_default",
    214       1.1  gdamore 		SYSCTL_DESCR("Default MTU"),
    215       1.1  gdamore 		NULL, 0,
    216       1.1  gdamore 		&rfcomm_mtu_default, sizeof(rfcomm_mtu_default),
    217       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
    218       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    219       1.1  gdamore 
    220       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    221       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    222       1.1  gdamore 		CTLTYPE_INT, "ack_timeout",
    223       1.1  gdamore 		SYSCTL_DESCR("Acknowledgement Timer"),
    224       1.1  gdamore 		NULL, 0,
    225       1.1  gdamore 		&rfcomm_ack_timeout, sizeof(rfcomm_ack_timeout),
    226       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
    227       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    228       1.1  gdamore 
    229       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    230       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    231       1.1  gdamore 		CTLTYPE_INT, "mcc_timeout",
    232       1.1  gdamore 		SYSCTL_DESCR("Response Timeout for Multiplexer Control Channel"),
    233       1.1  gdamore 		NULL, 0,
    234       1.1  gdamore 		&rfcomm_mcc_timeout, sizeof(rfcomm_mcc_timeout),
    235       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_RFCOMM,
    236       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    237       1.1  gdamore 
    238       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    239       1.1  gdamore 		CTLFLAG_PERMANENT,
    240       1.1  gdamore 		CTLTYPE_NODE, "sco",
    241       1.1  gdamore 		SYSCTL_DESCR("SCO data"),
    242       1.1  gdamore 		NULL, 0, NULL, 0,
    243       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_SCO, CTL_EOL);
    244       1.1  gdamore 
    245       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    246       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    247       1.1  gdamore 		CTLTYPE_INT, "sendspace",
    248       1.1  gdamore 		SYSCTL_DESCR("Socket Send Buffer Size"),
    249       1.1  gdamore 		NULL, 0,
    250       1.1  gdamore 		&sco_sendspace, sizeof(sco_sendspace),
    251       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_SCO,
    252       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    253       1.1  gdamore 
    254       1.1  gdamore 	sysctl_createv(clog, 0, NULL, NULL,
    255       1.1  gdamore 		CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
    256       1.1  gdamore 		CTLTYPE_INT, "recvspace",
    257       1.1  gdamore 		SYSCTL_DESCR("Socket Receive Buffer Size"),
    258       1.1  gdamore 		NULL, 0,
    259       1.1  gdamore 		&sco_recvspace, sizeof(sco_recvspace),
    260       1.1  gdamore 		CTL_NET, PF_BLUETOOTH, BTPROTO_SCO,
    261       1.1  gdamore 		CTL_CREATE, CTL_EOL);
    262       1.1  gdamore }
    263