zephyr/samples/bluetooth
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
..
beacon samples: bluetooth: display source address in beacon console output 2020-10-15 22:22:16 +03:00
central sanitycheck: inclusive language 2020-08-27 07:04:07 -04:00
central_hr Bluetooth: Use ATT FIRST/LAST attribute handle defines where applicable 2021-04-08 16:35:57 +02:00
central_ht Bluetooth: Use ATT FIRST/LAST attribute handle defines where applicable 2021-04-08 16:35:57 +02:00
central_iso Bluetooth: samples: Update central_iso sample to new delayable work API 2021-05-05 19:44:09 -04:00
direction_finding_connectionless_tx doc: direction_finding: fix space in file link 2021-03-09 04:54:46 -05:00
eddystone Bluetooth: samples: Update eddystone sample to new delayable work API 2021-05-05 19:44:09 -04:00
handsfree sanitycheck: inclusive language 2020-08-27 07:04:07 -04:00
hci_pwr_ctrl Bluetooth: samples: Remove workqueue stack configuration 2021-04-14 18:19:32 +02:00
hci_rpmsg samples: nrf5340: Trigger fatal error in an assertion handler 2021-03-11 13:20:16 +01:00
hci_spi Bluetooth: Refactor bluetooth buffer configuration for simplification 2021-05-06 14:56:18 +02:00
hci_uart Bluetooth: Refactor bluetooth buffer configuration for simplification 2021-05-06 14:56:18 +02:00
hci_usb samples: hci_usb: disable USB_DEVICE_BLUETOOTH_VS_H4 2021-02-15 08:27:19 -05:00
hci_usb_h4
ibeacon sanitycheck: inclusive language 2020-08-27 07:04:07 -04:00
ipsp kernel: sem: add K_SEM_MAX_LIMIT 2021-03-05 08:13:53 -06:00
iso_broadcast samples: Bluetooth: Add ISO Broadcaster sample 2021-05-04 16:58:38 +02:00
iso_receive samples: Bluetooth: Add Synchronized Receiver sample 2021-05-04 16:58:38 +02:00
mesh Bluetooth: Refactor bluetooth buffer configuration for simplification 2021-05-06 14:56:18 +02:00
mesh_demo samples: mesh_demo: rework error and device handling 2021-03-06 09:13:00 -06:00
mesh_provisioner Bluetooth: Mesh: Provisioner sample: Permit 16 nodes 2021-04-06 16:19:13 +03:00
periodic_adv samples: Bluetooth: add nrf52833dk_nrf52833 board in per. adv. samples 2021-02-23 12:36:11 +01:00
periodic_sync Bluetooth: samples: Update periodic_sync to new delayable work API 2021-05-05 19:44:09 -04:00
peripheral samples: Bluetooth: use indication destroy cb 2020-11-10 11:21:46 +01:00
peripheral_csc Bluetooth: Remove _gatt_ infix for Device Information Service (DIS) 2020-09-04 15:38:44 +02:00
peripheral_dis Bluetooth: Remove _gatt_ infix for Device Information Service (DIS) 2020-09-04 15:38:44 +02:00
peripheral_esp Bluetooth: Remove _gatt_ infix for Device Information Service (DIS) 2020-09-04 15:38:44 +02:00
peripheral_hids Bluetooth: Remove _gatt_ infix for Device Information Service (DIS) 2020-09-04 15:38:44 +02:00
peripheral_hr samples: bluetooth: Remove useless default_conn 2021-02-01 08:38:54 -05:00
peripheral_ht samples: peripheral_ht: drop device_get_binding() 2021-03-29 16:33:51 +02:00
peripheral_iso Bluetooth: ISO: Add missing reason to disconnected callback 2021-04-07 23:23:34 +02:00
peripheral_ots Bluetooth: services: Adds directory listing object to OTS 2021-03-17 11:30:07 +01:00
peripheral_sc_only sanitycheck: inclusive language 2020-08-27 07:04:07 -04:00
scan_adv sanitycheck: inclusive language 2020-08-27 07:04:07 -04:00
st_ble_sensor samples: st_ble_sensor: clean up 2021-03-29 16:33:51 +02:00
bluetooth.rst doc: bluetooth: Fix a typo in the nRF5340 note. 2021-03-19 10:47:37 +01:00