1# Bluetooth common configuration options 2 3# Copyright (c) 2017 Nordic Semiconductor ASA 4# Copyright (c) 2016 Intel Corporation 5# SPDX-License-Identifier: Apache-2.0 6 7menu "Bluetooth buffer configuration" 8 9config BT_BUF_ACL_TX_SIZE 10 int "Maximum supported ACL size for outgoing data" 11 range 27 $(UINT16_MAX) 12 default 37 if BT_MESH_GATT 13 default 27 14 help 15 Maximum supported ACL size of data packets sent from the Host to the 16 Controller. This value does not include the HCI ACL header. 17 18 In a combined build this value will be set in both the Host and the 19 Controller. 20 21 In a Host-only build the Host will read the maximum ACL size supported 22 by the Controller and use the smallest value supported by both the 23 Host and the Controller. 24 25 The Host supports sending of larger L2CAP PDUs than the ACL size and 26 will fragment L2CAP PDUs into ACL data packets. 27 The Controller will return this value in the HCI LE Read Buffer 28 Size command response. If this size if greater than effective Link 29 Layer transmission size then the Controller will perform 30 fragmentation before transmitting the packet(s) on air. 31 If this value is less than the effective Link Layer transmission size 32 then this will restrict the maximum Link Layer transmission size. 33 34config BT_BUF_ACL_TX_COUNT 35 int "Number of outgoing ACL data buffers" 36 default 7 if BT_HCI_RAW 37 default 4 if BT_MESH_GATT 38 default 3 39 range 1 $(UINT8_MAX) 40 help 41 Number of outgoing ACL data buffers sent from the Host to the 42 Controller. This determines the maximum amount of data packets the 43 Host can have queued in the Controller before waiting for the 44 to notify the Host that more packets can be queued with the Number of 45 Completed Packets event. 46 The buffers are shared between all of the connections and the Host 47 determines how to divide the buffers between the connections. 48 The Controller will return this value in the HCI LE Read Buffer Size 49 command response. 50 51config BT_BUF_ACL_RX_SIZE 52 int "Maximum supported ACL size for incoming data" 53 default 200 if BT_CLASSIC 54 default 70 if BT_EATT 55 default 69 if BT_SMP 56 default 37 if BT_MESH_GATT 57 default 27 58 range 70 $(UINT16_MAX) if BT_EATT 59 range 69 $(UINT16_MAX) if BT_SMP 60 range 27 $(UINT16_MAX) 61 help 62 Maximum support ACL size of data packets sent from the Controller to 63 the Host. This value does not include the HCI ACL header. 64 65 In a combined Host and Controller build, both the 66 Host and the Controller will use this value for buffer sizes, making 67 Controller to Host flow control not strictly necessary. 68 69 In a Host only build with Controller to Host flow control enabled 70 the Host will inform the Controller about the maximum ACL data size it 71 can send by setting this value in the Host Buffer Size command. 72 73 If Controller to Host flow control is not enabled then the Controller 74 can assume the Host has to receive and process ACL data faster than 75 the controller can produce it. 76 77 In a Controller only build this will determine the maximum ACL size 78 that the Controller will send to the Host. 79 80config BT_BUF_ACL_RX_COUNT_EXTRA 81 # As Host implementation unconditionally references this Kconfig, we 82 # hide it for !BT_CONN and default to 0. 83 int "Number of extra incoming ACL data buffers" if BT_CONN 84 range 1 65535 if BT_CONN 85 default BT_MAX_CONN if BT_CONN 86 range 0 0 87 default 0 88 help 89 Number of incoming extra ACL data buffers sent from the Controller to 90 the Host. 91 92 By default, the total number of incoming ACL data buffers is equal to 93 CONFIG_BT_MAX_CONN + 1, to support L2CAP recombination. 94 95 The L2CAP recombination in the Host keeps the first Rx buffer for each 96 connection and uses one Rx buffer across all connections to receive a 97 fragment from the Controller. 98 99config BT_BUF_ACL_RX_COUNT 100 int "[DEPRECATED] Number of incoming ACL data buffers" 101 default 0 102 range 0 256 103 help 104 Number or incoming ACL data buffers sent from the Controller to the 105 Host. 106 In a combined Host and Controller build the buffers are shared and 107 therefore Controller to Host flow control is not needed. 108 109 In a Host only build with Controller to Host flow control enabled 110 the Host will inform the Controller about the maximum number of 111 buffers by setting this value in the Host Buffer Size command. 112 113 When Controller to Host flow control is not enabled the Controller 114 can assume that the Host has infinite amount of buffers. 115 116 For both configurations, there is an additional requirement that is 117 enforced by a build-time check: BT_BUF_ACL_RX_COUNT needs to be at 118 least one greater than BT_MAX_CONN. 119 120config BT_BUF_EVT_RX_SIZE 121 int "Maximum supported HCI Event buffer length" 122 default $(UINT8_MAX) if (BT_EXT_ADV && BT_OBSERVER) || BT_PER_ADV_SYNC || BT_DF_CONNECTION_CTE_RX || BT_CLASSIC || BT_CHANNEL_SOUNDING 123 # LE Read Supported Commands command complete event. 124 default 68 125 range 68 $(UINT8_MAX) 126 range 78 $(UINT8_MAX) if BT_CHANNEL_SOUNDING 127 help 128 Maximum supported HCI event buffer size. This value does not include 129 the HCI Event header. 130 This value is used by both the Host and the Controller for buffer 131 sizes that include HCI events. It should be set according to the 132 expected HCI events that can be generated from the configuration. 133 If the subset of possible HCI events is unknown, this should be set to 134 the maximum of 255. 135 136config BT_BUF_EVT_RX_COUNT 137 int "Number of HCI Event buffers" 138 default 20 if (BT_MESH && !(BT_BUF_EVT_DISCARDABLE_COUNT > 0)) 139 default 10 140 range 2 $(UINT8_MAX) 141 help 142 Number of buffers available for incoming HCI events from the 143 Controller. 144 145config BT_BUF_EVT_DISCARDABLE_SIZE 146 int "Maximum supported discardable HCI Event buffer length" 147 range 43 $(UINT8_MAX) if !BT_EXT_ADV 148 range 58 $(UINT8_MAX) if BT_EXT_ADV 149 # LE Extended Advertising Report event 150 default $(UINT8_MAX) if BT_CLASSIC 151 # Le Advertising Report event 152 default 43 if !BT_EXT_ADV 153 default 58 if BT_EXT_ADV 154 help 155 Maximum support discardable HCI event size of buffers in the separate 156 discardable event buffer pool. This value does not include the 157 HCI Event header. 158 The minimum size is set based on the Advertising Report. Setting 159 the buffer size different than BT_BUF_EVT_RX_SIZE can save memory. 160 161config BT_BUF_EVT_DISCARDABLE_COUNT 162 int "Number of discardable HCI Event buffers" 163 range 1 $(UINT8_MAX) 164 default 20 if BT_MESH 165 default 3 166 depends on !BT_HCI_RAW 167 help 168 Number of buffers in a separate buffer pool for events which 169 the HCI driver considers discardable. Examples of such events 170 could be e.g. Advertising Reports. The benefit of having such 171 a pool is that the if there is a heavy inflow of such events 172 it will not cause the allocation for other critical events to 173 block and may even eliminate deadlocks in some cases. 174 175config BT_BUF_CMD_TX_SIZE 176 int "Maximum support HCI Command buffer length" 177 default $(UINT8_MAX) if (BT_EXT_ADV || BT_CLASSIC || BT_ISO_CENTRAL) 178 # LE Set Connection CTE Receive Parameters. Value required to store max allowed number 179 # of antenna ids for platforms other than Nordic. 180 default 83 if (!BT_EXT_ADV && !BT_CLASSIC && BT_CTLR_DF && BT_CTLR_DF_CONN_CTE_REQ && !SOC_COMPATIBLE_NRF) 181 # LE Generate DHKey v2 command 182 default 65 183 range 65 $(UINT8_MAX) 184 help 185 Maximum data size for each HCI Command buffer. This value does not 186 include the HCI Command header. 187 This value is used by both the Host and the Controller for buffer 188 sizes that include HCI commands. It should be set according to the 189 expected HCI commands that can be sent from the configuration. 190 If the subset of possible HCI commands is unknown, this should be set 191 to the maximum of 255. 192 193config BT_BUF_CMD_TX_COUNT 194 # This option is only visible for a user when Host and Controller are build together, or for 195 # Host-only builds. 196 int "Number of HCI command buffers" if !BT_HCI_RAW || !HAS_BT_CTLR 197 # This option is present when Host and Controller are build together, or 198 # for Host only builds, or when Controller-to-Host ACL data flow control 199 # is disabled. 200 depends on !BT_HCI_RAW || !HAS_BT_CTLR || !BT_HCI_ACL_FLOW_CONTROL 201 # The Mesh stack usage in applications and tests can start both advertising and scanning in 202 # parallel. Also, when BT_MESH_WORKQ_SYS is enabled, the Mesh stack is starting Extended 203 # Advertising in the receive callback run in the system work queue and as the Host also uses 204 # the system work queue for HCI command Tx towards the Controller, one additional HCI 205 # command buffer is needed. 206 range 2 64 if BT_MESH 207 range 1 64 208 default 2 if BT_MESH 209 default 1 210 help 211 Number of buffers available for outgoing HCI commands from the Host. 212 213 HCI Controllers may not support Num_HCI_Command_Packets > 1, hence they default to 1 when 214 not enabling Controller to Host data flow control (BT_HCI_ACL_FLOW_CONTROL), Read Remote 215 Version Information (BT_REMOTE_VERSION), Auto-Initiate PHY update (BT_AUTO_PHY_UPDATE), or 216 Auto-Initiate Data Length Update (BT_AUTO_DATA_LEN_UPDATE). 217 218 Normal HCI commands follow the HCI command flow control using Num_HCI_Command_Packets 219 return in HCI command complete and status. 220 221 The Host Number of Completed Packets command does not follow normal flow control of HCI 222 commands and the Controller side HCI drivers that allocates HCI command buffers with 223 K_NO_WAIT can end up running out of command buffers. 224 225 When Controller to Host data flow control is enabled in the Host-only or combined 226 Host plus Controller build, the internal BT_BUF_CMD_TX_COUNT is adjusted accordingly 227 taking into considerations the enabled auto-initiated procedures, and to follow the normal 228 HCI command flow control to be able to send Ncmd normal HCI commands and 229 BT_BUF_ACL_RX_COUNT of Host Number of Completed Packets command down to the Controller. 230 231 When Controller to Host data flow control is supported in the Controller-only build, 232 the internal BT_BUF_CMD_TX_COUNT is adjusted to be equal to (BT_BUF_RX_COUNT + Ncmd). 233 234 Where Ncmd is supported maximum Num_HCI_Command_Packets in the Controller implementation. 235 236endmenu 237 238# Workaround to have commas on function arguments 239ZEPHYR_BT_HCI := zephyr,bt-hci 240 241config BT_HAS_HCI_VS 242 bool 243 default $(dt_chosen_bool_prop,$(ZEPHYR_BT_HCI),bt-hci-vs-ext) 244 help 245 This option is set by the Bluetooth controller to indicate support 246 for the Zephyr HCI Vendor-Specific Commands and Event. 247 248config BT_HCI_VS 249 bool "Zephyr HCI Vendor-Specific Commands" 250 depends on BT_HAS_HCI_VS || !HAS_BT_CTLR 251 default y if BT_HAS_HCI_VS 252 help 253 Enable support for the Zephyr HCI Vendor-Specific Commands in the 254 Host and/or Controller. This enables Set Version Information, 255 Supported Commands, Supported Features vendor commands. 256 257config BT_HCI_VS_FATAL_ERROR 258 bool "Allow vendor specific HCI event Zephyr Fatal Error" 259 depends on BT_HCI_VS 260 help 261 Enable emitting HCI Vendor-Specific events for system and Controller 262 errors that are unrecoverable. 263 264config BT_HCI_VS_EXT_DETECT 265 bool "Use heuristics to guess HCI vendor extensions support in advance" 266 depends on BT_HCI_VS && !HAS_BT_CTLR 267 default y if BOARD_QEMU_X86 || BOARD_QEMU_CORTEX_M3 || BOARD_NATIVE_SIM 268 help 269 Use some heuristics to try to guess in advance whether the controller 270 supports the HCI vendor extensions in advance, in order to prevent 271 sending vendor commands to controller which may interpret them in 272 completely different ways. 273 274config BT_HCI_MESH_EXT 275 bool "Mesh HCI Command support" 276 depends on BT_BROADCASTER && BT_OBSERVER && !BT_LL_SW_SPLIT 277 help 278 Enable support for the Bluetooth Mesh HCI Commands. 279 280config BT_WAIT_NOP 281 bool "Wait for \"NOP\" Command Complete event during init" 282 help 283 Emit a Command Complete event from the Controller (and wait for it 284 from the Host) for the NOP opcode to indicate that the Controller is 285 ready to receive commands. 286 287config BT_RPA 288 bool 289 depends on BT_HOST_CRYPTO || BT_CTLR_CRYPTO 290 291config BT_PRIVATE_SHELL 292 bool 293 default n 294 295config BT_ASSERT 296 bool "Custom Bluetooth assert implementation" 297 default y 298 help 299 Use a custom Bluetooth assert implementation instead of the 300 kernel-wide __ASSERT() when CONFIG_ASSERT is disabled. 301 302if BT_ASSERT 303 304config BT_ASSERT_VERBOSE 305 bool "Print out an assert string when using BT_ASSERT" 306 default y 307 help 308 When CONFIG_BT_ASSERT is enabled, this option turns on printing the 309 cause of the assert to the console using printk(). 310 311config BT_ASSERT_PANIC 312 bool "Use k_panic() instead of k_oops()" 313 help 314 When CONFIG_BT_ASSERT is enabled, this option makes the code call 315 k_panic() instead of k_oops() when an assertion is triggered. 316 317endif # BT_ASSERT 318 319config BT_HCI_ERR_TO_STR 320 bool "Print HCI error codes as strings [EXPERIMENTAL]" 321 select EXPERIMENTAL 322 help 323 This configuration enables printing of HCI error 324 codes represented as strings. 325 See bt_hci_err_to_str() for more details. 326 327config BT_MONITOR 328 bool 329 select LOG_OUTPUT 330 331choice BT_DEBUG_TYPE 332 prompt "Bluetooth debug type" 333 default BT_DEBUG_NONE 334 335config BT_DEBUG_NONE 336 bool "No debug log" 337 help 338 Select this to disable all Bluetooth debug logs. 339 340config BT_DEBUG_MONITOR_UART 341 bool "Monitor protocol over UART" 342 select LOG 343 select CONSOLE_HAS_DRIVER 344 select BT_MONITOR 345 help 346 Use a custom logging protocol over the console UART 347 instead of plain-text output. Requires a special application 348 on the host side that can decode this protocol. Currently 349 the 'btmon' tool from BlueZ is capable of doing this. 350 351 If the target board has two or more external UARTs it is 352 possible to keep using UART_CONSOLE together with this option, 353 however if there is only a single external UART then 354 UART_CONSOLE needs to be disabled (in which case printk/printf 355 will get encoded into the monitor protocol). 356 357config BT_DEBUG_MONITOR_RTT 358 bool "Monitor protocol over RTT" 359 depends on USE_SEGGER_RTT 360 depends on SEGGER_RTT_MAX_NUM_UP_BUFFERS >= 2 361 select LOG 362 select CONSOLE_HAS_DRIVER 363 select BT_MONITOR 364 help 365 Use a custom logging protocol over the RTT buffer instead of 366 plain-text output. Requires a special application 367 on the host side that can decode this protocol. Currently 368 the 'btmon' tool from BlueZ is capable of doing this. 369 370if BT_DEBUG_MONITOR_RTT 371 372config BT_DEBUG_MONITOR_RTT_BUFFER 373 int "Buffer number used for custom logger output." 374 range 1 SEGGER_RTT_MAX_NUM_UP_BUFFERS 375 default 1 376 help 377 Select index of up-buffer used for logger output. 378 Make sure the buffer number is not used by other logger, 379 e.g. in LOG_BACKEND_RTT_BUFFER, otherwise the buffer will be 380 overwritten. 381 382config BT_DEBUG_MONITOR_RTT_BUFFER_NAME 383 string "Buffer name used for custom logger output." 384 default "btmonitor" 385 help 386 Select index of up-buffer used for logger output. 387 388config BT_DEBUG_MONITOR_RTT_BUFFER_SIZE 389 int "Size of reserved up-buffer for custom logger output." 390 default 1024 391 help 392 Specify reserved size of up-buffer used for custom logger output. 393 394endif # BT_DEBUG_MONITOR_RTT 395 396endchoice # Bluetooth debug type 397