Commit graph

21541 commits

Author SHA1 Message Date
Martin Jäger
467e4ccd92 subsystem: disk: stm32_sdmmc: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Asger Munk Nielsen
fbee6cc933 Bluetooth: controller: Create HCI stubs for CIG/CIS and ISO
Put infrastructure for the following HCI commands/events in place:
* LE Read ISO Link Quality command
* LE Read ISO TX Sync command
* LE Set Host Feature Command

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2020-11-30 15:49:30 +01:00
Lingao Meng
1b65fd066f Bluetooth: Mesh: Fix Friend node estalished
Since first poll request send by lpn use friend security
credentials, so, friend nodes should be able to decrypt with
friend security, even if they have not yet established a friendship.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-30 12:32:37 +02:00
Lingao Meng
084574b470 Bluetooth: Mesh: Fix Friend node handle Key update
When friend node key refresh phase to stage_1, there
are need to add friend update message to friend queue,
but, when friend KR phase to stage_2, must add friend
update to queue.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-30 12:32:37 +02:00
Lingao Meng
325288d531 Bluetooth: Mesh: Fix friend node cache message
Friend node cache segment message for lpn, message with
sequence number can't change, since could cause lpn replay
attack.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-30 12:32:37 +02:00
Wolfgang Puffitsch
6aa16e01dd Bluetooth: controller: hci: Fix naming for ISO path setup parameters
Fix field names of bt_hci_cp_le_setup_iso_path in le_setup_iso_path to
make CIS central/periphal compile and adjust parameter names for
ll_setup_iso_path accordingly.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-28 07:36:16 -05:00
Vinayak Kariappa Chettimada
8bf3ee9f98 Bluetooth: controller: Fix skipped single-shot ticker failure callback
A single-shot ticker in requested state beyond the elapsed
duration or skipped due to collision shall generate an
operation callback with failure status.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-26 15:47:02 +01:00
Morten Priess
2d0107ab27 Bluetooth: controller: Fix ticker collision update race
In the case where a BLE connection ticker node collides and does not
trigger a callback to ULL, and at the same time the same node receives a
ticker update request, the update causes the node to be scheduled for
execution a second time. This has the consequence of event_counter going
out of sync, and BLE connection is ultimately lost.

The solution is to mark collsions and re-scheduled nodes as expired, and
use the increased lazy count to identify its state instead of req/ack.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-11-26 15:47:02 +01:00
Wolfgang Puffitsch
1547108b19 Bluetooth: controller: HCI commands to read codecs and controller delay
Implement HCI commands to read information about supported codecs and
controller delay.
* Read Local Supported Codecs command (v1 and v2)
* Read Local Supported Codec Capabilities command
* Read Local Supported Controller Delay command

The following functions are implemented as "weak" symbols and should
be overridden to fill in vendor-specific information into the above
commands.
* hci_vendor_read_std_codecs
* hci_vendor_read_vs_codecs
* hci_vendor_read_codec_capabilities
* hci_vendor_read_ctlr_delay

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-26 15:46:17 +01:00
Wolfgang Puffitsch
9437a6a08d Bluetooth: hci: Add definitions for codec and controller delay info
Add defines and structs for reading information about supported codes,
codec capabilities and controller delays. Return parameter structs for
commands that return multiple variable-length fields only model the
fixed-length fields to minimize inconsistencies.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-26 15:46:17 +01:00
Morten Priess
18c01ecae8 Bluetooth: controller: Make random force on lost anchor configurable
Legacy functionality in ull_conn will force scheduling of a connection
which has missed an anchor point due to lost RX. This kicks in either
for previously skipped events (latenzy_event != 0) or at random
depending on the randomness of the AA bit pattern.

This behavior is good at ensuring that a connection with errors or
aborted RX gets prioitized, and helps break locked round-robin
patterns with lost sync, but it also breaks the predictability of
the round-robin ticker scheduling.

With "must_expire" enabled, this feature also kicks in for scheduling
collisions, which may not be desirable.

This commit adds a configuration flag, BT_CTLR_CONN_RANDOM_FORCE, which
is default enabled (legacy behavior).

Signed-off-by: Morten Priess <mtpr@oticon.com>
2020-11-26 13:51:15 +01:00
Vinayak Kariappa Chettimada
b7976e5633 Bluetooth: host: Fix uninitialized periodic interval parameter
Fix missing initialization of periodic interval value in
advertising report info structure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-26 13:50:03 +01:00
Joakim Andersson
8d3b9bae3b Bluetooth: host: Make acl_data extension of bt_buf user data explicit
Clarify that the acl_data struct includes the bt_buf type as the
first variable in the user data struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-26 13:15:03 +01:00
Joakim Andersson
431dd9f25b Bluetooth: host: Refactor out buffer handling to new file
Refactor out implementation of functions defined in buf.h to its own
source file buf.c

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-26 13:15:03 +01:00
Joakim Andersson
4978c19c05 Bluetooth: host: Refactor out address handling to new file
Refactor implementation of functions defined in addr.h to its own
source file addr.c.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-26 13:15:03 +01:00
Piotr Pryga
e54d2a7740 Bluetooth: host: Add HCI set conn CTE TX params wrapper function
Add implementation of a wrapper for HCI_LE_Set_Connection_-
CTE_Transmit_Parameters command.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-11-26 13:14:17 +01:00
Piotr Pryga
2589b7ace2 Bluetooth: controller: hci: Add set connection CTE transmit params
Add implementation of HCI_LE_Set_Connection_CTE_Transmit_Parameters
for Bluetooth 5.1 Direction Finding.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-11-26 13:14:17 +01:00
Piotr Pryga
0285903aee Bluetooth: controller: Add Direction Finding specific KConfig
Add separated Kconfig file for Bluetooth 5.1 Direction Finding.
Enable controller support for:
 - transmission of CTE
 - 2us antenna switching
 - 1us antenna switching
if build for nRF52833 SOC.
Add HAS_HW_NRF_RADIO_BLE_DF to nrf52833 SOC configuration.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-11-26 13:14:17 +01:00
Piotr Pryga
57b55d0fad Bluetooth: controller: Add read antenna information HCI command
Add partial implementation for handling Bluetooth 5.1 Direction
Finding HCI command HCI_LE_Read_Antenna_Information to controller
Upper Link layer.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-11-26 13:14:17 +01:00
Piotr Pryga
14890c8eb6 Bluetooth: host: Add read antenna information HCI command
Add Bluetooth 5.1 Direction Finding HCI command:
HCI_LE_Read_Antenna_Information handling to Host.
Add wrapper function to handle send the command
and receive response from Controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-11-26 13:14:17 +01:00
Trond Einar Snekvik
b0f83d387a Bluetooth: Mesh: Only block mod_sub if status was requested
Adds a cli_reset to mod_sub if no status response was requested. This
adds a non-blocking mode to the mod_sub calls, matching the behavior of
other cfg_cli functions.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-26 13:04:04 +01:00
Lingao Meng
fe7eda6ac8 Bluetooth: Mesh: Permit kr phase 0x00 to 0x03
MESH/NODE/KR/BI-01-C
Permit kr phase 0x00-->0x03

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-26 12:21:09 +02:00
Lingao Meng
3d55080bf3 Bluetooth: Mesh: Fixes missing recv net_idx copy to context
Missing copy net_idx to ctx, this cause tx subnet not found
or different with rx subnet, when rx subnet net_idx not zero.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-11-26 12:21:09 +02:00
Peter Bigot
cd2a5dd612 bluetooth: mesh: avoid improper access to internal structures
Nothing in the API description the delayed work structure sanctions
direct reference to internal fields.  Do not assume that a delayed
work item can be submitted without delay by invoking k_work_submit()
with a reference to the contained work item.  Instead submit with the
delayed API and no wait.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-24 13:04:48 +02:00
Peter Bigot
550a1f411d net: net_tc: change illicit reference to work queue internal state
Debug messages used the address of a member of the work_q structure as
an identifier; that field is not public API, so replace it with the
address of the work queue itself.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-11-24 13:04:48 +02:00
Vinayak Kariappa Chettimada
27529e0c0d Bluetooth: controller: Fix periodic sync conditional compilation
Fix Periodic Advertising Synchronization conditional
compilation to allow Extended Scanning feature without
Periodic Advertising Synchronization feature enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
64874168cb Bluetooth: controller: Fix extended adv/sync report buffer leak
Fix node rx buffer leak if extended advertising and/or
periodic sync reports are masked out by the host.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
ab82d8e158 Bluetooth: controller: Minor readability different variable use
Use an explicitly named variable to convey auxiliary pointer
present in the PDU chain.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
283a30875b Bluetooth: controller: Add code comments for ext adv report
Added code comments to explain the reasons to drop
incomplete advertising and sync report.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
d80d79e7f9 Bluetooth: controller: Use HCI defines for constants
Use HCI defines for PHY, and RSSI constants.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
20939b7b11 Bluetooth: controller: Periodic Advertising Report generation
Added implementation for LE Periodic Advertising Report
event generation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Vinayak Kariappa Chettimada
5b62fae902 Bluetooth: controller: Fix Extended Advertising Report generation
Fix Extended Advertising Report generation that skipped
population of AD data when there was no extended header.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Rubin Gerritsen
bc6d16e422 systemview: Use common function to get sysview thread name
Use a common function to get the thread name.
There was no necessity in keeping sys_trace_thread_info() inline,

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-11-21 08:29:26 -05:00
Rubin Gerritsen
7a9da57cd8 systemview: Use thread name when available
This may make it easier to debug.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-11-21 08:29:26 -05:00
Rubin Gerritsen
5d121a95e9 systemview: SystemView tracing requires THREAD_MONITOR
Otherwise it will not be able to send its thread list.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-11-21 08:29:26 -05:00
Maureen Helm
57b756b442 debug: tracing: Add Segger RTT and SystemView linker section options
Enables optionally placing Segger RTT and SystemView data in the DTCM
linker section instead of the default data section. This is needed on
SoCs in the i.MX RT series that use cacheable external SDRAM to store
data.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-11-20 12:54:09 -06:00
Jukka Rissanen
03df709a46 net: tc: Refactor RX and TX thread priorities
Set the RX/TX thread priorities so that if cooperative priorities
are used, then lowest priority thread will have priority -1 which
is the lowest cooperative priority. The higest net thread priority
will depend on number of traffic classes but with max value 8,
the highest priority will be -8.

