Commit graph

9864 commits

Author SHA1 Message Date
Ioannis Papamanoglou 3415f71910 fs/nvs: prevent use after clear without init
Unset ready flag in nvs instance on clear.

Signed-off-by: Ioannis Papamanoglou <ioannis.papamanoglou@zonneplan.nl>
2021-07-20 13:34:45 +02:00
Robert Lubos 0722e1d896 net: lwm2m: Prevent notifications on non-readable resources
In case a non-readable resource gets updated (either by the server or
with an API), it makes no sense to send a notification in such case, as
no such resources are not included in notifications anyway.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-07-20 13:33:22 +02:00
Trond Einar Snekvik abcbfed6c3 Bluetooth: Mesh: Provisioning PDU length defines
Adds length defines for all provisioning PDUs and uses them to split
prov_link.conf_inputs into separate fields.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-07-20 13:32:57 +02:00
Marcin Niestroj eb0eb67481 logging: fs: fix leak of opened directories in check_log_file_exist()
Opened directory descriptor is leaked when returning 1. Fix that by
utilizing goto in function return path.

Fixes: 6b18e6992d ("subsys/loggin/log_backend_fs: added recovery after
  file lost")
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-20 13:31:33 +02:00
Emil Gydesen 6ee70bd220 Bluetooth: Audio: Fix compile error if AICS is not enabled
Fix compile error if AICS is disable but AICS_CLIENT is
enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-19 20:08:30 -04:00
Emil Gydesen e6d49645de Bluetooth: Audio: Guard MICS cli/srv structs
Add guards to the structs. This has two purposes:
1) Reduce size of only one of them are enabled
2) Fix a compile issue if only one of them were enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-19 20:08:30 -04:00
Emil Gydesen dfc1fa39b6 Bluetooth: Audio: Guard VCS cli/srv structs
Add guards to the structs. This has two purposes:
1) Reduce size of only one of them are enabled
2) Fix a compile issue if only one of them were enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-19 20:08:30 -04:00
Emil Gydesen d9213051bd Bluetooth: Audio: Fix MICS client without AICS compile error
Fix an error if MICS client was enabled without MICS AICS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-19 20:08:30 -04:00
Emil Gydesen a9557531d3 Bluetooth: Audio: Fix compile error for VCS cli if no AICS/VOCS
If either AICS or VOCS clients were not enable, then the VCS
client could not be enabled as there was a compile error
in the function that registered callbacks.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-19 20:08:30 -04:00
Christopher Friedt 8e9d055d49 logging: use unsigned print format specifier
Even though it's highly unlikely that a component of time
would ever approach INT_MAX, use the unsigned specifier to mitigate
any unexpected behaviour.

Fixes #36814

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2021-07-19 20:04:03 -04:00
Emil Gydesen 61a3b1eb38 Bluetooth: uuid: Use BT_UUID_SIZE_ macros for bt_uuid_create
Use the UUID size macros instead of literal values in
bt_uuid_create.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-19 18:52:41 +02:00
Jedrzej Ciupis 25ebb42bd9 net: pkt: remove ieee802154_frame_retry flag
Flag that indicates if a given packet is being retransmitted has become
obsolete since more detailed flags were added. This commit removes the
flag and references to it altogether.

Signed-off-by: Jedrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2021-07-19 18:15:56 +03:00
Vinayak Kariappa Chettimada c1792c002d Bluetooth: Controller: Fix HCI reset assert initiating on coded PHY
Fix HCI Reset Command from asserting when there is pending
connection creation requested on coded PHY.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:19:25 +02:00
Vinayak Kariappa Chettimada a5ac9c65f1 Bluetooth: Controller: Fix SID for legacy advertising reported
SID value for legacy advertising reported shall be 255.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:19:15 +02:00
Vinayak Kariappa Chettimada 8818c51cec Bluetooth: Controller: Use sizeof(uint8_t) for Tx Power field size
Use sizeof(uint8_t) for Tx Power field size instead of
auto-increment ++.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:19:00 +02:00
Vinayak Kariappa Chettimada 1922a0e982 Bluetooth: Controller: Add target address into common extended header
Add and retain in subsequent updates the target address
in the auxiliary PDUs.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:19:00 +02:00
Vinayak Kariappa Chettimada 6e0692fc4c Bluetooth: Controller: Fix legacy advertising PDU length initialization
Fix missing initialization of legacy advertising PDU length
when advertising sets are reused between extended and legacy
advertising modes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:18:40 +02:00
Vinayak Kariappa Chettimada e34ec9fc25 Bluetooth: Controller: Use BT_CTLR_BROADCAST_ISO Kconfig option
Use CONFIG_BT_CTLR_BROADCAST_ISO when CONFIG_BT_CTLR_ADV_ISO
or CONFIG_BT_CTLR_SYNC_ISO Kconfig option is supported.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:18:31 +02:00
Vinayak Kariappa Chettimada ba6be70129 Bluetooth: Controller: Added comments for CSA #2 implementation
Added Bluetooth Specification references to the
implementation of Channel Selection algorithm #2 in the
Controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:18:31 +02:00
Vinayak Kariappa Chettimada 7b12723aad Bluetooth: Controller: Replace test vector inputs with auto variable
Replace hard coded channel map count and channel identifier
with an auto variables.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:18:31 +02:00
Vinayak Kariappa Chettimada b329d198a7 Bluetooth: controller: Implement CSA #2 for SubEvents
Implement the functions required to calculate the SubEvent 1
and SubEvent n mapped channel indices.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 14:18:31 +02:00
Vinayak Kariappa Chettimada 3501148922 Bluetooth: Controller: Legacy vs Extended check for Periodic Adv HCI
Add the check for mixed use of Legacy vs Extended HCI
commands for Periodic Advertising related HCI commands.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 12:28:55 +02:00
Vinayak Kariappa Chettimada 591007206d Bluetooth: Controller: Fix directed advertising report
Fix extended advertising report to set the directed bit in
the event type when receiving directed non-connectable
advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 12:05:10 +02:00
Vinayak Kariappa Chettimada 449d0b29b7 Bluetooth: Controller: Fix extended advertising timeout
Fix extended advertising PDUs seen after the advertising
duration has elapsed, by considering the events skipped
due to overlap with other events which is provided by
the ticker lazy parameter.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 12:04:56 +02:00
Vinayak Kariappa Chettimada 5659b005f1 Bluetooth: Controller: Add checks for invalid PHYs
Add checks for invalid PHYs supplied to HCI LE Extended Scan
Parameters and LE Extended Create Connection commands.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 12:04:36 +02:00
Vinayak Kariappa Chettimada 027835fea6 Bluetooth: Controller: Disallow anonymous legacy advertising
Check and disallow legacy advertising from being anonymous.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-19 12:03:35 +02:00
Marcin Niestroj 577315c4ff fs: littlefs: drop newline character in log messages
Newline character is automatically appended in log backends such as
UART, so there is no need to add it explicitly.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-19 12:03:15 +02:00
Marcin Niestroj c314557f2a fs: shell: fix incorrect message format when mount fails
There is '%u' and '%d' in format message, while there is only one
argument (besides format string). Remove ununsed '%u' to stop printing
garbage.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-19 12:02:58 +02:00
Marcin Niestroj 8e1a071725 logging: allow timestamp formatting for FS backend
FS backend is no different when it comes to producing human readable
timestamp. Allow to select it when FS is the only enabled logging
backend.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2021-07-19 12:02:43 +02:00
Johann Fischer 8b37c62b35 usb: remove useless len argument from usb_data_to_host()
The len argument always has the same value as
usb_dev.setup.wLength, which is also the last received
USB device request.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-07-19 04:01:22 -04:00
Piotr Pryga 378a1e082a Bluetooth: controller: remove unnecessary ull_adv_ext_hdr_data struct
After extracting from ull_adv_sync_pdu_set_clear functions:
ull_adv_sync_pdu_alloc, ull_adv_sync_extra_data_set_clear
Use of ull_adv_ext_hrd_data structure became unnecessary.
The extra_data member of the structure was never used
due to separate function responsible for setting extra_data
content.
In all cases content for extended advertising header fields
may be passed to the ull_adv_sync_pdu_set_clear directly
as void * pointer, instead of pointer to ull_adv_ext_hdr_data.

This simplifies use of ull_adv_sync_pdu_set_clear as well
as removes unneccesary code to handle special structure type.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-07-17 16:43:08 -04:00
Piotr Pryga 4c3d76bf8b Bluetooth: controller: remove extra_data use in BIG create and terminate
extra_data is not used by ll_big_create and ll_big_terminate.
extra_data_prev and extra_data_new are optional arguments for
ull_adv_sync_pdu_alloc.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-07-17 16:43:08 -04:00
Piotr Pryga bef9d14f7f Bluetooth: controller: simplify arg list of ull_adv_sync_pdu_alloc
ull_adv_sync_pdu_alloc function was extracted from ull_adv_sync_pdu_-
-set_clear function. The arguments list of ull_adv_sync_pdu_alloc
was derived from source function but the acutal functionality is
only part of what it was before.

The ull_adv_sync_pdu_alloc does not change extended advertising
PDU header fileds. The hdr_add_fields and hdr_rem_fields arguments
were used to allocate or not allocate memory for extra_data related
with new periodic advertising PDU. Also hrd_data pointer was
not used by the function.

