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

[dns-sd] Add support for service subtypes on Thread devices #8252

Merged
merged 3 commits into from
Jul 14, 2021

Conversation

Damian-Nordic
Copy link
Contributor

@Damian-Nordic Damian-Nordic commented Jul 9, 2021

Problem

Our OpenThread-based DNS-SD Advertiser implementation does not support service subtypes while it is necessary to enable commissionable node advertising for Thread devices.

Change overview

  • Extend the existing ThreadStackManager::AddSrpService method to support additional service subtypes.
  • Fix subtype-related constants in Advertiser.h
  • Clean up the existing code a bit by adding begin()/end() methods to Span.

Testing

Tested using nRF Connect Lock example with manually enabled commissionable node advertising:

  • Verified using ot srp client service shell command that a proper service is registered
  • Verified E2E with a modified OpenThread Border Router (I made another PR to otbr-posix).

Note:
@jmartinez-silabs @doru91 @tima-q you will need to update OpenThread soon to make use of this addition on your platforms.

@todo
Copy link

todo bot commented Jul 9, 2021

use fixed buffer allocator to reduce the memory footprint from N*M to sum(M_i)

// TODO: use fixed buffer allocator to reduce the memory footprint from N*M to sum(M_i)
char mSubTypeBuffers[chip::Mdns::kSubTypeMaxNumber][chip::Mdns::kSubTypeMaxLength + 1];
const char * mSubTypes[chip::Mdns::kSubTypeMaxNumber + 1]; // extra entry for nullptr at the end
#endif
otDnsTxtEntry mTxtEntries[kMaxTxtEntriesNumber];
uint8_t mTxtValueBuffers[kMaxTxtEntriesNumber][kMaxTxtValueSize];
char mTxtKeyBuffers[kMaxTxtEntriesNumber][kMaxTxtKeySize];


This comment was generated by todo based on a TODO comment in 228b170 in #8252. cc @Damian-Nordic.

@@ -1119,35 +1119,54 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread<ImplClass>::_AddSrpService(c

srpService->mService.mPort = aPort;

// Check if there are some optional text entries to add.
if (aTxtEntries && aTxtEntriesSize != 0)
#if OPENTHREAD_API_VERSION >= 132
Copy link
Contributor

Choose a reason for hiding this comment

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

@Damian-Nordic Happy to accomodate this new feature, but can you advise to which OpenThread commit you bumped for this ? At your side this get's updated through Zephyr I assume.
btw I see another check for API_VERSION >= 126 in OpenThreadUtils.cpp - is the feature expected to work with anything in between ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We bumped OpenThread in Zephyr to 48b129 (API_VERSION == 134). The check for API_VERSION >= 126 was added because with that API version OpenThread switched from otMasterXXX to otNetworkXXX function naming.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Damian-Nordic Thanks - we will align to that commit to avoid OpenThread inconsistencies

src/lib/mdns/Discovery_ImplPlatform.cpp Outdated Show resolved Hide resolved
src/lib/mdns/Advertiser.h Outdated Show resolved Hide resolved
@bzbarsky-apple
Copy link
Contributor

/rebase

Damian-Nordic and others added 3 commits July 13, 2021 11:29
Implementing commissionable node advertising for Thread
devices requires that our OpenThread-based DNS-SD backend
be able to register a set of service subtypes. It has become
possible recently once the support for service subtypes
was added to the OpenThread SRP client.
@github-actions
Copy link

Size increase report for "gn_qpg-example-build" from 13888a6

File Section File VM
chip-qpg6100-lighting-example.out .text 16 16
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-qpg6100-lighting-example.out and ./pull_artifact/chip-qpg6100-lighting-example.out:

sections,vmsize,filesize
.debug_info,0,16296
.debug_str,0,1221
.debug_loc,0,161
.debug_abbrev,0,75
.debug_line,0,51
.strtab,0,25
.text,16,16
.shstrtab,0,-1
[Unmapped],0,-16
.debug_ranges,0,-32

Comparing ./master_artifact/chip-qpg6100-lighting-example.out.map and ./pull_artifact/chip-qpg6100-lighting-example.out.map:

BLOAT EXECUTION FAILED WITH CODE 1:
bloaty: unknown file type for file './pull_artifact/chip-qpg6100-lighting-example.out.map'


@github-actions
Copy link

Size increase report for "esp32-example-build" from 13888a6

File Section File VM
chip-temperature-measurement-app.elf .flash.text -56 -56
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-all-clusters-app.elf and ./pull_artifact/chip-all-clusters-app.elf:

sections,vmsize,filesize
.debug_info,0,15948
.debug_str,0,234
.debug_abbrev,0,55
.debug_loc,0,13
.debug_line,0,6

Comparing ./master_artifact/chip-shell.elf and ./pull_artifact/chip-shell.elf:

sections,vmsize,filesize
.debug_info,0,2640
.debug_str,0,139
.debug_line,0,1

Comparing ./master_artifact/chip-pigweed-app.elf and ./pull_artifact/chip-pigweed-app.elf:

sections,vmsize,filesize

Comparing ./master_artifact/chip-temperature-measurement-app.elf and ./pull_artifact/chip-temperature-measurement-app.elf:

sections,vmsize,filesize
.debug_info,0,12314
.debug_str,0,238
[Unmapped],0,56
.debug_abbrev,0,55
.debug_loc,0,7
.debug_line,0,6
.flash.text,-56,-56

Comparing ./master_artifact/chip-lock-app.elf and ./pull_artifact/chip-lock-app.elf:

sections,vmsize,filesize
.debug_info,0,13553
.debug_str,0,234
.debug_abbrev,0,56
.debug_line,0,6
.debug_loc,0,-1

Comparing ./master_artifact/chip-persistent-storage.elf and ./pull_artifact/chip-persistent-storage.elf:

sections,vmsize,filesize


@github-actions
Copy link

Size increase report for "nrfconnect-example-build" from 13888a6

File Section File VM
chip-shell.elf bss 0 243
chip-shell.elf text 128 128
chip-shell.elf [LOAD #3 [RW]] 0 -19
chip-lock.elf bss 0 224
chip-lock.elf text 128 128
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-shell.elf and ./pull_artifact/chip-shell.elf:

sections,vmsize,filesize
.debug_info,0,7819
.debug_str,0,1156
.debug_loc,0,944
bss,243,0
.debug_line,0,232
text,128,128
.strtab,0,25
.debug_ranges,0,16
.shstrtab,0,3
.debug_abbrev,0,1
[LOAD #3 [RW]],-19,0

Comparing ./master_artifact/chip-lock.elf and ./pull_artifact/chip-lock.elf:

sections,vmsize,filesize
.debug_info,0,18714
.debug_str,0,1254
.debug_loc,0,962
.debug_line,0,234
bss,224,0
text,128,128
.strtab,0,25
.debug_abbrev,0,20
.debug_ranges,0,16
.shstrtab,0,-1


Copy link
Contributor

@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.

LGTM 👍

@Damian-Nordic Damian-Nordic merged commit 6aab4c1 into project-chip:master Jul 14, 2021
@Damian-Nordic Damian-Nordic deleted the subtypes-thread branch July 14, 2021 07:19
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
…chip#8252)

* [dns-sd] Add support for service subtypes on Thread devices

Implementing commissionable node advertising for Thread
devices requires that our OpenThread-based DNS-SD backend
be able to register a set of service subtypes. It has become
possible recently once the support for service subtypes
was added to the OpenThread SRP client.

* Restyled by clang-format

* Address code-review comments

Co-authored-by: Restyled.io <[email protected]>
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.

7 participants