zephyr/subsys/bluetooth/host/Kconfig.gatt
Joakim Andersson 6483e12a8a Bluetooth: Refactor bluetooth buffer configuration for simplification
Refactor and simplify the bluetooth buffer configurations to improve the
easy of configurations and eliminate invalid ones.
By moving configurations out of host and controller specific
configurations and into a common one it becomes easier to configure
the host and controller separately as the same configurations can be
used as would be for a combined build.

All HCI configurations are now given exluding the matching HCI header,
which eases the configuration as the application don't have to know the
different header sizes.
The BT_RX_BUF_LEN is split into ACL and Event, as well as the suprising
use of Command size.
BT_L2CAP_RX_MTU is removed as the stack does not support reassembling of
HCI ACL data to larger L2CAP PDUs. The application will have to set
ACL RX size and account for the L2CAP PDU header itself.
BT_EATT_RX_MTU was removed as it is only used for setting a different
default value for another option which leads to the stuck kconfig symbol
problem.

The configurations can be updated according to the table below:

** New configuration         | ** Old configuration
All configurations
BT_BUF_ACL_RX_SIZE           | BT_L2CAP_RX_MTU + 4
BT_BUF_ACL_RX_SIZE           | BT_RX_BUF_LEN - 4
BT_BUF_EVT_RX_SIZE           | BT_RX_BUF_LEN - 2
BT_BUF_CMD_TX_SIZE           | BT_RX_BUF_LEN - 3
BT_BUF_CMD_TX_COUNT          | BT_HCI_CMD_COUNT
BT_BUF_EVT_RX_COUNT          | BT_RX_BUF_COUNT
BT_BUF_ACL_RX_COUNT          | BT_RX_BUF_COUNT
BT_BUF_ACL_RX_COUNT          | BT_ACL_RX_COUNT
BT_BUF_EVT_DISCARDABLE_SIZE  | BT_DISCARDABLE_BUF_SIZE - 2
BT_BUF_EVT_DISCARDABLE_COUNT | BT_DISCARDABLE_BUF_COUNT
Controller-build
BT_BUF_ACL_TX_SIZE           | BT_CTLR_TX_BUFFERS_SIZE
BT_BUF_ACL_TX_COUNT          | BT_CTLR_TX_BUFFER
HCI-bridge
BT_BUF_ACL_TX_SIZE           | BT_HCI_ACL_DATA_SIZE
BT_BUF_ACL_TX_COUNT          | 6

Fixed invalid configurations setting either BT_L2CAP_RX_MTU or
BT_CTLR_DATA_LENGTH_MAX larger than BT_RX_BUF_LEN could lead to buffer
overruns.

Fix advertising report max data length calculation.
This always used the BT_DISCARDABLE_BUF_SIZE macro but this feature
can be turned off and advertising reports will be allocated from the RX
buffer in that case. Also controller-build does not have this buffer
(in hci_raw.c). Also the wrong HCI header was used in the calculation,
HCI event header should have been used instead of HCI ACL header.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-06 14:56:18 +02:00

217 lines
6.6 KiB
Plaintext

# Bluetooth ATT/GATT configuration options
# Copyright (c) 2019 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
menu "ATT and GATT Options"
config BT_ATT_ENFORCE_FLOW
bool "Enforce strict flow control semantics for incoming PDUs"
default y if !(BOARD_QEMU_CORTEX_M3 || BOARD_QEMU_X86 || ARCH_POSIX)
help
Enforce flow control rules on incoming PDUs, preventing a peer
from sending new requests until a previous one has been responded
or sending a new indication until a previous one has been
confirmed. This may need to be disabled to avoid potential race
conditions arising from a USB based HCI transport that splits
HCI events and ACL data to separate endpoints.
config BT_ATT_PREPARE_COUNT
int "Number of ATT prepare write buffers"
default 0
range 0 64
help
Number of buffers available for ATT prepare write, setting
this to 0 disables GATT long/reliable writes.
config BT_EATT
bool "Enhanced ATT Bearers support [EXPERIMENTAL]"
depends on BT_L2CAP_ECRED
help
This option enables support for Enhanced ATT bearers support. When
enabled additional L2CAP channels can be connected as bearers enabling
multiple outstanding request.
if BT_EATT
config BT_EATT_MAX
int "Maximum number of Enhanced ATT bearers"
default 3
range 1 16
help
Number of Enhanced ATT bearers available.
config BT_EATT_SEC_LEVEL
int "Enhanced ATT bearer security level"
default 1
range 1 4
help
L2CAP server required security level of EATT bearers:
Level 1 (BT_SECURITY_L1) = No encryption or authentication required
Level 2 (BT_SECURITY_L2) = Only encryption required
Level 3 (BT_SECURITY_L3) = Encryption and authentication required
Level 4 (BT_SECURITY_L4) = Secure connection required
endif # BT_EATT
config BT_GATT_SERVICE_CHANGED
bool "GATT Service Changed support"
default y
help
This option enables support for the service changed characteristic.
config BT_GATT_DYNAMIC_DB
bool "GATT dynamic database support"
depends on BT_GATT_SERVICE_CHANGED
help
This option enables registering/unregistering services at runtime.
config BT_GATT_CACHING
bool "GATT Caching support"
default y
depends on BT_GATT_SERVICE_CHANGED
select TINYCRYPT
select TINYCRYPT_AES
select TINYCRYPT_AES_CMAC
help
This option enables support for GATT Caching. When enabled the stack
will register Client Supported Features and Database Hash
characteristics which can be used by clients to detect if anything has
changed on the GATT database.
if BT_GATT_CACHING
config BT_GATT_NOTIFY_MULTIPLE
bool "GATT Notify Multiple Characteristic Values support"
depends on BT_GATT_CACHING
help
This option enables support for the GATT Notify Multiple
Characteristic Values procedure.
config BT_GATT_ENFORCE_CHANGE_UNAWARE
bool "GATT Enforce change-unaware state"
depends on BT_GATT_CACHING
help
When enable this option blocks notification and indications to client
to conform to the following statement from the Bluetooth 5.1
specification:
'...the server shall not send notifications and indications to such
a client until it becomes change-aware."
In case the service cannot deal with sudden errors (-EAGAIN) then it
shall not use this option.
endif # BT_GATT_CACHING
config BT_GATT_CLIENT
bool "GATT client support"
help
This option enables support for the GATT Client role.
config BT_GATT_READ_MULTIPLE
bool "GATT Read Multiple Characteristic Values support"
default y
help
This option enables support for the GATT Read Multiple Characteristic
Values procedure.
config BT_GATT_AUTO_DISCOVER_CCC
bool "Support to automatic discover the CCC handles of characteristics"
depends on BT_GATT_CLIENT
help
This option enables support for GATT to initiate discovery for CCC
handles if the CCC handle is unknown by the application.
config BT_GAP_AUTO_UPDATE_CONN_PARAMS
bool "Automatic Update of Connection Parameters"
default y
depends on BT_PERIPHERAL
help
This option if enabled allows automatically sending request for connection
parameters update after GAP recommended 5 seconds of connection as
peripheral.
config BT_GAP_PERIPHERAL_PREF_PARAMS
bool "Configure peripheral preferred connection parameters"
default y
depends on BT_PERIPHERAL
help
This allows to configure peripheral preferred connection parameters.
Enabling this option results in adding PPCP characteristic in GAP.
If disabled it is up to application to set expected connection parameters.
if BT_GAP_PERIPHERAL_PREF_PARAMS
config BT_PERIPHERAL_PREF_MIN_INT
int "Peripheral preferred minimum connection interval in 1.25ms units"
default 24
range 6 65535
help
Range 3200 to 65534 is invalid. 65535 represents no specific value.
config BT_PERIPHERAL_PREF_MAX_INT
int "Peripheral preferred maximum connection interval in 1.25ms units"
default 40
range 6 65535
help
Range 3200 to 65534 is invalid. 65535 represents no specific value.
config BT_PERIPHERAL_PREF_SLAVE_LATENCY
int "Peripheral preferred slave latency in Connection Intervals"
default 0
range 0 499
config BT_PERIPHERAL_PREF_TIMEOUT
int "Peripheral preferred supervision timeout in 10ms units"
default 42
range 10 65535
help
It is up to user to provide valid timeout which pass required minimum
value: in milliseconds it shall be larger than
"(1+ Conn_Latency) * Conn_Interval_Max * 2"
where Conn_Interval_Max is given in milliseconds.
Range 3200 to 65534 is invalid. 65535 represents no specific value.
endif # BT_GAP_PERIPHERAL_PREF_PARAMS
config BT_DEVICE_NAME_GATT_WRITABLE
bool "Allow to write name by remote GATT clients"
depends on BT_DEVICE_NAME_DYNAMIC
default y
help
Enabling this option allows remote GATT clients to write to device
name GAP characteristic.
if BT_DEVICE_NAME_GATT_WRITABLE
config DEVICE_NAME_GATT_WRITABLE_ENCRYPT
bool "Encryption required to write name by remote GATT clients"
default y
help
Enabling this option requires the connection to be encrypted to write
to the device name GAP characteristic.
config DEVICE_NAME_GATT_WRITABLE_AUTHEN
bool "Authentication required to write name by remote GATT clients"
help
Enabling this option requires the connection to be encrypted and
authenticated to write to the device name GAP characteristic.
endif #BT_DEVICE_NAME_GATT_WRITABLE
if BT_DEBUG
config BT_DEBUG_ATT
bool "Bluetooth Attribute Protocol (ATT) debug"
help
This option enables debug support for the Bluetooth
Attribute Protocol (ATT).
config BT_DEBUG_GATT
bool "Bluetooth Generic Attribute Profile (GATT) debug"
help
This option enables debug support for the Bluetooth
Generic Attribute Profile (GATT).
endif # BT_DEBUG
endmenu