Commit graph

21541 commits

Author SHA1 Message Date
Jukka Rissanen
9080a46e68 net: tcp2: Use mutex instead of irq_lock
When needing to lock non-connection related access, use k_mutex
instead of locking irq. There is really no reason to prevent the
system from generating interrupts.

Fixes #30636

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-12-15 12:16:19 +02:00
Anas Nashif
802d214582 debug: analyzer: add support for thread runtime stats
Add thread runtime statistics to the thread analyser.

With CONFIG_THREAD_RUNTIME_STATS enabled:

Booting from ROM..*** Booting Zephyr OS build zephyr-v2.4.0-2330-g77be0e93e65b  ***
thread_a: Hello World from cpu 0 on qemu_x86!
Thread analyze:
 thread_b            : STACK: unused 740 usage 284 / 1024 (27 %); CPU: 0 %
 thread_analyzer     : STACK: unused 8 usage 504 / 512 (98 %); CPU: 0 %
 thread_a            : STACK: unused 648 usage 376 / 1024 (36 %); CPU: 98 %
 idle 00             : STACK: unused 204 usage 116 / 320 (36 %); CPU: 0 %
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
thread_b: Hello World from cpu 0 on qemu_x86!
thread_a: Hello World from cpu 0 on qemu_x86!
Thread analyze:
 thread_b            : STACK: unused 648 usage 376 / 1024 (36 %); CPU: 7 %
 thread_analyzer     : STACK: unused 8 usage 504 / 512 (98 %); CPU: 0 %
 thread_a            : STACK: unused 648 usage 376 / 1024 (36 %); CPU: 9 %
 idle 00             : STACK: unused 204 usage 116 / 320 (36 %); CPU: 82 %
thread_b: Hello World from cpu 0 on qemu_x86!

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-14 13:00:47 -05:00
Marcin Niestroj
0e769c1a36 dfu: mcuboot: add shell module
Add new shell module for mcuboot enabled application. It provides
information about image slots and allows to perform such operations as:
confirm, erase and request upgrade.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-12-14 11:24:57 +01:00
Martin Åberg
226f918289 logging: Reduce missinglog_strdup() on SPARC
is_rodata() can now determine if an object is the rodata section
on SPARC. This eliminates spurious run-time error messages about
"missinglog_strdup()".

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2020-12-14 11:23:34 +01:00
Vinayak Kariappa Chettimada
62cb9aedc4 Bluetooth: controller: Clean up direction finding Kconfig
Simplify selection of direction finding related Kconfig.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-12-14 11:23:26 +01:00
Piotr Pryga
1283b136e7 Bluetooth: controller: ull_df: Fix compilation warnings
Remove unused functions to fix compilation warninigs.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-12-14 11:23:26 +01:00
Piotr Pryga
307ac64374 Bluetooth: controller: Add set connectionless CTE TX parameters
Add implementation of HCI_LE_Set_Connectionless_CTE_-
Transmit_Parameters command in HCI.
Add implementation of command handling in controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-12-14 11:23:26 +01:00
Trond Einar Snekvik
2e3de6c5f8 Bluetooth: Mesh: LPN non-low power establishment set state
Sets the LPN state to WAIT_UPDATE when waiting for the initial poll
response when disabling LPN_ESTABLISHMENT. Previously, the LPN node
would stay in the wait offer state even after the offer was processed,
which led to it aborting the friend establishment completely if it
failed to receive the first poll.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-12-14 11:21:41 +01:00
Trond Einar Snekvik
040b027e00 Bluetooth: Mesh: Check LPN credentials before establishment
While the friend node considers the friendship established as soon as it
sends the friendship offer, the LPN only considers the friendship
established once it receives the first update after its poll. This
update is encrypted with the friendship credentials, which aren't
available, as they're protected by an if (lpn_established()) check.

Changes the check to lpn_waiting_update(), which makes the LPN check its
friendship credentials only when it's expecting a response to a poll
message. This is the only time the friend will send messages encrypted
with the friendship credentials.

This is a regression from #28511.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-12-14 11:21:41 +01:00
Trond Einar Snekvik
a0bb080f8a Bluetooth: Mesh: Set LPN credentials on friend_req
Explicitly sets the LPN credentials when sending a friend request.

This fixes a regression from #28511.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-12-14 11:21:41 +01:00
Jonathan Rico
21311c8bc5 Bluetooth: host: Ignore reserved SMP PDUs
Do not abort pairing when peer sends a SMP command with an opcode
reserved for future use, as per spec.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2020-12-14 11:21:24 +01:00
Jonathan Rico
98584a4bbc Bluetooth: host: Add keypress notification SMP handler
Add a dummy SMP command handler for keypress notification, that does
nothing (yet). This allows the next commit to work properly.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2020-12-14 11:21:24 +01:00
Gerson Fernando Budke
450330420e mgmt: updatehub: Kconfig: Drop NET_CONFIG_SETTINGS option
Remove NET_CONFIG_SETTINGS Kconfig option. The net settings should
be enabled from now at project config or at any overlay. This is
necessary to allow better control when application should start.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-12-14 11:21:06 +01:00
Gerson Fernando Budke
58fa3c039a mgmt: updatehub: Add debug logs
Current logs only prints default logs level. Add LOG_LEVEL at updatehub
to switch to another variation based on CONFIG_UPDATEHUB_LOG_LEVEL.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-12-14 11:21:06 +01:00
Gerson Fernando Budke
2a394372d2 mgmt: updatehub: Clean SHA-256 macros
Clean SHA-256 macros that were left behind when added flash SHA-256
verification.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-12-14 11:21:06 +01:00
Joakim Andersson
a7fd4eab5c drivers: counters: Fix TIMER0 and RTC0 with Bluetooth controller
Fix TIMER0 and RTC0 being selectable when using out-of-tree Bluetooth
controller.
Generalize the Kconfig to have the features that use the HW peripheral
select them as reserved to make the dependencies more manageable.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-13 19:25:49 -05:00
Maik Vermeulen
4cfd2a1943 net: lwm2m: Added execute arguments support
A dedicated LwM2M execute callback type has been implemented which
supports execute arguments. The lwm2m engine, lwm2m_client sample and
lwm2m objects have been updated accordingly. Also the API change has
been documented, and the lwm2m engine reference has been updated.

Fixes #30551.

Signed-off-by: Maik Vermeulen <maik.vermeulen@innotractor.com>
2020-12-13 15:39:08 -05:00
Pavel Vasilyev
347a1ab19f Bluetooth: Mesh: Make access packet sizes defines public
This commit makes BT_MESH_*_SDU_MAX macros public so that applications
can use them.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2020-12-12 14:15:47 +02:00
Pavel Vasilyev
12bcf652e6 Bluetooth: Mesh: Make address defines public
This commit makes BT_MESH_ADDR_IS_* macros public so that applications
can use them.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2020-12-12 14:15:47 +02:00
Anas Nashif
276ef71890 hawkbit: improve Kconfig dependencies
Put everything inside an if, we should not see anything related to
hawkbit in generated .config if it is not enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-11 16:49:41 -05:00
Anas Nashif
818e8deb3b updatehub: improve Kconfig dependencies
Put everything inside an if, we should not see anything related to
updatehub in generated .config if it is not enabled.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-11 16:49:41 -05:00
Anas Nashif
3d33d767f1 twister: rename in code
Some code had reference to sanitycheck, replace with twister.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-11 14:13:02 -05:00
Lingao Meng
f105455ebe Bluetooth: Mesh: Fix overflow of ivu_duration value
Bluetooth Mesh require minimum limit time to enter iv update
state or return to iv nornal state.

For Zephyr bluetooth mesh implementation, use`ivu_duration`
type `uint8_t` to represent current time, but if the time is
more than 255 hours, there will be problems due to the
overflow of 8-bit unassigned variables.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-12-11 09:03:05 -05:00
Trond Einar Snekvik
040b14366e Bluetooth: Mesh: Pull all function calls out of the K_MSEC macro
The K_MSEC macro evaluates its argument twice, which causes double
evaluation of some function calls in the mesh stack.

This removes all instances of function calls inside K_MSEC macros in the
mesh stack.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-12-10 12:15:04 -05:00
Kamil Piszczek
ac88b86179 bluetooth: services: add tps service
Added Transmit Power Service implementation.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-12-10 13:33:12 +01:00
Kamil Piszczek
fd8d03bd8b bluetooth: conn: add api for getting tx power level
Added a new Bluetooth API that can be used to read the current and
maximum transmit power level of the radio. The reading operation is
performed over HCI.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-12-10 13:33:12 +01:00
Rubin Gerritsen
a8bbe4d1db bluetooth: host: Disallow directed adv options on undirected adv
Previously, if the peer address was not set, the host would
do undirected advertising even if the application applied
options only applicable to directed advertising.

Adding this additional parameter validation reduces the confusion
of application developers when they have configured something wrong.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2020-12-10 14:32:51 +02:00
Lingao Meng
aea9adfc89 Bluetooth: Mesh: Fixes LPN poll timeout gradually grow
`POLL_TIMEOUT_MAX` should use `CONFIG_BT_MESH_LPN_POLL_TIMEOUT`
instead of `CONFIG_BT_MESH_LPN_INIT_POLL_TIMEOUT`. The described
algorithm to grow the poll timeout implemented in function
poll_timeout does not work with this implementation.

It's a regression in 3b4d58a
Bluetooth: Mesh: optimize performance for lpn node

Fixes: #30338

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-12-10 14:04:19 +02:00
Thomas Ebert Hansen
f0f25cfc32 Bluetooth: controller: Fix CUI/CPR lock during TO
Release the CUI/CPR lock if the connection owning the lock is
terminated.

This can happen if a device performing a CUI/CPR procedure gets a LSTO
before the procedeure completes or the procedure itself TO.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2020-12-10 12:58:35 +01:00
Lingao Meng
779fd135f3 Bluetooth: Mesh: Fixes wrong app_key_idx parameters
`app_key_del` first param should be key_app_idx,
not key_net_idx.

