Commit graph

21541 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada
cb67f36029 Bluetooth: controller: Rename to BT_CTLR_SYNC_PERIODIC
Rename Kconfig option BT_CTLR_SCAN_PERIODIC to
BT_CTLR_SYNC_PERIODIC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
01006be29f Bluetooth: controller: Fix offset and offset units population
Fix the auxiliary pointer and sync information offset and
offset unit population. Offsets are 13-bit value, use 300 us
offset unit when offset value using 30 us offset unit does
not fit in 13-bits.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
56a7a46bc9 Bluetooth: controller: Fix SCA and Channel Map in Sync Info
Fix the population of SCA and Channel Map in Sync Info
structure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
bf505fdf98 tests: Bluetooth: shell: Minor print format update
Minor print format update, updated format for Periodic
Advertising Interval, and added SID to be printed.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
66b95aa1d4 Bluetooth: controller: Fix set per adv recv enable HCI integration
Uncomment the code integrating the LE Set Periodic
Advertising Receive Enable command.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f9a8507b4d Bluetooth: controller: Move identical ll_scan_params_set out
Move the identical ll_scan_params_set definitions out of
extended advertising conditional compilation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
2234515f96 Bluetooth: controller: Add missing Periodic Adv Sync resources
Add the missing resources like ticker instances, Rx PDU
buffers and memory queue link buffers, that are required
for Periodic Advertising Sync creation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
3a5eed8bac Bluetooth: controller: Fix Periodic Advertising Context leak
Fix Periodic Advertising Context leak on Sync Lost.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f402435535 Bluetooth: controller: Remove redundant use of update check
Remove the redundant ticker update check, ticker is not
stopped and started in Periodic Advertising unlike in a
Connection Update Procedure in connections.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
0a56d57107 Bluetooth: controller: Fix own address type check
Fix the own address type check for whether local static
random address has been set.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
874c1452f1 Bluetooth: controller: Replace use of printk with BT_WARN
Replace printk in ISR with BT_WARN to avoid problems with
co-existing with logging subsystem.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
a5983e1237 Bluetooth: controller: Fix memory alignment violation
Fix memory word access alignment violation that causes
hardfault in nRF51x SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
abebdb2f52 Bluetooth: controller: Fix cond. compilation for broadcaster
Fix compilation error when building only broadcaster support
in an application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
0de3943bb6 Bluetooth: controller: Do not generate sync lost on terminate sync
Remove generation of Periodic Sync Lost HCI event generation
that is not needed as per BT Spec. v5.2 Vol.4 Part E.
Section 7.8.69.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
c23b1a27a7 Bluetooth: controller: Fix uninitialized rl_idx value
Fix uninitialized rl_idx value for the Extended Advertising
PDU received in the auxiliary channels. This caused
uninitialized rl_idx to be used by HCI layer and fail an
assert check in ull_filter.c file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
62e8572df7 Bluetooth: controller: Fix missing periodic advertising start
Fix missing periodic advertising start due to missing
allocation of auxiliary context when no Extended
Advertising PDU on auxiliary channels.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
aec99da741 Bluetooth: controller: Remove cond compile on struct definition
Remove conditional compilation on structure definition in
pdu.h so as to allow inclusion of header files with
function prototypes that use those structures. I.e. to
avoid conditionally including the header file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
baef416d5d Bluetooth: controller: Added Periodic Sync Terminate and Sync Lost
Added implementation to perform Periodic Sync Terminate,
generation of Sync Lost on terminate and on remote device
termination of Periodic Advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
d1f4611ad8 Bluetooth: controller: Add Periodic Sync drift compensation
Added implementation to handle Periodic Advertising clock
drift in the created Periodic Advertising Sync instance.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
31f2196abd Bluetooth: controller: Fix auxiliary channel scanning
Fix auxiliary channel scanning to capture the PDU end
timing that is need to correctly setup Periodic Sync.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
422d8b1466 Bluetooth: controller: Fix correct CA in Periodic Advertising
Fill the correct local clock accurracy in the Sync Info
structure in the Periodic Advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
b2dcfa7ace Bluetooth: controller: Refactor the order of file static function
Refactor the order of file static function to be consistent.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
90cfe1dc66 Bluetooth: controller: Fix minor conditional compilation
Fix minor conditional compilation around extended advertising
and scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
732de50f67 Bluetooth: controller: Refactor out drift compensation code
Refactor out drift compensation implementation so as to
reuse it for Periodic Sync feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
057653c220 Bluetooth: controller: Initial implementation of Periodic Sync setup
Added initial implementation of setting up of Periodic Sync
and scheduling the Radio Events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
ff4546dced Bluetooth: controller: Refactor out common lll_abort_cb function
Refactor out common lll_abort_cb function so that it can be
used across Periodic Advertising and Periodic Advertising
Sync creation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
2627524162 Bluetooth: controller: Refactor out clock ppm interface
Refactor out clock ppm interface so that it can be reused
for Periodic Advertising Sync feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
a0612dabe1 Bluetooth: controller: Implementation of Periodic Sync Create Cancel
Implementation of Periodic Sync Create Cancel.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
f9380dbf48 Bluetooth: controller: Implementation of Periodic Sync Create
Implementation of Periodic Sync creation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
e533f99f04 Bluetooth: controller: Initial implementation of Periodic Sync LLL
Added initial implementation of LLL layer of Periodic Sync
creation feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
96dd0ef9d8 Bluetooth: controller: Minor internal comments updated
Minor updates to internal comments.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
99916bead0 Bluetooth: controller: Refactor to use ull_sync naming
Refactored to use ull_sync naming instead of ull_scan_sync.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
7a5413dcca Bluetooth: controller: Add Kconfig to config Periodic Sync Sets
Added Kconfig option to configure supported simultaneous
Periodic Sync Sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
5c525f0350 Bluetooth: controller: Add HCI integration of Periodic Sync
Added implementation to integrate the Periodic Sync LL
interface with HCI layer.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
b0cc96ec61 Bluetooth: controller: Add initial ULL Periodic Sync code
Add initial files and code for Periodic Sync feature support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Vinayak Kariappa Chettimada
5acdb7d9d2 Bluetooth: controller: Add depends on BT_PER_ADV
Enable controller periodic advertising if host supports it.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-07 17:45:23 +02:00
Mattia Fiumara
8244590fb8 tracing: add feature for analysing post-mortem
This adds a Kconfig option for enabling post-mortem mode of SystemView.
This is useful for crashes that occur after a longer period of time.

Signed-off-by: Mattia Fiumara <mattia.fiumara@bgrid.com>
2020-10-07 10:10:48 -04:00
Dominik Ermel
d795f2dbfe fs: fs_seek and fs_tell return -ENOTSUP when not implemented
Simple change that makes fs_seek and fs_tell return -ENOTSUP when
file system does not implement the seek/tell.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-07 14:51:39 +02:00
Joakim Andersson
b5bf46fe3c Bluetooth: host: Don't use struct with zero size
Don't use the ATT structs that has contains only a flexible array
member. This is not supported by C99 standard, only through GNU C
extension with zero length array.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-10-07 14:51:30 +02:00
Marcin Niestroj
7c5ab5873a mgmt: smp: shell: log warning when buf allocation fails
Log when allocation fails, so user gets warned about communication
problems.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-07 14:51:06 +02:00
Marcin Niestroj
7451a32e98 mgmt: smp: shell: allow to configure multiple RX buffers via Kconfig
With only single RX buffer there is a high chance that such buffer will
not be processed before new bytes come in over UART. This is why it is
good to have at least two buffers, one which can be processed by SMP
layer, while another is being filled with new incoming bytes.

Add Kconfig option which allows to configure multiple buffers filled
with received UART SMP fragments. Use default value of 2, so we can
safely process already received frame in thread, while new fragment
comes in concurrently.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-07 14:51:06 +02:00
Marcin Niestroj
79fa92229a mgmt: smp: shell: use net_buf API for storing UART SMP fragments
So far there was a simple char array used as buffer, with additional
variable representing number of bytes already written into it. After
full frame was written, a boolean flag was simply set to notify thread
about being ready to be processed. There was however no mechanism
implemented to prevent new incoming bytes from overwriting such buffer
before (or during) being processed.

Use net_buf to store temporary frame. Define dedicated net_buf_pool,
from which such buffer will be allocated and freed after being
processed. This will prevent from reusing the same buffer before having
it fully processed (and returning once again to available buffer pool)
in shell thread.

Define also fifo that will store buffers that are ready to be
processed. This will be the mechanism for notifying thread about new
UART SMP fragments.

net_buf pool and k_fifo are used on purpose, keeping in mind their
additional overhead (mostly in RAM/ROM usage). This makes the code ready
for increasing number of buffers if needed. In this commit however we
stick with only 1 buffer, to keep minimal changes in processing flow.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-10-07 14:51:06 +02:00
Vinayak Kariappa Chettimada
c87c1a8890 Bluetooth: controller: Fix implicit declaration warning
Fix implicit declaration warning for peripheral_latency_cancel
by moving it to ull_slave file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-10-06 13:47:18 +02:00
Jackie Ja
1b79d5c279 net: websocket: Fix remnant of message type
Reset message type if all the data has been received.

Signed-off-by: Jackie Ja <qazq.jackie@gmail.com>
2020-10-06 12:01:39 +03:00
Robert Lubos
5fc7d86d7c net: lwm2m: Report boostrap complete after final response is sent
So far, `LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE` event was
reported before the final ACK for the Bootstrap Finish was sent from the
client side. This could cause delays in the ACK sending, in case the
application wanted for instance to store the received data in flash.

Fix this, by reporting the
`LWM2M_RD_CLIENT_EVENT_BOOTSTRAP_TRANSFER_COMPLETE` event on the next
state tansition (before the actual registration starts).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-06 12:01:13 +03:00
Robert Lubos
f35d88503a net: lwm2m: Use the actual data size when provisioning PSK ID
"Public Key or Identity" resource is of opaque data type, therefore it's
not correct to assume it will be a NULL terminated string (the existing
servers, for instance Leshan, does not include NULL terminator). Use the
actual size associated with the resource instead.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-06 12:01:13 +03:00
Robert Lubos
f223d0a86f net: lwm2m: Store the actual resource size in the resource instance
So far, the resource instance structure kept only the information about
the buffer length provided to the resource (in the `data_len` field).
While this approach might be enough for integer resources, where the
actual data size is fixed, it did not work for opaque resources. It is
impossible to determine the actual opaque resource length after it's
been written into.

Fix this, by replacing the current `data_len` field of the
`lwm2m_engine_res_inst` with `max_data_len`, indicating the buffer
size, and making the `data_len` field to hold the actual data size of
the resource.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-06 12:01:13 +03:00
Robert Lubos
f7a5638871 net: lwm2m: Make bootstrap optional
Currently, after `CONFIG_LWM2M_RD_CLIENT_SUPPORT_BOOTSTRAP` is enabled,
the LwM2M engine will initiate bootstrap procedure on each run. This
approach limits the flexibility of the application, as it's not always
necessary to go over the bootstrap procedure (for instance, the
application may decide to store the security object obtained during the
bootstrap in flash, and restore it on boot).

Fix this by introducing an additional `flags` parameter to the
`lwm2m_rd_client_start()` function, which provides information whether
to run bootstrap in the current session or not.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-06 12:01:13 +03:00
Robert Lubos
40d25b8efa net: lwm2m: Introduce ENGINE_IDLE state
So far, the LwM2M state machine started in the `ENGINE_INIT` state,
which made it exectue the registration/bootstrap registration even when
`lwm2m_rd_client_start()` was not called. With a new `ENGINE_IDLE`
state, the state machine can wait for the application to actually start
the client before proceeding. It also makes sense to stay in the
ENGINE_IDLE state after successfull deregistration, until the
application restarts the client.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-10-06 12:01:13 +03:00
Benjamin Lindqvist
8c22983234 net: l2: ppp: Remove ipcp address on network down
Without removing the stale address obtained during IPCP, it will still
be present the next time we do IPCP, marked as "in use" by the network
stack even if it is stale. This turned out to be a showstopper for
restarting the PPP stack on devices without static IP.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2020-10-06 11:57:46 +03:00