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

[mle] implement alternate RLOC16 usage during role transition #10006

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abtink
Copy link
Member

@abtink abtink commented Apr 8, 2024

This commit introduces a mechanism for a device transitioning from child to router role to keep receiving frames addressed to its previous short address for a brief period.

A new radio platform API, otPlatRadioSetAlternateShortAddress(), is introduced. This allows the OT stack to configure an alternate short address. Radio platform support for this function is indicated by the OT_RADIO_CAPS_ALT_SHORT_ADDR capability in otPlatRadioGetCaps() The same function can be used with OT_RADIO_INVALID_SHORT_ADDR (0xfffe) to clear a previously set alternate short address. Support for the new API is implemented in RCP and RadioSpinel, ensuring backward compatibility by dynamically checking supported radio capabilities.

MLE code is updated to instruct the radio to use the old child RLOC16 as an alternate address upon role transition. The MLE layer will automatically clear the alternate address after eight seconds, or if other state/mode changes occur. This eight-second window ensures the new router can transmit four MLE Advertisement messages.


Rebased this PR on top of the commit from the following PR (used by the test).
- #10033

Copy link

size-report bot commented Apr 8, 2024

Size Report of OpenThread

Merging #10006 into main(3bf281d).

name branch text data bss total
ot-cli-ftd main 466840 856 66364 534060
#10006 467240 856 66364 534460
+/- +400 0 0 +400
ot-ncp-ftd main 435756 760 61576 498092
#10006 436180 760 61576 498516
+/- +424 0 0 +424
libopenthread-ftd.a main 235928 95 40310 276333
#10006 236306 95 40310 276711
+/- +378 0 0 +378
libopenthread-cli-ftd.a main 57522 0 8075 65597
#10006 57575 0 8075 65650
+/- +53 0 0 +53
libopenthread-ncp-ftd.a main 31863 0 5916 37779
#10006 31905 0 5916 37821
+/- +42 0 0 +42
ot-cli-mtd main 364488 760 51220 416468
#10006 364568 760 51220 416548
+/- +80 0 0 +80
ot-ncp-mtd main 347036 760 46448 394244
#10006 347164 760 46448 394372
+/- +128 0 0 +128
libopenthread-mtd.a main 157999 0 25182 183181
#10006 158089 0 25182 183271
+/- +90 0 0 +90
libopenthread-cli-mtd.a main 39753 0 8059 47812
#10006 39806 0 8059 47865
+/- +53 0 0 +53
libopenthread-ncp-mtd.a main 24743 0 5916 30659
#10006 24785 0 5916 30701
+/- +42 0 0 +42
ot-cli-ftd-br main 549944 864 131212 682020
#10006 550360 864 131212 682436
+/- +416 0 0 +416
libopenthread-ftd-br.a main 324242 100 105134 429476
#10006 324646 100 105134 429880
+/- +404 0 0 +404
libopenthread-cli-ftd-br.a main 71185 0 8099 79284
#10006 71238 0 8099 79337
+/- +53 0 0 +53
ot-rcp main 62248 564 20604 83416
#10006 62328 564 20604 83496
+/- +80 0 0 +80
libopenthread-rcp.a main 9542 0 5052 14594
#10006 9584 0 5052 14636
+/- +42 0 0 +42
libopenthread-radio.a main 18870 0 214 19084
#10006 18924 0 214 19138
+/- +54 0 0 +54

Copy link
Member

@LuDuda LuDuda left a comment

Choose a reason for hiding this comment

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

All looks good! 👍

How do you plan to test this feature?

include/openthread/platform/radio.h Outdated Show resolved Hide resolved
@abtink
Copy link
Member Author

abtink commented Apr 16, 2024

How do you plan to test this feature?

Thanks @LuDuda. I added a test that covers the basic behavior of this, i.e. the stack sets the "alt short address" after transition from child to router and after the timeout removes it.

@abtink abtink force-pushed the mle/alt-short-addr branch 2 times, most recently from 31024a4 to a6e7b78 Compare April 16, 2024 21:54
This commit introduces a mechanism for a device transitioning from
child to router role to keep receiving frames addressed to its
previous short address for a brief period.

A new radio platform API, `otPlatRadioSetAlternateShortAddress()`, is
introduced. This allows the OT stack to configure an alternate short
address. Radio platform support for this function is indicated by the
`OT_RADIO_CAPS_ALT_SHORT_ADDR` capability in `otPlatRadioGetCaps()`
The same function can be used with `OT_RADIO_INVALID_SHORT_ADDR`
(`0xfffe`) to clear a previously set alternate short address. Support
for the new API is implemented in RCP and `RadioSpinel`, ensuring
backward compatibility by dynamically checking supported radio
capabilities.

MLE code is updated to instruct the radio to use the old child RLOC16
as an alternate address upon role transition. The MLE layer will
automatically clear the alternate address after eight seconds, or if
other state/mode changes occur. This eight-second window ensures the
new router can transmit four MLE Advertisement messages.
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

2 participants