Skip to content
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

[spinel] create spinel interface based on the radio url protocol #9393

Merged
merged 10 commits into from
Oct 10, 2023

Conversation

zhanglongxia
Copy link
Contributor

@zhanglongxia zhanglongxia commented Sep 1, 2023

The posix platform is able to support the HDLC, SPI and vendor spinel interfaces, but the spinel interface type can't be changed dynamically. It is inconvenient to use different spinel interfaces for Thread stack in Android. This commit enables the posix platform to support the HDLC, SPI and vendor interface at the same time, and the final spinel interface type is determined by the radio url protocol.

Some other changes:
<1> Not use CRTP style for the radio spinel.
<2> Deprecate the OT_POSIX_CONFIG_RCP_BUS and OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL.

@size-report
Copy link

size-report bot commented Sep 1, 2023

Size Report of OpenThread

Merging #9393 into main(786bd7f).

name branch text data bss total
ot-cli-ftd main 462856 760 66204 529820
#9393 462856 760 66204 529820
+/- 0 0 0 0
ot-ncp-ftd main 434164 760 61368 496292
#9393 434164 760 61368 496292
+/- 0 0 0 0
libopenthread-ftd.a main 232581 0 40166 272747
#9393 232581 0 40166 272747
+/- 0 0 0 0
libopenthread-cli-ftd.a main 55964 0 8051 64015
#9393 55964 0 8051 64015
+/- 0 0 0 0
libopenthread-ncp-ftd.a main 31497 0 5852 37349
#9393 31501 0 5852 37353
+/- +4 0 0 +4
ot-cli-mtd main 361336 760 51132 413228
#9393 361336 760 51132 413228
+/- 0 0 0 0
ot-ncp-mtd main 345028 760 46304 392092
#9393 345044 760 46304 392108
+/- +16 0 0 +16
libopenthread-mtd.a main 155030 0 25102 180132
#9393 155030 0 25102 180132
+/- 0 0 0 0
libopenthread-cli-mtd.a main 39029 0 8043 47072
#9393 39029 0 8043 47072
+/- 0 0 0 0
libopenthread-ncp-mtd.a main 24377 0 5852 30229
#9393 24381 0 5852 30233
+/- +4 0 0 +4
ot-cli-ftd-br main 529768 768 131076 661612
#9393 529768 768 131076 661612
+/- 0 0 0 0
libopenthread-ftd-br.a main 294492 5 105014 399511
#9393 294492 5 105014 399511
+/- 0 0 0 0
libopenthread-cli-ftd-br.a main 69165 0 8075 77240
#9393 69165 0 8075 77240
+/- 0 0 0 0
ot-rcp main 61880 564 20532 82976
#9393 61880 564 20532 82976
+/- 0 0 0 0
libopenthread-rcp.a main 9182 0 4988 14170
#9393 9186 0 4988 14174
+/- +4 0 0 +4
libopenthread-radio.a main 18528 0 206 18734
#9393 18528 0 206 18734
+/- 0 0 0 0

@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Merging #9393 (b4f5df7) into main (50e20c8) will decrease coverage by 0.15%.
Report is 5 commits behind head on main.
The diff coverage is 85.23%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9393      +/-   ##
==========================================
- Coverage   85.81%   85.66%   -0.15%     
==========================================
  Files         559      560       +1     
  Lines       73991    74037      +46     
==========================================
- Hits        63497    63427      -70     
- Misses      10494    10610     +116     
Files Coverage Δ
src/lib/hdlc/hdlc.cpp 96.80% <100.00%> (+0.13%) ⬆️
src/lib/spinel/radio_spinel.hpp 95.23% <100.00%> (-0.22%) ⬇️
src/lib/spinel/spinel_interface.hpp 80.00% <ø> (-20.00%) ⬇️
src/lib/url/url.cpp 96.77% <100.00%> (+0.26%) ⬆️
src/lib/url/url.hpp 100.00% <ø> (ø)
src/ncp/ncp_hdlc.cpp 83.15% <100.00%> (ø)
src/posix/platform/hdlc_interface.hpp 80.00% <100.00%> (+13.33%) ⬆️
src/posix/platform/radio.hpp 100.00% <100.00%> (ø)
src/posix/platform/radio_url.cpp 75.00% <100.00%> (+3.57%) ⬆️
src/posix/platform/trel.cpp 45.22% <ø> (-30.66%) ⬇️
... and 4 more

... and 43 files with indirect coverage changes

Copy link
Member

@abtink abtink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zhanglongxia. This is a great improvement.
Looks great overall. Some suggestions below:

src/lib/spinel/radio_spinel.cpp Outdated Show resolved Hide resolved
src/lib/spinel/radio_spinel.cpp Outdated Show resolved Hide resolved
src/lib/spinel/spinel_interface.hpp Show resolved Hide resolved
src/posix/platform/system.cpp Outdated Show resolved Hide resolved
script/check-posix-build-cmake Show resolved Hide resolved
src/posix/platform/openthread-posix-config.h Show resolved Hide resolved
@jwhui jwhui requested review from bukepo and abtink September 7, 2023 20:26
@zhanglongxia zhanglongxia requested review from abtink and removed request for abtink September 22, 2023 15:57
Copy link
Member

