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

[netdata-publisher] optimize route prefixes #8901

Closed
wants to merge 1 commit into from

Conversation

abtink
Copy link
Member

@abtink abtink commented Mar 24, 2023

This commit adds a new mechanism in NetworkData::Publisher to optimize published route prefixes.

If three or more route prefixes (excluding NAT64 prefixes) share a common sub-prefix of length 7, they are marked as optimized and replaced with the compact sub-prefix. For example, three or more ULA prefixes will be replaced with the fc00::/7 route prefix. If the number of prefixes drops below three, the compact prefix is removed and the original prefixes are again published. The compact prefix is added using the highest preference level among all prefixes that it replaces.

OPENTHREAD_CONFIG_NETDATA_PUBLISHER_OPTIMIZE_ROUTES enables this feature and is enabled by default.

This commit also adds CompactFlag in HasRouteEntry flags. This flag is used to indicate that a route prefix is compact.

test-020-network-data-publisher-compact-routes.py is added testing the behavior of the new feature. In particular, when many route prefixes are published together or separately and we go over or below the threshold of 3 prefixes. Also the case where the compact prefix itself happens to be a published route is validated.


This is related to SPEC-1130.

This commit adds a new mechanism in `NetworkData::Publisher` to
optimize published route prefixes.

If three or more route prefixes (excluding NAT64 prefixes) share a
common sub-prefix of length 7, they are marked as optimized and
replaced with the compact sub-prefix. For example, three or more ULA
prefixes will be replaced with the `fc00::/7` route prefix. If the
number of prefixes drops below three, the compact prefix is removed
and the original prefixes are again published. The compact prefix is
added using the highest preference level among all prefixes that it
replaces.

`OPENTHREAD_CONFIG_NETDATA_PUBLISHER_OPTIMIZE_ROUTES` enables this
feature and is enabled by default.

This commit also adds `CompactFlag` in `HasRouteEntry` flags. This flag
is used to indicate that a route prefix is compact.

`test-020-network-data-publisher-compact-routes.py` is added testing
the behavior of the new feature. In particular, when many route
prefixes are published together or separately and we go over or below
the threshold of 3 prefixes. Also the case where the compact prefix
itself happens to be a published route is validated.
@size-report
Copy link

size-report bot commented Mar 24, 2023

Size Report of OpenThread

Merging #8901 into main(e8f3ec0).

name branch text data bss total
ot-cli-ftd_1.1 main 472800 776 63964 537540
#8901 473688 776 63996 538460
+/- +888 0 +32 +920
ot-cli-mtd_1.1 main 391600 776 54004 446380
#8901 392440 776 54036 447252
+/- +840 0 +32 +872
ot-ncp-ftd_1.1 main 445532 776 59184 505492
#8901 445580 776 59216 505572
+/- +48 0 +32 +80
ot-ncp-mtd_1.1 main 368476 776 49232 418484
#8901 368508 776 49264 418548
+/- +32 0 +32 +64
ot-rcp_1.1 main 60204 564 19964 80732
#8901 60204 564 19964 80732
+/- 0 0 0 0
libopenthread-cli-ftd.a_1.1 main 54076 0 8003 62079
#8901 54090 0 8003 62093
+/- +14 0 0 +14
libopenthread-cli-mtd.a_1.1 main 45191 0 7995 53186
#8901 45205 0 7995 53200
+/- +14 0 0 +14
libopenthread-ftd.a_1.1 main 245201 20 38518 283739
#8901 246045 20 38550 284615
+/- +844 0 +32 +876
libopenthread-mtd.a_1.1 main 179599 20 28566 208185
#8901 180401 20 28598 209019
+/- +802 0 +32 +834
libopenthread-ncp-ftd.a_1.1 main 31699 0 5852 37551
#8901 31699 0 5852 37551
+/- 0 0 0 0
libopenthread-ncp-mtd.a_1.1 main 26541 0 5852 32393
#8901 26541 0 5852 32393
+/- 0 0 0 0
libopenthread-rcp.a_1.1 main 9028 0 4988 14016
#8901 9028 0 4988 14016
+/- 0 0 0 0
libopenthread-radio.a_1.1 main 18057 0 174 18231
#8901 18057 0 174 18231
+/- 0 0 0 0
ot-cli-ftd_1.3 main 495016 776 73444 569236
#8901 495864 776 73476 570116
+/- +848 0 +32 +880
ot-cli-mtd_1.3 main 406656 776 55228 462660
#8901 407520 776 55260 463556
+/- +864 0 +32 +896
ot-ncp-ftd_1.3 main 466636 776 68656 536068
#8901 466668 776 68688 536132
+/- +32 0 +32 +64
ot-ncp-mtd_1.3 main 382036 776 50448 433260
#8901 382084 776 50480 433340
+/- +48 0 +32 +80
ot-rcp_1.3 main 62564 564 20532 83660
#8901 62564 564 20532 83660
+/- 0 0 0 0
libopenthread-cli-ftd.a_1.3 main 56977 0 8003 64980
#8901 56991 0 8003 64994
+/- +14 0 0 +14
libopenthread-cli-mtd.a_1.3 main 47493 0 7995 55488
#8901 47507 0 7995 55502
+/- +14 0 0 +14
libopenthread-ftd.a_1.3 main 263494 20 47454 310968
#8901 264318 20 47486 311824
+/- +824 0 +32 +856
libopenthread-mtd.a_1.3 main 191112 20 29246 220378
#8901 191952 20 29278 221250
+/- +840 0 +32 +872
libopenthread-ncp-ftd.a_1.3 main 33537 0 5852 39389
#8901 33537 0 5852 39389
+/- 0 0 0 0
libopenthread-ncp-mtd.a_1.3 main 27907 0 5852 33759
#8901 27907 0 5852 33759
+/- 0 0 0 0
libopenthread-rcp.a_1.3 main 9194 0 4988 14182
#8901 9194 0 4988 14182
+/- 0 0 0 0
libopenthread-radio.a_1.3 main 18950 0 206 19156
#8901 18950 0 206 19156
+/- 0 0 0 0

@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Merging #8901 (6f2702e) into main (a43484e) will decrease coverage by 0.10%.
The diff coverage is 92.47%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8901      +/-   ##
==========================================
- Coverage   82.55%   82.46%   -0.10%     
==========================================
  Files         536      535       -1     
  Lines       73260    73169      -91     
==========================================
- Hits        60482    60336     -146     
- Misses      12778    12833      +55     
Impacted Files Coverage Δ
src/core/thread/network_data_tlvs.hpp 100.00% <ø> (ø)
src/core/thread/network_data_types.hpp 100.00% <ø> (ø)
tests/unit/test_routing_manager.cpp 100.00% <ø> (ø)
src/cli/cli_network_data.cpp 75.93% <66.66%> (-0.12%) ⬇️
src/core/thread/network_data_publisher.cpp 90.27% <92.30%> (+0.33%) ⬆️
src/core/border_router/routing_manager.cpp 87.17% <100.00%> (-0.09%) ⬇️
src/core/thread/network_data_publisher.hpp 83.72% <100.00%> (+2.14%) ⬆️
src/core/thread/network_data_types.cpp 93.54% <100.00%> (+1.12%) ⬆️

... and 51 files with indirect coverage changes

@abtink
Copy link
Member Author

abtink commented Apr 8, 2023

Closing this PR as discussion in SPEC-1130 moves to a different approach.

@abtink abtink closed this Apr 8, 2023
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

1 participant