The effect is that app_key_del is broken.

It's a regression in eca014115
Bluetooth: Mesh: Isolate cryptographic material

Fixes: 30468

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2020-12-10 12:58:20 +01:00
Robert Lubos
5d038eb014 net: openthread: Add option to enable software CSMA backoff
Add option to enable software CSMA backoff in the OpenThread MAC layer.

This allows to run CSMA procedure correctly in radios that do not
support hardware CSMA backoff, and use them as RCP, where this feature
is required.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-12-10 12:58:07 +01:00
Rafał Kuźnia
065722fef0 net: openthread: add missing settings deinit function
This commit adds a missing otPlatSettingsDeinit function
to the Zephyr OpenThread platform implementation.

Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
2020-12-09 22:53:53 +02:00
Anas Nashif
98cef8376c power: cleanup kernel idle and power hooks
Cleanup code for power management and remove some duplication and
isolate power management code from the kernel code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
8a97717c72 power: rename _pm_idle_exit_notification_disable
Rename API to be more consistent with guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
5e4222749a power: pm_force_power_state -> pm_power_state_force
Rename API to be more consistent with guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
72cab9a2d0 power: sys_set_power_state -> pm_power_state_set
remove sys_ prefix and rename API to be more consistent with guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
400b4f0d75 power: power kconfig cleanups
Help and prompt cleanups.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
4933345e7a power: remove FSM from DEVICE_PM_FSM_*
simplify device variable names, remove useless FSM.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
e3937453a6 power: rename _sys_suspend/_sys_resume
Be consistent in PM namespaces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
e0f3833bf7 power: remove SYS_ and sys_ prefixes
Remove SYS_ and sys_ from all PM related functions and defines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
142c3060e7 power: move kconfigs from arch/ to power/
Move all Kconfigs where they belong and in one place.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Anas Nashif
dd931f93a2 power: standarize PM Kconfigs and cleanup
- Remove SYS_ prefix
- shorten POWER_MANAGEMENT to just PM
- DEVICE_POWER_MANAGEMENT -> PM_DEVICE

and use PM_ as the prefix for all PM related Kconfigs

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-12-09 15:18:29 -05:00
Trond Einar Snekvik
81bf99145a Bluetooth: Mesh: Extended advertising support
Adds support for extended advertiser commands in the mesh. This doubles
throughput for common packet sending, and significantly improves timing
accuracy for the Friend and Low Power features.

The proxy module's advertisement control has been moved inside the adv
module to abstract away the different advertiser modes.

The extended advertiser mode does not need an advertising thread to
operate, and ends up with a net reduction in RAM usage.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-12-09 12:57:59 +02:00
Henning Fleddermann
061de0376a net: lwm2m: fix buffer length check in lwm2m_engine_set
Previously, lwm2m_engine set would check against the max_data_len
parameter of the ressource, but didn't take into consideration the
(possibly changed) max_data_len returned by the pre_write callback.

Fixes #30541

Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
2020-12-09 11:21:48 +02:00
Simen S. Røstad
adb8087707 net: mqtt: Return -1 if keepalive messages are disabled.
In mqtt_keepalive_time_left(), return -1 if keep alive messages are
disabled by setting CONFIG_MQTT_KEEPALIVE=0.

This allows to use mqtt_keepalive_time_left() directly as an input
for poll(). If no keep-alive is expected, -1 would indicate
that poll() can block until new data is available on the socket.

Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
2020-12-08 14:08:36 -05:00
Andy Ross
fcd392f6ce kernel: subsys: lib: drivers: Use k_heap instead of z_mem_pool wrappers
Use the core k_heap API pervasively within our tree instead of the
z_mem_pool wrapper that provided compatibility with the older mempool
implementation.

Almost all of this is straightforward swapping of one alloc/free call
for another.  In a few cases where code was holding onto an old-style
"mem_block" a local compatibility struct with a single field has been
swapped in to keep the invasiveness of the changes down.

Note that not all the relevant changes in this patch have in-tree test
coverage, though I validated that it all builds.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Andy Ross
ea7ffbde7d subsys/bluetooth: Add missing stdint.h include
This tiny header uses non-builtin types but includes no headers that
would define them.  Recent header motion seems to have exposed a case
where this file can get built before its dependencies are included.
Add the header directly.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Andy Ross
0c15627cc1 lib: Remove sys_mem_pool implementation
This has been replaced by sys_heap now and all dependencies are gone.
Remove.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Andy Ross
6965cf526d kernel: Deprecate k_mem_pool APIs
Mark all k_mem_pool APIs deprecated for future code.  Remaining
internal usage now uses equivalent "z_mem_pool" symbols instead.

Fixes #24358

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2020-12-07 21:50:14 -05:00
Vinayak Kariappa Chettimada
3f7b4d2877 Bluetooth: controller: Fix cond. compile of conn window offset calc
Fix missing conditional compilation of connection window
offset calculations.

Regression introduced in commit 467173a56646 ("Bluetooth:
controller: Fix incorrect initiator window offset").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-12-07 15:25:39 -05:00