Commit graph

9523 commits

Author SHA1 Message Date
Thomas Ebert Hansen
7f4471c84e Bluetooth: controller: Rename local proc ctx config
Rename
BT_CTLR_LLCP_PROC_CTX_BUF_NUM
to
BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM
to match naming scheme of
BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-03-14 11:38:09 +01:00
Thomas Ebert Hansen
33cb9e3433 Bluetooth: controller: Add remote proc ctx pool
Add a separate procedure context pool for remote initiated procedures.
Make it configurable in size by BT_CTLR_LLCP_REMOTE_PROC_CTX_BUF_NUM.
Fix all unit tests referring to the amount of free context buffers.

Fixes #41823

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-03-14 11:38:09 +01:00
Thomas Ebert Hansen
cecb12e9d9 Bluetooth: controller: Improve mem mngt of proc ctx
Move the mem_pool structure to the internal header for wider access.
Introduce a mem_pool owner in the proc_ctx, sch that multiple mem_pool
could be used for memory management of proc_ctx, also static 'foreign'
allocated proc_ctx would be supported by this.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-03-14 11:38:09 +01:00
Piotr Pryga
008fd88d6f Bluetooth: Controller: Add sampling and switching offset configuration
Start of the antenna switching and sampling CTE is configured by use
of DFECTRL2 register in Nodric Radio peripheral. As of now the
configuration was set to defaults, so antenna switching has started
immediately after CTE procedure was started (end of CRC).

Sampling was started at the very beginning of a sampling slot.
It should be delayed for at least 125 ns from beginning of sampling
slot and not more than 125 ns to the end of sampling slot. This is a
requirement from BT 5.3 Core specification Vol 6, Part B section 2.5.4
IQ sampling.

Although it seems to me that when samples are taken depends on
implementation and used hardware. Taking that into account
there is provided a set of KConfig options to configure samples
offset for PHY 1M, PHY 2M and sapling slots 1 us and 2us separetely.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-03-14 11:31:24 +01:00
Piotr Pryga
b7bbe4b702 Bluetooth: Controller: Fix per adv chain broken after per adv re-enable
If there is enabled support for ADI in periodic advertising and
periodic advertising uses chained PDUs there is an assert when
periodic advertising is re-enabled.

There is missing a code that will set a chain for PDU with
updated ADI field.

The commit fixes the issue.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-03-14 11:29:59 +01:00
Gerard Marull-Paretas
749afa38e1 bluetooth: controller: ll_sw: obtain entropy device using DEVICE_DT_GET
The entropy device can be obtained at compile time.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-11 15:27:05 -08:00
Emil Gydesen
18466530ab Bluetooth: PACS: Refactor PAC location read/write
Refactor the PAC location read and write. Instead
of storing the location in the service, the
location is now stored in the application, and
is retrieved by the service via callbacks.

Similarly, if a client writes the location, this
request is being sent to the application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-11 11:36:19 -08:00
Emil Gydesen
4518c1935f Bluetooth: Audio: Add sent callback for audio streams
Add a sent callback that is used to notify applications
using the audio API when a SDU has been sent over HCI.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-11 11:28:53 -08:00
Emil Gydesen
9a3a2424e1 Bluetooth: Host: Use IN_RANGE macro from util.h
Use the IN_RANGE macro from util.h instead
of the two local implementations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-11 07:20:16 -06:00
Omkar Kulkarni
539c1c9c34 Bluetooth: Mesh: Change ERR to WARN
Changes ERR to WARN message when relay buffers
run out, as this is not really an error but a
consequence of high traffic.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2022-03-11 10:59:56 +01:00
Emil Gydesen
7e2c206274 Bluetooth: ASCS: Call stream callbacks on ASE state changes
Whenever a stream is attached to an endpoint, the
stream's operation callbacks will be called for the
unicast server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-11 10:59:28 +01:00
Mariusz Skamra
5e6fe46d08 Bluetooth: iso: Fix ISO data path setup
This patch fixes ISO data path setup that shall be done for enabled
directions only and removes usage of Path ID = 0xFF which is RFU value.

As per Core 5.3 Vol 4, Part E, 7.8.109
"If the Host attempts to set an output data path using a connection handle
that is for an Isochronous Broadcaster, for an input data path on a
Synchronized Receiver, or for a data path for the direction on a
unidirectional CIS where BN is set to 0, the Controller shall return the
error code Command Disallowed (0x0C)."

