Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)    BlueZ - Bluetooth protocol stack for Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)    Copyright (C) 2000-2001 Qualcomm Incorporated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)    This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)    it under the terms of the GNU General Public License version 2 as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)    published by the Free Software Foundation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)    SOFTWARE IS DISCLAIMED.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #ifndef __BLUETOOTH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define __BLUETOOTH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/poll.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <net/sock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define BT_SUBSYS_VERSION	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define BT_SUBSYS_REVISION	22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #ifndef AF_BLUETOOTH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define AF_BLUETOOTH	31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define PF_BLUETOOTH	AF_BLUETOOTH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) /* Bluetooth versions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define BLUETOOTH_VER_1_1	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define BLUETOOTH_VER_1_2	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define BLUETOOTH_VER_2_0	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define BLUETOOTH_VER_2_1	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define BLUETOOTH_VER_4_0	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /* Reserv for core and drivers use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define BT_SKB_RESERVE	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define BTPROTO_L2CAP	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define BTPROTO_HCI	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define BTPROTO_SCO	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define BTPROTO_RFCOMM	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define BTPROTO_BNEP	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define BTPROTO_CMTP	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define BTPROTO_HIDP	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define BTPROTO_AVDTP	7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define SOL_HCI		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define SOL_L2CAP	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define SOL_SCO		17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define SOL_RFCOMM	18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define BT_SECURITY	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) struct bt_security {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	__u8 level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	__u8 key_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define BT_SECURITY_SDP		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #define BT_SECURITY_LOW		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #define BT_SECURITY_MEDIUM	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) #define BT_SECURITY_HIGH	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #define BT_SECURITY_FIPS	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #define BT_DEFER_SETUP	7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #define BT_FLUSHABLE	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #define BT_FLUSHABLE_OFF	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) #define BT_FLUSHABLE_ON		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #define BT_POWER	9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) struct bt_power {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	__u8 force_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #define BT_POWER_FORCE_ACTIVE_OFF 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #define BT_POWER_FORCE_ACTIVE_ON  1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #define BT_CHANNEL_POLICY	10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) /* BR/EDR only (default policy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  *   AMP controllers cannot be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  *   Channel move requests from the remote device are denied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  *   If the L2CAP channel is currently using AMP, move the channel to BR/EDR.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define BT_CHANNEL_POLICY_BREDR_ONLY		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) /* BR/EDR Preferred
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  *   Allow use of AMP controllers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  *   If the L2CAP channel is currently on AMP, move it to BR/EDR.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  *   Channel move requests from the remote device are allowed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define BT_CHANNEL_POLICY_BREDR_PREFERRED	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* AMP Preferred
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  *   Allow use of AMP controllers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  *   If the L2CAP channel is currently on BR/EDR and AMP controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  *     resources are available, initiate a channel move to AMP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  *   Channel move requests from the remote device are allowed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  *   If the L2CAP socket has not been connected yet, try to create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  *     and configure the channel directly on an AMP controller rather
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  *     than BR/EDR.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #define BT_CHANNEL_POLICY_AMP_PREFERRED		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define BT_VOICE		11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct bt_voice {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	__u16 setting;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define BT_VOICE_TRANSPARENT			0x0003
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define BT_VOICE_CVSD_16BIT			0x0060
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define BT_SNDMTU		12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define BT_RCVMTU		13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define BT_PHY			14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define BT_PHY_BR_1M_1SLOT	0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #define BT_PHY_BR_1M_3SLOT	0x00000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #define BT_PHY_BR_1M_5SLOT	0x00000004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define BT_PHY_EDR_2M_1SLOT	0x00000008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define BT_PHY_EDR_2M_3SLOT	0x00000010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #define BT_PHY_EDR_2M_5SLOT	0x00000020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #define BT_PHY_EDR_3M_1SLOT	0x00000040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define BT_PHY_EDR_3M_3SLOT	0x00000080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #define BT_PHY_EDR_3M_5SLOT	0x00000100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define BT_PHY_LE_1M_TX		0x00000200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #define BT_PHY_LE_1M_RX		0x00000400
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define BT_PHY_LE_2M_TX		0x00000800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define BT_PHY_LE_2M_RX		0x00001000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #define BT_PHY_LE_CODED_TX	0x00002000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #define BT_PHY_LE_CODED_RX	0x00004000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #define BT_MODE			15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define BT_MODE_BASIC		0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #define BT_MODE_ERTM		0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define BT_MODE_STREAMING	0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) #define BT_MODE_LE_FLOWCTL	0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define BT_MODE_EXT_FLOWCTL	0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #define BT_PKT_STATUS          16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) #define BT_SCM_PKT_STATUS	0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) __printf(1, 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) void bt_info(const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) __printf(1, 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) void bt_warn(const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) __printf(1, 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) void bt_err(const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #if IS_ENABLED(CONFIG_BT_FEATURE_DEBUG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) void bt_dbg_set(bool enable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) bool bt_dbg_get(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) __printf(1, 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) void bt_dbg(const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) __printf(1, 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) void bt_warn_ratelimited(const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) __printf(1, 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) void bt_err_ratelimited(const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) #define BT_INFO(fmt, ...)	bt_info(fmt "\n", ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) #define BT_WARN(fmt, ...)	bt_warn(fmt "\n", ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) #define BT_ERR(fmt, ...)	bt_err(fmt "\n", ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) #if IS_ENABLED(CONFIG_BT_FEATURE_DEBUG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #define BT_DBG(fmt, ...)	bt_dbg(fmt "\n", ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) #define BT_DBG(fmt, ...)	pr_debug(fmt "\n", ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #define bt_dev_info(hdev, fmt, ...)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	BT_INFO("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #define bt_dev_warn(hdev, fmt, ...)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	BT_WARN("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) #define bt_dev_err(hdev, fmt, ...)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	BT_ERR("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) #define bt_dev_dbg(hdev, fmt, ...)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	BT_DBG("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #define bt_dev_warn_ratelimited(hdev, fmt, ...)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	bt_warn_ratelimited("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #define bt_dev_err_ratelimited(hdev, fmt, ...)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	bt_err_ratelimited("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /* Connection and socket states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	BT_OPEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	BT_BOUND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	BT_LISTEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	BT_CONNECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	BT_CONNECT2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	BT_CONFIG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	BT_DISCONN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	BT_CLOSED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /* If unused will be removed by compiler */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static inline const char *state_to_string(int state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	switch (state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	case BT_CONNECTED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		return "BT_CONNECTED";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	case BT_OPEN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		return "BT_OPEN";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	case BT_BOUND:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		return "BT_BOUND";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	case BT_LISTEN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		return "BT_LISTEN";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	case BT_CONNECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		return "BT_CONNECT";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	case BT_CONNECT2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		return "BT_CONNECT2";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	case BT_CONFIG:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		return "BT_CONFIG";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	case BT_DISCONN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		return "BT_DISCONN";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	case BT_CLOSED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		return "BT_CLOSED";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	return "invalid state";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /* BD Address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) typedef struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	__u8 b[6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) } __packed bdaddr_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) /* BD Address type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #define BDADDR_BREDR		0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #define BDADDR_LE_PUBLIC	0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #define BDADDR_LE_RANDOM	0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) static inline bool bdaddr_type_is_valid(u8 type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	switch (type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	case BDADDR_BREDR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	case BDADDR_LE_PUBLIC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	case BDADDR_LE_RANDOM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 		return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) static inline bool bdaddr_type_is_le(u8 type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	switch (type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	case BDADDR_LE_PUBLIC:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	case BDADDR_LE_RANDOM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 		return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #define BDADDR_ANY  (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #define BDADDR_NONE (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) /* Copy, swap, convert BD Address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	return memcmp(ba1, ba2, sizeof(bdaddr_t));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	memcpy(dst, src, sizeof(bdaddr_t));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) void baswap(bdaddr_t *dst, const bdaddr_t *src);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) /* Common socket structures and functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) #define bt_sk(__sk) ((struct bt_sock *) __sk)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) struct bt_sock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	struct sock sk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	struct list_head accept_q;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	struct sock *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	void (*skb_msg_name)(struct sk_buff *, void *, int *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	void (*skb_put_cmsg)(struct sk_buff *, struct msghdr *, struct sock *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	BT_SK_DEFER_SETUP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	BT_SK_SUSPEND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) struct bt_sock_list {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	struct hlist_head head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	rwlock_t          lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) #ifdef CONFIG_PROC_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)         int (* custom_seq_show)(struct seq_file *, void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) int  bt_sock_register(int proto, const struct net_proto_family *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) void bt_sock_unregister(int proto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) void bt_sock_link(struct bt_sock_list *l, struct sock *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) int  bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 		     int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) int  bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 			    size_t len, int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) __poll_t bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) int  bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) int  bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) int  bt_sock_wait_ready(struct sock *sk, unsigned long flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) void bt_accept_unlink(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) /* Skb helpers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) struct l2cap_ctrl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	u8	sframe:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 		poll:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 		final:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 		fcs:1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		sar:2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 		super:2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	u16	reqseq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	u16	txseq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	u8	retries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	__le16  psm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	bdaddr_t bdaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	struct l2cap_chan *chan;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) struct sco_ctrl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	u8	pkt_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) struct hci_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status, u16 opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) typedef void (*hci_req_complete_skb_t)(struct hci_dev *hdev, u8 status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 				       u16 opcode, struct sk_buff *skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) #define HCI_REQ_START	BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) #define HCI_REQ_SKB	BIT(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) struct hci_ctrl {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	u16 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	u8 req_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	u8 req_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		hci_req_complete_t req_complete;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 		hci_req_complete_skb_t req_complete_skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) struct bt_skb_cb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	u8 pkt_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 	u8 force_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	u16 expect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	u8 incoming:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 		struct l2cap_ctrl l2cap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 		struct sco_ctrl sco;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 		struct hci_ctrl hci;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) #define hci_skb_pkt_type(skb) bt_cb((skb))->pkt_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) #define hci_skb_expect(skb) bt_cb((skb))->expect
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) #define hci_skb_opcode(skb) bt_cb((skb))->hci.opcode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	skb = alloc_skb(len + BT_SKB_RESERVE, how);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	if (skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 		skb_reserve(skb, BT_SKB_RESERVE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	return skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 					unsigned long len, int nb, int *err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 	struct sk_buff *skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 	if (skb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 		skb_reserve(skb, BT_SKB_RESERVE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	if (!skb && *err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 	*err = sock_error(sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 	if (*err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	if (sk->sk_shutdown) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 		*err = -ECONNRESET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 		goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	return skb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	kfree_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 	return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) int bt_to_errno(u16 code);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) void hci_sock_set_flag(struct sock *sk, int nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) void hci_sock_clear_flag(struct sock *sk, int nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) int hci_sock_test_flag(struct sock *sk, int nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) unsigned short hci_sock_get_channel(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) u32 hci_sock_get_cookie(struct sock *sk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) int hci_sock_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) void hci_sock_cleanup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) int bt_sysfs_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) void bt_sysfs_cleanup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) int bt_procfs_init(struct net *net, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 		   struct bt_sock_list *sk_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 		   int (*seq_show)(struct seq_file *, void *));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) void bt_procfs_cleanup(struct net *net, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) extern struct dentry *bt_debugfs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) int l2cap_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) void l2cap_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) #if IS_ENABLED(CONFIG_BT_BREDR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) int sco_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) void sco_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) static inline int sco_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) static inline void sco_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) int mgmt_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) void mgmt_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) void bt_sock_reclassify_lock(struct sock *sk, int proto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) #endif /* __BLUETOOTH_H */