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 command timeouts during commissioning. #19137

Merged

Conversation

bzbarsky-apple
Copy link
Contributor

Several fixes here:

  1. AutoCommissioner has a comment about how per spec everything during
    commissioning needs at least a 30s timeout, and it was passing that to
    PerformCommissioningStep, but DeviceCommissioner was ignoring the "timeout"
    parameter for a bunch of the cases, including crucially for AddNOC and
    CSRRequest. Those can take a while to run, and were hitting the
    now-much-lower default 2s timeout. The fix here is to stop ignoring the
    passed-in value.

  2. The passed-in timeout value computation in AutoCommissioner was not quite
    right. It was set to max(30s, network-connect-time), but the network connect
    time is the processing time on the server, not the total time including
    transport latency. Fix the computation of the timeout to:
    a. Take the network connect times for the network enable steps, a "slow
    crypto" time of 15s for the AddNOC and CSRRequest steps, and the default
    IM timeout for all other steps and treat that as the server processing
    time.
    b. Add the transport timeout bits from our device's session to that server
    processing time.
    c. If the result is less than the spec-mandated 30s timeout, use 30s,
    otherwise use the result we computed.

  3. Assuming that BLE has 0 transport latency is wrong. Not clear what the right
    value is, but for now setting it to the same as TCP.

Fixes #19135

Problem

See above.

Change overview

See above.

Testing

Verified via logging that sane timeout values are computed, and checked that BLE commissioning of an M5Stack in fact works now.

@github-actions
Copy link

github-actions bot commented Jun 3, 2022

PR #19137: Size comparison from e8c2a6f to 49e6038

Increases (1 build for k32w)
platform target config section e8c2a6f 49e6038 change % change
k32w lock k32w061+release (read/write) 716812 716828 16 0.0
.text 638832 638848 16 0.0
Full report (2 builds for k32w)
platform target config section e8c2a6f 49e6038 change % change
k32w light k32w061+release (read/write) 657796 657796 0 0.0
.bss 69768 69768 0 0.0
.data 2020 2020 0 0.0
.text 580208 580208 0 0.0
lock k32w061+release (read/write) 716812 716828 16 0.0
.bss 70192 70192 0 0.0
.data 1988 1988 0 0.0
.text 638832 638848 16 0.0

Several fixes here:

1. AutoCommissioner has a comment about how per spec everything during
   commissioning needs at least a 30s timeout, and it was passing that to
   PerformCommissioningStep, but DeviceCommissioner was ignoring the "timeout"
   parameter for a bunch of the cases, including crucially for AddNOC and
   CSRRequest.  Those can take a while to run, and were hitting the
   now-much-lower default 2s timeout.  The fix here is to stop ignoring the
   passed-in value.

2. The passed-in timeout value computation in AutoCommissioner was not quite
   right.  It was set to max(30s, network-connect-time), but the network connect
   time is the processing time on the server, not the total time including
   transport latency.  Fix the computation of the timeout to:
   a. Take the network connect times for the network enable steps, a "slow
      crypto" time of 15s for the AddNOC and CSRRequest steps, and the default
      IM timeout for all other steps and treat that as the server processing
      time.
   b. Add the transport timeout bits from our device's session to that server
      processing time.
   c. If the result is less than the spec-mandated 30s timeout, use 30s,
      otherwise use the result we computed.

3. Assuming that BLE has 0 transport latency is wrong.  Not clear what the right
   value is, but for now setting it to the same as TCP.

Fixes project-chip#19135
@github-actions
Copy link

github-actions bot commented Jun 3, 2022

PR #19137: Size comparison from e8c2a6f to 30cc40f

Increases (28 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, nrfconnect, p6, telink)
platform target config section e8c2a6f 30cc40f change % change
cc13x2_26x2 pump-app LP_CC2652R7 (read only) 663647 663655 8 0.0
.text 577460 577468 8 0.0
pump-controller-app LP_CC2652R7 (read only) 654975 654983 8 0.0
.text 570596 570604 8 0.0
shell LP_CC2652R7 (read only) 641482 641490 8 0.0
.text 559724 559732 8 0.0
cyw30739 lock cyw930739m2evb_01 (read/write) 597986 597994 8 0.0
.app_xip_area 456884 456892 8 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 596634 596642 8 0.0
.app_xip_area 456656 456664 8 0.0
efr32 lighting-app BRD4161A+rpc (read only) 950068 950084 16 0.0
.text 950060 950076 16 0.0
BRD4161A+rs911x (read only) 787908 787924 16 0.0
.text 787900 787916 16 0.0
esp32 all-clusters-app c3devkit (read only) 1005296 1005304 8 0.0
.flash.text 1005296 1005304 8 0.0
k32w lock k32w061+release (read/write) 716812 716828 16 0.0
.text 638832 638848 16 0.0
linux all-clusters-app debug (read only) 2766841 2766905 64 0.0
.text 2348226 2348290 64 0.0
all-clusters-minimal-app debug (read only) 2643993 2644057 64 0.0
.text 2224818 2224882 64 0.0
bridge-app debug+rpc (read only) 2029865 2029929 64 0.0
.text 1703474 1703538 64 0.0
chip-tool debug (read only) 9591333 9592677 1344 0.0
.rodata 494909 494941 32 0.0
.text 7716885 7718197 1312 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9345492 9346492 1000 0.0
.rodata 458652 458724 72 0.0
.text 7372676 7373604 928 0.0
lighting-app debug+rpc (read only) 2320017 2320081 64 0.0
.text 1965474 1965538 64 0.0
lock-app debug (read only) 2258681 2258761 80 0.0
.text 1896482 1896562 80 0.0
ota-provider-app debug (read only) 2066697 2066777 80 0.0
.text 1726338 1726418 80 0.0
ota-requestor-app debug (read only) 2093689 2093753 64 0.0
.text 1755954 1756018 64 0.0
shell debug (read only) 2571825 2571889 64 0.0
.text 2187666 2187730 64 0.0
thermostat-no-ble arm64 (read only) 2366668 2366748 80 0.0
.text 1988064 1988144 80 0.0
tv-app debug (read only) 2876977 2878321 1344 0.0
.rodata 223104 223136 32 0.0
.text 2471218 2472530 1312 0.1
tv-casting-app debug (read only) 5326905 5326969 64 0.0
.text 4638162 4638226 64 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1187763 1187779 16 0.0
text 814712 814716 4 0.0
p6 all-clusters-app default (read/write) 2541776 2541792 16 0.0
.text 1500040 1500056 16 0.0
all-clusters-minimal-app default (read/write) 2487744 2487760 16 0.0
.text 1446008 1446024 16 0.0
light-app default (read/write) 2422144 2422160 16 0.0
.text 1380408 1380424 16 0.0
telink light-switch-app tlsr9518adk80d text 552132 552136 4 0.0
lighting-app tlsr9518adk80d text 568874 568878 4 0.0
Decreases (2 builds for cc13x2_26x2)
platform target config section e8c2a6f 30cc40f change % change
cc13x2_26x2 pump-app LP_CC2652R7 (read/write) 180176 180168 -8 -0.0
pump-controller-app LP_CC2652R7 (read/write) 188960 188952 -8 -0.0
Full report (41 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section e8c2a6f 30cc40f change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 648467 648467 0 0.0
(read/write) 158988 158988 0 0.0
.bss 74668 74668 0 0.0
.data 3404 3404 0 0.0
.rodata 84531 84531 0 0.0
.text 563704 563704 0 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 615347 615347 0 0.0
(read/write) 158160 158160 0 0.0
.bss 73900 73900 0 0.0
.data 3344 3344 0 0.0
.rodata 73915 73915 0 0.0
.text 541200 541200 0 0.0
lock-ftd LP_CC2652R7 (read only) 680623 680623 0 0.0
(read/write) 162288 162288 0 0.0
.bss 72692 72692 0 0.0
.data 3268 3268 0 0.0
.rodata 96687 96687 0 0.0
.text 583456 583456 0 0.0
lock-mtd LP_CC2652R7 (read only) 630023 630023 0 0.0
(read/write) 145812 145812 0 0.0
.bss 68428 68428 0 0.0
.data 3268 3268 0 0.0
.rodata 96567 96567 0 0.0
.text 532968 532968 0 0.0
pump-app LP_CC2652R7 (read only) 663647 663655 8 0.0
(read/write) 180176 180168 -8 -0.0
.bss 72836 72836 0 0.0
.data 3300 3300 0 0.0
.rodata 85703 85703 0 0.0
.text 577460 577468 8 0.0
pump-controller-app LP_CC2652R7 (read only) 654975 654983 8 0.0
(read/write) 188960 188952 -8 -0.0
.bss 72948 72948 0 0.0
.data 3264 3264 0 0.0
.rodata 83895 83895 0 0.0
.text 570596 570604 8 0.0
shell LP_CC2652R7 (read only) 641482 641490 8 0.0
(read/write) 154544 154544 0 0.0
.bss 77020 77020 0 0.0
.data 3408 3408 0 0.0
.rodata 81522 81522 0 0.0
.text 559724 559732 8 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 601886 601886 0 0.0
.app_xip_area 460912 460912 0 0.0
.bss 83912 83912 0 0.0
.data 744 744 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 597986 597994 8 0.0
.app_xip_area 456884 456892 8 0.0
.bss 84072 84072 0 0.0
.data 712 712 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 596634 596642 8 0.0
.app_xip_area 456656 456664 8 0.0
.bss 83044 83044 0 0.0
.data 620 620 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 915840 915840 0 0.0
(read/write) 133280 133280 0 0.0
.bss 131176 131176 0 0.0
.data 2100 2100 0 0.0
.text 915832 915832 0 0.0
BRD4161A+rpc (read only) 950068 950084 16 0.0
(read/write) 149968 149968 0 0.0
.bss 147664 147664 0 0.0
.data 2304 2304 0 0.0
.text 950060 950076 16 0.0
BRD4161A+rs911x (read only) 787908 787924 16 0.0
(read/write) 129496 129496 0 0.0
.bss 127396 127396 0 0.0
.data 2100 2100 0 0.0
.text 787900 787916 16 0.0
lock-app BRD4161A+wf200 (read only) 955220 955220 0 0.0
(read/write) 128332 128332 0 0.0
.bss 126260 126260 0 0.0
.data 2072 2072 0 0.0
.text 955212 955212 0 0.0
window-app BRD4161A (read only) 900760 900760 0 0.0
(read/write) 133344 133344 0 0.0
.bss 131248 131248 0 0.0
.data 2096 2096 0 0.0
.text 900752 900752 0 0.0
esp32 all-clusters-app c3devkit (read only) 1005296 1005304 8 0.0
(read/write) 1480178 1480178 0 0.0
.dram0.bss 69232 69232 0 0.0
.dram0.data 14656 14656 0 0.0
.flash.rodata 210864 210864 0 0.0
.flash.text 1005296 1005304 8 0.0
.iram0.text 62954 62954 0 0.0
m5stack (read only) 1060475 1060475 0 0.0
(read/write) 482380 482380 0 0.0
.dram0.bss 74752 74752 0 0.0
.dram0.data 34208 34208 0 0.0
.flash.rodata 241424 241424 0 0.0
.flash.text 1055091 1055091 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 657796 657796 0 0.0
.bss 69768 69768 0 0.0
.data 2020 2020 0 0.0
.text 580208 580208 0 0.0
lock k32w061+release (read/write) 716812 716828 16 0.0
.bss 70192 70192 0 0.0
.data 1988 1988 0 0.0
.text 638832 638848 16 0.0
linux all-clusters-app debug (read only) 2766841 2766905 64 0.0
(read/write) 178344 178344 0 0.0
.bss 86304 86304 0 0.0
.data 2032 2032 0 0.0
.data.rel.ro 83848 83848 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 1024 1024 0 0.0
.rodata 244637 244637 0 0.0
.text 2348226 2348290 64 0.0
all-clusters-minimal-app debug (read only) 2643993 2644057 64 0.0
(read/write) 170376 170376 0 0.0
.bss 85568 85568 0 0.0
.data 1904 1904 0 0.0
.data.rel.ro 76728 76728 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 1024 1024 0 0.0
.rodata 246589 246589 0 0.0
.text 2224818 2224882 64 0.0
bridge-app debug+rpc (read only) 2029865 2029929 64 0.0
(read/write) 148000 148000 0 0.0
.bss 72960 72960 0 0.0
.data 3936 3936 0 0.0
.data.rel.ro 65528 65528 0 0.0
.dynamic 592 592 0 0.0
.got 4272 4272 0 0.0
.init 27 27 0 0.0
.init_array 696 696 0 0.0
.rodata 169824 169824 0 0.0
.text 1703474 1703538 64 0.0
chip-tool debug (read only) 9591333 9592677 1344 0.0
(read/write) 597048 597048 0 0.0
.bss 24032 24032 0 0.0
.data 1120 1120 0 0.0
.data.rel.ro 565600 565600 0 0.0
.dynamic 624 624 0 0.0
.got 5008 5008 0 0.0
.init 27 27 0 0.0
.init_array 656 656 0 0.0
.rodata 494909 494941 32 0.0
.text 7716885 7718197 1312 0.0
chip-tool-no-interactive-ipv6only arm64 (read only) 9345492 9346492 1000 0.0
(read/write) 662961 662961 0 0.0
.bss 42305 42305 0 0.0
.data 1176 1176 0 0.0
.data.rel.ro 600832 600832 0 0.0
.dynamic 528 528 0 0.0
.got 14824 14824 0 0.0
.init 24 24 0 0.0
.init_array 192 192 0 0.0
.rodata 458652 458724 72 0.0
.text 7372676 7373604 928 0.0
lighting-app debug+rpc (read only) 2320017 2320081 64 0.0
(read/write) 153640 153640 0 0.0
.bss 74816 74816 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 71016 71016 0 0.0
.dynamic 608 608 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 800 800 0 0.0
.rodata 188744 188744 0 0.0
.text 1965474 1965538 64 0.0
lock-app debug (read only) 2258681 2258761 80 0.0
(read/write) 148736 148736 0 0.0
.bss 73504 73504 0 0.0
.data 1568 1568 0 0.0
.data.rel.ro 67944 67944 0 0.0
.dynamic 592 592 0 0.0
.got 4336 4336 0 0.0
.init 27 27 0 0.0
.init_array 760 760 0 0.0
.rodata 201832 201832 0 0.0
.text 1896482 1896562 80 0.0
ota-provider-app debug (read only) 2066697 2066777 80 0.0
(read/write) 141656 141656 0 0.0
.bss 73088 73088 0 0.0
.data 1768 1768 0 0.0
.data.rel.ro 61000 61000 0 0.0
.dynamic 608 608 0 0.0
.got 4504 4504 0 0.0
.init 27 27 0 0.0
.init_array 656 656 0 0.0
.rodata 181240 181240 0 0.0
.text 1726338 1726418 80 0.0
ota-requestor-app debug (read only) 2093689 2093753 64 0.0
(read/write) 144496 144496 0 0.0
.bss 73792 73792 0 0.0
.data 1960 1960 0 0.0
.data.rel.ro 63096 63096 0 0.0
.dynamic 592 592 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 680 680 0 0.0
.rodata 177152 177152 0 0.0
.text 1755954 1756018 64 0.0
shell debug (read only) 2571825 2571889 64 0.0
(read/write) 201752 201752 0 0.0
.bss 117160 117160 0 0.0
.data 1376 1376 0 0.0
.data.rel.ro 77464 77464 0 0.0
.dynamic 608 608 0 0.0
.got 4192 4192 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 224690 224690 0 0.0
.text 2187666 2187730 64 0.0
thermostat-no-ble arm64 (read only) 2366668 2366748 80 0.0
(read/write) 177601 177601 0 0.0
.bss 87969 87969 0 0.0
.data 1528 1528 0 0.0
.data.rel.ro 80288 80288 0 0.0
.dynamic 528 528 0 0.0
.got 4800 4800 0 0.0
.init 24 24 0 0.0
.init_array 384 384 0 0.0
.rodata 148828 148828 0 0.0
.text 1988064 1988144 80 0.0
tv-app debug (read only) 2876977 2878321 1344 0.0
(read/write) 280280 280280 0 0.0
.bss 191112 191112 0 0.0
.data 4672 4672 0 0.0
.data.rel.ro 78224 78224 0 0.0
.dynamic 592 592 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 223104 223136 32 0.0
.text 2471218 2472530 1312 0.1
tv-casting-app debug (read only) 5326905 5326969 64 0.0
(read/write) 222744 222744 0 0.0
.bss 78696 78696 0 0.0
.data 2400 2400 0 0.0
.data.rel.ro 135432 135432 0 0.0
.dynamic 608 608 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 872 872 0 0.0
.rodata 337504 337504 0 0.0
.text 4638162 4638226 64 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2425560 2425560 0 0.0
.bss 202652 202652 0 0.0
.data 5880 5880 0 0.0
.text 1388204 1388204 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1187763 1187779 16 0.0
bss 141297 141297 0 0.0
rodata 152892 152892 0 0.0
text 814712 814716 4 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1136547 1136547 0 0.0
bss 140526 140526 0 0.0
rodata 129460 129460 0 0.0
text 787756 787756 0 0.0
p6 all-clusters-app default (read/write) 2541776 2541792 16 0.0
.bss 137192 137192 0 0.0
.data 2808 2808 0 0.0
.text 1500040 1500056 16 0.0
all-clusters-minimal-app default (read/write) 2487744 2487760 16 0.0
.bss 136416 136416 0 0.0
.data 2752 2752 0 0.0
.text 1446008 1446024 16 0.0
light-app default (read/write) 2422144 2422160 16 0.0
.bss 129520 129520 0 0.0
.data 2608 2608 0 0.0
.text 1380408 1380424 16 0.0
lock-app default (read/write) 2440200 2440200 0 0.0
.bss 129336 129336 0 0.0
.data 2576 2576 0 0.0
.text 1398464 1398464 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 780760 780760 0 0.0
bss 70584 70584 0 0.0
noinit 40416 40416 0 0.0
text 552132 552136 4 0.0
lighting-app tlsr9518adk80d (read/write) 800804 800804 0 0.0
bss 70844 70844 0 0.0
noinit 40416 40416 0 0.0
text 568874 568878 4 0.0

@woody-apple woody-apple merged commit b27420a into project-chip:master Jun 3, 2022
@bzbarsky-apple bzbarsky-apple deleted the fix-commissioning-timeouts branch June 4, 2022 02:03
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.

Pairing of M5 board via CHIPTool cli throws Timeout error
6 participants