Skip to content

Conversation

57300
Copy link
Contributor

@57300 57300 commented Aug 22, 2025

Fixes undeclared uint32_t hash in: [nrf noup] zms: add lookup cache hash function for legacy ZMS

Also includes a re-cherry-pick of upstream PR 94330 to stabilize the ZMS ABI.

57300 and others added 6 commits August 25, 2025 07:40
This reverts commit 8ccb986.

To be re-applied after cherry-picks with a fix for a recent mistake.

Signed-off-by: Grzegorz Swiderski <[email protected]>
This reverts commit 73fe1ee.

Signed-off-by: Grzegorz Swiderski <[email protected]>
Upstream PR #: 94330

Allow the ZMS API to optionally accept 64 bit IDs. A typedef `zms_id_t`
is added, so that the maximum ID width can be controlled using Kconfig.

The current ATE structure is already large enough that it is possible to
reserve 64 bits for IDs without increasing its total size (128 bits).
This makes the feature a natural, low footprint alternative to Settings,
for cases where the supported key namespace must be larger than 32 bit
but not arbitrarily large.

The ATE format does have to be altered to accommodate larger IDs, but
the default "32 bit" format is left as is. Now, the `struct zms_ate`
describes one of two supported formats, selected by an `#if` condition.
In the future, it may be possible to support multiple ATE formats at
runtime, in which case the structure can be turned into a union.

In the new, "64 bit" ATEs, the `offset` and `metadata` fields are moved
into a union, because they are found to be mutually exclusive. With the
old format, the same fields are in different locations, but one of them
always gets filled with a dummy value, depending on the given ATE type.
To cover both cases, a `memset` is used, which should be optimized away
by the compiler when appropriate.

The only limitation is that the new ATE format has no room for data CRC,
but an alternative integrity check can be implemented by the caller.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit ec7a4ad199b0a87e5d604cbea20c8e2f4f741303)
Upstream PR #: 94330

* Update the "corrupt ATE" tests to work with the new ATE format.

* Add a basic test to verify support to 64 bit ZMS IDs.

* Add a `testcase.yaml` entry to cover the above points and also run
  lookup cache tests to evaluate the 64 bit hash function.

Signed-off-by: Grzegorz Swiderski <[email protected]>
(cherry picked from commit d9e38a9c4521e9b4423526e2c8e91b64f15928c7)
ZMS legacy enabled by CONFIG_SETTINGS_ZMS_LEGACY uses a different lookup
cache function that is optimized for Settings subsystem.

Signed-off-by: Riadh Ghaddab <[email protected]>
(cherry picked from commit 491354b)
(cherry picked from commit 15cd2f6)
(cherry picked from commit 8ccb986)
@57300 57300 force-pushed the fix-mistake-when-reapplying-noup branch from 0e598a1 to 800e53f Compare August 25, 2025 05:41
@anangl anangl merged commit 476ad66 into nrfconnect:main Aug 25, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants