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>
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>
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>
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>
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>
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>
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>
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>
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>
This commit bumps openthread commit to `4ed44bc`
and implements `CONFIG_OPENTHREAD_MULTIPAN_RCP` option.
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
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>
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>
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>
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>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The method ieee802154_radio_handle_ack() does not belong to the
PHY/radio layer but to the L2 layer. It is a callback called from the
radio layer into the L2 layer and to be implemented by all L2 stacks.
This is the same pattern as is used for ieee802154_init(). The
'_radio_' infix in this function is therefore confusing and
conceptually wrong.
This change fixes the naming inconsistency and extensively documents
its rationale.
It is assumed that the change can be made without prior deprecation of the
existing method as in the rare cases where users have implemented custom
radio drivers these will break in obvious ways and can easily be fixed.
Nevertheless such a rename would not be justified on its own if it were
not for an important conceptual reason:
The renamed function represents a generic "inversion-of-control" pattern
which will become important in the TSCH context: It allows for clean
separation of concerns between the PHY/radio driver layer and the
MAC/L2 layer even in situations where the radio driver needs to be
involved for performance or deterministic timing reasons. This
"inversion-of-control" pattern can be applied to negotiate timing
sensitive reception and transmission windows, it let's the L2 layer
deterministically timestamp information elements just-in-time with
internal radio timer counter values, etc.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The RSSI value in net_pkt (net_pkt_cb_ieee802154.rssi) was used
inconsistently across drivers. Some drivers did cast a signed dBm value
directly to net_pkt's unsigned byte value. Others were assigning the
negative value of the signed dBm value and again others were offsetting
and stretching the signed dBm value linearly onto the full unsigned byte
range.
This change standardizes net_pkt's rssi attribute to represent RSSI on
the RX path as an unsigned integer ranging from 0 (–174 dBm) to 254 (80
dBm) and lets 255 represent an "unknown RSSI" (IEEE 802.15.4-2020,
section 6.16.2.8). On the TX path the rssi attribute will always be
zero. Out-of-range values will be truncated to max/min values.
The change also introduces conversion functions to and from signed dBm
values and introduces these consistently to all existing call sites. The
"unknown RSSI" value is represented as INT16_MIN in this case.
In some cases drivers had to be changed to calculate dBm values from
internal hardware specific representations.
The conversion functions are fully covered by unit tests.
Fixes: #58494
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The IEEE802154_2015 option is misleading, as it does not introduce full
802.15.4-2015 standard compliance but only random bits, plus it's
defined at the radio driver level, which brings yet another confusion.
Because of that, the option will be deprecated, and respective parts of
code that made use of it converted to use more specific configurations:
* nRF driver will now use CONFIG_NRF_802154_ENCRYPTION to specify
whether to compile in TX security
* net_pkt will only add extra 802.15.4 control block fields if
OpenThread is used, as they were solely used by this L2
* OpenThread radio layer will now use the OpenThread version to
determine whether to compile in TX security.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
nRF52 in case of USB CDC required `CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n`
Due to incorrect error check in `otPlatUartEnable`.
Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>