-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Don't encode fabric-index in fabric scoped structs for a write. #15268
Closed
bzbarsky-apple
wants to merge
1
commit into
project-chip:master
from
bzbarsky-apple:encode-indicate-write
Closed
Don't encode fabric-index in fabric scoped structs for a write. #15268
bzbarsky-apple
wants to merge
1
commit into
project-chip:master
from
bzbarsky-apple:encode-indicate-write
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PR #15268: Size comparison from 6e55dee to 26ad641 Increases (38 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
Full report (43 builds for cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
@mrjerryjohns is going to take over this and do the |
mrjerryjohns
added a commit
to mrjerryjohns/connectedhomeip
that referenced
this pull request
Feb 16, 2022
This builds upon bzbarsky's original PR project-chip#15268 based upon discussions with him to create separate EncodeForWrite/EncodeForRead APIs that only apply to fabric-scoped structs. This is then used (for now) to omit encoding the fabric index on writes. Tests: Ran chip-tool to write an ACL entry and confirmed that that the fabric index field is omitted on writes.
mrjerryjohns
added a commit
to mrjerryjohns/connectedhomeip
that referenced
this pull request
Feb 16, 2022
This builds upon bzbarsky's original PR project-chip#15268 based upon discussions with him to create separate EncodeForWrite/EncodeForRead APIs that only apply to fabric-scoped structs. This is then used (for now) to omit encoding the fabric index on writes. Tests: Ran chip-tool to write an ACL entry and confirmed that that the fabric index field is omitted on writes.
mrjerryjohns
added a commit
that referenced
this pull request
Feb 17, 2022
* Separate DataModel APIs for encoding fabric-sensitive structs This builds upon bzbarsky's original PR #15268 based upon discussions with him to create separate EncodeForWrite/EncodeForRead APIs that only apply to fabric-scoped structs. This is then used (for now) to omit encoding the fabric index on writes. Tests: Ran chip-tool to write an ACL entry and confirmed that that the fabric index field is omitted on writes. * WIP * Review feedback * Tests were using fabric index 0 for fake fabric testing, but that trips the invalid fabric checker in AttributeValueEncoder::EncodeListItem... * Review feedback
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
We are encoding (uselessly) fabric indices for a write.
Change overview
Stop doing that, at least when the WriteClient is doing the encoding itself.
Some notes:
Encode()
at all and have separateEncodeForWrite
andEncodeForRead
APIs, so when you are encoding them you have to think about what you are doing. That's a slightly more invasive change in terms of needing to change some code that currently callsEncode
to callEncodeForRead
, but absolutely doable.DataModel::Encode
(and presumably the struct'sEncode
) just take a boolean for whether it's an encode for a write. If we default it to false, that is more or less equivalent to the proposed change. More slightly inscrutable booleans floating around (esp. in all theEncode
methods that have nothing to do with structs), a little less template duplication involved.DataMode::Encode
but only default it for things that are not fabric scoped, while requiring it for things that are fabric-scoped, so consumers have to think about it. This might have the least copy/paste code and should be a little simpler to get to than separateEncodeForRead
/EncodeForWrite
methods that only exist for fabric-scoped structs, since allEncode
signatures would allow passing in the boolean.Testing
Checked that if I do:
without this change the recipient sees:
and with this change the tag
0x0
is gone.