The function arguments list was simplified.
New enum ull_adv_pdu_extra_data_flag was introduced to provide
named flags for extra_data memory management.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-07-17 16:43:08 -04:00
Robert Lubos 8a4e489739 net: sockets: dtls: Fix handshake with socket offloading
Fix `poll()` handling for DTLS clients when the underlying socket is an
offloaded socket. As in this case no `k_poll()` is used underneath, it's
not possible to monitor the handhshake status with `tls_established`
semaphore. Instead, do the following:

1. If no handhshake is in progress yet, just drop the incoming data -
   it's the client who should initiate the handshake, any data incoming
   before that should not be processed.
2. If handshake is currently in progress, lift the `POLLIN` flag and add
   small delay to allow the other thread to proceed with the handshake.
3. Otherwise, just proceed as usual.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-07-16 22:09:58 -04:00
Robert Lubos b4366a8732 net: sockets: tls: Fix handshake on non blocking sockets
The TLS/DTLS handshake in most cases is a blocking process, therefore
the underlying socket should be in a blocking mode to prevent busy
looping in the handshake thread. Fix this by clearing the O_NONBLOCK
flag on the underlying socket before the handshake, and restoring it
afterards.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-07-16 22:09:04 -04:00
Elliot Revell-Nash 15318634b7 logging: count file with index 0 as log file too
Fixes #36667

If you had a single log file with index 0 created and you reboot
the log backend wasn't counting it and was overwiting it.
If you filled that file up before rebooting then it worked as
expected, creating a new file at the next index on each boot.

Signed-off-by: Elliot Revell-Nash <elliot.revell-nash@wdtl.com>
2021-07-16 21:55:55 -04:00
Marcin Jeliński 20d63b078c ipc: ipc_service: RPMsg multi-instance as backend for IPC Service
Implementation of the backend for IPC Service.
Multi-instance RPMsg was used as a backend.

Signed-off-by: Marcin Jeliński <marcin.jelinski@nordicsemi.no>
2021-07-16 21:43:39 -04:00
Marcin Jeliński 3fcd8d1003 ipc: Added IPC Service to support different transport backends
IPC Service allow plugging in different transport backends.
Specifies a generic API that is implemented by the backend.

Signed-off-by: Marcin Jeliński <marcin.jelinski@nordicsemi.no>
2021-07-16 21:43:39 -04:00
Marcin Jeliński 54d2eb45a1 ipc: Add multiple instances RPMsg
This patch implements a service that adds multiple instances
capabilities to RPMsg.
Each instance is allocated a separate piece of shared memory.
Multiple instances provide independent message processing.
Each instance has its own work_q.

Signed-off-by: Marcin Jeliński <marcin.jelinski@nordicsemi.no>
2021-07-16 21:43:39 -04:00
Vinayak Kariappa Chettimada 78e3fe3d75 Bluetooth: Controller: Refactor Periodic Advertising time update
Refactor Periodic Advertising time update function to use
caller supplied Periodic Advertising PDU to calculate the
time reservations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada ab6d4693da Bluetooth: Controller: Use BT_HCI_ERR_SUCCESS return and other changes
Apply suggestions from code review, and change to using
BT_HCI_ERR_SUCCESS instead of returning 0.

Co-authored-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada ead034d514 Bluetooth: Controller: Fix Extended and Periodic Coded PHY time
Fix Extended and Periodic Coded PHY time reservation. The
define earlier used does not have calculations for Coded
PHY.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada 177ebac790 Bluetooth: Controller: Periodic advertising time reservation
Implementation to update Periodic Advertising time
reservations when advertising data and/or CTE length is
updated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada 91956dadcd Bluetooth: Controller: Disallow Periodic Adv Enable if already enabled
Add check for already enabled and started Periodic
Advertising when HCI LE Set Periodic Advertising Parameters
command is called.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada baca5c2c55 Bluetooth: Controller: Refactor out Periodic Advertising time calc
Refactor out Periodic Advertising time calculations so that
it can be reused when PDU length is updated as part of
advertising data updates.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada f93e41202d Bluetooth: Controller: Extended advertising time reservation
Implementation to update Extended Advertising time
reservations when advertising and scan response data are
updated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada 9928c81fbf Bluetooth: Controller: Export primary adv channel event time calc
Export the function calculating the primary channel
advertising event time reservation, so that Extended
Advertising implementation can reuse it.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada dd1b296d46 Bluetooth: Controller: Update DID when scan response data removed
Update DID value when scan response data is remove, length
set to 0.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada 739b8ad903 Bluetooth: Controller: Refactor out Extended Advertising time calc
Refactor out Extended Advertising time calculations so that
it can be reused when PDU length is updated as part of
advertising data and scan response data updates.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00
Vinayak Kariappa Chettimada ee04896ca9 Bluetooth: Controller: Legacy advertising time reservation
Implementation to update legacy advertising time
reservations when advertising and scan response data are
updated.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-07-16 10:48:39 +02:00