Fixes: #43190
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-03-10 14:33:20 -05:00
Pavel Vasilyev
d9de3dcc90 Bluetooth: Mesh: Send Friend Poll after every segments retransmission
Send Friend Poll every time when segments are retrasmitted.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-03-10 14:32:39 -05:00
Emil Gydesen
0d719ba893 Bluetooth: Audio: Add endpoint type to capabilities config cb
The capabilities callback did not provide information about
the type of the endpoint being configured, making it
impossible for the application to determine if it is a
sink or source endpoint.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:07:17 -05:00
Emil Gydesen
f41c1cd8a9 Bluetooth: Audio: Fix setting correct QoS based on direction
The unicast client would set the QoS reversed, as the
client should configure it TX parameters for SINK
and RX parameters for source, where it did it the other
way around.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:07:17 -05:00
Emil Gydesen
23c1d6c3da Bluetooth: Audio: Use endpoint dir value
Remove functions and and macro uses that otherwise
determined the direction of an audio stream, and instead
use the direction (dir) field of the endpoint instead.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:07:17 -05:00
Emil Gydesen
b880637231 Bluetooth: Audio: Remove bidirectional audio streams
Audio streams as defined by the BAP spec does not
support bidirectional audio streams. This commit
updates the API and implementation to match that.

The use a bidirectional CIS with 2 audio stream will
be added in a future commit.

This removes the _IN_ and _OUT_ and _INOUT_ QOS
values, as well as the direction of the codec QOS
struct.

To keep direction for internal use, the direction
has been added to the endpoint struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:07:17 -05:00
Emil Gydesen
956518a33b Bluetooth: Audio: Add BASS client shell
Add the BASS client shell module.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:06:44 -05:00
Emil Gydesen
dcbd1a555f Bluetooth: Audio: Add BASS shell
Add support for the BASS server shell.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:06:44 -05:00
Emil Gydesen
b1437e1f0c Bluetooth: Audio: Add BASS client
Add the BASS client implementation

This is a standalone implementation that
needs to be (heavily) modified for the
broadcast assistant role in the future.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:06:44 -05:00
Emil Gydesen
742eac6214 Bluetooth: Audio: Add broadcast audio scan service (BASS)
Add the BASS as a standalone service. The service is
used for the scan delegator role, which has not been
fully implemented yet.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 14:06:44 -05:00
Emil Gydesen
e485305b7c Bluetooth: Audio: Fix ordering of array size after array parameter
Make it consistent for audio.h and capabilities.h that the
array size parameter appear after the array parameter.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 13:50:20 -05:00
Emil Gydesen
a01cc054c9 Bluetooth: Audio: Use size_t for audio.h array len arguments
Use size_t instead of uint8_t to describe array lengths.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 13:50:20 -05:00
Emil Gydesen
7ce1022691 Bluetooth: Audio: Fix valid checks for bt_audio_unicast_group_delete
The checks for stream->group was useless, and the check for
an active CIG was missing.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 13:50:20 -05:00
Emil Gydesen
d64328ebe5 Bluetooth: Audio: Add support for add/rem streams for unicast group
Add a function to add more and remove streams
to and from a unicast group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-10 13:50:20 -05:00
Piotr Pryga
ce0ad0e30a Bluetooth: Controller: df: Do not send IQ rep for PDU without CTE
Check if the CTE was discovered by Radio peripheral should be
done with use of CTEPRESENT event. Samples count should not
be used for that purpose. If samples count is a value different
than zero for PDUs that don't have CTE, unwanted IQ samples
report will be generated. CTEPRESENT event is set only in case the
CTEInfo filed was correctly parsed by Radio peripheral during
PDU reception.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-03-10 13:45:41 -05:00
Pavel Vasilyev
f1d5066032 Bluetooth: Mesh: Don't replace destination of segmented message
Don't replace destination of segmented message when acknowledgement is
received from a friend node, otherwise, when segments are retransmitted,
the destination will be used and the friend node will treat it as a new
segmented message.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-03-10 13:44:05 -05:00
Erwan Gouriou
a099c79234 subsys/bluetooth/host: hci_core: Add a bt_disable command
Add a bt_disable function. This will abort existing threads and
close the HCI transport.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-03-10 13:28:41 -05:00
Herman Berget
3fb7f24f1d Bluetooth: Host: Add missing BT_ATT_OPs to att_op_get_type()
BT_ATT_OP_READ_MULT_VL_REQ, BT_ATT_OP_READ_MULT_VL_RSP, and
BT_ATT_OP_NOTIFY_MULT were missing.

Because of this, multiple variable length reads did not time out.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-03-10 13:16:56 -05:00
Aleksandr Khromykh
8c9e8da82f Bluetooth: Mesh: add heartbeat publication callback
Heartbeat publication sent callback can be used
as a watch mechanism to determine whether
the mesh stack is still capable of sending messages or not.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-03-10 13:16:40 -05:00
Herman Berget
6a23439b20 Bluetooth: Host: Fix check for number of ATT bearers
Fixes #42306

Attach bt_att_chan objects to bt_att when creating them so that the
check in att_chan_new() works. Use the flag ATT_CONNECTED to signal that
a channel is connected instead of attaching it.

The flag ATT_DISCONNECTED was not set anywhere and is replaced by
ATT_CONNECTED.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-03-10 13:26:46 +01:00
Herman Berget
5afa815e88 Bluetooth: Host: Remove unused function att_chan_is_connected()
gcc does not warn on unused static inline functions.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-03-10 13:26:46 +01:00
Lingao Meng
5b50133467 Bluetooth: Host: Reconstruct stream interface
Add `remaining_size` in struct ad_stream.