If preemptive priorities are used, then highest priority thread
will have priority 0, which is the highest preemptive priority.
In this case, the lowest thread priority will be 7 if there are
8 traffic classes.

The motivation for this change is that for cooperative priorities
we want to let other cooperative priority threads to run before
networking. But if preemptive priorities are used, we want
networking threads to run reasonably often compared to other
preemptive priority threads.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-20 12:57:29 +02:00
Jukka Rissanen
f02fd19706 net: Adjust the thread priorities
If networking pre-emptive thread priorities are enabled,
then use the proper macro to enable them.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-20 12:57:29 +02:00
Jukka Rissanen
575fc5fe14 net: tc: Allow user to select pre-emptive threading for RX/TX
Let user to decide whether the RX/TX threads are run in either
co-operative or pre-emptive thread priority.
Default is co-operative threading.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-20 12:57:29 +02:00
Asger Munk Nielsen
3df64a306b Bluetooth: controller: Create HCI stubs for CIG/CIS and ISO tests
Put infrastructure for the following HCI commands/events in place:
* LE Setup ISO Data Path command
* LE Remove ISO Data Path command
* Configure Data Path command
* LE Set CIG Parameters Test command
* LE ISO Read Test Counters command
* LE ISO Receive Test command
* LE ISO Test End command
* LE ISO Transmit Test command

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2020-11-20 10:56:51 +01:00
Vinayak Kariappa Chettimada
e9892c0000 tests: Bluetooth: shell: Fix PAST commands conditional compilation
Enclose PAST subscribe/unsubscribe test commands inside
CONFIG_BT_PER_ADV_SYNC and CONFIG_BT_CONN conditional
compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-20 11:39:13 +02:00
Vinayak Kariappa Chettimada
6578a366d5 Bluetooth: host: Fix Periodic Adv Set Info Transfer dependency
Periodic Advertising Set Info Transfer depends on Extended
Advertising and connections hence enclose the LE Periodic
Advertising Set Info Sync Transfer implementation inside
CONFIG_BT_PER_ADV and CONFIG_BT_CONN conditional
compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-20 11:39:13 +02:00
Vinayak Kariappa Chettimada
77d4ad65c5 Bluetooth: host: Fix PAST dependency on connections
Periodic Advertising Sync Transfer depends on connections
hence enclose the LE Periodic Advertising Sync Transfer
Received Event code inside CONFIG_BT_CONN conditional
compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-20 11:39:13 +02:00
Paul Sokolovsky
d29fcb8187 net: sockets: recv() on unconnected stream socket should lead to ENOTCONN
Because unoconnected stream socket doesn't have any chance to receive
any data, so a blocking recv() would hang forever on it (and does
without this change).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2020-11-19 16:58:37 -05:00
Simon Glass
129cfec28a emul: spi: bmi160: Add a check for a missing rx buffer
If a read is requested without a read buffer, the emulator currently
crashes. Fix this by adding a check.

Fixes: #29703
Fixes: #29702
Fixes: #29017
Fixes: #29016

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-19 11:26:32 -06:00
Jukka Rissanen
753412bd23 net: tcp2: Fix llvm issue when printing mss
llvm uses wrong int type for some reason, force cast to uint16_t

Fixes #29997

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-11-19 10:56:26 -05:00
Joakim Andersson
34e66db776 Bluetooth: host: Fix different endian in comparison
Fix the debug key-set comparison for debug keys comparing the
generated key in big-endian format against the debug private
key in little-endian format.

Fix this by converting the private key to big-endian format for
convenience.

Use the _be suffix for all variables to make the mixing of the
endian formats easier to read.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-19 12:40:13 +01:00
Emil Gydesen
deac6d73c5 Bluetooth: controller: Removes guards ull_adv_sync_*
Two ull_adv_sync function declarations, ull_adv_sync_reset and
ull_adv_sync_init was guarded by a #if causing CI issues.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-19 12:36:23 +01:00
Emil Gydesen
6b72bed967 Bluetooth: Controller: Add common ULL ticker stop with mark function
The same code block for marking an object with
ull_disable_mark, stopping the ticker and then unmarking
the object appeared multiple places; often with a regression
bug where instead of unmarking it in case of error, it would
be "remarked".

This commit fixes the bug, and moves the functionality to
a common function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-19 12:36:14 +01:00
Emil Gydesen
071db25f66 Bluetooth: Controller: Adds missing ull_disable in ll_sync_terminate
A call to `ull_disable` was missing in the function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-11-19 12:36:14 +01:00