-
Notifications
You must be signed in to change notification settings - Fork 45
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
Reduce Fabrics memory consumption; provisions for UpdateNOC #208
Merged
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
Still in Draft as I noticed I have the tests in |
Ready. |
Yes, that understanding is aligned with mine 👍 |
kedars
approved these changes
Sep 25, 2024
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.
(This is the last big PR in my series (forthcoming ones are much smaller), so please bear with me one more time.)
The PR builds upon the previous two (in-place-init and tlv-rework) and implements the following changes, in order of importance and magnitude:
Matter
object memory reduced by ~ 16 sessions x 480B = 7KBReason:
Session::noc_data (= Option<NocData>)
is now removed. The fabric initial/updated key-pair as well as the Root CA are now stored in theFailsafe
.(In all fairness, before the project became
no_std
, storing theNocData
inside the session was OK, because it wasOption<Arc<NocData>>
and as such did not occupy space until allocated. And usually, there was just one session with allocatedNocData
.)This is possible because of the observation that - at any point in time - only ONE fabric can be in the process of being created (
AddNOC
) or updated (UpdateNOC
). This is so because NOC updates do require the Failsafe to be locked first.@kedars Would appreciate if you could confirm that my understanding ^^^ is correct.
Hence, the "in-transit" data preceding
AddNOC
/UpdateNOC
is in the failsafe now. It is automatically invalidated when the failsafe timeout expires/it is disarmed/commissioning is complete.AclMgr
is goneAll
AclEntry
s belonging to a fabric are now simply kept in their corresponding Fabric object. ACL tests are updated to work withFabricMgr
instead ofAclMgr
.While not strictly necessary, it makes dealing with these entries a tad easier. Including their persistence to NVS. If a
Fabric
object is persisted, so are its ACLs as they are contained inside it.Also, this change is symmetric to the removal of
ExchangeMgr
one year ago, where I merged allExchange
s into their correspondingSession
object.Failsafe
reworkedIt resembles the Matter C++ logic much more closely now, and I hope it would be relatively easy to add
UpdateNOC
now, which - while not part of this PR, is already handled inFailsafe
.Smaller items
Maybe
had a bug where its destructor was not called. Now fixed and covered with unit tests