By calculating the actual space required instead of
using the maximum space.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-03-09 13:59:47 -05:00
Lingao Meng
5f2170f184 Bluetooth: Host: Optimize hci buf alloc by calc actually require size
By calculating the actual space required instead of using
the maximum space, for `hci_set_adv_ext_complete`.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/37710

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-03-09 13:59:47 -05:00
Gerard Marull-Paretas
dffaf5375c kconfig: tweak Kconfig prompts
Tweak some Kconfig prompts after the removal of "Enable...".

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Gerard Marull-Paretas
95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Vinayak Kariappa Chettimada
d510663c26 Bluetooth: Controller: Fix Extended Advertising Power Amp setup
Fix Extended Advertising implementation to setup Power
Amplifier (PA) GPIO toggle for transmission instead of
incorrect Low Noise Amplifier (LNA) setup which is for
reception.

Relates to commit 4e5290948e ("Bluetooth: Controller: Fix
Periodic Advertising to setup Power Amp").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 14:22:04 +01:00
Vinayak Kariappa Chettimada
681127f6ce Bluetooth: Controller: Fix allocations for chain reception
Do not implicitly allocate Rx buffers for maximum chain PDU
reception. Instead let applications increase as required the
Kconfig CONFIG_BT_CTLR_RX_BUFFERS.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 14:20:47 +01:00
Alperen Sener
0eee702bad Bluetooth: Mesh: Add back-off to secure beacons
adding back-off mechanism to mesh secure beacon behaviour

Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
2022-03-09 15:10:26 +02:00
Emil Gydesen
b2cf78af4c Bluetooth: Audio: Improved cleanup on disconnect
The LE Audio clients will now do more and proper cleanup
during disconnects. Furthermore, the will also
take a proper bt_conn_ref when the conn pointer
is assigned locally.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-09 15:04:57 +02:00
Vinayak Kariappa Chettimada
39570bd1d7 Bluetooth: Controller: Fix missing configure of Device Address Match
Fix missing configure of Device Address Matching when
receiving auxiliary PDUs.

This fixes some privacy related conformance test cases.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 13:59:23 +01:00
Vinayak Kariappa Chettimada
e60ac093b4 Bluetooth: Controller: Fix missing RPA timer start for Broadcaster
Fix missing RPA timer start in Broadcaster only controller
builds.

Without the fix private resolvable addresses where not
updated at RPA timeout.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 13:58:41 +01:00
Vinayak Kariappa Chettimada
b36a0ee071 Bluetooth: Controller: Fix private address update in auxiliary PDUs
Fix missing implementation to update private resolvable
address in auxiliary PDUs on RPA timeout.

Without the implementation the controller asserted on RPA
timeout when AdvA is not present in the primary channel PDU
of Extended Advertising set.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 13:58:41 +01:00
Vinayak Kariappa Chettimada
d54f3bd5f7 Bluetooth: Controller: Fix missing reset of sync create association
Fix missing reset of sync create association with scan
context when associated with both 1M and Coded PHY contexts,
and sync create cancel is called.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 13:58:17 +01:00
Vinayak Kariappa Chettimada
5494f475b8 Bluetooth: Controller: Fix address resolution when max entries in list
Fix address resolution when trying to match the maximum
entries in the resolving list.

Wait for address resolution AAR peripheral to complete with
checking with all the entries in the IRK list.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 13:57:57 +01:00
Vinayak Kariappa Chettimada
a10cb58295 Bluetooth: Controller: Fix out-of-bound memory write
Fix out-of-bound memory write during mem_init due to
regression introduced in commit c6750de9c1 ("Bluetooth:
Controller: Fix missing ISOAL sink destroy").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-03-09 12:44:42 +01:00
Trond Einar Snekvik
b6993b0837 Bluetooth: Mesh: Extended advertiser should build without relay
The extended advertiser would fail to build due to a missing kconfig
option dependency when relay was disabled.

Fixes #43172.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2022-03-08 12:32:46 +02:00
Lingao Meng
05f75f9f33 Bluetooth: Mesh: Fix unable iv update due to cache
When local node poweroff and power on again, will
receive iv update but within 96hours.

When 96h after, due to cache, we can't process this
beacon any more.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-03-08 11:09:49 +01:00
Lingao Meng
78eddf6e37 Bluetooth: Mesh: Fix unable iv recovery when in iv update state
According Mesh Profile 3.10.6 IV Index Recovery procedure

Upon receiving and successfully authenticating a Secure Network
beacon for a primary subnet whose IV Index is 1 or more higher
than the current known IV Index, the node shall set its current
IV Index and its current IV Update procedure state from the
values in this Secure Network beacon.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-03-08 11:09:49 +01:00
Emil Gydesen
62704bd8a0 Bluetooth: PACS: Add PAC record data to pac_notify
When pac_notify is called it will notify the
actual PAC records for the specific type (sink/source).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-08 11:08:00 +01:00