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

Fix fabric index management in the fabric table. #16587

Merged

Conversation

bzbarsky-apple
Copy link
Contributor

Before this change, the fabric index for a fabric table entry had to match its offset in the table. Therefore we only used indices up to CHIP_CONFIG_MAX_FABRICS and then looped back around to index 1.

Furthermore, we did not use to persist our mNextAvailableFabricIndex,
so after a restart would start assigning fabric indices that
corresponded to deleted fabrics, instead of not-yet-used ones, even if
we had not yet exceeded CHIP_CONFIG_MAX_FABRICS total commissioning
events.

This change decouples the fabric index from the table offset. We now
store the list of fabric indices used and the fabric index we should
use for the next time a fabric is added.

Problem

See above.

Change overview

See above.

Testing

Manually set CHIP_CONFIG_MAX_FABRICS to 2 on the server and kMaxValidFabricIndex to 5 and verified that we correctly error out when trying to add a third fabric and that repeatedly removing and adding a fabric cycles the fabric index being assigned up to 5, then back to the beginning, instead of cutting off at 2.

@github-actions
Copy link

github-actions bot commented Mar 23, 2022

PR #16587: Size comparison from 395bb1f to 890fff2

Increases above 0.2%:

platform target config section 395bb1f 890fff2 change % change
linux bridge-app debug+rpc (read only) 1753317 1757237 3920 0.2
.text 1493525 1497349 3824 0.3
door-lock-app debug (read only) 2005073 2009105 4032 0.2
.text 1674402 1678306 3904 0.2
lighting-app debug+rpc .text 1844514 1848338 3824 0.2
ota-provider-app debug (read only) 1946473 1950441 3968 0.2
.text 1627746 1631618 3872 0.2
ota-requestor-app debug .text 1657650 1661458 3808 0.2
Increases (25 builds for cyw30739, efr32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 395bb1f 890fff2 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603470 604318 848 0.1
.app_xip_area 510560 511408 848 0.2
lock cyw930739m2evb_01 (read/write) 561266 562098 832 0.1
.app_xip_area 469884 470716 832 0.2
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 573350 574190 840 0.1
.app_xip_area 472320 473160 840 0.2
efr32 lighting-app BRD4161A (read only) 922876 924420 1544 0.2
.text 922868 924412 1544 0.2
BRD4161A+rpc (read only) 951692 953236 1544 0.2
.text 951684 953228 1544 0.2
window-app BRD4161A (read only) 852656 854200 1544 0.2
.text 852648 854192 1544 0.2
k32w light k32w061+release (read/write) 701644 702468 824 0.1
.text 616320 617144 824 0.1
lock k32w061+release (read/write) 701080 701904 824 0.1
.text 615740 616564 824 0.1
linux all-clusters-app debug (read only) 2478273 2482193 3920 0.2
.rodata 211941 212037 96 0.0
.text 2102834 2106658 3824 0.2
bridge-app debug+rpc (read only) 1753317 1757237 3920 0.2
.rodata 144556 144652 96 0.1
.text 1493525 1497349 3824 0.3
chip-tool debug (read only) 10187517 10192029 4512 0.0
.rodata 520725 520821 96 0.0
.text 8883509 8887925 4416 0.0
chip-tool-ipv6only arm64 (read only) 9807276 9810388 3112 0.0
(read/write) 473313 473377 64 0.0
.data.rel.ro 372000 372024 24 0.0
.got 55696 55736 40 0.1
.rodata 496036 496108 72 0.0
.text 8258340 8261236 2896 0.0
door-lock-app debug (read only) 2005073 2009105 4032 0.2
.rodata 180988 181116 128 0.1
.text 1674402 1678306 3904 0.2
lighting-app debug+rpc (read only) 2178721 2182673 3952 0.2
.rodata 175164 175292 128 0.1
.text 1844514 1848338 3824 0.2
ota-provider-app debug (read only) 1946473 1950441 3968 0.2
.rodata 166987 167083 96 0.1
.text 1627746 1631618 3872 0.2
ota-requestor-app debug (read only) 1973281 1977185 3904 0.2
.rodata 162980 163076 96 0.1
.text 1657650 1661458 3808 0.2
shell debug (read only) 2427617 2431569 3952 0.2
.rodata 209362 209490 128 0.1
.text 2061506 2065330 3824 0.2
thermostat-no-ble arm64 (read only) 2262660 2265148 2488 0.1
.rodata 139780 139804 24 0.0
.text 1899536 1902000 2464 0.1
tv-app debug (read only) 2679201 2683089 3888 0.1
.rodata 207157 207221 64 0.0
.text 2297170 2300994 3824 0.2
mbed lock-app CY8CPROTO_062_4343W+release (read/write) 2353636 2354476 840 0.0
.text 1316236 1317076 840 0.1
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1139459 1140279 820 0.1
rodata 141588 141592 4 0.0
text 780508 781320 812 0.1
p6 all-clusters-app default (read/write) 2493592 2495200 1608 0.1
.text 1451856 1453464 1608 0.1
light-app default (read/write) 2396760 2398368 1608 0.1
.text 1355024 1356632 1608 0.1
lock-app default (read/write) 2360296 2361904 1608 0.1
.text 1318560 1320168 1608 0.1
telink lighting-app tlsr9518adk80d (read/write) 896954 897698 744 0.1
text 634296 635026 730 0.1
Full report (25 builds for cyw30739, efr32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 395bb1f 890fff2 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603470 604318 848 0.1
.app_xip_area 510560 511408 848 0.2
.bss 75656 75656 0 0.0
.data 604 604 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 561266 562098 832 0.1
.app_xip_area 469884 470716 832 0.2
.bss 74160 74160 0 0.0
.data 568 568 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 573350 574190 840 0.1
.app_xip_area 472320 473160 840 0.2
.bss 83488 83488 0 0.0
.data 508 508 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 922876 924420 1544 0.2
(read/write) 128756 128756 0 0.0
.bss 126760 126760 0 0.0
.data 1996 1996 0 0.0
.text 922868 924412 1544 0.2
BRD4161A+rpc (read only) 951692 953236 1544 0.2
(read/write) 144712 144712 0 0.0
.bss 142536 142536 0 0.0
.data 2176 2176 0 0.0
.text 951684 953228 1544 0.2
window-app BRD4161A (read only) 852656 854200 1544 0.2
(read/write) 126728 126728 0 0.0
.bss 124856 124856 0 0.0
.data 1872 1872 0 0.0
.text 852648 854192 1544 0.2
k32w light k32w061+release (read/write) 701644 702468 824 0.1
.bss 77648 77648 0 0.0
.data 1876 1876 0 0.0
.text 616320 617144 824 0.1
lock k32w061+release (read/write) 701080 701904 824 0.1
.bss 77624 77624 0 0.0
.data 1916 1916 0 0.0
.text 615740 616564 824 0.1
linux all-clusters-app debug (read only) 2478273 2482193 3920 0.2
(read/write) 143216 143216 0 0.0
.bss 57312 57312 0 0.0
.data 1280 1280 0 0.0
.data.rel.ro 78904 78904 0 0.0
.dynamic 592 592 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 211941 212037 96 0.0
.text 2102834 2106658 3824 0.2
bridge-app debug+rpc (read only) 1753317 1757237 3920 0.2
(read/write) 89456 89456 0 0.0
.bss 44456 44456 0 0.0
.data 1984 1984 0 0.0
.data.rel.ro 37944 37944 0 0.0
.dynamic 592 592 0 0.0
.got 3920 3920 0 0.0
.init 27 27 0 0.0
.init_array 544 544 0 0.0
.rodata 144556 144652 96 0.1
.text 1493525 1497349 3824 0.3
chip-tool debug (read only) 10187517 10192029 4512 0.0
(read/write) 355136 355136 0 0.0
.bss 22400 22400 0 0.0
.data 1072 1072 0 0.0
.data.rel.ro 325560 325560 0 0.0
.dynamic 608 608 0 0.0
.got 4816 4816 0 0.0
.init 27 27 0 0.0
.init_array 632 632 0 0.0
.rodata 520725 520821 96 0.0
.text 8883509 8887925 4416 0.0
chip-tool-ipv6only arm64 (read only) 9807276 9810388 3112 0.0
(read/write) 473313 473377 64 0.0
.bss 40673 40673 0 0.0
.data 1144 1144 0 0.0
.data.rel.ro 372000 372024 24 0.0
.dynamic 560 560 0 0.0
.got 55696 55736 40 0.1
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 496036 496108 72 0.0
.text 8258340 8261236 2896 0.0
door-lock-app debug (read only) 2005073 2009105 4032 0.2
(read/write) 116832 116832 0 0.0
.bss 47584 47584 0 0.0
.data 992 992 0 0.0
.data.rel.ro 62856 62856 0 0.0
.dynamic 592 592 0 0.0
.got 4120 4120 0 0.0
.init 27 27 0 0.0
.init_array 664 664 0 0.0
.rodata 180988 181116 128 0.1
.text 1674402 1678306 3904 0.2
lighting-app debug+rpc (read only) 2178721 2182673 3952 0.2
(read/write) 123792 123792 0 0.0
.bss 48864 48864 0 0.0
.data 1472 1472 0 0.0
.data.rel.ro 67928 67928 0 0.0
.dynamic 608 608 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 744 744 0 0.0
.rodata 175164 175292 128 0.1
.text 1844514 1848338 3824 0.2
ota-provider-app debug (read only) 1946473 1950441 3968 0.2
(read/write) 112560 112560 0 0.0
.bss 47456 47456 0 0.0
.data 1256 1256 0 0.0
.data.rel.ro 58200 58200 0 0.0
.dynamic 608 608 0 0.0
.got 4376 4376 0 0.0
.init 27 27 0 0.0
.init_array 616 616 0 0.0
.rodata 166987 167083 96 0.1
.text 1627746 1631618 3872 0.2
ota-requestor-app debug (read only) 1973281 1977185 3904 0.2
(read/write) 115816 115816 0 0.0
.bss 48448 48448 0 0.0
.data 1480 1480 0 0.0
.data.rel.ro 60424 60424 0 0.0
.dynamic 592 592 0 0.0
.got 4184 4184 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 162980 163076 96 0.1
.text 1657650 1661458 3808 0.2
shell debug (read only) 2427617 2431569 3952 0.2
(read/write) 147272 147272 0 0.0
.bss 67240 67240 0 0.0
.data 800 800 0 0.0
.data.rel.ro 73536 73536 0 0.0
.dynamic 592 592 0 0.0
.got 4152 4152 0 0.0
.init 27 27 0 0.0
.init_array 920 920 0 0.0
.rodata 209362 209490 128 0.1
.text 2061506 2065330 3824 0.2
thermostat-no-ble arm64 (read only) 2262660 2265148 2488 0.1
(read/write) 148289 148289 0 0.0
.bss 62753 62753 0 0.0
.data 1040 1040 0 0.0
.data.rel.ro 77000 77000 0 0.0
.dynamic 560 560 0 0.0
.got 4480 4480 0 0.0
.init 24 24 0 0.0
.init_array 360 360 0 0.0
.rodata 139780 139804 24 0.0
.text 1899536 1902000 2464 0.1
tv-app debug (read only) 2679201 2683089 3888 0.1
(read/write) 247776 247776 0 0.0
.bss 164416 164416 0 0.0
.data 3136 3136 0 0.0
.data.rel.ro 74168 74168 0 0.0
.dynamic 592 592 0 0.0
.got 4552 4552 0 0.0
.init 27 27 0 0.0
.init_array 888 888 0 0.0
.rodata 207157 207221 64 0.0
.text 2297170 2300994 3824 0.2
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2353636 2354476 840 0.0
.bss 184652 184652 0 0.0
.data 5760 5760 0 0.0
.text 1316236 1317076 840 0.1
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1139459 1140279 820 0.1
bss 142588 142588 0 0.0
rodata 141588 141592 4 0.0
text 780508 781320 812 0.1
p6 all-clusters-app default (read/write) 2493592 2495200 1608 0.1
.bss 118072 118072 0 0.0
.data 2640 2640 0 0.0
.text 1451856 1453464 1608 0.1
light-app default (read/write) 2396760 2398368 1608 0.1
.bss 111544 111544 0 0.0
.data 2496 2496 0 0.0
.text 1355024 1356632 1608 0.1
lock-app default (read/write) 2360296 2361904 1608 0.1
.bss 111288 111288 0 0.0
.data 2456 2456 0 0.0
.text 1318560 1320168 1608 0.1
telink lighting-app tlsr9518adk80d (read/write) 896954 897698 744 0.1
bss 87444 87444 0 0.0
noinit 37160 37160 0 0.0
text 634296 635026 730 0.1

@github-actions
Copy link

github-actions bot commented Mar 23, 2022

PR #16587: Size comparison from 395bb1f to 52bfb96

Increases above 0.2%:

platform target config section 395bb1f 52bfb96 change % change
linux bridge-app debug+rpc (read only) 1753317 1756885 3568 0.2
.text 1493525 1497349 3824 0.3
door-lock-app debug .text 1674402 1678402 4000 0.2
lighting-app debug+rpc .text 1844514 1848354 3840 0.2
ota-provider-app debug .text 1627746 1631634 3888 0.2
ota-requestor-app debug .text 1657650 1661474 3824 0.2
Increases (27 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 395bb1f 52bfb96 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603470 604182 712 0.1
.app_xip_area 510560 511272 712 0.1
lock cyw930739m2evb_01 (read/write) 561266 561970 704 0.1
.app_xip_area 469884 470588 704 0.1
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 573350 574062 712 0.1
.app_xip_area 472320 473032 712 0.2
efr32 lighting-app BRD4161A (read only) 922876 924436 1560 0.2
.text 922868 924428 1560 0.2
BRD4161A+rpc (read only) 951692 953244 1552 0.2
.text 951684 953236 1552 0.2
window-app BRD4161A (read only) 852656 854240 1584 0.2
.text 852648 854232 1584 0.2
esp32 all-clusters-app c3devkit (read only) 964154 964906 752 0.1
(read/write) 1393730 1393850 120 0.0
.dram0.data 14196 14204 8 0.1
.flash.rodata 198536 198656 120 0.1
.flash.text 964154 964906 752 0.1
m5stack (read only) 1020691 1021527 836 0.1
(read/write) 461500 461628 128 0.0
.flash.rodata 228040 228168 128 0.1
.flash.text 1015307 1016143 836 0.1
k32w light k32w061+release (read/write) 701644 702340 696 0.1
.text 616320 617016 696 0.1
lock k32w061+release (read/write) 701080 701776 696 0.1
.text 615740 616436 696 0.1
linux all-clusters-app debug (read only) 2478273 2482113 3840 0.2
.text 2102834 2106770 3936 0.2
bridge-app debug+rpc (read only) 1753317 1756885 3568 0.2
.text 1493525 1497349 3824 0.3
chip-tool debug (read only) 10187517 1019132 3808 0.0
.text 8883509 8887637 4128 0.0
chip-tool-ipv6only arm64 (read only) 9807276 9809892 2616 0.0
(read/write) 473313 473361 48 0.0
.got 55696 55744 48 0.1
.text 8258340 8261060 2720 0.0
door-lock-app debug (read only) 2005073 2009073 4000 0.2
.rodata 180988 181084 96 0.1
.text 1674402 1678402 4000 0.2
lighting-app debug+rpc (read only) 2178721 2182369 3648 0.2
.text 1844514 1848354 3840 0.2
ota-provider-app debug (read only) 1946473 1950073 3600 0.2
.text 1627746 1631634 3888 0.2
ota-requestor-app debug (read only) 1973281 1976817 3536 0.2
.text 1657650 1661474 3824 0.2
shell debug (read only) 2427617 2431505 3888 0.2
.rodata 209362 209426 64 0.0
.text 2061506 2065426 3920 0.2
thermostat-no-ble arm64 (read only) 2262660 2265252 2592 0.1
.text 1899536 1902400 2864 0.2
tv-app debug (read only) 2679201 2682753 3552 0.1
.text 2297170 2301010 3840 0.2
mbed lock-app CY8CPROTO_062_4343W+release (read/write) 2353636 2354268 632 0.0
.text 1316236 1316868 632 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1139459 1140119 660 0.1
text 780508 781240 732 0.1
p6 all-clusters-app default (read/write) 2493592 2495440 1848 0.1
.text 1451856 1453704 1848 0.1
light-app default (read/write) 2396760 2398392 1632 0.1
.text 1355024 1356656 1632 0.1
lock-app default (read/write) 2360296 2361928 1632 0.1
.text 1318560 1320192 1632 0.1
telink lighting-app tlsr9518adk80d (read/write) 896954 897570 616 0.1
text 634296 634984 688 0.1
Decreases (12 builds for linux, nrfconnect)
platform target config section 395bb1f 52bfb96 change % change
linux all-clusters-app debug (read/write) 143216 143184 -32 -0.0
.data.rel.ro 78904 78872 -32 -0.0
bridge-app debug+rpc (read/write) 89456 89424 -32 -0.0
.data.rel.ro 37944 37912 -32 -0.1
.rodata 144556 144396 -160 -0.1
chip-tool debug (read/write) 355136 355072 -64 -0.0
.data.rel.ro 325560 325496 -64 -0.0
.rodata 520725 520501 -224 -0.0
chip-tool-ipv6only arm64 .data.rel.ro 372000 371992 -8 -0.0
.rodata 496036 495852 -184 -0.0
door-lock-app debug (read/write) 116832 116800 -32 -0.0
.data.rel.ro 62856 62824 -32 -0.1
lighting-app debug+rpc (read/write) 123792 123760 -32 -0.0
.data.rel.ro 67928 67896 -32 -0.0
.rodata 175164 175068 -96 -0.1
ota-provider-app debug (read/write) 112560 112528 -32 -0.0
.data.rel.ro 58200 58168 -32 -0.1
.rodata 166987 166795 -192 -0.1
ota-requestor-app debug (read/write) 115816 115784 -32 -0.0
.data.rel.ro 60424 60392 -32 -0.1
.rodata 162980 162788 -192 -0.1
shell debug (read/write) 147272 147240 -32 -0.0
.data.rel.ro 73536 73504 -32 -0.0
thermostat-no-ble arm64 (read/write) 148289 148257 -32 -0.0
.data.rel.ro 77000 76968 -32 -0.0
.rodata 139780 139604 -176 -0.1
tv-app debug (read/write) 247776 247712 -64 -0.0
.data.rel.ro 74168 74104 -64 -0.1
.rodata 207157 206965 -192 -0.1
nrfconnect all-clusters-app nrf52840dk_nrf52840 rodata 141588 141512 -76 -0.1
Full report (27 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 395bb1f 52bfb96 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603470 604182 712 0.1
.app_xip_area 510560 511272 712 0.1
.bss 75656 75656 0 0.0
.data 604 604 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 561266 561970 704 0.1
.app_xip_area 469884 470588 704 0.1
.bss 74160 74160 0 0.0
.data 568 568 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 573350 574062 712 0.1
.app_xip_area 472320 473032 712 0.2
.bss 83488 83488 0 0.0
.data 508 508 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 922876 924436 1560 0.2
(read/write) 128756 128756 0 0.0
.bss 126760 126760 0 0.0
.data 1996 1996 0 0.0
.text 922868 924428 1560 0.2
BRD4161A+rpc (read only) 951692 953244 1552 0.2
(read/write) 144712 144712 0 0.0
.bss 142536 142536 0 0.0
.data 2176 2176 0 0.0
.text 951684 953236 1552 0.2
window-app BRD4161A (read only) 852656 854240 1584 0.2
(read/write) 126728 126728 0 0.0
.bss 124856 124856 0 0.0
.data 1872 1872 0 0.0
.text 852648 854232 1584 0.2
esp32 all-clusters-app c3devkit (read only) 964154 964906 752 0.1
(read/write) 1393730 1393850 120 0.0
.dram0.bss 62072 62072 0 0.0
.dram0.data 14196 14204 8 0.1
.flash.rodata 198536 198656 120 0.1
.flash.text 964154 964906 752 0.1
.iram0.text 62016 62016 0 0.0
m5stack (read only) 1020691 1021527 836 0.1
(read/write) 461500 461628 128 0.0
.dram0.bss 67600 67600 0 0.0
.dram0.data 34024 34024 0 0.0
.flash.rodata 228040 228168 128 0.1
.flash.text 1015307 1016143 836 0.1
.iram0.text 123107 123107 0 0.0
k32w light k32w061+release (read/write) 701644 702340 696 0.1
.bss 77648 77648 0 0.0
.data 1876 1876 0 0.0
.text 616320 617016 696 0.1
lock k32w061+release (read/write) 701080 701776 696 0.1
.bss 77624 77624 0 0.0
.data 1916 1916 0 0.0
.text 615740 616436 696 0.1
linux all-clusters-app debug (read only) 2478273 2482113 3840 0.2
(read/write) 143216 143184 -32 -0.0
.bss 57312 57312 0 0.0
.data 1280 1280 0 0.0
.data.rel.ro 78904 78872 -32 -0.0
.dynamic 592 592 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 211941 211941 0 0.0
.text 2102834 2106770 3936 0.2
bridge-app debug+rpc (read only) 1753317 1756885 3568 0.2
(read/write) 89456 89424 -32 -0.0
.bss 44456 44456 0 0.0
.data 1984 1984 0 0.0
.data.rel.ro 37944 37912 -32 -0.1
.dynamic 592 592 0 0.0
.got 3920 3920 0 0.0
.init 27 27 0 0.0
.init_array 544 544 0 0.0
.rodata 144556 144396 -160 -0.1
.text 1493525 1497349 3824 0.3
chip-tool debug (read only) 10187517 1019132 3808 0.0
(read/write) 355136 355072 -64 -0.0
.bss 22400 22400 0 0.0
.data 1072 1072 0 0.0
.data.rel.ro 325560 325496 -64 -0.0
.dynamic 608 608 0 0.0
.got 4816 4816 0 0.0
.init 27 27 0 0.0
.init_array 632 632 0 0.0
.rodata 520725 520501 -224 -0.0
.text 8883509 8887637 4128 0.0
chip-tool-ipv6only arm64 (read only) 9807276 9809892 2616 0.0
(read/write) 473313 473361 48 0.0
.bss 40673 40673 0 0.0
.data 1144 1144 0 0.0
.data.rel.ro 372000 371992 -8 -0.0
.dynamic 560 560 0 0.0
.got 55696 55744 48 0.1
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 496036 495852 -184 -0.0
.text 8258340 8261060 2720 0.0
door-lock-app debug (read only) 2005073 2009073 4000 0.2
(read/write) 116832 116800 -32 -0.0
.bss 47584 47584 0 0.0
.data 992 992 0 0.0
.data.rel.ro 62856 62824 -32 -0.1
.dynamic 592 592 0 0.0
.got 4120 4120 0 0.0
.init 27 27 0 0.0
.init_array 664 664 0 0.0
.rodata 180988 181084 96 0.1
.text 1674402 1678402 4000 0.2
lighting-app debug+rpc (read only) 2178721 2182369 3648 0.2
(read/write) 123792 123760 -32 -0.0
.bss 48864 48864 0 0.0
.data 1472 1472 0 0.0
.data.rel.ro 67928 67896 -32 -0.0
.dynamic 608 608 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 744 744 0 0.0
.rodata 175164 175068 -96 -0.1
.text 1844514 1848354 3840 0.2
ota-provider-app debug (read only) 1946473 1950073 3600 0.2
(read/write) 112560 112528 -32 -0.0
.bss 47456 47456 0 0.0
.data 1256 1256 0 0.0
.data.rel.ro 58200 58168 -32 -0.1
.dynamic 608 608 0 0.0
.got 4376 4376 0 0.0
.init 27 27 0 0.0
.init_array 616 616 0 0.0
.rodata 166987 166795 -192 -0.1
.text 1627746 1631634 3888 0.2
ota-requestor-app debug (read only) 1973281 1976817 3536 0.2
(read/write) 115816 115784 -32 -0.0
.bss 48448 48448 0 0.0
.data 1480 1480 0 0.0
.data.rel.ro 60424 60392 -32 -0.1
.dynamic 592 592 0 0.0
.got 4184 4184 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 162980 162788 -192 -0.1
.text 1657650 1661474 3824 0.2
shell debug (read only) 2427617 2431505 3888 0.2
(read/write) 147272 147240 -32 -0.0
.bss 67240 67240 0 0.0
.data 800 800 0 0.0
.data.rel.ro 73536 73504 -32 -0.0
.dynamic 592 592 0 0.0
.got 4152 4152 0 0.0
.init 27 27 0 0.0
.init_array 920 920 0 0.0
.rodata 209362 209426 64 0.0
.text 2061506 2065426 3920 0.2
thermostat-no-ble arm64 (read only) 2262660 2265252 2592 0.1
(read/write) 148289 148257 -32 -0.0
.bss 62753 62753 0 0.0
.data 1040 1040 0 0.0
.data.rel.ro 77000 76968 -32 -0.0
.dynamic 560 560 0 0.0
.got 4480 4480 0 0.0
.init 24 24 0 0.0
.init_array 360 360 0 0.0
.rodata 139780 139604 -176 -0.1
.text 1899536 1902400 2864 0.2
tv-app debug (read only) 2679201 2682753 3552 0.1
(read/write) 247776 247712 -64 -0.0
.bss 164416 164416 0 0.0
.data 3136 3136 0 0.0
.data.rel.ro 74168 74104 -64 -0.1
.dynamic 592 592 0 0.0
.got 4552 4552 0 0.0
.init 27 27 0 0.0
.init_array 888 888 0 0.0
.rodata 207157 206965 -192 -0.1
.text 2297170 2301010 3840 0.2
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2353636 2354268 632 0.0
.bss 184652 184652 0 0.0
.data 5760 5760 0 0.0
.text 1316236 1316868 632 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1139459 1140119 660 0.1
bss 142588 142588 0 0.0
rodata 141588 141512 -76 -0.1
text 780508 781240 732 0.1
p6 all-clusters-app default (read/write) 2493592 2495440 1848 0.1
.bss 118072 118072 0 0.0
.data 2640 2640 0 0.0
.text 1451856 1453704 1848 0.1
light-app default (read/write) 2396760 2398392 1632 0.1
.bss 111544 111544 0 0.0
.data 2496 2496 0 0.0
.text 1355024 1356656 1632 0.1
lock-app default (read/write) 2360296 2361928 1632 0.1
.bss 111288 111288 0 0.0
.data 2456 2456 0 0.0
.text 1318560 1320192 1632 0.1
telink lighting-app tlsr9518adk80d (read/write) 896954 897570 616 0.1
bss 87444 87444 0 0.0
noinit 37160 37160 0 0.0
text 634296 634984 688 0.1

Before this change, the fabric index for a fabric table entry had to match its offset in the table.  Therefore we only used indices up to CHIP_CONFIG_MAX_FABRICS and then looped back around to index 1.

Furthermore, we did not use to persist our mNextAvailableFabricIndex,
so after a restart would start assigning fabric indices that
corresponded to deleted fabrics, instead of not-yet-used ones, even if
we had not yet exceeded CHIP_CONFIG_MAX_FABRICS total commissioning
events.

This change decouples the fabric index from the table offset.  We now
store the list of fabric indices used and the fabric index we should
use for the next time a fabric is added.
@github-actions
Copy link

github-actions bot commented Mar 24, 2022

PR #16587: Size comparison from 6c3f648 to 6e1b915

Increases above 0.2%:

platform target config section 6c3f648 6e1b915 change % change
linux bridge-app debug+rpc (read only) 1755461 1759285 3824 0.2
.text 1495925 1499653 3728 0.2
door-lock-app debug .text 1676706 1680530 3824 0.2
lighting-app debug+rpc .text 1847250 1850994 3744 0.2
ota-provider-app debug .text 1629954 1633746 3792 0.2
ota-requestor-app debug .text 1659858 1663602 3744 0.2
Increases (27 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 6c3f648 6e1b915 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603562 604418 856 0.1
.app_xip_area 510732 511588 856 0.2
lock cyw930739m2evb_01 (read/write) 561350 562206 856 0.2
.app_xip_area 470048 470904 856 0.2
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 573426 574282 856 0.1
.app_xip_area 472476 473332 856 0.2
efr32 lighting-app BRD4161A (read only) 923432 924992 1560 0.2
.text 923424 924984 1560 0.2
BRD4161A+rpc (read only) 952240 953816 1576 0.2
.text 952232 953808 1576 0.2
window-app BRD4161A (read only) 853220 854780 1560 0.2
.text 853212 854772 1560 0.2
esp32 all-clusters-app c3devkit (read only) 964804 965524 720 0.1
(read/write) 1394194 1394202 8 0.0
.flash.rodata 199064 199072 8 0.0
.flash.text 964804 965524 720 0.1
m5stack (read only) 1021107 1021983 876 0.1
(read/write) 461940 461948 8 0.0
.flash.rodata 228560 228568 8 0.0
.flash.text 1015723 1016599 876 0.1
k32w light k32w061+release (read/write) 701704 702560 856 0.1
.text 616460 617316 856 0.1
lock k32w061+release (read/write) 701156 702012 856 0.1
.text 615896 616752 856 0.1
linux all-clusters-app debug (read only) 2483153 2487025 3872 0.2
.rodata 212229 212357 128 0.1
.text 2107202 2110946 3744 0.2
bridge-app debug+rpc (read only) 1755461 1759285 3824 0.2
.rodata 144300 144396 96 0.1
.text 1495925 1499653 3728 0.2
chip-tool debug (read only) 10206533 10210965 4432 0.0
.rodata 518101 518197 96 0.0
.text 8903925 8908261 4336 0.0
chip-tool-ipv6only arm64 (read only) 9825308 9828564 3256 0.0
(read/write) 473793 473857 64 0.0
.data.rel.ro 372664 372688 24 0.0
.got 55416 55456 40 0.1
.rodata 493732 493804 72 0.0
.text 8278148 8281188 3040 0.0
door-lock-app debug (read only) 2007345 2011297 3952 0.2
.rodata 180956 181084 128 0.1
.text 1676706 1680530 3824 0.2
lighting-app debug+rpc (read only) 2181289 2185161 3872 0.2
.rodata 174972 175100 128 0.1
.text 1847250 1850994 3744 0.2
ota-provider-app debug (read only) 1948393 1952281 3888 0.2
.rodata 166699 166795 96 0.1
.text 1629954 1633746 3792 0.2
ota-requestor-app debug (read only) 1975201 1979041 3840 0.2
.rodata 162692 162788 96 0.1
.text 1659858 1663602 3744 0.2
shell debug (read only) 2431945 2435817 3872 0.2
.rodata 209682 209810 128 0.1
.text 2065394 2069138 3744 0.2
thermostat-no-ble arm64 (read only) 2266140 2268804 2664 0.1
.rodata 139708 139748 40 0.0
.text 1903024 1905648 2624 0.1
tv-app debug (read only) 2681737 2685545 3808 0.1
.rodata 206933 206997 64 0.0
.text 2299906 2303650 3744 0.2
mbed lock-app CY8CPROTO_062_4343W+release (read/write) 2353772 2354612 840 0.0
.text 1316372 1317212 840 0.1
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1140039 1140875 836 0.1
rodata 141912 141916 4 0.0
text 780764 781592 828 0.1
p6 all-clusters-app default (read/write) 2494984 2496624 1640 0.1
.text 1453248 1454888 1640 0.1
light-app default (read/write) 2397360 2399000 1640 0.1
.text 1355624 1357264 1640 0.1
lock-app default (read/write) 2360888 2362528 1640 0.1
.text 1319152 1320792 1640 0.1
telink lighting-app tlsr9518adk80d (read/write) 896606 897390 784 0.1
text 633984 634756 772 0.1
Full report (27 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 6c3f648 6e1b915 change % change
cyw30739 light cyw930739m2evb_01 (read/write) 603562 604418 856 0.1
.app_xip_area 510732 511588 856 0.2
.bss 75576 75576 0 0.0
.data 604 604 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 561350 562206 856 0.2
.app_xip_area 470048 470904 856 0.2
.bss 74080 74080 0 0.0
.data 568 568 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 573426 574282 856 0.1
.app_xip_area 472476 473332 856 0.2
.bss 83408 83408 0 0.0
.data 508 508 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 923432 924992 1560 0.2
(read/write) 128680 128680 0 0.0
.bss 126680 126680 0 0.0
.data 1996 1996 0 0.0
.text 923424 924984 1560 0.2
BRD4161A+rpc (read only) 952240 953816 1576 0.2
(read/write) 144632 144632 0 0.0
.bss 142456 142456 0 0.0
.data 2176 2176 0 0.0
.text 952232 953808 1576 0.2
window-app BRD4161A (read only) 853220 854780 1560 0.2
(read/write) 126648 126648 0 0.0
.bss 124776 124776 0 0.0
.data 1872 1872 0 0.0
.text 853212 854772 1560 0.2
esp32 all-clusters-app c3devkit (read only) 964804 965524 720 0.1
(read/write) 1394194 1394202 8 0.0
.dram0.bss 61992 61992 0 0.0
.dram0.data 14212 14212 0 0.0
.flash.rodata 199064 199072 8 0.0
.flash.text 964804 965524 720 0.1
.iram0.text 62016 62016 0 0.0
m5stack (read only) 1021107 1021983 876 0.1
(read/write) 461940 461948 8 0.0
.dram0.bss 67520 67520 0 0.0
.dram0.data 34024 34024 0 0.0
.flash.rodata 228560 228568 8 0.0
.flash.text 1015723 1016599 876 0.1
.iram0.text 123107 123107 0 0.0
k32w light k32w061+release (read/write) 701704 702560 856 0.1
.bss 77568 77568 0 0.0
.data 1876 1876 0 0.0
.text 616460 617316 856 0.1
lock k32w061+release (read/write) 701156 702012 856 0.1
.bss 77544 77544 0 0.0
.data 1916 1916 0 0.0
.text 615896 616752 856 0.1
linux all-clusters-app debug (read only) 2483153 2487025 3872 0.2
(read/write) 143344 143344 0 0.0
.bss 57408 57408 0 0.0
.data 1280 1280 0 0.0
.data.rel.ro 78920 78920 0 0.0
.dynamic 592 592 0 0.0
.got 4176 4176 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 212229 212357 128 0.1
.text 2107202 2110946 3744 0.2
bridge-app debug+rpc (read only) 1755461 1759285 3824 0.2
(read/write) 89552 89552 0 0.0
.bss 44552 44552 0 0.0
.data 1984 1984 0 0.0
.data.rel.ro 37936 37936 0 0.0
.dynamic 592 592 0 0.0
.got 3920 3920 0 0.0
.init 27 27 0 0.0
.init_array 544 544 0 0.0
.rodata 144300 144396 96 0.1
.text 1495925 1499653 3728 0.2
chip-tool debug (read only) 10206533 10210965 4432 0.0
(read/write) 355712 355712 0 0.0
.bss 22496 22496 0 0.0
.data 1072 1072 0 0.0
.data.rel.ro 326056 326056 0 0.0
.dynamic 608 608 0 0.0
.got 4816 4816 0 0.0
.init 27 27 0 0.0
.init_array 632 632 0 0.0
.rodata 518101 518197 96 0.0
.text 8903925 8908261 4336 0.0
chip-tool-ipv6only arm64 (read only) 9825308 9828564 3256 0.0
(read/write) 473793 473857 64 0.0
.bss 40769 40769 0 0.0
.data 1144 1144 0 0.0
.data.rel.ro 372664 372688 24 0.0
.dynamic 560 560 0 0.0
.got 55416 55456 40 0.1
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 493732 493804 72 0.0
.text 8278148 8281188 3040 0.0
door-lock-app debug (read only) 2007345 2011297 3952 0.2
(read/write) 116896 116896 0 0.0
.bss 47680 47680 0 0.0
.data 992 992 0 0.0
.data.rel.ro 62840 62840 0 0.0
.dynamic 592 592 0 0.0
.got 4120 4120 0 0.0
.init 27 27 0 0.0
.init_array 664 664 0 0.0
.rodata 180956 181084 128 0.1
.text 1676706 1680530 3824 0.2
lighting-app debug+rpc (read only) 2181289 2185161 3872 0.2
(read/write) 123888 123888 0 0.0
.bss 48960 48960 0 0.0
.data 1472 1472 0 0.0
.data.rel.ro 67928 67928 0 0.0
.dynamic 608 608 0 0.0
.got 4168 4168 0 0.0
.init 27 27 0 0.0
.init_array 744 744 0 0.0
.rodata 174972 175100 128 0.1
.text 1847250 1850994 3744 0.2
ota-provider-app debug (read only) 1948393 1952281 3888 0.2
(read/write) 112624 112624 0 0.0
.bss 47552 47552 0 0.0
.data 1256 1256 0 0.0
.data.rel.ro 58184 58184 0 0.0
.dynamic 608 608 0 0.0
.got 4376 4376 0 0.0
.init 27 27 0 0.0
.init_array 616 616 0 0.0
.rodata 166699 166795 96 0.1
.text 1629954 1633746 3792 0.2
ota-requestor-app debug (read only) 1975201 1979041 3840 0.2
(read/write) 115880 115880 0 0.0
.bss 48544 48544 0 0.0
.data 1480 1480 0 0.0
.data.rel.ro 60408 60408 0 0.0
.dynamic 592 592 0 0.0
.got 4184 4184 0 0.0
.init 27 27 0 0.0
.init_array 640 640 0 0.0
.rodata 162692 162788 96 0.1
.text 1659858 1663602 3744 0.2
shell debug (read only) 2431945 2435817 3872 0.2
(read/write) 147400 147400 0 0.0
.bss 67336 67336 0 0.0
.data 800 800 0 0.0
.data.rel.ro 73568 73568 0 0.0
.dynamic 592 592 0 0.0
.got 4152 4152 0 0.0
.init 27 27 0 0.0
.init_array 920 920 0 0.0
.rodata 209682 209810 128 0.1
.text 2065394 2069138 3744 0.2
thermostat-no-ble arm64 (read only) 2266140 2268804 2664 0.1
(read/write) 148385 148385 0 0.0
.bss 62833 62833 0 0.0
.data 1040 1040 0 0.0
.data.rel.ro 77000 77000 0 0.0
.dynamic 560 560 0 0.0
.got 4504 4504 0 0.0
.init 24 24 0 0.0
.init_array 360 360 0 0.0
.rodata 139708 139748 40 0.0
.text 1903024 1905648 2624 0.1
tv-app debug (read only) 2681737 2685545 3808 0.1
(read/write) 247872 247872 0 0.0
.bss 164512 164512 0 0.0
.data 3136 3136 0 0.0
.data.rel.ro 74160 74160 0 0.0
.dynamic 592 592 0 0.0
.got 4552 4552 0 0.0
.init 27 27 0 0.0
.init_array 888 888 0 0.0
.rodata 206933 206997 64 0.0
.text 2299906 2303650 3744 0.2
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2353772 2354612 840 0.0
.bss 184572 184572 0 0.0
.data 5760 5760 0 0.0
.text 1316372 1317212 840 0.1
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1140039 1140875 836 0.1
bss 142512 142512 0 0.0
rodata 141912 141916 4 0.0
text 780764 781592 828 0.1
p6 all-clusters-app default (read/write) 2494984 2496624 1640 0.1
.bss 117992 117992 0 0.0
.data 2640 2640 0 0.0
.text 1453248 1454888 1640 0.1
light-app default (read/write) 2397360 2399000 1640 0.1
.bss 111464 111464 0 0.0
.data 2496 2496 0 0.0
.text 1355624 1357264 1640 0.1
lock-app default (read/write) 2360888 2362528 1640 0.1
.bss 111208 111208 0 0.0
.data 2456 2456 0 0.0
.text 1319152 1320792 1640 0.1
telink lighting-app tlsr9518adk80d (read/write) 896606 897390 784 0.1
bss 87356 87356 0 0.0
noinit 37160 37160 0 0.0
text 633984 634756 772 0.1

@bzbarsky-apple bzbarsky-apple merged commit 7a8bf2b into project-chip:master Mar 24, 2022
@bzbarsky-apple bzbarsky-apple deleted the fabric-index-storage branch March 24, 2022 22:27
rochaferraz pushed a commit to rochaferraz/connectedhomeip that referenced this pull request Mar 31, 2022
* Fix fabric index management in the fabric table.

Before this change, the fabric index for a fabric table entry had to match its offset in the table.  Therefore we only used indices up to CHIP_CONFIG_MAX_FABRICS and then looped back around to index 1.

Furthermore, we did not use to persist our mNextAvailableFabricIndex,
so after a restart would start assigning fabric indices that
corresponded to deleted fabrics, instead of not-yet-used ones, even if
we had not yet exceeded CHIP_CONFIG_MAX_FABRICS total commissioning
events.

This change decouples the fabric index from the table offset.  We now
store the list of fabric indices used and the fabric index we should
use for the next time a fabric is added.

* Fix TestCASESession compilation.

* Address review comments.
andrei-menzopol pushed a commit to andrei-menzopol/connectedhomeip that referenced this pull request Apr 14, 2022
* Fix fabric index management in the fabric table.

Before this change, the fabric index for a fabric table entry had to match its offset in the table.  Therefore we only used indices up to CHIP_CONFIG_MAX_FABRICS and then looped back around to index 1.

Furthermore, we did not use to persist our mNextAvailableFabricIndex,
so after a restart would start assigning fabric indices that
corresponded to deleted fabrics, instead of not-yet-used ones, even if
we had not yet exceeded CHIP_CONFIG_MAX_FABRICS total commissioning
events.

This change decouples the fabric index from the table offset.  We now
store the list of fabric indices used and the fabric index we should
use for the next time a fabric is added.

* Fix TestCASESession compilation.

* Address review comments.
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.

4 participants