Skip to content

Openthread separate L2 configs #2792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ArekBalysNordic
Copy link
Contributor

Please see commit messages.

Do not review while it is in draft.

@ArekBalysNordic ArekBalysNordic changed the title Openthread separate l2 cp Openthread separate L2 configs Apr 18, 2025
@ArekBalysNordic ArekBalysNordic force-pushed the openthread_separate_l2_cp branch 6 times, most recently from e258eaf to a98cb40 Compare April 30, 2025 09:00
@ArekBalysNordic ArekBalysNordic force-pushed the openthread_separate_l2_cp branch from a98cb40 to 164efb6 Compare May 9, 2025 10:20
@adigie adigie force-pushed the openthread_separate_l2_cp branch 2 times, most recently from bd8dcac to 711cb9e Compare May 19, 2025 13:48
@adigie adigie force-pushed the openthread_separate_l2_cp branch from ae584be to 7272dea Compare May 27, 2025 08:48
ArekBalysNordic and others added 4 commits May 27, 2025 12:58
… modules

Move OpenThread-related code from
zephyr/subsys/net/l2/openthread/openthread.c to
zephyr/modules/openthread/platform/openthread.c.

The primary goal of this refactor is to enable the use
of OpenThread as an independent module, without the necessity
of Zephyr's networking layer.

This change is particularly beneficial for simple applications
that have their own implementation of the IEEE802.15.4 driver
and do not require a networking layer. These applications can
now disable Zephyr's L2 and IEEE802.15.4 shim layers and
directly use the OpenThread module, saving valuable kilobytes
of memory.

In this approach if the CONFIG_NET_L2_OPENTHREAD
Kconfig option is set, Zephyr's L2 and IEEE802.15.4 layers
will be used, and everything will function as before.
The main difference is the Zephyr's L2 layer now uses
the OpenThread module, no longer implementing it.

While most of the functions in include/net/openthread.h
have been deprecated, they are still available for use to
maintain backwards compatibility.

Signed-off-by: Arkadiusz Balys <[email protected]>
(cherry picked from commit 596844a)
…n POST_KERNEL

The new CONFIG_OPENTHREAD_SYS_INIT Kconfig option allows OpenThread
to be automatically initialised during the Zephyr POST_KERNEL
initialisation stage.

If Zephyr's L2 layer OpenThread implementation is enabled, the
IEEE802.15.4 shim layer initialises OpenThread in the POST_KERNEL
phase. However, since Openthread may work without Zephyr's L2
layer, in this case, no object can initialise it automatically.
This new Kconfig option may help start OpenThread automatically
if the L2 Layer is disabled.

Signed-off-by: Arkadiusz Balys <[email protected]>
(cherry picked from commit 9a5f4b9)
… platform

Stop using L2 log level in OpenThread platform files.

Signed-off-by: Arkadiusz Balys <[email protected]>
(cherry picked from commit ca40f41)
…_addr

When both CONFIG_NET_IPV6_DAD and CONFIG_NET_IPV4_ACD are disabled, the
anonymous union in struct net_if_addr ends up with no members, which
results in a different struct layout between C and C++.

In C, an empty union has size 0, while in C++ it has size >=1, which
shifts the offsets of the following fields.

Add a 1-byte dummy member to the union to ensure consistent layout
across both compilers.

Signed-off-by: Adrian Gielniewski <[email protected]>
(cherry picked from commit 4d8ffcc)
Signed-off-by: Adrian Gielniewski <[email protected]>
@adigie adigie force-pushed the openthread_separate_l2_cp branch 4 times, most recently from 8fa1b75 to c6b24db Compare May 30, 2025 08:17
adigie added 3 commits May 30, 2025 10:35
* Add header with public API of OpenThread module.
* Add module include directory to Zephyr include directories.
* Use new header in platform implementation.

Signed-off-by: Adrian Gielniewski <[email protected]>
(cherry picked from commit 201d928)
Signed-off-by: Adrian Gielniewski <[email protected]>
… header

Use OpenThread module header instead of redefining its API.

Signed-off-by: Adrian Gielniewski <[email protected]>
(cherry picked from commit 47f39a1)
Signed-off-by: Adrian Gielniewski <[email protected]>
Add openthread module header to INPUT due to dependencies to symbols in
`zephyr/net/openthread.h`

Signed-off-by: Adrian Gielniewski <[email protected]>
(cherry picked from commit 73faf5c)
Signed-off-by: Adrian Gielniewski <[email protected]>
…r functions

Add new Kconfig options to enable platform-specific features in
OpenThread:

- CONFIG_OPENTHREAD_PLATFORM_PKT_TXTIME enables support for packet TX
time when CONFIG_NET_PKT_TXTIME is selected.
- CONFIG_OPENTHREAD_PLATFORM_CARRIER_FUNCTIONS enables modulated and
continuous carrier functions when CONFIG_OPENTHREAD_DIAG and
CONFIG_IEEE802154_CARRIER_FUNCTIONS are enabled.

Update preprocessor conditionals to use the new options instead of
relying directly on CONFIG_NET_PKT_TXTIME and
CONFIG_IEEE802154_CARRIER_FUNCTIONS.

This change improves configurability and allows to reuse the platform
implementation when not using Zephyr networking.

Signed-off-by: Adrian Gielniewski <[email protected]>
(cherry picked from commit e04f679)
Signed-off-by: Adrian Gielniewski <[email protected]>
@adigie adigie force-pushed the openthread_separate_l2_cp branch from 0087a08 to 58cb7bb Compare May 30, 2025 14:39
…twork.

If CONFIG_OPENTHREAD_SYS_INIT is enabled, OpenThread initialisation
should also consider running OpenThread automatically if
CONFIG_OPENTHREAD_MANUAL_START is disabled.

Removed also dependency on the `net_bytes_from_str` functions from
the openthread.h file. Now, in the OpenThread module, there is an
additional `openthread_utils.c/.h` file that can implement useful
utilities for the OpenThread platform. Currently, it implements
the `bytes_from_str` function to use it instead of
`net_bytes_from_str`.

Upstream PR #: 90861

Signed-off-by: Arkadiusz Balys <[email protected]>
Copy link

sonarqubecloud bot commented Jun 2, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants