Commit Graph

105 Commits

Author SHA1 Message Date
Maciej Baczmanski 23ba68a45d kconfig: openthread: Add 1.4 version
This commit adds thread 1.4 version.

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-08-13 14:56:30 +02:00
Przemyslaw Bida bd05d0032c net: openthread: Clean not used defines in OT platform.
Remove unused `DEVICE_NAME` from OT `ble.c`.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2024-08-09 17:58:24 +01:00
Rubin Gerritsen a4e43d013c Bluetooth: Samples: Use string printing functions for error codes
When developing Bluetooth applications, you typically run into some errors.
If you are an experienced Bluetooth developer, you would typically know
how to translate the error codes into string representations.
Others might not.

This commit to adds string printing of error codes for all
samples to make them more user-friendly.

Several formatting alternatives were considered. The chosen alternative
balances code readability and FLASH size (with and without string
printing).

Example output from the peripheral_hids sample when the
peer rejects pairing:

```
Bluetooth initialized
Bluetooth authentication callbacks registered.
Advertising successfully started
Connected 5E:67:02:D3:1C:DB (random)
Security failed: 5E:67:02:D3:1C:DB (random) \
level 1 err 6 BT_SECURITY_ERR_PAIR_NOT_ALLOWED
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason 0x13 BT_HCI_ERR_REMOTE_USER_TERM_CONN
```

Other alternatives that were considered:

- Use of parantheses:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err BT_SECURITY_ERR_PAIR_NOT_ALLOWED(6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
BT_HCI_ERR_REMOTE_USER_TERM_CONN(0x13)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err (6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason (0x13)
```

- Spaces and parantheses:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err BT_SECURITY_ERR_PAIR_NOT_ALLOWED (6)
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason BT_HCI_ERR_REMOTE_USER_TERM_CONN (0x13)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err  (6)
Disconnected from 5E:67:02:D3:1C:DB (random), reason  (0x13)
```

- Parantheses around everything:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err (BT_SECURITY_ERR_PAIR_NOT_ALLOWED(6))
Disconnected from 5E:67:02:D3:1C:DB (random), \
reason (BT_HCI_ERR_REMOTE_USER_TERM_CONN(0x13))
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err ((6))
Disconnected from 5E:67:02:D3:1C:DB (random), reason ((0x13))
```

- Error code first, then string representation:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err 6 (BT_SECURITY_ERR_PAIR_NOT_ALLOWED)
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
0x13 (BT_HCI_ERR_REMOTE_USER_TERM_CONN)
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err 6 ()
Disconnected from 5E:67:02:D3:1C:DB (random), reason 0x13 ()
```

- Apostrophes around error printing:
```
// strings enabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 \
err "BT_SECURITY_ERR_PAIR_NOT_ALLOWED (6)"
Disconnected from 5E:67:02:D3:1C:DB (random), reason \
"BT_HCI_ERR_REMOTE_USER_TERM_CONN (0x13)"
// strings disabled
Security failed: 5E:67:02:D3:1C:DB (random) level 1 err " (6)"
Disconnected from 5E:67:02:D3:1C:DB (random), reason " (0x13)"
```

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-07-31 12:56:11 +02:00
Maciej Baczmanski 040a942a63 manifest: net: openthread: Regular openthread upmerge to `e10a925`.
Regular openthread upmerge to `e10a92570f94ff1e0bc5e0da9ecf0ee135d955a6`.

Additionally commit aligns platform implementation with diag changes:
https://github.com/openthread/openthread/pull/10354

based on:
https://github.com/openthread/ot-nrf528xx/pull/822

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-07-30 18:27:15 +01:00
Marcin Gasiorek 313a92baf9 net: openthread: Set CIDR for NAT64
Implementation of functionality whitch configure CIDR for OT NAT64.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-07-28 07:29:50 +03:00
Marcin Gasiorek ac0a9d79ab net: openthread: Add NAT64 send and receive callbacks.
Packets are routed between OT and Zephyr net stacks.
For IPv4 these packets are managed by NAT64 by default.

Signed-off-by: Marcin Gasiorek <marcin.gasiorek@nordicsemi.no>
2024-07-28 07:29:50 +03:00
Pieter De Gendt ad63ca284e kconfig: replace known integer constants with variables
Make the intent of the value clear and avoid invalid ranges with typos.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-07-27 20:49:15 +03:00
Konrad Derda ec0d6ab885 net: l2: openthread: set multicast loop by default
When multicast packet is forwarded to the OpenThread stack it has to
have its "multicast loop" flag enabled to be processed by the stack
itself instead of only propagating it further.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-07-27 10:46:38 +03:00
Przemyslaw Bida 7dc830e9db net: openthread: Add new kconfig OT options.
Adding:
	- `OPENTHREAD_BORDER_AGENT_EPHEMERAL_KEY_ENABLE`
	- `OPENTHREAD_CHANNEL_MANAGER_CSL`
	- `OPENTHREAD_PLATFORM_LOG_CRASH_DUMP`
	- `OPENTHREAD_MULTICAST_DNS`
	- `OPENTHREAD_VERHOEFF_CHECKSUM`

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2024-06-11 10:05:04 +02:00
Przemyslaw Bida 4c34e95904 net: openthread: Add implementation of TCAT advertisement.
Adds implementation of tcat advertisement API.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2024-06-11 10:05:04 +02:00
Damian Krolik 42d928ee93 drivers: ieee802154: fix configuring CSL IE in ACK
The code was assigning a pointer to a scoped buffer to
an object outside that scope. This would cause the driver
would receive garbage instead of a well-formatted IE and
would likely reject the IE. This in turn caused CSL IE
not being included in enhanced ACKs (verified with
wireshark).

Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
2024-04-03 13:57:50 +03:00
Dave Lacerte 379ac5e394 modules: openthread: platform: radio: Time Sync OT Feature support
Add missing otRadioIeInfo structure and add plaform time to transmit frame

Signed-off-by: Dave Lacerte <lacerte.dave@hydroquebec.com>
2024-03-28 16:05:21 -05:00
Maciej Baczmanski ba2a8bd795 manifest: openthread: Regular openthread upmerge
Adds `CONFIG_OPENTHREAD_SRP_ADV_PROXY` option

Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
2024-03-11 15:21:46 +00:00
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