Commit Graph

92 Commits

Author SHA1 Message Date
Henrik Brix Andersen 33708c6b3d modules: openthread: platform: logging: catch up on log2_generic rename
The log2_generic() function was renamed to log_generic().

Fixes: 2155a9e5f7

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-02-15 10:02:40 +01:00
Maciej Baczmanski 85bc24eb07 net: openthread: Add PSA implementation for PBDKF2 genkey
Add implementation of openthread pbkdf2 generate key using PSA
functions.

Co-authored-by: Joakim Andersson <joakim.andersson@nordicsemi.no>

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-26 11:03:42 +01:00
Maciej Baczmanski 0f1747e4e7 net: openthread: upmerge to `7761b81`
additionaly, implement `otPlatRadioResetCsl` functionality

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-26 10:48:02 +01:00
Maciej Baczmanski 36b7f44c1d drivers: ieee802154: fix handling of `struct ieee802154_config`
`struct ieee802154_config config` is a struct containing an
union. Members of `config` were accessed incorrectly in
`otPlatRadioEnableCsl`. Fix by initializing `config` with `0`
and accessing one member at a time.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-26 10:48:02 +01:00
Maciej Baczmanski d76bcd346c drivers: ieee802154: fix ACK header IE implementation
- In `set_vendor_ie_header_lm`, case when
`link_metrics_data_len == 0` has been ignored.
This commit fixes that by setting `header_ie->length = 0`
before returning.
- current implementation of enh ACK header IE returns
`-ENOTSUP` when `ack_ie.header_ie == NULL` or
`ack_ie.header_ie->length == 0`. This commit fixes that by
refactoring checks in `nrf5_configure`.

Co-authored-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-26 10:48:02 +01:00
Przemyslaw Bida a6184b9be3 net: openthread: Fix key import in case of ECDSA.
According to PSA specification in case of `PSA_KEY_TYPE_ECC_KEY_PAIR`
function `psa_import_key` takes private key from key pair as argument.
This commit adds extraction of Private key from ECDSA key pair.

Also removes not needed `otPlatCryptoEcdsaGetPublicKey`.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2024-01-23 10:02:17 +01:00
Eduardo Montoya 822e8d4cc4 net: openthread: remove unneded call to `otLinkMetricsInit`
Platforms calculate Link Metrics values internally after using
`otPlatRadioConfigureEnhAckProbing`.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2024-01-19 09:48:03 +01:00
Eduardo Montoya fe9e306a83 net: openthread: fix `otLinkMetricsInit` usage
Remove usage of `otPlatRadioGetReceiveSensitivity` without the
`otInstance` parameter.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2024-01-17 09:55:34 +01:00
Damian Krolik 7b42e36c68 net: openthread: Print the actual assert location
When OpenThread application is built with CONFIG_ASSERT
and CONFIG_ASSERT_NO_MSG_INFO, OT_ASSERT() prints a location
that points to the otPlatAssertFail() function instead of
the code that actually failed an assertion.

This is confusing and CONFIG_ASSERT_NO_MSG_INFO sometimes
cannot be disabled because of flash size limitations.

Make otPlatAssertFail() always print the actual assert
location.

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2024-01-15 09:58:48 +01:00
Damian Krolik 36b7a3e701 net: openthread: Remove PSA crypto backend workarounds
Remove two workarounds in OpenThread's PSA crypto backend
that were required when Zephyr used pre-1.5 TF-M version:
1. psa_open_key() is no longer needed to reference
   a persistent key
2. psa_cipher_encrypt() can be used to simplify AES
   encryption

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2024-01-12 11:26:41 -06:00
Przemyslaw Bida 0018204091 net: openthread: Add new key and algorithm in PSA.
This commit adds new types of keys and algorithm to crypto_psa backend
of openthread.

Added options:
- `OT_CRYPTO_KEY_TYPE_ECDSA`
- `OT_CRYPTO_KEY_ALG_ECDSA`
- `OT_CRYPTO_KEY_USAGE_VERIFY_HASH`

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2024-01-11 15:40:55 -06:00
Maciej Baczmanski f32e686511 net: openthread: implement `otPlatResetToBootloader`
This commit implements `otPlatResetToBootloader` in two ways:

- trigger reset to bootloader using boot mode retention API
- trigger reset to bootloader by triggering GPIO pin (applicable
for nRF52840 Dongle)

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-11 15:37:58 -06:00
Maciej Baczmanski d0283f9b15 net: openthread: add missing cmake option
Added `OT_PLATFORM_POWER_CALIBRATION` and set to always off
as in Zephyr power calibration is handled by Radio Driver.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-08 10:09:13 +01:00
Eduardo Montoya 5767998d4f drivers: ieee802154: nrf: make selective tx power the default
Remove `IEEE802154_SELECTIVE_TXPOWER` option.

Cache the tx power value in nRF5 driver and make use of it on each
operation.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2024-01-05 09:04:17 +01:00
Maciej Baczmanski 11613e08e7 net: openthread: increase TCAT stack size
Running TCAT with PSA crypto API  causes stack overflow.
Increased stack size.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-01-03 19:01:05 +00:00
Przemyslaw Bida b6d8d2715c net: openthread: Add cmake makro to openthread cmake lists.
This commit introduces `kconfig_to_ot_option` to simply fye the way of
adding openthread related kconfigs.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-12-18 12:25:12 +01:00
Jędrzej Ciupis 7afeb62e20 drivers: ieee802154: support Key Identifier Mode > 1
IEEE 802.15.4-2020 defines four possible values for Key Identifier Mode
field of the Auxiliary Security Header. The current ieee802154 driver
API only supports two of them: b00 and b01. This commit adds support for
the two remaining Key Identifier Mode values. It's done by replacing a
field that can only hold Key Index into a field that can holds a pointer
to the entire Key Identifier field.

See IEEE 802.15.4-2020, sections 9.4.2.3 and 9.4.4 for further reference.

Signed-off-by: Jędrzej Ciupis <jedrzej.ciupis@nordicsemi.no>
2023-12-13 13:57:24 +01:00
Przemyslaw Bida 304b98391c net: openthread: Add openthread TCAT implementation.
This commit adds bbtc implementation.
New file in modules/openthread/platform/ble.c
New corresponding kconfig option `OPENTHREAD_BLE_TCAT`.

Co-authored-by: Piotr Jasiński <piotr.jasinski@nordicsemi.no>

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
Signed-off-by: Piotr Jasiński <piotr.jasinski@nordicsemi.no>
2023-12-08 10:21:56 +00:00
Przemyslaw Bida 8f2b7a121b net: openthread: Openthread upmerge to `4ed44bc`
This commit bumps openthread commit to `4ed44bc`
and implements `CONFIG_OPENTHREAD_MULTIPAN_RCP` option.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-12-08 10:21:56 +00:00
Eduardo Montoya e504ab5217 net: openthread: add Link Metrics noise floor initialization
It was missing.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-11-30 10:05:14 +01:00
Maciej Baczmanski c2f1ff7f5f net: openthread: upmerge to `75694d2`
Regular OpenThread upmerge to commit `75694d2`.

Move CONFIG_OPENTHREAD_PLATFORM_KEY_REFERENCES_ENABLE
from header file to Kconfig.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2023-11-27 19:59:04 +01:00
Jamie McCrae ce3ba0dfd2 modules: openthread: platform: radio: Rename missed type
Fixes an issue whereby a rename of a variable type has been
forgotten in an instance, which now uses the correct type name

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-11-17 16:00:07 +01:00
Eduardo Montoya b406024148 net: openthread: implement `otPlatRadioSetRxOnWhenIdle`
OpenThread upmerge to commit `193e77e`.

Implement `otPlatRadioSetRxOnWhenIdle` radio platform API.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-11-15 09:59:17 +01:00
Grant Ramsay a3ff19a39e cmake: compiler: Add compiler property for no-builtin
Abstracts these flags for multiple toolchain support

Signed-off-by: Grant Ramsay <gramsay@enphaseenergy.com>
2023-11-13 10:21:41 +01:00
Eduardo Montoya 3508cd609c net: openthread: upmerge to `6edb06e`
Regular OpenThread upmerge to `6edb06e`.

Also add `OPENTHREAD_CSL_RECEIVER_LOCAL_TIME_SYNC` config.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-11-09 18:21:41 +01:00
Przemyslaw Bida 2a4350dfd2 net: openthread: Adding snoop entries kconfig.
Adding missing `CONFIG_OPENTHREAD_TMF_ADDRESS_CACHE_MAX_SNOOP_ENTRIES`
to thread kconfig file.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-11-08 10:08:58 +01:00
Eduardo Montoya 1d0dda794c net: pkt: remove redundant `net_pkt_cb_ieee802154` fields
Remove redundant `arb` and `fv2015` fields.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-11-03 11:44:40 +01:00
Przemyslaw Bida b2fec758b3 net: openthread: Fix dependency on openthread max ip addr.
Fixes discrepancy between FTD and MTD in amount of ipaddr in
`ChildUpdateRequest`.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-10-27 10:52:55 +02:00
Przemyslaw Bida cc85223ed4 net: openthread: Remove waiting for DTR in openthread UART.
Uart driver for openthread have been waiting for host to start
communicating with coprocessor, during booting of the Zephyr and
by that blocking start os OS. There is no longer a need for
that since the stack will be soft rebooted after host connects
to coprocessor, removing the need to wait on host communication.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-10-20 14:59:47 +02:00
Florian Grandel e9d5a98e9d drivers: ieee802154: improve CSL standard conformance
This change slightly simplifies the configuration of a CSL receiver and
generalized CSL_RX_TIME to EXPECTED_RX_TIME as a re-usable primitive
across several timing-sensitive IEEE 802.15.4 standard sub-protocols
(namely BE-PANs/DSME/CSL/RIT/TSCH).

This API change is based on the rules outlined in RFC #61227.

Fixes: #62918

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-20 14:58:32 +02:00
Florian Grandel 80da9ddfef drivers: ieee802154: improve ACK header IE config
Improves standard conformance of the IEEE802154_CONFIG_ENH_ACK_HEADER_IE
option and introduces certain "soft MAC" capabilities around header IEs:
 * Introduces types and helpers that allow driver maintainers to
   represent, parse, write and validate header IEs.
 * Introduces helper functions to access non-aligned fields in header
   IEs, namely element IDs.

Updates the only existing L2 and driver pair that uses
IEEE802154_CONFIG_ENH_ACK_HEADER_IE: OpenThread platform radio and nRF5
and improves header IE validation in the nRF5 driver.

This change should help further driver maintainers to support
OpenThread's CSL and vendor IE extensions. It is based on the rules
specified in RFC #61227.

It is also a precondition to generically support both, "soft MAC" and
"hard MAC", approaches to header IEs in the TSCH protocol, namely the
time synchronization IE.

Fixes: #62940

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-20 14:58:23 +02:00
Florian Grandel 62396443fc drivers: ieee802154: deprecate OT "sleep" nomenclature
"Sleeping" has a well defined meaning in Zephyr related to threading and
power management. This differs from OpenThread's definition:

- Deprecates the "SLEEP_TO_TX" capability as it is redundant and
  conflicts with all of Zephyr's nomenclature, #61227, RFC 2863, Thread
  standard and IEEE 802.15.4. This binds the API to an implementation
  detail of OpenThread, instead. See #63670 for the agreed migration path.

- Renames the "SLEEP" event to "RX_OFF" which conforms to the
  nomenclature in Zephyr, this API and IEEE 802.15.4.

Fixes: #62995

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-10-20 14:58:16 +02:00
Flavio Ceolin e7bd10ae71 random: Rename random header
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.

Rename it to random.h and get consistently with other
subsystems.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-10-10 14:23:50 +03:00
Florian Grandel 36402b6d2a net: pkt: time: introduce ns timestamp helper
A little refactoring that simplifies dealing with nanosecond timestamp
values in packets and further decouples calling code from PTP:

Benefits:
- simplifies calling code by removing redundant conversions.
- prepares for removing PTP dependencies from net_pkt.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-29 16:27:15 +02:00
Flavio Ceolin 5d505c7b28 random: Fix feature dependency usage
Code using sys_csrand_get should depend on CONFIG_CSPRNG_ENABLED symbol
and not in ENTROPY_HAS_DRIVER since they are not using the entropy
device directly.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2023-09-27 11:55:10 -05:00
Maciej Baczmanski d2495b14f2 modules: openthread: fix unused variable during `otPlatCryptoInit`
If asserts are disabled, there is a warning in 'otPlatCryptoInit'
regarding unused variable `err`. This commit fixes that.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2023-09-19 15:22:03 +01:00
Florian Grandel e2005b6e48 modules: openthread: radio: OT now uses standard TX timestamp
Synchronizes with the new upstream RX/TX timestamp definition in
OpenThread based on the standard's SFD.

This change is synchronized with the upstream OpenThread implementation
via west.yml.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-09-19 15:21:17 +01:00
Maciej Baczmanski be483d76d7 modules: openthread: initialize settings in `otPlatCryptoInit()`
In OpenThread, Settings are initialized after KeyManager by default.
If device uses PSA with emulated TFM, Settings have to be initialized
at the end of otPlatCryptoInit(), to be available before storing
Network Key.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2023-08-28 14:27:53 +02:00
Daniel Leung 50a20f7b62 openthread: rename shadow variables
Rename shadow variables found by -Wshadow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-22 11:39:58 +02:00
Florian Grandel 137a7edd6e drivers: ieee802154: nRF5: TX timestamp now refers to start of PHR
Based on the standard based definitions given in previous commits, the
TX timestamp used for timed TX now refers to the start of PHR. As OT
continues to calculate timestamps based on a "start of SHR" definition,
the duration of the PHY specific SHR is added in the OT adaptation layer
to make up for this OT quirk.

Fixes: #59245

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Florian Grandel 7db0184e1b drivers: ieee802154: nRF5: remove RX PHR offset workaround
Builds upon the newly introduced nrf_802154_phr_timestamp_get() function
to calculate RX timestamps according to the timestamp definitions
introduced in earlier commits and removes the prior workaround to
calculate the start-of-frame message timestamp point.

Fixes: #59245

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Florian Grandel eacec3dad2 modules: openthread: radio: encapsulate OT 32-bit timestamp
OT does not have 64 bit timestamp support. This is a limitation of OT
and not of the IEEE 802.15.4 driver API. Therefore any workaround
related to such OT idiosyncracies should be encapsulated inside the OT
adapatation layer.

This change moves the OT-specific conversion of OT 32 bit timestamps to
Zephyr 64 bit timestamps into the OT adaptation layer.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-08-16 17:06:16 +02:00
Arkadiusz Balys f16f1ae819 net: openthread: Initialize PSA crypto when random is initializing
The psa_generate_random function requires the psa_crypto_init call
before the usage. This can be ensured by calling the psa_crypto_init
in otPlatCryptoRandomInitfunction.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2023-08-01 08:23:52 +00:00
Florian Grandel a4cd5cee40 drivers: ieee802154: consistent high res timestamps
The IEEE 802.15.4 API and networking subsystem were using several
inconsistent timestamp resolutions and types. This change defines all
timestamps with nanosecond resolution and reduces the number of
available types to represent timestamps to two:
* `struct net_ptp_time` for PTP timestamps
* `net_time_t` for all other high resolution timestamps

All timestamps (including PTP timestamps) are now referred to a
"virtual" local network subsystem clock source based on the well-defined
types above. It is the responsibility of network subsystem L2/driver
implementations (notably Ethernet and IEEE 802.15.4 L2 stacks) to ensure
consistency of all timestamps and radio timer values exposed by the
driver API to such a network subsystem uptime reference clock
independent of internal implementation details.

The "virtual" network clock source may be implemented based on arbitrary
hardware peripherals (e.g. a coarse low power RTC counter during sleep
time plus a high resolution/high precision radio timer while receiving
or sending). Such implementation details must be hidden from API
clients, as if the driver used a single high resolution clock source
instead.

For IEEE 802.15.4, whenever timestamps refer to packet send or receive
times, they are measured when the end of the IEEE 802.15.4 SFD (message
timestamp point) is present at the local antenna (reference plane).

Due to its limited range of ~290 years, net_time_t timestamps (and
therefore net_pkt timestamps and times) must not be used to represent
absolute points in time referred to an external epoch independent of
system uptime (e.g.  UTC, TAI, PTP, NTP, ...).

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-28 09:06:35 +00:00
Przemyslaw Bida 96893e84ce net: openthread: Refactor openthread entropy `otPlatEntropyGet`.
This commit replaces direct entropy device driver class with
`sys_csrand_get`, which is recommended way of getting crypto
secure random buffer.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-07-17 13:22:16 +00:00
Przemyslaw Bida 54c991b8f2 net: openthread: regular openthread upmerge to `f7690fe`
Adding new kconfig option: CONFIG_OPENTHREAD_TX_QUEUE_STATISTICS

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-07-17 10:13:49 +00:00
Florian Grandel 4edf46d86c net: l2: ieee802154: radio: fix radio utils naming
The IEEE 802.15.4 stack defines radio API helpers that provide
simplified and encapsulated access to radio API features.

These helpers were missing the `_radio_` infix. This infix is introduced
to clearly distinguish between MAC and PHY concerns. While PHY features
may be shared between L2 implementations (including the functions
concerned here), this is not true for MAC features.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-07-10 09:29:10 +02:00
Eduardo Montoya 8e40304258 net: openthread: remove unneeded `OPENTHREAD_MAX_CHILDREN` default value
After https://github.com/openthread/openthread/pull/9213 there is no
need to reduce the `ChildMask` size for MTD builds.

Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
2023-07-07 10:15:24 +00:00
Przemyslaw Bida 8a78148e61 manifest: openthread: regular openthread upmerge `37fb770`
Implementation of new option:
`OPENTHREAD_OPERATIONAL_DATASET_AUTO_INIT`

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-07-07 09:18:25 +02:00
Przemyslaw Bida f940a5a988 manifest: openthread: Regular openthread upmerge to `6d55738`
Openthread upmerge to `6d55738`. Includes implementing of:
- `OPENTHREAD_CONFIG_RADIO_STATS_ENABLE`
- `OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE`

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-06-23 09:20:23 +02:00