@abtink abtink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks for helping change this. The radio_spinel.cpp looks and reads much nicer. 👍

src/posix/platform/radio.hpp Outdated Show resolved Hide resolved
src/posix/platform/radio_url.cpp Outdated Show resolved Hide resolved
tests/scripts/expect/posix-ccathreshold.exp Outdated Show resolved Hide resolved
src/posix/platform/vendor_interface.hpp Outdated Show resolved Hide resolved
src/lib/spinel/radio_spinel.hpp Outdated Show resolved Hide resolved
The posix platform is able to support the HDLC, SPI and vendor
spinel interfaces, but the spinel interface type can't be changed
dynamically. It is inconvenient to use different spinel interfaces
for Thread stack in Android. This commit enables the posix platform
to support the HDLC, SPI and vendor interface at the same time, and
the final spinel interface type is determined by the radio url protocol.

Some other changes:
<1> Not use CRTP style for the radio spinel.
<2> Deprecate the OT_POSIX_CONFIG_RCP_BUS and OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL.
@zhanglongxia zhanglongxia force-pushed the spinel/dynamic-spinel-interface branch from 95b1208 to 05a0976 Compare October 9, 2023 03:31
@zhanglongxia zhanglongxia requested review from jwhui and removed request for jwhui October 10, 2023 02:45
src/lib/hdlc/hdlc.hpp Show resolved Hide resolved
src/posix/platform/radio.hpp Show resolved Hide resolved
@jwhui jwhui merged commit 7568e31 into openthread:main Oct 10, 2023
105 checks passed
@@ -61,6 +61,7 @@ set(COMMON_INCLUDES
)

set(COMMON_SOURCES
radio_spinel.cpp
Copy link
Contributor

@romacdon romacdon Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhanglongxia - I know this PR is already merged but I'm curious why we need this file to be included in NCP/RCP builds? From what I see this file should only need to be included in host side builds. Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file radio_spinel.cpp is renamed from the file radio_spinel_impl.hpp, and it was included by both the NCP and RCP builds before this commit is merged. That's the reason why I added the radio_spinel.cpp to the COMMON_SOURCES. Thanks for your notification, I think it is reasonable to remove the file radio_spinel.cpp from the lib openthread-spinel-ncp. I have submitted a commit #9530 to resolve this issue.

Copy link
Contributor

@romacdon romacdon Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhanglongxia thanks for the quick response and for opening the new PR. I did have one comment on the new PR which I added there. Also, you mention that radio_spinel_impl.hpp was included by both the NCP and RCP builds before this commit was merged, however, I don't see that. radio_spinel_impl.hpp is included by radio_spinel.hpp and I only see radio_spinel.hpp being included by the posix platform code.

wgtdkp pushed a commit to wgtdkp/openthread that referenced this pull request Nov 6, 2023
…nthread#9393)

The posix platform is able to support the HDLC, SPI and vendor spinel
interfaces, but the spinel interface type can't be changed
dynamically. It is inconvenient to use different spinel interfaces for
Thread stack in Android. This commit enables the posix platform to
support the HDLC, SPI and vendor interface at the same time, and the
final spinel interface type is determined by the radio url protocol.

Some other changes:
1. Not use CRTP style for the radio spinel.
2. Deprecate the OT_POSIX_CONFIG_RCP_BUS and
   OPENTHREAD_POSIX_CONFIG_RCP_TIME_SYNC_INTERVAL.

(cherry picked from commit 7568e31)
Change-Id: I56da30c92b11620d27c02e6adfda1da5965f23a7
wgtdkp pushed a commit to wgtdkp/openthread that referenced this pull request Nov 6, 2023
wgtdkp pushed a commit to wgtdkp/openthread that referenced this pull request Jan 16, 2024
…ol (openthread#9393)" into main am: ff54b9b

Original change: https://android-review.googlesource.com/c/platform/external/openthread/+/2784091

Change-Id: I2ec69c8ee059237bca26ca1d651e50597c0fc25c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
wgtdkp pushed a commit to wgtdkp/openthread that referenced this pull request Jan 16, 2024
…ol (openthread#9393)" into main am: ff54b9b am: ca79b7d

Original change: https://android-review.googlesource.com/c/platform/external/openthread/+/2784091

Change-Id: I3aa5de055277f4f550186c3e73cafae9dad0b58e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
wgtdkp pushed a commit to wgtdkp/openthread that referenced this pull request Jan 16, 2024
…ol (openthread#9393)" into main am: ff54b9b am: ca79b7d am: 89c203d

Original change: https://android-review.googlesource.com/c/platform/external/openthread/+/2784091

Change-Id: I5380a2822bd57ecaeddeb93beef90985cd2bb043
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
wgtdkp pushed a commit to wgtdkp/openthread that referenced this pull request Jan 16, 2024
…ol (openthread#9393)" into main am: ff54b9b am: ca79b7d am: 89c203d am: 36fe612

Original change: https://android-review.googlesource.com/c/platform/external/openthread/+/2784091

Change-Id: I25e09ca7721a23cd880173aaa2f7c8b3677b274b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants