Commit graph

21541 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
a9e900dbfd Bluetooth: controller: Fix scheduling stall in BT_CTLR_LOW_LAT feature
Fix radio event scheduling stall when using BT_CTLR_LOW_LAT
feature.

Performing a Connection Update Procedure on an ACL
connection while simultaneously having continuous scanning
causes the ACL connection to drop in nRF51 series which uses
BT_CTLR_LOW_LAT by default.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-07 15:02:13 +02:00
Johann Fischer
8999c30cee usb: hid: remove get_protocol/set_protocol from USB HID class API
The USB HID class API offers the possibility to register callbacks
for Get/SetIdle, Get/SetProtocol to the application.
Rules for these callbacks are neither obvious nor documented.

This patch remove this possibility to register Get/SetProtocol
and Get/SetIdle callbacks for the following reasons:

The possibility to call unknown application code while processing
control requests should be avoided or reduced to a minimum.

The Get/SetProtocol callbacks are redundant and do not provide any
additional value since the way to inform the application
about the change of the protocol exists via the callback
hid_protocol_cb_t protocol_change.

The core provides implementation to handle Get/SetIdle requests and
on idle reports. If this is not suitable in any way then the application
should implement everything itself.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-05-07 13:14:47 +02:00
Asger Munk Nielsen
29006bd6fb Bluetooth: Controller: ISO adaptation layer
Improves error handling and makes ISO adaptation layer
independent of CIS.

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2021-05-07 13:14:31 +02:00
Vinayak Kariappa Chettimada
7eba8c403d Bluetooth: controller: Add Kconfig for maximum Broadcast ISO PDU length
Added Kconfig option to configure the maximum Broadcast and
Synchronized Receiver ISO PDU length.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-07 13:10:11 +02:00
Thomas Ebert Hansen
5f43fb3463 Bluetooth: controller: Make number of done events vendor configurable
The amount of needed done events changes when using the "must expire"
logic.

Make the amount vendor configurable (via ull_vendor.h)

Defaults to the original amount of 3.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2021-05-07 13:08:27 +02:00
Rubin Gerritsen
98321c61fb bluetooth: host: Allow concurrent advertising with multiple ids
The HCI specification creates additional complexity to allow this
configuration:
 - When a connection gets established, we need to know which
   identity the HCI_LE_Connection_Complete event corresponds to.
 - The identity is a property of the advertising set.
   Therefore we need the advertising handle.
 - The advertising handle is part of the
   HCI_LE_Advertising_Set_Terminated event and is not part of
   the HCI_LE_Connection_Complete event. Therefore
   the information of both events needs to be combined.

By spec the LE_Connection_Complete comes first. Therefore we cache
this event until the identity is available.
The event is only cached when a connection gets established as
that is the only case where we need to resolve the identity.

As the caching requires more resources, it is only enabled if the
application requires multiple advertising sets and multiple
identities.

The host maps the HCI_LE_Advertising_Set_Terminated event with
the HCI_LE_Connection_Complete event by comparing the connection
handles.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2021-05-07 12:15:20 +03:00
Morten Priess
b8aae321a1 Bluetooth: controller: ISO resume ticker in ULL
Added function ull_conn_iso_resume_ticker_start to enable LLL ISO
peripheral/central to start the one-shot resume ticker.
At timeout the common lll_resume handler is called, and based on the
LLL state, the peripheral/central is able to resume the CIG event.

The resume acts exactly like a normal event resume from the prepare
pipeline, with the exception that the LLL must provide specific
lll_event instances.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-05-06 13:23:00 -04:00
Vinayak Kariappa Chettimada
03a285b9d5 Bluetooth: controller: Add LE Read Buffer Size v2 support
Add LE Read Buffer Size v2 support in the controller
implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
44e9163484 Bluetooth: controller: Add ISO Buffer size Kconfig dependency
Add BT_CTLR_ISO_TX_BUFFER_SIZE depends on Broadcast ISO
and/or Connected ISO feature being enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
63a68e6ff4 Bluetooth: HCI: Rename LE Read Buffer Size v2 struct members
Rename LE Read Buffer Size v2 struct members to related to
Bluetooth Specification use Length and Number terminology.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
8db6941b1a Bluetooth: controller: Minor conditional compile comment correction
Corrected a conditional compile comment and added some
newlines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 13:22:02 -04:00
Vinayak Kariappa Chettimada
ffb3242e4b Bluetooth: controller: Accumulate latency on aborting event in pipeline
Only accumulate latency when event has not been prepared but
has been aborted while being enqueued in pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 19:13:31 +02:00
Marcin Niestroj
1beb95938e smp: shell: consume all pending buffers in smp_shell_process()
smp_shell_process() is called only once after receiving new bytes over
shell. If multiple MCUMGR frames were received over UART one after the
other, then calling smp_shell_process() resulted in consuming only the
first one. All subsequent frames were not processed unless there was
some more RX traffic.

Process received frames in smp_shell_process() in a loop until there is
no frame left. This will make sure that received packets are not stalled
waiting for more RX traffic to trigger processing again.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-05-06 19:13:20 +02:00
Pavel Vasilyev
a335c755a7 Bluetooth: Mesh: Add option to include bt name in scan rsp
Sometimes it may be needed to know device name when proxy feature is
enabled.

This commit adds an option to include device name in scan response.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-05-06 19:20:00 +03:00
Lukasz Maciejonczyk
103b516a3c net: openthread: add Link Metrics API
This commit implements the OpenThread APIs to configure Enhanced-ACK
Based Probing in radio for a specific Initiator. This is needed for
Link Metrics functionality.

Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
2021-05-06 09:57:15 -05:00
Piotr Pryga
ce56f046e5 bluetooth: Fix cte_type value in periodic adv sync report
Periodic advertising sync report returned wrong cte_type value.
This commit fixes the problem.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
7cdbeb541a Bluetooth: controller: Use common mem_link_rx for node_rx_iq_report
Change use of dedicated memory pool for linked list nodes for
node_rx_iq_report to common mem_link_rx. Former solution had
a drawback. Released link nodes may be enqueued to wrong memory
pool. E.g. link related with nopde_rx_iq_report went to common
link memory pool, whereas link nodes from common pool were enqueued
to dedicated list.
The solution was working because links have the same memory layout,
just different memory pools they originated from.
The problem may occur if one of those link memory pools is reset.
Then the same link may be used by node_rx and node_rx_iq_report
at the same time, causing controller failure.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
938f04ffaa Bluetooth: controller: Fix build error for non Nordic plaforms
Direction finding is implemented only for Nordic link layer.
Build was failing due to missing header files for Openisa (RiskV).
Added dummy lll_df_types.h header file to OpenISA lower link layer.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
7c834bf19d Bluetooth: host: Add handl HCI_LE_Connectionless_IQ_Report
Add handling for HCI_LE_Connectionless_IQ_Report received
from controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
64c359bcef Bluetoot: host: Make get_per_adv_sync to be global function
The function get_per_adv_sync is used by HCI events to get
reference to periodic advertising sync object related with
handle available in handled events. Due to implementation
of Direction Finding event handlers in separate source file,
direction.c instead of putting in hci_core.c the function
get_per_adv_sync has to be globally accessible.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
6518621805 Bluetooth: host: Add CTE receive and sample enable API
Add functions that give possibility to enable or disable
CTE receive and sample in connectionless mode.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
b48fe0a7db Bluetooth: host: Add option to enable connectionless CTE RX
Add Kconfig option that will enable supprot for connectionless
CTE reception. Thanks to that it will be possible to conditionally
enable or disable support of the feature and decrease code size
if the feature is not required.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
ca87766bd7 Bluetooth: controller: df: Set BT_CTLR_DF_ANT_SWITCH_RX enable
Set BT_CTLR_DF_ANT_SWITCH_RX enabled by default.
There is already added implementation that supports
this feature in controller, so it may be enabled by
default.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
4009692fcf Bluetooth: controller: Add connectionless CTE RX feat. in supp. feat. list
Add connectionless CTE RX feature to list of features supported
by controller. Add direction finding initialization in hci_core
if the feature is enabled.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
f74a0b294c Bluetooth: controller: Dropp IQ sampl report if CTE disabled after evt end
Disable of CTE sampling for periodic advertising sync PDUs may be
interrupted by radio event. In such situation, TX thread will be
handled before RX thread delivers IQ samples report to host. In
this case RX thread would deliver IQ samples report after CTE
sampling was disabled.

To avoid such situation RX thread has to check if:
- CTE sampling is not disabled,
- CTE sampling was not requested to be disabled after start of radio
  event.

CTE sampling configuration is double buffered. Updated configuration is
swapped at the beginning of radio event.

If CTE sampling is diabled or requested to disable (next radio event
didn't start), the IQ samples report should be dropped by RX thread
and should not be delivered to host.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
6652b18d19 Bluetooth: controller: LLL: Add CTE report for per. adv. PDU with bad CRC
Add reporing of IQ samples collected for CTE attached to periodic
advertising PDUs with bad CRC.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
e884c02d92 Bluetooth: controller: Add opt. to enable CTE samplig for PDUs with bad CRC
Add Kconfig option that will enable possiblity to sample CTE attached to
PDUs that have bard CRC. Sampling is based on CTEInfo field available
in received PDU. If radio is able to parse the field correclty then
it will start sampling even the CRC is wrong.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
17d9df1c7a Bluetooth: controller: hci: Add connectionless IQ report event handler
Add handler for HCI_LE_Connection_IQ_Report event.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
582ca85e29 Bluetooth: controller: hci: Add connectionelss IQ samplig enable handler
Add handler for HCI_LE_Set_Connectionless_IQ_Sampling_Enable HCI
command.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
ff24092bdd Bluetooth: controller: ULL: Add function to enable or disable CTE sampling
Add function that enables or disables CTE sampling attached to received
periodic advertising PDUs.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
b7c1c4575d Bluetooth: controller: LLL: Add CTE sampling and reporting
ULL may request LLL to start receiving and sampling CTE attached to
end of periodic advertising PDUs. When the CTE is successfully sampled,
LLL should report collected samples to ULL.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
edfb85736e Bluetooth: controller: radio: Add function to get CTEInfo from Radio reg
Nordic Radio perihperal provides possiblity to get value of CTEInfo
field parsed from received PDU. It is faster to get the information
from Radio register than parse a PDU content.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
646303834c Bluetooth: controller: LLL: DF: Add function to enable CTE receive
Add function to enable CTE receive and sampling. The function
is aimed to be used by code in lll_sync.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
d182b7169a Bluetooth: controller: Add function to update per sync event slot duration
To enable or disable CTE sampling during periodic advertising sync evnet
it is requireq to change the event duration. To make it possible new
function was added that handles the operation.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
871359d934 Bluetooth: controller: ULL: Add init of DF sync configuration
lll_sync object is used to store information for LLL to enable
or disable CTE sampling. The commit adds initialization of
lll_df_sync member of lll_sync.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
37dd38c988 Bluetooth: controller: LLL: Add DF configuration to lll_sync structure.
To enable or disable CTE sampling in periodic advertising scanner LLL
implementation lll_sync is extended by lll_df_sync member.
The lll_df_sync is a double buffer for lll_df_sync_cfg.
It will be used by LL thread to enable or disable CTE sampling and
provide configuration for sampling CTE in AoA mode.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
2f4e014f14 Bluetooth: controller: ULL: Add node_rx_iq_report handling in ULL RX path
Add handling of Direction Finding node_rx_iq_report type in ULL.
This is required to correctly deliver IQ samples collected by
LLL during receive of PDU including CTE.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
ff94b9f676 Bluetooth: controller: Add double buffer for DF sync configuration
CTE sampling enable or disable requests should be provided to LLL.
Double buffer of lll_df_sync_cfg is added to lll_sync for that purpose
Thanks to that:
- there is no need to synchronize LLL with LL thread
- LLL has always access to valid configuration (new or former)

The configuration is stored in double buffer as instances
of lll_df_sync_cfg, not as pointers. This is the only
difference between double buffer pattern used to store adverising PDU.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
aa51f0a0dc Bluetooth: controller: Add DF per. adv. sync. configuration stucture
Add new structure lll_df_sync_cfg to store DF configuration
for periodic advertising synchronization.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
4d706bb6fb Bluetooth: controller: Add IQ report mem pool management
Add functions that will allow to mangage IQ reports memory pool
e.g. allocate or relase new IQ report nodes.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
bdaf4eed9a Bluetooth: controller: New node_rx type for IQ sample report
Add new kind of node_rx type that will store IQ samples report.
The structure includes node_rx_hdr and may be used by the same
queues that are used to forward regular node_rx_pdu objects
between LLL and ULL.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
68704c8cb1 Bluetooth: controller: Add Kconfig option to enable conn-less CTE sampling
Direction Finding support requires possibility to receive and sample CTE
attached to periodic advertising PDUs. New option will be used to enable
or disable the functionality. New option is introduced to avoid using
double statements checking if BT_CTLR_DF_CTE_RX and BT_CTLR_SYNC_-
-PERIODIC are enabled.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
2e1e8aff8d Bluetooth: controller: Add Kconfig option to enable debugging code in DF
To avid enabling HCI drived debugging, like in other controller source
files, Direction Finding has its own option BT_CTLR_DF_DEBUG_ENABLE.
This gives fine grained control deubgging output.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
2f7b0b7392 Bluetooth: controller: Disable not implemented DF features
Set to disabled not yet implemented Direction Finding features.
The features will be enabled by default when they are implemented.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Piotr Pryga
5779a2d7f2 Bluetooth: controller: radio: Add function to get PDU ant. switch pattern
IQ samples report requires information about antenna switch pattern
that was used to measure RSSI. RSSI is measured during PDU receive.
For Nordic Radio peripheral the PDU antenna is selected by first antenna
switch pattern set in SWITCHPATTERN register. That pattern is providded
by device tree. This information is already available in radio_df.c.
The information is required by LLL, that has access to functions
provided in radio_df.c. New function was provided to return PDU antenna
switch pattern.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-05-06 16:27:16 +02:00
Krzysztof Chruscinski
4c971d2c21 logging: Add panic flag reset to core initialization
Add panic_mode flag reset to log_core_init(). It allows full logging
reinitialization which is useful for testing.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-06 15:40:05 +02:00
Krzysztof Chruscinski
d58ff39879 logging: Fix runtime filtering in immediate mode
Fixed immediate mode where runtime filter was not applied.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-06 15:40:05 +02:00
Krzysztof Chruscinski
d9518ce4cc logging: Add optional context argument to LOG_BACKEND_DEFINE
Extended LOG_BACKEND_DEFINE to support optional context argument.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-05-06 15:40:05 +02:00
Vinayak Kariappa Chettimada
737cab2614 Bluetooth: controller: openisa: Check preempt event on timeout
Check whether the preempt event matches with the head of the
pipeline before aborting the currently active event.

This is required to avoid preemption of events that became
active due to done event and there has been a race in
stopping the preempt ticker.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 15:39:16 +02:00
Vinayak Kariappa Chettimada
5b75bdf589 Bluetooth: controller: nRF5: Check preempt event on timeout
Check whether the preempt event matches with the head of the
pipeline before aborting the currently active event.

This is required to avoid preemption of events that became
active due to done event and there has been a race in
stopping the preempt ticker.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-05-06 15:39:16 +02:00